mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-11-25 19:07:59 +03:00
all-formats: fix incorrect symlinks i.e. for sd-image formats
- output $out/$basename instead of $out being a symlink to the resulting file. This works around problem where we cannot predict the file extension of the output reliably, and therefore the direct symlink had the wrong extension in some cases. - fix wrong file symlinked under $out for sd image formats
This commit is contained in:
parent
9a666f144f
commit
b9c5637760
@ -36,11 +36,14 @@
|
||||
|
||||
# attrset of formats to be exposed under config.system.formats
|
||||
formats = lib.flip lib.mapAttrs allConfigs (
|
||||
formatName: conf: pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}${conf.config.fileExtension}" {} ''
|
||||
formatName: conf: exposeConfig conf (
|
||||
pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}" {} ''
|
||||
set -efu
|
||||
target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit)
|
||||
ln -s "$target" "$out"
|
||||
mkdir $out
|
||||
ln -s "$target" "$out/$(basename "$target")"
|
||||
''
|
||||
)
|
||||
);
|
||||
in {
|
||||
_file = ./all-formats.nix;
|
||||
@ -54,7 +57,7 @@ in {
|
||||
options.formats = lib.mkOption {
|
||||
type = lib.types.lazyAttrsOf lib.types.raw;
|
||||
description = ''
|
||||
Different target formats generated for this NixOS configuratation.
|
||||
Different target formats generated for this NixOS configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user