accept relative paths for flakes in disko/disko-install

builtins.getFlake wants absolute paths
This commit is contained in:
Jörg Thalheim 2024-03-11 13:59:00 +01:00 committed by Jörg Thalheim
parent 5866ae41f7
commit a949edef70
2 changed files with 8 additions and 0 deletions

3
disko
View file

@ -118,6 +118,9 @@ if [[ -n "${flake+x}" ]]; then
echo "For example, to use the output diskoConfigurations.foo from the flake.nix, append \"#foo\" to the flake-uri."
exit 1
fi
if [[ -e "$flake" ]]; then
flake=$(realpath "$flake")
fi
nix_args+=("--arg" "flake" "\"$flake\"")
nix_args+=("--argstr" "flakeAttr" "$flakeAttr")
nix_args+=(--extra-experimental-features flakes)

View file

@ -151,6 +151,11 @@ main() {
flake="${BASH_REMATCH[1]}"
flakeAttr="${BASH_REMATCH[2]}"
fi
if [[ -e "$flake" ]]; then
flake=$(realpath "$flake")
fi
if [[ -z ${flakeAttr-} ]]; then
echo "Please specify the name of the NixOS configuration to be installed, as a URI fragment in the flake-uri." >&2
echo 'For example, to use the output nixosConfigurations.foo from the flake.nix, append "#foo" to the flake-uri.' >&2