From 916ed0f6a570be89e237073eec652977a212c0cc Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 7 Dec 2022 15:06:02 +0000 Subject: [PATCH] allow settings store paths directly --- nixos-remote | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nixos-remote b/nixos-remote index 40cfe90..36c52d5 100755 --- a/nixos-remote +++ b/nixos-remote @@ -10,6 +10,9 @@ Options: * -f, --flake flake set the flake to install the system from +* -s, --store-paths + set the store paths to the disko-script and nixos-system directly + if this is give, flake is not needed * --arg name value pass value to nix-build. can be used to set disk-names for example * --argstr name value @@ -33,6 +36,12 @@ while [[ $# -gt 0 ]]; do flake=$2 shift ;; + -s | --store-paths) + disko_script=$2 + nixos_system=$3 + shift + shift + ;; --argstr | --arg) nix_args+=("$1" "$2" "$3") shift @@ -80,7 +89,6 @@ nix_build() { "$@" } -nixos_system="" # parse flake nixos-install style syntax, get the system attr if [[ ! -z "${flake+x}" ]]; then if [[ $flake =~ ^(.*)\#([^\#\"]*)$ ]]; then @@ -94,6 +102,12 @@ if [[ ! -z "${flake+x}" ]]; then fi disko_script=$(nix_build "${flake}#nixosConfigurations.${flakeAttr}.config.system.build.disko") nixos_system=$(nix_build "${flake}#nixosConfigurations.${flakeAttr}.config.system.build.toplevel") +elif [[ ! -z "${disko_script+x}" ]] && [[ ! -z "${nixos_system+x}" ]]; then + if [[ ! -e "${disko_script}" ]] || [[ ! -e "${nixos_system}" ]]; then + echo "${disko_script} and ${nixos_system} must be existing store-paths" + exit 1 + fi + : else abort "flake must be set" fi