Going from nix profile
to configuration.nix
$ cat ~/.nix-profile/manifest.json |
jq --arg PLATFORM "$(nix-instantiate --eval --expr 'builtins.currentSystem' | jq --raw-output)\\." \
--raw-output \
'.elements[].attrPath | split(".")[-2:] | join(".") | sub($PLATFORM;"")'
jless
xxd
llvm
cmake
gnumake
clang
...
From here, add the above to systemPackages
in /etc/nixos/configuration.nix
. You can then remove
all packages from your profile with nix profile remove '.*'
.
Tip: run nixos-rebuild switch
before removing all packages from your profile.