Remove Nix package(nix command binaries) from nix store

I am trying to build an NixOS iso image. I don’t want to include nix package (nix command binaries) in nix store.
I used following option:

nix.enable = false;

along with following change set in nixpkgs:

Although it disables nix commands but Nix binaries are still there in nix store, which can be executed.
I can not use ‘nix-store --delete’ to delete as it reports, “Package is still alive”. Is there any way to remove nix binaries?

If it’s alive, it is a dependency of something else in the system, figure out what that might be and remove that from your build.

1 Like

Thanks for the input. I don’t want it in the nix store of my ISO image. Once the system is booted, I can not use ‘nix-store --delete’ command to delete the Nix package as it will try to delete itself. So the error is coming which is pretty logical. How can I check the dependency? I am not sure nix commands are required by system during boot.

Without knowing how exactly you build the image, it’s hard to do any suggestions, though nix why-depends is always a good start.


Thanks :slight_smile: Now I can see the dependency.

Can we close the linked issue then? Or it is still relevant?