From 22b66062169c11043bf32c058c4cb11db9bdb82c Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:13:55 +0100 Subject: [PATCH] feat: use flake-parts for nix devshell https://flake.parts/options/devshell --- flake.lock | 92 +++++++++++++++++++++++++++++++++++++++++------------- flake.nix | 32 +++++++++---------- 2 files changed, 86 insertions(+), 38 deletions(-) diff --git a/flake.lock b/flake.lock index 9f4742a..d635c1a 100644 --- a/flake.lock +++ b/flake.lock @@ -2,19 +2,15 @@ "nodes": { "devshell": { "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs", + "systems": "systems" }, "locked": { - "lastModified": 1678957337, - "narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=", + "lastModified": 1698410321, + "narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=", "owner": "numtide", "repo": "devshell", - "rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47", + "rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e", "type": "github" }, "original": { @@ -23,28 +19,65 @@ "type": "github" } }, - "flake-utils": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1678898370, - "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", + "lastModified": 1700444282, + "narHash": "sha256-s/+tgT+Iz0LZO+nBvSms+xsMqvHt2LqYniG9r+CYyJc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3f21a22b5aafefa1845dec6f4a378a8f53d8681c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ac718d02867a84b42522a0ece52d841188208f2c", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", "type": "github" }, "original": { @@ -57,8 +90,23 @@ "root": { "inputs": { "devshell": "devshell", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 29e1460..a0c52c5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,26 +1,25 @@ { description = "hosting.de terraform provider"; - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs.devshell.url = "github:numtide/devshell"; + inputs.flake-parts.url = "github:hercules-ci/flake-parts"; - flake-utils.url = "github:numtide/flake-utils"; + outputs = inputs@{ self, flake-parts, devshell, nixpkgs }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + devshell.flakeModule + ]; - devshell.url = "github:numtide/devshell"; - devshell.inputs.flake-utils.follows = "flake-utils"; - devshell.inputs.nixpkgs.follows = "nixpkgs"; - }; + systems = [ + "x86_64-linux" + ]; - outputs = { self, flake-utils, devshell, nixpkgs }: - flake-utils.lib.simpleFlake { - inherit self nixpkgs; - name = "hosting.de terraform provider"; - overlay = devshell.overlays.default; - shell = { pkgs }: - pkgs.devshell.mkShell { + perSystem = { pkgs, ... }: { + devshells.default = { # Add additional packages you'd like to be available in your devshell # PATH here - devshell.packages = with pkgs; [ + packages = with pkgs; [ go errcheck go-tools @@ -29,8 +28,9 @@ ]; bash.extra = '' export GOPATH=~/.local/share/go - export PATH=$GOPATH:$PATH + export PATH=$GOPATH/bin:$PATH ''; }; + }; }; }