Skip to content

Commit

Permalink
devenv: add build subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
bobvanderlinden committed May 16, 2023
1 parent 957e4eb commit a6c6d09
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit a6c6d09

Please sign in to comment.