How to remove single package from cache/nix store?

10,738

nix-store --delete /path Note that the path might be alive and thus refused to be deleted without --ignore-liveness and root privileges.

Share:
10,738

Related videos on Youtube

wizzup
Author by

wizzup

Updated on September 18, 2022

Comments

  • wizzup
    wizzup almost 2 years

    Is there any way to force removing a package from /nix/store/..

    I am testing my expression for my package and want to make sure it will rebuild correctly.

    The problem is if I build my package once, the next time I build it again it will use the cache.

    I use this command to test my package

    nix-shell -I nixpkgs=</path/to/repo> -p <package_name>
    

    I don't want to use nix-collect-garbage because it remove lot of buildInputs too.

    Looking for something like nix-cg <package_name>

  • srghma
    srghma almost 6 years
    sudo nix-store --delete --ignore-liveness /nix/store/XXX
  • Jeff
    Jeff almost 5 years
    Careful with that! I just recursively deleted my entire system and had to recover from the install USB.
  • eigenfield
    eigenfield over 3 years
    This command borked my $HOME user profile symlinks to store, despite the package I was uninstalling was android-studio I thought was ok.