Skip to content

Commit

Permalink
Add a devenv-up package
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry committed Jul 20, 2023
1 parent 36a7bb5 commit a955325
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ devenvFlake: { flake-parts-lib, lib, inputs, ... }: {
config.packages =
lib.concatMapAttrs
(shellName: devenv:
lib.concatMapAttrs
(lib.concatMapAttrs
(containerName: container:
{ "${shellPrefix shellName}container-${containerName}" = container.derivation; }
)
devenv.containers
) // {
"${shellPrefix shellName}devenv-up" = devenv.procfileScript;
}
)
config.devenv.shells;
});
Expand Down
3 changes: 2 additions & 1 deletion src/devenv-devShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
let
lib = pkgs.lib;
version = lib.fileContents ./modules/latest-version;
shellPrefix = shellName: if shellName == "default" then "" else "${shellName}-";
in
pkgs.writeScriptBin "devenv" ''
#!/usr/bin/env bash
Expand All @@ -18,7 +19,7 @@ pkgs.writeScriptBin "devenv" ''
case $command in
up)
procfilescript=$(nix build '.#devShells.${pkgs.stdenv.system}.default.config.procfileScript' --print-out-paths --impure)
procfilescript=$(nix build '.#${shellPrefix config._module.args.name}devenv-up' --print-out-paths --impure)
if [ "$(cat $procfilescript|tail -n +2)" = "" ]; then
echo "No 'processes' option defined: https://devenv.sh/processes/"
exit 1
Expand Down

0 comments on commit a955325

Please sign in to comment.