The nix.nixPath ( ref ) parameter looks like it will do what you need.
Also the nixos-unstable channel may be more suitable for you, rather than nixpkgs-unstable. I believe that pkgs in the nixpkgs channel are tested and built for systems other than nixOS, although I canβt remember the link for this at the moment.
nix-channel --add https:
# /etc/nixos/configuration.nix
If you need real nix-channel commands in your configuration.nix file, you can write a little systemd service for this, as shown here .
PS I realized that you can just point the nixos path to a nixos-unstable channel by running nix-channel --add https://nixos.org/channels/nixos-unstable/ nixos , but I think the first solution is clearer.
source share