summaryrefslogtreecommitdiff
path: root/parts/modules/shared/base/nix.nix
diff options
context:
space:
mode:
Diffstat (limited to 'parts/modules/shared/base/nix.nix')
-rw-r--r--parts/modules/shared/base/nix.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/parts/modules/shared/base/nix.nix b/parts/modules/shared/base/nix.nix
new file mode 100644
index 0000000..2c95933
--- /dev/null
+++ b/parts/modules/shared/base/nix.nix
@@ -0,0 +1,42 @@
+{
+ config,
+ inputs,
+ lib,
+ pkgs,
+ ...
+}: let
+ cfg = config.base.nix-settings;
+ inherit (lib) mkDefault mkEnableOption mkIf;
+ inherit (pkgs.stdenv) isLinux;
+in {
+ options.base.nix-settings.enable = mkEnableOption "base nix settings";
+
+ config = mkIf cfg.enable {
+ nix = {
+ registry =
+ {
+ n.flake = mkDefault inputs.nixpkgs;
+ }
+ // (builtins.mapAttrs (_: flake: {inherit flake;})
+ (inputs.nixpkgs.lib.filterAttrs (n: _: n != "nixpkgs") inputs));
+
+ settings = {
+ auto-optimise-store = isLinux;
+ experimental-features = ["nix-command" "flakes" "auto-allocate-uids" "repl-flake"];
+
+ trusted-substituters = ["https://cache.garnix.io"];
+ trusted-public-keys = ["cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="];
+ };
+
+ gc = {
+ automatic = mkDefault true;
+ options = mkDefault "--delete-older-than 7d";
+ };
+ };
+
+ nixpkgs = {
+ overlays = with inputs; [nur.overlay getchoo.overlays.default self.overlays.default];
+ config.allowUnfree = true;
+ };
+ };
+}