shell: add get-source command
This commit is contained in:
parent
29ae8b026c
commit
a942b33f04
28
shell.nix
28
shell.nix
@ -2,6 +2,10 @@ let
|
|||||||
lib = import ./lib;
|
lib = import ./lib;
|
||||||
pkgs = import <nixpkgs> { overlays = [(import ./krebs/5pkgs)]; };
|
pkgs = import <nixpkgs> { overlays = [(import ./krebs/5pkgs)]; };
|
||||||
|
|
||||||
|
#
|
||||||
|
# high level commands
|
||||||
|
#
|
||||||
|
|
||||||
# usage: deploy [--user=USER] --system=SYSTEM [--target=TARGET]
|
# usage: deploy [--user=USER] --system=SYSTEM [--target=TARGET]
|
||||||
cmds.deploy = pkgs.writeDash "cmds.deploy" ''
|
cmds.deploy = pkgs.writeDash "cmds.deploy" ''
|
||||||
set -efu
|
set -efu
|
||||||
@ -29,6 +33,22 @@ let
|
|||||||
exec ${utils.build} config.system.build.toplevel
|
exec ${utils.build} config.system.build.toplevel
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
#
|
||||||
|
# low level commands
|
||||||
|
#
|
||||||
|
|
||||||
|
# usage: get-source SOURCE_FILE
|
||||||
|
cmds.get-source = pkgs.writeDash "cmds.get-source" ''
|
||||||
|
set -efu
|
||||||
|
exec ${pkgs.nix}/bin/nix-instantiate \
|
||||||
|
--eval \
|
||||||
|
--json \
|
||||||
|
--readonly-mode \
|
||||||
|
--show-trace \
|
||||||
|
--strict \
|
||||||
|
"$1"
|
||||||
|
'';
|
||||||
|
|
||||||
init.args = pkgs.writeText "init.args" /* sh */ ''
|
init.args = pkgs.writeText "init.args" /* sh */ ''
|
||||||
args=$(${pkgs.utillinux}/bin/getopt -n "$command" -s sh \
|
args=$(${pkgs.utillinux}/bin/getopt -n "$command" -s sh \
|
||||||
-o s:t:u: \
|
-o s:t:u: \
|
||||||
@ -90,13 +110,7 @@ let
|
|||||||
};
|
};
|
||||||
populate = pkgs.writeDash "init.env.populate" ''
|
populate = pkgs.writeDash "init.env.populate" ''
|
||||||
set -efu
|
set -efu
|
||||||
_source=$(${pkgs.nix}/bin/nix-instantiate \
|
_source=$(get-source "$source")
|
||||||
--eval \
|
|
||||||
--json \
|
|
||||||
--readonly-mode \
|
|
||||||
--show-trace \
|
|
||||||
--strict \
|
|
||||||
"$source")
|
|
||||||
echo $_source |
|
echo $_source |
|
||||||
${pkgs.populate}/bin/populate \
|
${pkgs.populate}/bin/populate \
|
||||||
"$target_user@$target_host:$target_port$target_path" \
|
"$target_user@$target_host:$target_port$target_path" \
|
||||||
|
Loading…
Reference in New Issue
Block a user