diff options
| author | Fuwn <[email protected]> | 2024-10-11 23:11:22 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-11 23:11:22 -0700 |
| commit | 7a8680e94bbc2cb57e77a030280ab5365b2a9c92 (patch) | |
| tree | 5c1f883879b80cce8015e8c61409577695e0f50e /parts/devenv.nix | |
| parent | nix: add devenv substituter (diff) | |
| download | nixos-config-7a8680e94bbc2cb57e77a030280ab5365b2a9c92.tar.xz nixos-config-7a8680e94bbc2cb57e77a030280ab5365b2a9c92.zip | |
flake: use devenv instead of devshell
Diffstat (limited to 'parts/devenv.nix')
| -rw-r--r-- | parts/devenv.nix | 40 |
1 files changed, 40 insertions, 0 deletions
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; + }; + }; + }; +} |