mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-11-22 01:52:05 +03:00
rename filename to fileExtension
This commit is contained in:
parent
efb2d33d4f
commit
af3d3a7538
@ -188,7 +188,7 @@ images can be built from that flake by running:
|
|||||||
formatConfigs.my-custom-format = {config, modulesPath, ...}: {
|
formatConfigs.my-custom-format = {config, modulesPath, ...}: {
|
||||||
imports = ["${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"];
|
imports = ["${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"];
|
||||||
formatAttr = "isoImage";
|
formatAttr = "isoImage";
|
||||||
filename = "*.iso";
|
fileExtension = ".iso";
|
||||||
networking.wireless.networks = {
|
networking.wireless.networks = {
|
||||||
# ...
|
# ...
|
||||||
};
|
};
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
|
|
||||||
# attrset of formats to be exposed under config.system.formats
|
# attrset of formats to be exposed under config.system.formats
|
||||||
formats = lib.flip lib.mapAttrs allConfigs (
|
formats = lib.flip lib.mapAttrs allConfigs (
|
||||||
formatName: conf: pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}${conf.config.filename}" {} ''
|
formatName: conf: pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}${conf.config.fileExtension}" {} ''
|
||||||
set -efu
|
set -efu
|
||||||
target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.filename}' -xtype f -print -quit)
|
target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit)
|
||||||
ln -s "$target" "$out"
|
ln -s "$target" "$out"
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
@ -37,7 +37,7 @@ Tests using the all-formats module through a flake.
|
|||||||
}: {
|
}: {
|
||||||
imports = ["${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"];
|
imports = ["${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"];
|
||||||
formatAttr = "isoImage";
|
formatAttr = "isoImage";
|
||||||
filename = "*.iso";
|
fileExtension = ".iso";
|
||||||
networking.wireless.networks = {
|
networking.wireless.networks = {
|
||||||
# ...
|
# ...
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
key = "github:nix-community/nixos-generators/format-module.nix";
|
key = "github:nix-community/nixos-generators/format-module.nix";
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
filename = lib.mkOption {
|
fileExtension = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Declare the path of the wanted file in the output directory";
|
description = "Declare the path of the wanted file in the output directory";
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
imports = [./kexec.nix];
|
imports = [./kexec.nix];
|
||||||
|
|
||||||
formatAttr = lib.mkForce "kexec_bundle";
|
formatAttr = lib.mkForce "kexec_bundle";
|
||||||
filename = lib.mkForce "*-kexec_bundle";
|
fileExtension = lib.mkForce "*-kexec_bundle";
|
||||||
}
|
}
|
||||||
|
@ -67,5 +67,5 @@ in {
|
|||||||
networking.hostName = lib.mkDefault "kexec";
|
networking.hostName = lib.mkDefault "kexec";
|
||||||
|
|
||||||
formatAttr = "kexec_tarball";
|
formatAttr = "kexec_tarball";
|
||||||
filename = "*/tarball/*.tar.xz";
|
fileExtension = "*/tarball/*.tar.xz";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "amazonImage";
|
formatAttr = "amazonImage";
|
||||||
filename = ".vhd";
|
fileExtension = ".vhd";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "digitalOceanImage";
|
formatAttr = "digitalOceanImage";
|
||||||
filename = ".qcow2.gz";
|
fileExtension = ".qcow2.gz";
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
services.journald.console = "/dev/console";
|
services.journald.console = "/dev/console";
|
||||||
|
|
||||||
formatAttr = "tarball";
|
formatAttr = "tarball";
|
||||||
filename = ".tar.xz";
|
fileExtension = ".tar.xz";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "googleComputeImage";
|
formatAttr = "googleComputeImage";
|
||||||
filename = ".raw.tar.gz";
|
fileExtension = ".raw.tar.gz";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "hypervImage";
|
formatAttr = "hypervImage";
|
||||||
filename = ".vhdx";
|
fileExtension = ".vhdx";
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,5 @@
|
|||||||
virtualisation.hypervGuest.enable = true;
|
virtualisation.hypervGuest.enable = true;
|
||||||
|
|
||||||
formatAttr = "isoImage";
|
formatAttr = "isoImage";
|
||||||
filename = ".iso";
|
fileExtension = ".iso";
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,5 @@
|
|||||||
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];
|
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];
|
||||||
|
|
||||||
formatAttr = "isoImage";
|
formatAttr = "isoImage";
|
||||||
filename = ".iso";
|
fileExtension = ".iso";
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,5 @@
|
|||||||
isoImage.makeUsbBootable = true;
|
isoImage.makeUsbBootable = true;
|
||||||
|
|
||||||
formatAttr = "isoImage";
|
formatAttr = "isoImage";
|
||||||
filename = ".iso";
|
fileExtension = ".iso";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "kubevirtImage";
|
formatAttr = "kubevirtImage";
|
||||||
filename = ".qcow2";
|
fileExtension = ".qcow2";
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "linode";
|
formatAttr = "linode";
|
||||||
filename = ".img.gz";
|
fileExtension = ".img.gz";
|
||||||
|
|
||||||
system.build.linode = import "${toString modulesPath}/../lib/make-disk-image.nix" {
|
system.build.linode = import "${toString modulesPath}/../lib/make-disk-image.nix" {
|
||||||
inherit lib config pkgs;
|
inherit lib config pkgs;
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "metadata";
|
formatAttr = "metadata";
|
||||||
filename = ".tar.xz";
|
fileExtension = ".tar.xz";
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "tarball";
|
formatAttr = "tarball";
|
||||||
filename = ".tar.xz";
|
fileExtension = ".tar.xz";
|
||||||
}
|
}
|
||||||
|
@ -16,5 +16,5 @@ else {
|
|||||||
"${toString modulesPath}/../maintainers/scripts/openstack/openstack-image.nix"
|
"${toString modulesPath}/../maintainers/scripts/openstack/openstack-image.nix"
|
||||||
];
|
];
|
||||||
formatAttr = "openstackImage";
|
formatAttr = "openstackImage";
|
||||||
filename = ".qcow2";
|
fileExtension = ".qcow2";
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
"${toString modulesPath}/virtualisation/proxmox-lxc.nix"
|
"${toString modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||||
];
|
];
|
||||||
formatAttr = "tarball";
|
formatAttr = "tarball";
|
||||||
filename = ".tar.xz";
|
fileExtension = ".tar.xz";
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
"${toString modulesPath}/virtualisation/proxmox-image.nix"
|
"${toString modulesPath}/virtualisation/proxmox-image.nix"
|
||||||
];
|
];
|
||||||
formatAttr = "VMA";
|
formatAttr = "VMA";
|
||||||
filename = ".vma.zst";
|
fileExtension = ".vma.zst";
|
||||||
}
|
}
|
||||||
|
@ -35,5 +35,5 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
formatAttr = "qcow";
|
formatAttr = "qcow";
|
||||||
filename = ".qcow2";
|
fileExtension = ".qcow2";
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,5 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
formatAttr = "raw";
|
formatAttr = "raw";
|
||||||
filename = ".img";
|
fileExtension = ".img";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "virtualBoxOVA";
|
formatAttr = "virtualBoxOVA";
|
||||||
filename = ".ova";
|
fileExtension = ".ova";
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
formatAttr = "vmwareImage";
|
formatAttr = "vmwareImage";
|
||||||
filename = ".vmdk";
|
fileExtension = ".vmdk";
|
||||||
}
|
}
|
||||||
|
@ -163,13 +163,13 @@ if [[ -n $cores ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
formatAttr=$(nix-instantiate "${nix_args[@]}" --eval --json -A config.formatAttr | jq -r .)
|
formatAttr=$(nix-instantiate "${nix_args[@]}" --eval --json -A config.formatAttr | jq -r .)
|
||||||
filename=$(nix-instantiate "${nix_args[@]}" --eval --json -A config.filename | jq -r .)
|
fileExtension=$(nix-instantiate "${nix_args[@]}" --eval --json -A config.fileExtension | jq -r .)
|
||||||
|
|
||||||
out=$(nix-build "${nix_args[@]}" "${nix_build_args[@]}" -A "config.system.build.$formatAttr")
|
out=$(nix-build "${nix_args[@]}" "${nix_build_args[@]}" -A "config.system.build.$formatAttr")
|
||||||
|
|
||||||
if [[ -z $run ]]; then
|
if [[ -z $run ]]; then
|
||||||
# show the first file, ignoring nix-support
|
# show the first file, ignoring nix-support
|
||||||
find "$out" -name "*$filename" -xtype f -print -quit
|
find "$out" -name "*$fileExtension" -xtype f -print -quit
|
||||||
else
|
else
|
||||||
runner=$(find "$out"/bin -type l -print -quit)
|
runner=$(find "$out"/bin -type l -print -quit)
|
||||||
exec "$runner"
|
exec "$runner"
|
||||||
|
Loading…
Reference in New Issue
Block a user