Skip to content

Override or remove the runtime references of a path #5633

@ncfavier

Description

@ncfavier

Is your feature request related to a problem? Please describe.

Say you build a NixOS live ISO image. The resulting image will incur a false runtime dependency on all the paths that were used in creating it, because they're now embedded in the image and thus Nix detects their hashes. (False because those paths are references to the store embedded in the ISO itself, not to the local Nix store.)

This is a problem because when I build that ISO from a different machine and it's cached, I just want to download the image from the cache, not its build closure.

Is there a way to forcibly remove or change the runtime references of a store path?

Describe the solution you'd like

I'm not sure.

Describe alternatives you've considered

The current (horrible) hack I'm using is something like this:

pkgs.runCommand "nixos.iso" {} ''
  ${pkgs.fortune}/bin/rot < ${pkgs.runCommand "avkbf.vfb" {} ''
    ${pkgs.fortune}/bin/rot < ${iso.config.system.build.isoImage}/iso/* > "$out"
  ''} > "$out"
''

It works because rot is involutive and mangles all the hashes, so Nix forgets about the references in the intermediary step. The final nixos.iso still has a reference to glibc for some reason, but this is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions