diff options
| author | seth <[email protected]> | 2024-10-27 20:12:19 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-28 00:12:19 +0000 |
| commit | 5ec7ee21e036f7bc1cbdec714271c619cb3fdb3d (patch) | |
| tree | 3277d8ba68ca466e68c58a8373063010db392d2e /modules/shared/defaults | |
| parent | 75ec48c5f7dd7877f2294b86764b1fdadc6b7e88 (diff) | |
modules: restructure (#487)
* seth: remove unused pkgs
* modules: restructure
from archetypes back to profiles
make less actual modules for everything
use lib.mkDefault like it's supposed to
move mixins out of server
* nixos/resolved: use modern options
Diffstat (limited to 'modules/shared/defaults')
| -rw-r--r-- | modules/shared/defaults/default.nix | 11 | ||||
| -rw-r--r-- | modules/shared/defaults/nix.nix | 50 |
2 files changed, 61 insertions, 0 deletions
diff --git a/modules/shared/defaults/default.nix b/modules/shared/defaults/default.nix new file mode 100644 index 0000000..f2bb28a --- /dev/null +++ b/modules/shared/defaults/default.nix @@ -0,0 +1,11 @@ +{ inputs, ... }: +let + inherit (inputs) self; +in +{ + imports = [ + ./nix.nix + ]; + + system.configurationRevision = self.rev or self.dirtyRev or "dirty-unknown"; +} diff --git a/modules/shared/defaults/nix.nix b/modules/shared/defaults/nix.nix new file mode 100644 index 0000000..e5d7607 --- /dev/null +++ b/modules/shared/defaults/nix.nix @@ -0,0 +1,50 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (pkgs.stdenv.hostPlatform) isLinux; + + # TODO: remove this nonsense when all implementations remove repl-flake + hasReplFlake = + lib.versionOlder config.nix.package.version "2.22.0" # repl-flake was removed in nix 2.22.0 + || lib.versionAtLeast config.nix.package.version "2.90.0"; # but not in lix yet + + hasAlwaysAllowSubstitutes = lib.versionAtLeast config.nix.package.version "2.19.0"; +in +{ + config = lib.mkMerge [ + { + nix = { + settings = { + auto-optimise-store = lib.mkDefault isLinux; + experimental-features = [ + "nix-command" + "flakes" + "auto-allocate-uids" + ]; + + trusted-substituters = [ "https://getchoo.cachix.org" ]; + trusted-public-keys = [ "getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE=" ]; + }; + + gc = { + automatic = lib.mkDefault true; + options = lib.mkDefault "--delete-older-than 2d"; + }; + }; + + nixpkgs.config.allowUnfree = lib.mkDefault true; + } + + (lib.mkIf hasReplFlake { + nix.settings.experimental-features = [ "repl-flake" ]; + }) + + (lib.mkIf hasAlwaysAllowSubstitutes { + nix.settings.always-allow-substitutes = true; + }) + ]; +} |
