feat: switched devshell to utilize devshell

This commit is contained in:
Patrick Großmann 2023-05-22 21:25:00 +09:00
parent e81d178e6e
commit ff3bdaad1a
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
3 changed files with 55 additions and 10 deletions

View file

@ -91,6 +91,29 @@
"type": "github" "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-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -125,7 +148,9 @@
}, },
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": [
"systems"
]
}, },
"locked": { "locked": {
"lastModified": 1681202837, "lastModified": 1681202837,
@ -304,12 +329,14 @@
"agenix": "agenix", "agenix": "agenix",
"agenix-rekey": "agenix-rekey", "agenix-rekey": "agenix-rekey",
"colmena": "colmena", "colmena": "colmena",
"devshell": "devshell",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks", "pre-commit-hooks": "pre-commit-hooks",
"systems": "systems",
"templates": "templates" "templates": "templates"
} }
}, },

View file

@ -4,6 +4,9 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# to prevent multiple instances of systems
systems.url = "github:nix-systems/default";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
# should use system nixpkgs instead of their own # should use system nixpkgs instead of their own
@ -22,7 +25,10 @@
inputs.nixpkgs.follows = "nixpkgs"; 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 = { pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix"; url = "github:cachix/pre-commit-hooks.nix";
@ -47,6 +53,13 @@
url = "github:hyprwm/Hyprland"; url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
inputs.flake-utils.follows = "flake-utils";
};
}; };
outputs = { outputs = {
@ -55,6 +68,7 @@
flake-utils, flake-utils,
colmena, colmena,
agenix-rekey, agenix-rekey,
devshell,
... ...
} @ inputs: } @ inputs:
{ {
@ -86,7 +100,7 @@
}; };
apps = agenix-rekey.defineApps self pkgs self.nodes; apps = agenix-rekey.defineApps self pkgs self.nodes;
checks = import ./nix/checks.nix inputs system; 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; formatter = pkgs.alejandra;
}); });
} }

View file

@ -1,12 +1,18 @@
{ {
self, self,
nixpkgs,
colmena, colmena,
devshell,
... ...
}: system: }: system: let
with self.pkgs.${system}; pkgs = import nixpkgs {
mkShell { inherit system;
overlays = [devshell.overlays.default];
};
in
pkgs.devshell.mkShell {
name = "nix-config"; name = "nix-config";
packages = [ packages = with pkgs; [
# Nix # Nix
cachix cachix
colmena.packages.${system}.colmena colmena.packages.${system}.colmena
@ -26,7 +32,5 @@ with self.pkgs.${system};
rage rage
]; ];
shellHook = '' devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-check.shellHook;
${self.checks.${system}.pre-commit-check.shellHook}
'';
} }