From 1da37cae7db710026e727bb2a6d4d98f89b100b0 Mon Sep 17 00:00:00 2001 From: Jen Reiss Date: Thu, 28 Sep 2023 20:07:02 -0500 Subject: [PATCH] add 'package' and 'devShell' arguments --- default.nix | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/default.nix b/default.nix index f4f81dc..6b45e55 100644 --- a/default.nix +++ b/default.nix @@ -5,10 +5,9 @@ # containing 'defaultNix' (to be used in 'default.nix'), 'shellNix' # (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 - lockFilePath = src + "/flake.lock"; lockFile = builtins.fromJSON (builtins.readFile lockFilePath); @@ -191,11 +190,9 @@ in rec { defaultNix = (builtins.removeAttrs result ["__functor"]) - // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}) - // (if result ? packages.${system}.default then { default = result.packages.${system}.default; } else {}); + // (if result ? packages.${system}.${package} then { default = result.packages.${system}.${package}; } else {}) shellNix = defaultNix - // (if result ? devShell.${system} then { default = result.devShell.${system}; } else {}) - // (if result ? devShells.${system}.default then { default = result.devShells.${system}.default; } else {}); + // (if result ? devShells.${system}.${devShell} then { default = result.devShells.${system}.${devShell}; } else {}); } -- 2.44.1