From 04a13ab97692a9956da5cef15fbcbfe1424f9166 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 12 May 2024 14:50:33 -0500 Subject: [PATCH] hostname/timezone abstractions --- hosts/algiz/system.nix | 3 --- hosts/mannaz/default.nix | 4 +--- hosts/mannaz/system.nix | 3 --- hosts/othalan/system.nix | 3 --- lib/default.nix | 17 +++++++---------- modules/oizys.nix | 11 ++++++++++- modules/runes/default.nix | 1 - 7 files changed, 18 insertions(+), 24 deletions(-) diff --git a/hosts/algiz/system.nix b/hosts/algiz/system.nix index a52922f..f028554 100644 --- a/hosts/algiz/system.nix +++ b/hosts/algiz/system.nix @@ -8,9 +8,6 @@ bantime = "24h"; }; - time.timeZone = "America/Chicago"; - - networking.hostName = "algiz"; # # added to make using `pip install` work in docker build # networking.nameservers = [ "8.8.8.8"]; diff --git a/hosts/mannaz/default.nix b/hosts/mannaz/default.nix index 352e401..cdddcf8 100644 --- a/hosts/mannaz/default.nix +++ b/hosts/mannaz/default.nix @@ -1,7 +1,5 @@ -{ self, enabled, ... }: +{ enabled, ... }: { - imports = with self.nixosModules; [ nix-ld ]; - oizys = { desktop = enabled; nix-ld = enabled; diff --git a/hosts/mannaz/system.nix b/hosts/mannaz/system.nix index 5ea6b8e..5669309 100644 --- a/hosts/mannaz/system.nix +++ b/hosts/mannaz/system.nix @@ -59,10 +59,8 @@ package = config.boot.kernelPackages.nvidiaPackages.stable; }; - programs.nix-ld = enabled; services.openssh = enabled; - networking.hostName = "mannaz"; # networking.wireless.enable = true; # networking.networkmanager.enable = true; @@ -71,7 +69,6 @@ 7860 ]; - time.timeZone = "America/Chicago"; security.sudo.wheelNeedsPassword = false; # don't delete this you foo bar diff --git a/hosts/othalan/system.nix b/hosts/othalan/system.nix index 3fa1306..5e7e2a7 100644 --- a/hosts/othalan/system.nix +++ b/hosts/othalan/system.nix @@ -23,9 +23,6 @@ environment.systemPackages = with pkgs; [ pamixer ]; - networking.hostName = "othalan"; - time.timeZone = "US/Central"; - # catppuccin/tty move to "module" boot.kernelParams = [ "vt.default_red=30,243,166,249,137,245,148,186,88,243,166,249,137,245,148,166" diff --git a/lib/default.nix b/lib/default.nix index 2dea12c..2d81989 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -29,18 +29,14 @@ rec { nixosModules = listToAttrs (findModulesList ../modules); mkSystem = - hostname: + hostName: nixosSystem { system = "x86_64-linux"; - modules = - [ - ../modules/oizys.nix - ../overlays - inputs.lix-module.nixosModules.default - ] - ++ filter - isNixFile - (listFilesRecursive (../. + "/hosts/${hostname}")); + modules = [ + ../modules/oizys.nix + ../overlays + inputs.lix-module.nixosModules.default + ] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostName}")); specialArgs = { inherit @@ -50,6 +46,7 @@ rec { mkDefaultOizysModule mkOizysModule enabled + hostName ; }; }; diff --git a/modules/oizys.nix b/modules/oizys.nix index fc4bc90..49cd18d 100644 --- a/modules/oizys.nix +++ b/modules/oizys.nix @@ -1,4 +1,9 @@ -{ lib, self, ... }: +{ + lib, + self, + hostName, + ... +}: let inherit (lib) mkEnableOption; in @@ -35,4 +40,8 @@ in ]; options.oizys.desktop.enable = mkEnableOption "is desktop"; + config = { + networking.hostName = hostName; + time.timeZone = "US/Central"; + }; } diff --git a/modules/runes/default.nix b/modules/runes/default.nix index 4e6ede6..ca129ed 100644 --- a/modules/runes/default.nix +++ b/modules/runes/default.nix @@ -65,7 +65,6 @@ in number = "2"; # todo: autogenerate based on hostname? name = cfg.name; }; - }) ]; }