add filename option

This commit is contained in:
lassulus 2020-05-22 10:26:49 +02:00
parent ca2b26afab
commit 90c20db183
11 changed files with 17 additions and 1 deletions

View File

@ -5,4 +5,5 @@
];
formatAttr = "hypervImage";
filename = "*.vhdx";
}

View File

@ -9,4 +9,5 @@
virtualisation.hypervGuest.enable = true;
formatAttr = "isoImage";
filename = "*.iso";
}

View File

@ -12,4 +12,5 @@
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
formatAttr = "isoImage";
filename = "*.iso";
}

View File

@ -11,4 +11,5 @@
isoImage.makeUsbBootable = true;
formatAttr = "isoImage";
filename = "*.iso";
}

View File

@ -55,4 +55,5 @@ in {
networking.hostName = lib.mkDefault "kexec";
formatAttr = "kexec_tarball";
filename = "*/tarball/*.tar.xz";
}

View File

@ -13,6 +13,8 @@
target = "/metadata.yaml";
}];
};
formatAttr = "metadata";
filename = "*/tarball/*.tar.xz";
}

View File

@ -19,4 +19,5 @@ in {
});
formatAttr = "tarball";
filename = "*/tarball/*.tar.xz";
}

View File

@ -19,4 +19,5 @@
};
formatAttr = "raw";
filename = "*.img";
}

View File

@ -5,4 +5,5 @@
];
formatAttr = "virtualBoxOVA";
filename = "*.ova";
}

View File

@ -121,12 +121,13 @@ if [[ -n $cores ]]; then
fi
formatAttr=$(nix-instantiate "${nix_args[@]}" --eval --json -A config.formatAttr | jq -r .)
filename=$(nix-instantiate "${nix_args[@]}" --eval --json -A config.filename | jq -r .)
out=$(nix-build "${nix_args[@]}" --no-out-link -A "config.system.build.$formatAttr")
if [[ -z $run ]]; then
# show the first file, ignoring nix-support
find "$out" -path "$out/nix-support" -prune -o -type f -print -quit
find "$out" -wholename "$filename" -type f -print -quit
else
runner=$(find "$out"/bin -type l -print -quit)
exec "$runner"

View File

@ -6,6 +6,11 @@
let
module = { lib, ... }: {
options = {
filename = lib.mkOption {
type = lib.types.str;
description = "Declare the path of the wanted file in the output directory";
default = "*";
};
formatAttr = lib.mkOption {
type = lib.types.str;
description = "Declare the default attribute to build";