summaryrefslogtreecommitdiff
path: root/parts
diff options
context:
space:
mode:
Diffstat (limited to 'parts')
-rw-r--r--parts/dev-shells.nix19
-rw-r--r--parts/devenv.nix40
2 files changed, 40 insertions, 19 deletions
diff --git a/parts/dev-shells.nix b/parts/dev-shells.nix
deleted file mode 100644
index 09bb2fb..0000000
--- a/parts/dev-shells.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- config,
- pkgs,
- self,
- system,
- ...
-}:
-{
- devShells.default = pkgs.mkShell {
- inherit (self.checks.${system}.pre-commit-check) shellHook;
-
- buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
-
- inputsFrom = [
- config.flake-root.devShell
- config.just-flake.outputs.devShell
- ];
- };
-}
diff --git a/parts/devenv.nix b/parts/devenv.nix
new file mode 100644
index 0000000..6049afb
--- /dev/null
+++ b/parts/devenv.nix
@@ -0,0 +1,40 @@
+{
+ config,
+ lib,
+ pkgs,
+}:
+{
+ devenv.shells.default = {
+ # <https://devenv.sh/reference/options/>
+ packages = [ config.packages.default ];
+
+ enterShell =
+ let
+ commonJustfile = pkgs.writeTextFile {
+ name = "justfile";
+
+ text = lib.concatStringsSep "\n" (
+ lib.mapAttrsToList (_: feature: feature.outputs.justfile) config.just-flake.features
+ );
+ };
+ in
+ ''
+ # <https://github.com/srid/flake-root/blob/master/flake-module.nix#L30-L31>
+ export FLAKE_ROOT="''$(${lib.getExe config.flake-root.package})"
+
+ # <https://github.com/juspay/just-flake/blob/main/flake-module.nix#L55>
+ ln -sf ${builtins.toString commonJustfile} ./${config.just-flake.commonFileName}
+ '';
+
+ pre-commit = {
+ src = ./.;
+
+ hooks = {
+ deadnix.enable = true;
+ flake-checker.enable = true;
+ nixfmt-rfc-style.enable = true;
+ statix.enable = false;
+ };
+ };
+ };
+}