I am trying to pass a parameter to a flake-based build, but apparently I am doing it wrong. My configuration.nix includes:
environment.systemPackages = with pkgs; [
aerc
... other packages here ...
];
aerc’s package.nix specifies a parameter withNotmuch, and I want to override the default. I tried using specialArgs in flake.nix, but this does not seem to have any effect:
darwinConfigurations."MyHostname" = nix-darwin.lib.darwinSystem {
modules = [ ./configuration.nix ];
specialArgs = { inherit inputs pkgs; withNotmuch = false; };
};
Is using specialArgs even the right approach, or is there a more idiomatic way?
environment.systemPackages = with pkgs; [
(aerc.override { withNotmuch = false; })
# ...
];
Or if you want to set this for all packages including dependencies, not just for this one use of aerc:
nixpkgs.overlays = [ (_: _: { withNotmuch = false; }) ];
(Beware mass rebuilds in some scenarios.)
This has nothing to do with flakes, btw. Flakes just let you describe how to fetch nixpkgs or other inputs, let you describe any outputs your project should expose, and disallow impure inputs like envvars and random files on the system.
1 Like
Thank you. Being able to specify the parameter for an individual package is even better! Something like withFoo might have different meanings for different packages.