From fbb85bc1da748526302fcaad33382404eb7b80fd Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Sat, 20 Jan 2024 17:41:14 +0100 Subject: [PATCH] Extract configuration to own module --- hosts/thrall/default.nix | 9 ++------- modules/common-system.nix | 29 +++++++---------------------- modules/nix-config.nix | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 modules/nix-config.nix diff --git a/hosts/thrall/default.nix b/hosts/thrall/default.nix index 9722408..db917a5 100644 --- a/hosts/thrall/default.nix +++ b/hosts/thrall/default.nix @@ -7,17 +7,12 @@ let extIface = "ens3"; ledgerVHost = "ledger.failco.de"; in { - imports = [ # Include the results of the hardware scan. + imports = [ ./hardware-configuration.nix ../../modules/upgrade-pg-cluster.nix + ../../modules/nix-config.nix ]; - nix.package = pkgs.nixUnstable; - nix.extraOptions = '' - experimental-features = nix-command flakes repl-flake ca-derivations - ''; - # nix.registry.nixpkgs.flake = nixpkgs; - # Binary Cache for Haskell.nix nix.settings.trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; diff --git a/modules/common-system.nix b/modules/common-system.nix index 3e053fd..b8de7d7 100644 --- a/modules/common-system.nix +++ b/modules/common-system.nix @@ -1,5 +1,6 @@ -{config, pkgs, inputs, ...}: -{ +{ config, pkgs, inputs, ... }: { + imports = [ ./nix-config.nix ]; + i18n.defaultLocale = "en_US.UTF-8"; time.timeZone = "Europe/Berlin"; @@ -21,25 +22,9 @@ networking.firewall.enable = true; nix = { - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - registry = { - nixpkgs.flake = inputs.nixpkgs; - nixpkgs-unstable.flake = inputs.nixpkgs-unstable; - }; - - settings = { - auto-optimise-store = true; - experimental-features = [ "nix-command" "flakes" ]; - warn-dirty = false; - - # avoid unwanted garbage collection when using direnv - keep-outputs = true; - keep-derivations = true; - }; + registry = { + nixpkgs.flake = inputs.nixpkgs; + nixpkgs-unstable.flake = inputs.nixpkgs-unstable; + }; }; } diff --git a/modules/nix-config.nix b/modules/nix-config.nix new file mode 100644 index 0000000..716d4e7 --- /dev/null +++ b/modules/nix-config.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +{ + nix = { + package = pkgs.nixUnstable; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + warn-dirty = false; + + # avoid unwanted garbage collection when using direnv + keep-outputs = true; + keep-derivations = true; + }; + }; +}