I prefer to use nix-serve
to share packages between laptops
% nix-env -i nix-serve
% nix-serve -p 8080
more options how to share nix packages between machines described in nix manual
NixOS community has three manuals, always consult them first, if you're stuck:
Every package on Nix is specified by a Nix expression. A Nix expression is some text, written in Nix language, typically residing in a file with extension .nix
.
Every expression has the so-called “symbolic name”, a human-readable name that is printed, when you use nix-env
. See sample Nix expression. Nix itself doesn't use this symbolic name anywhere internally, so it doesn't matter if your package is named aspell-dict-en
, it's just for your, human's, convenience.
What actually matters is the so-called “attribute path”. So your confusion is between symbolic name and attribute path. Every package has an attribute path, which you can use in environment.systemPackages
configuration option to install system-wide using declarative package management.
To find out your package's attribute path, add another flag -P
to your query:
$ nix-env -qaP 'aspell.*en'
nixos.aspellDicts.en aspell-dict-en-7.1-0
You should be comfortable using nix-env
on a daily basis, so practice calling nix-env
with --query
and --install
options. However you can also browse packages and find out their attribute paths online on Nix packages search. Type aspell
, click on aspell-dict-en
and you'll see various package's properties, including attribute path as part of the install command:
$ nix-env -iA nixos.pkgs.aspellDicts.en
Now you can put this attribute path into /etc/nixos/configuration.nix
:
environment.systemPackages = with pkgs; [
aspellDicts.en
];
Then update the system by running sudo nixos-rebuild switch
.
Best Answer
nix-store --delete /path
Note that the path might be alive and thus refused to be deleted without--ignore-liveness
and root privileges.