diff --git a/flake.lock b/flake.lock index 1bed1a8..a8838ae 100644 --- a/flake.lock +++ b/flake.lock @@ -91,6 +91,29 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1683635384, + "narHash": "sha256-9goJTd05yOyD/McaMqZ4BUB8JW+mZMnZQJZ7VQ6C/Lw=", + "owner": "numtide", + "repo": "devshell", + "rev": "5143ea68647c4cf5227e4ad2100db6671fc4c369", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -125,7 +148,9 @@ }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": [ + "systems" + ] }, "locked": { "lastModified": 1681202837, @@ -304,12 +329,14 @@ "agenix": "agenix", "agenix-rekey": "agenix-rekey", "colmena": "colmena", + "devshell": "devshell", "flake-utils": "flake-utils", "home-manager": "home-manager", "hyprland": "hyprland", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks", + "systems": "systems", "templates": "templates" } }, diff --git a/flake.nix b/flake.nix index 8c4d3ba..cb66737 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,9 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # to prevent multiple instances of systems + systems.url = "github:nix-systems/default"; + home-manager = { url = "github:nix-community/home-manager"; # should use system nixpkgs instead of their own @@ -22,7 +25,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - flake-utils.url = "github:numtide/flake-utils"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; @@ -47,6 +53,13 @@ url = "github:hyprwm/Hyprland"; inputs.nixpkgs.follows = "nixpkgs"; }; + + devshell = { + url = "github:numtide/devshell"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.systems.follows = "systems"; + inputs.flake-utils.follows = "flake-utils"; + }; }; outputs = { @@ -55,6 +68,7 @@ flake-utils, colmena, agenix-rekey, + devshell, ... } @ inputs: { @@ -86,7 +100,7 @@ }; apps = agenix-rekey.defineApps self pkgs self.nodes; checks = import ./nix/checks.nix inputs system; - devShells.default = import ./nix/dev-shell.nix inputs system; + devShell = import ./nix/dev-shell.nix inputs system; formatter = pkgs.alejandra; }); } diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix index c661440..7726d03 100644 --- a/nix/dev-shell.nix +++ b/nix/dev-shell.nix @@ -1,12 +1,18 @@ { self, + nixpkgs, colmena, + devshell, ... -}: system: -with self.pkgs.${system}; - mkShell { +}: system: let + pkgs = import nixpkgs { + inherit system; + overlays = [devshell.overlays.default]; + }; +in + pkgs.devshell.mkShell { name = "nix-config"; - packages = [ + packages = with pkgs; [ # Nix cachix colmena.packages.${system}.colmena @@ -26,7 +32,5 @@ with self.pkgs.${system}; rage ]; - shellHook = '' - ${self.checks.${system}.pre-commit-check.shellHook} - ''; + devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-check.shellHook; }