Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix build results in "failed to create symbolic link" #359

Open
SebastianStork opened this issue Aug 16, 2024 · 6 comments
Open

nix build results in "failed to create symbolic link" #359

SebastianStork opened this issue Aug 16, 2024 · 6 comments

Comments

@SebastianStork
Copy link

I followed the instructions for the "Using as a nixos-module" method. My configuration can be found here.

When I run nix build .#nixosConfigurations.installer.config.formats.iso I get this error:

error: builder for '/nix/store/0acylkkqsd9q36gzdqwibc1337jhwfhd-NixOS.iso.drv' failed with exit code 1;
       last 10 log lines:
       > sourcing setup hook '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh'
       > sourcing setup hook '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh'
       > sourcing setup hook '/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh'
       > sourcing setup hook '/nix/store/jivxp510zxakaaic7qkrb7v1dd2rdbw9-multiple-outputs.sh'
       > sourcing setup hook '/nix/store/ilaf1w22bxi6jsi45alhmvvdgy4ly3zs-patch-shebangs.sh'
       > sourcing setup hook '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh'
       > sourcing setup hook '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh'
       > sourcing setup hook '/nix/store/aazf105snicrlvyzzbdj85sx4179rpfp-set-source-date-epoch-to-latest.sh'
       > sourcing setup hook '/nix/store/gps9qrh99j7g02840wv5x78ykmz30byp-strip.sh'
       > ln: failed to create symbolic link '/nix/store/2yx7pj2gy89fj1m6vcvcd0j358hrd7bs-NixOS.iso' -> '': No such file or directory
       For full logs, run 'nix log /nix/store/0acylkkqsd9q36gzdqwibc1337jhwfhd-NixOS.iso.

The same happens when I append -o result to specify the symlink location.

Is this intended behavior? I couldn't find any other mention of this anywhere. Any help is appreciated.

@Mic92
Copy link
Member

Mic92 commented Aug 17, 2024

Could be a bug or regression.
Check nix show-derivation /nix/store/0acylkkqsd9q36gzdqwibc1337jhwfhd-NixOS.iso.drv to get the build instructions for this.
I strongly suspect this command here fails and it returns an empty string:

target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit)

making this line fail:

ln -s "$target" "$out"

@SebastianStork
Copy link
Author

Here is the output:

{
  "/nix/store/0acylkkqsd9q36gzdqwibc1337jhwfhd-NixOS.iso.drv": {
    "args": [
      "-e",
      "/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh"
    ],
    "builder": "/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26/bin/bash",
    "env": {
      "__structuredAttrs": "",
      "buildCommand": "set -efu\ntarget=$(find '/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS' -name '*.iso' -xtype f -print -quit)\nln -s \"$target\" \"$out\"\n",
      "buildInputs": "",
      "builder": "/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26/bin/bash",
      "cmakeFlags": "",
      "configureFlags": "",
      "depsBuildBuild": "",
      "depsBuildBuildPropagated": "",
      "depsBuildTarget": "",
      "depsBuildTargetPropagated": "",
      "depsHostHost": "",
      "depsHostHostPropagated": "",
      "depsTargetTarget": "",
      "depsTargetTargetPropagated": "",
      "doCheck": "",
      "doInstallCheck": "",
      "enableParallelBuilding": "1",
      "enableParallelChecking": "1",
      "enableParallelInstalling": "1",
      "mesonFlags": "",
      "name": "NixOS.iso",
      "nativeBuildInputs": "",
      "out": "/nix/store/2yx7pj2gy89fj1m6vcvcd0j358hrd7bs-NixOS.iso",
      "outputs": "out",
      "passAsFile": "buildCommand",
      "patches": "",
      "propagatedBuildInputs": "",
      "propagatedNativeBuildInputs": "",
      "stdenv": "/nix/store/6a7qxqcm33y3lwr1v55hpp5hg7akja92-stdenv-linux",
      "strictDeps": "",
      "system": "x86_64-linux"
    },
    "inputDrvs": {
      "/nix/store/0bjp0x3hysgy3hdvjcflmpy2al96jcl1-NixOS.drv": {
        "dynamicOutputs": {},
        "outputs": [
          "out"
        ]
      },
      "/nix/store/j5s66rbmbp025zdaj14g3hqjk83q00w2-stdenv-linux.drv": {
        "dynamicOutputs": {},
        "outputs": [
          "out"
        ]
      },
      "/nix/store/wzh01sawfkrvg2srg4jl8zprz1a347gy-bash-5.2p26.drv": {
        "dynamicOutputs": {},
        "outputs": [
          "out"
        ]
      }
    },
    "inputSrcs": [
      "/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh"
    ],
    "name": "NixOS.iso",
    "outputs": {
      "out": {
        "path": "/nix/store/2yx7pj2gy89fj1m6vcvcd0j358hrd7bs-NixOS.iso"
      }
    },
    "system": "x86_64-linux"
  }
}

And I can confirm that find '/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS' -name '*.iso' -xtype f -print -quit) returns an empty string.

@Mic92
Copy link
Member

Mic92 commented Aug 17, 2024

What's in /nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS if you run this command?

find /nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS

@SebastianStork
Copy link
Author

/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS
/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS/iso
/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS/iso/NixOS
/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS/nix-support
/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS/nix-support/system
/nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS/nix-support/hydra-build-products

That seems totally fine to me. I get the same result when I do nix run nixpkgs#nixos-generators -- --format iso --flake .#installer -o result.

@Mic92
Copy link
Member

Mic92 commented Aug 25, 2024

So /nix/store/2y2fq0q6ij8c86mv10d6vhqvi8fnd08y-NixOS/iso/NixOS is an iso file?

@SebastianStork
Copy link
Author

That's right. I tested it and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants