From a6c6d090c1b3401dbf1b420e6b0cf3485029cb28 Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Tue, 16 May 2023 22:48:01 +0200 Subject: [PATCH] devenv: add build subcommand --- src/devenv.nix | 19 +++++++++++++++++++ src/flake.nix | 1 + 2 files changed, 20 insertions(+) diff --git a/src/devenv.nix b/src/devenv.nix index 0dc89dd2d..246ac5920 100644 --- a/src/devenv.nix +++ b/src/devenv.nix @@ -148,6 +148,24 @@ pkgs.writeScriptBin "devenv" '' $(${nix}/bin/nix $NIX_FLAGS build --print-out-paths --no-link --impure ".#devenv.containers.\"$container\".dockerRun") fi ;; + build) + assemble + help=$(${coreutils}/bin/cat << 'EOF' + Usage: build OPTION + + Example: + $ devenv build languages.python.package + /nix/store/iw1vmh509hcbby8dbpsaanbri4zsq7dj-python3-3.10.10 + EOF + ) + eval "$(${docopts}/bin/docopts -A subcommand -h "$help" : "$@")" + ${nix}/bin/nix $NIX_FLAGS build \ + --impure \ + --print-out-paths \ + --print-build-logs \ + --no-link \ + .#devenv.config."''${subcommand[OPTION]}" + ;; search) name=$1 shift @@ -290,6 +308,7 @@ pkgs.writeScriptBin "devenv" '' echo "shell Activate the developer environment." echo "shell CMD [args] Run CMD with ARGS in the developer environment. Useful when scripting." echo "container [options] NAME Generate a container for NAME. See devenv container --help and http://devenv.sh/containers" + echo "build OPTION Build the package residing in OPTION. See devenv build --help" echo "info Print information about the current developer environment." echo "update Update devenv.lock from devenv.yaml inputs. See http://devenv.sh/inputs/#locking-and-updating-inputs" echo "up Starts processes in foreground. See http://devenv.sh/processes" diff --git a/src/flake.nix b/src/flake.nix index 4c20678fb..0a57ee9a7 100644 --- a/src/flake.nix +++ b/src/flake.nix @@ -75,6 +75,7 @@ inherit (config) info procfileScript procfileEnv procfile; ci = config.ciDerivation; }; + devenv.config = config; devenv.containers = config.containers; devShell."${pkgs.stdenv.system}" = config.shell; };