Skip to content

Instantly share code, notes, and snippets.

@kalbasit
Created January 5, 2019 03:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kalbasit/beab7b80e5ab9615e634f17021b67e4e to your computer and use it in GitHub Desktop.
# neither A nor B is working. I don't see this in the activation script or under `result/etc/`
{
# A
system.activationScripts = {
nixpkgsPin = {
text = ''
ln -sfn ${pinnedNixpkgs} /etc/nixpkgs
'';
deps = [];
};
};
# B
system.activationScripts.nixpkgs = stringAfter [ "users" "groups" ] ''
ln -sfn ${pinnedNixpkgs} /etc/nixpkgs
'';
}
@worldofpeace
Copy link

I think what you want is

system.extraSystemBuilderCmds = ''
  ln -sv ${pinnedNixpkgs} $out/nixpkgs
'';

What this precisely does is described

This code will be added to the builder creating the system store path.

So nixpkgs will end up at /run/current-system/nixpkgs.

@kalbasit
Copy link
Author

kalbasit commented Jan 5, 2019

I think what you want is

system.extraSystemBuilderCmds = ''
  ln -sv ${pinnedNixpkgs} $out/nixpkgs
'';

It does not seem to work! I can't seem to find the option over on https://nixos.org/nixos/options.html#system.extr either.

EDIT: Oh I see, it's an internal option that's why we cannot see it over on the documentation side. https://github.com/NixOS/nixpkgs/blob/0a124ba93d4e0f9e77d003402e7a6b0e56ef8aa1/nixos/modules/system/activation/top-level.nix#L215-L222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment