[Nix-dev] Pass arguments to 'required' configs

Sergey Mironov grrwlf at gmail.com
Tue Nov 17 15:17:19 CET 2015


Hi. This is a follow-up to my previous letter about Private NixOS modules.

Another thing I am missing is the ability to pass arguments to
'required' configuration modules. Below is the illustration of the
idea. Could you please give me some advice on this?

Regards,
Sergey


// configuration.nix

{config, pkgs, ...}:
let
  proxy_port = "4343";
  proxy_host = "myproxy.local";
in
{
  require = [
    /etc/nixos/hardware-configuration.nix
    ..
    (withArguments ./include/global_bash_aliases.nix { inherit
proxy_port  proxy_host; })
    ..
  ];
 ...

}


//./include/global_bash_aliases.nix

{ proxy_port, proxy_host} :
{ config, pkgs, ... } :
{
  environment = rec {

    extraInit = ''
       alias goproxy "nc ${proxy_port} ${proxy_host}
    '';
  };

}


More information about the nix-dev mailing list