diff options
Diffstat (limited to 'modules/nix/default.nix')
-rw-r--r-- | modules/nix/default.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/nix/default.nix b/modules/nix/default.nix new file mode 100644 index 000000000000..39715962f20a --- /dev/null +++ b/modules/nix/default.nix @@ -0,0 +1,36 @@ +{ config, pkgs, options, lib, ... }: + +let + # Most of the standard Darwin-detection methods cause infinite recursion. + isDarwin = options.environment ? "darwinConfig"; + +in { + nix.nixPath = [ + "nixos-config=/run/current-system/nixlib/sys/${config.networking.hostName}.nix" + "/run/current-system/nixlib" + ]; + + nix.autoOptimiseStore = true; + nix.daemonCPUSchedPolicy = "idle"; + nix.trustedUsers = [ "@wheel" ]; + + system.extraSystemBuilderCmds = '' + ln -s ${lib.cleanSource ../..} $out/nixlib + ''; + + nixpkgs.overlays = + let + inherit (builtins) attrNames readDir; + dir = ../../overlays; + names = attrNames (readDir dir); + in + map (o: import "${dir}/${o}") names; + + services = lib.optionalAttrs isDarwin + { nix-daemon.enable = true; }; + + systemd.tmpfiles.rules = [ + "d ${config.users.users.qyliss.home}/state/nix 0700 qyliss qyliss" + ]; + +} |