1 { config, lib, pkgs, ... }:
4 /* Alternative which does not need to re-export envvars when called via sudo.
5 But this is maybe more clear to just (re-)export envvars.
6 nix = pkgs.writeShellScriptBin "nix" ''
7 NIX_CONF_DIR=${cfg.nixConf} \
8 NIX_SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" \
9 SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" \
10 ${pkgs.nix}/bin/nix "$@"
16 enable = lib.mkEnableOption "nix";
17 nixConf = lib.mkOption {
19 apply = s: pkgs.writeText "nix.conf" s;
21 auto-optimise-store = true
24 Nix's nix.conf content.
28 config = lib.mkIf cfg.enable {
29 #shell.buildInputs = [ nix ];
30 nix-shell.shellHook = ''
32 export NIX_CONF_DIR=${cfg.nixConf}
33 export NIX_SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
34 export SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"