add 'package' and 'devShell' arguments #58

Closed
jenr24G wants to merge 1 commit from jenr24-select-package-shell into master
Showing only changes of commit 1da37cae7d - Show all commits

View file

@ -5,10 +5,9 @@
# containing 'defaultNix' (to be used in 'default.nix'), 'shellNix' # containing 'defaultNix' (to be used in 'default.nix'), 'shellNix'
# (to be used in 'shell.nix'). # (to be used in 'shell.nix').
{ src, system ? builtins.currentSystem or "unknown-system" }: { src, system ? builtins.currentSystem or "unknown-system", package ? "default", devShell ? "default" }:
let let
lockFilePath = src + "/flake.lock"; lockFilePath = src + "/flake.lock";
lockFile = builtins.fromJSON (builtins.readFile lockFilePath); lockFile = builtins.fromJSON (builtins.readFile lockFilePath);
@ -191,11 +190,9 @@ in
rec { rec {
defaultNix = defaultNix =
(builtins.removeAttrs result ["__functor"]) (builtins.removeAttrs result ["__functor"])
// (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}) // (if result ? packages.${system}.${package} then { default = result.packages.${system}.${package}; } else {})
// (if result ? packages.${system}.default then { default = result.packages.${system}.default; } else {});
shellNix = shellNix =
defaultNix defaultNix
// (if result ? devShell.${system} then { default = result.devShell.${system}; } else {}) // (if result ? devShells.${system}.${devShell} then { default = result.devShells.${system}.${devShell}; } else {});
// (if result ? devShells.${system}.default then { default = result.devShells.${system}.default; } else {});
} }