Skip to content

Commit b80bee9

Browse files
committed
flake/dev: refactor devshell
1 parent 8882dbb commit b80bee9

2 files changed

Lines changed: 13 additions & 29 deletions

File tree

flake/dev/devshells.nix

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
lib,
66
inputs,
77
self,
8+
self',
9+
system,
810
...
911
}:
1012
let
@@ -51,33 +53,13 @@
5153

5254
buildShell = name: {
5355
${name} = import (shellsPath + "/${name}.nix") {
54-
inherit lib;
56+
inherit system self';
5557
inherit (devPkgs) mkShell;
5658
pkgs = devPkgs;
5759
};
5860
};
59-
60-
dynamicShells = lib.foldl' (acc: name: acc // buildShell name) { } shellNames;
6161
in
6262
{
63-
devShells = dynamicShells // {
64-
default = pkgs.mkShell {
65-
name = "khanelidev";
66-
packages = with pkgs; [
67-
nixpkgs-fmt
68-
statix
69-
deadnix
70-
nil
71-
];
72-
shellHook = ''
73-
echo "🚀 Khanelinix development environment"
74-
echo "Available commands:"
75-
echo " nix flake check - Run all checks"
76-
echo " nix fmt -- --no-cache - Format without cache"
77-
echo " statix check - Check for anti-patterns"
78-
echo " deadnix - Find unused code"
79-
'';
80-
};
81-
};
63+
devShells = lib.foldl' (acc: name: acc // buildShell name) { } shellNames;
8264
};
8365
}

flake/dev/shells/default.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
2-
inputs,
32
mkShell,
43
pkgs,
5-
system,
4+
self',
65
...
76
}:
87
mkShell {
@@ -12,13 +11,16 @@ mkShell {
1211
nh
1312
statix
1413
sops
15-
(inputs.treefmt-nix.lib.mkWrapper pkgs ../../treefmt.nix)
14+
self'.formatter
1615
];
1716

1817
shellHook = ''
19-
${inputs.self.checks.${system}.pre-commit-hooks.shellHook}
20-
echo 🔨 Welcome to Khanelinix!
21-
22-
18+
${self'.checks.pre-commit-hooks.shellHook or ""}
19+
echo "🚀 Khanelinix development environment"
20+
echo "Available commands:"
21+
echo " nix flake check - Run all checks"
22+
echo " nix fmt -- --no-cache - Format without cache"
23+
echo " statix check - Check for anti-patterns"
24+
echo " deadnix - Find unused code"
2325
'';
2426
}

0 commit comments

Comments
 (0)