From 704a630a339f04f61904efb075dfd3756d718972 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Thu, 8 May 2025 17:06:03 -0400 Subject: [PATCH] Refactors host config file structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Migrates configuration files from 'common' to 'global' • Updates import paths across modules • Removes outdated macOS configuration • Adds user configuration files WIP --- hosts/common/optional/ventura.nix | 22 ---------------- .../common}/acme/default.nix | 0 .../optional => global/common}/adb.nix | 0 .../optional => global/common}/audio.nix | 0 .../optional => global/common}/bluetooth.nix | 0 .../optional => global/common}/ddcutil.nix | 0 .../optional => global/common}/docker.nix | 0 .../optional => global/common}/gaming.nix | 0 .../optional => global/common}/gnome.nix | 0 .../common}/hyprland/default.nix | 0 .../common}/hyprland/foot.nix | 0 .../common}/hyprland/gnome-services.nix | 0 .../common}/hyprland/greetd.nix | 0 .../common}/hyprland/wayland.nix | 0 .../optional => global/common}/libvirt.nix | 0 .../optional => global/common}/nvtop.nix | 0 .../optional => global/common}/plymouth.nix | 0 .../optional => global/common}/system/lxc.nix | 0 .../common}/system/pool.nix | 0 .../optional => global/common}/vial.nix | 0 hosts/{common => global}/core/default.nix | 0 hosts/{common => global}/core/fonts.nix | 0 hosts/{common => global}/core/gnupg.nix | 0 hosts/{common => global}/core/networking.nix | 0 hosts/{common => global}/core/ssh.nix | 0 hosts/nixos/cloud/default.nix | 6 ++--- hosts/nixos/cloud/hardware.nix | 2 +- hosts/nixos/komodo/default.nix | 6 ++--- hosts/nixos/komodo/hardware.nix | 4 +-- hosts/nixos/lxc/default.nix | 2 +- hosts/nixos/lxc/hardware.nix | 4 +-- hosts/nixos/nix/default.nix | 2 +- hosts/nixos/nix/hardware.nix | 4 +-- hosts/nixos/proxy/default.nix | 6 ++--- hosts/nixos/proxy/hardware.nix | 4 +-- hosts/nixos/rune/default.nix | 26 +++++++++---------- hosts/nixos/rune/hardware.nix | 2 +- hosts/nixos/vm/default.nix | 14 +++++----- hosts/nixos/vm/hardware.nix | 2 +- hosts/readme.md | 10 +++++++ hosts/users/cesar/default.nix | 23 ++++++++++++++++ hosts/users/gio/default.nix | 23 ++++++++++++++++ hosts/users/gio/minimal/default.nix | 23 ++++++++++++++++ hosts/users/toph/default.nix | 4 +-- 44 files changed, 122 insertions(+), 67 deletions(-) delete mode 100644 hosts/common/optional/ventura.nix rename hosts/{common/optional => global/common}/acme/default.nix (100%) rename hosts/{common/optional => global/common}/adb.nix (100%) rename hosts/{common/optional => global/common}/audio.nix (100%) rename hosts/{common/optional => global/common}/bluetooth.nix (100%) rename hosts/{common/optional => global/common}/ddcutil.nix (100%) rename hosts/{common/optional => global/common}/docker.nix (100%) rename hosts/{common/optional => global/common}/gaming.nix (100%) rename hosts/{common/optional => global/common}/gnome.nix (100%) rename hosts/{common/optional => global/common}/hyprland/default.nix (100%) rename hosts/{common/optional => global/common}/hyprland/foot.nix (100%) rename hosts/{common/optional => global/common}/hyprland/gnome-services.nix (100%) rename hosts/{common/optional => global/common}/hyprland/greetd.nix (100%) rename hosts/{common/optional => global/common}/hyprland/wayland.nix (100%) rename hosts/{common/optional => global/common}/libvirt.nix (100%) rename hosts/{common/optional => global/common}/nvtop.nix (100%) rename hosts/{common/optional => global/common}/plymouth.nix (100%) rename hosts/{common/optional => global/common}/system/lxc.nix (100%) rename hosts/{common/optional => global/common}/system/pool.nix (100%) rename hosts/{common/optional => global/common}/vial.nix (100%) rename hosts/{common => global}/core/default.nix (100%) rename hosts/{common => global}/core/fonts.nix (100%) rename hosts/{common => global}/core/gnupg.nix (100%) rename hosts/{common => global}/core/networking.nix (100%) rename hosts/{common => global}/core/ssh.nix (100%) create mode 100644 hosts/readme.md create mode 100644 hosts/users/cesar/default.nix create mode 100644 hosts/users/gio/default.nix create mode 100644 hosts/users/gio/minimal/default.nix diff --git a/hosts/common/optional/ventura.nix b/hosts/common/optional/ventura.nix deleted file mode 100644 index 56e57b5..0000000 --- a/hosts/common/optional/ventura.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - inputs, - pkgs, - ... -}: -{ - imports = [ - inputs.nixtheplanet.nixosModules.macos-ventura - ]; - - services.macos-ventura = { - enable = true; - package = pkgs.makeDarwinImage { diskSizeBytes = 80000000000; }; - openFirewall = true; - vncListenAddr = "0.0.0.0"; - autoStart = false; - extraQemuFlags = [ - "-spice" - "port=5930,addr=127.0.0.1,disable-ticketing" - ]; - }; -} diff --git a/hosts/common/optional/acme/default.nix b/hosts/global/common/acme/default.nix similarity index 100% rename from hosts/common/optional/acme/default.nix rename to hosts/global/common/acme/default.nix diff --git a/hosts/common/optional/adb.nix b/hosts/global/common/adb.nix similarity index 100% rename from hosts/common/optional/adb.nix rename to hosts/global/common/adb.nix diff --git a/hosts/common/optional/audio.nix b/hosts/global/common/audio.nix similarity index 100% rename from hosts/common/optional/audio.nix rename to hosts/global/common/audio.nix diff --git a/hosts/common/optional/bluetooth.nix b/hosts/global/common/bluetooth.nix similarity index 100% rename from hosts/common/optional/bluetooth.nix rename to hosts/global/common/bluetooth.nix diff --git a/hosts/common/optional/ddcutil.nix b/hosts/global/common/ddcutil.nix similarity index 100% rename from hosts/common/optional/ddcutil.nix rename to hosts/global/common/ddcutil.nix diff --git a/hosts/common/optional/docker.nix b/hosts/global/common/docker.nix similarity index 100% rename from hosts/common/optional/docker.nix rename to hosts/global/common/docker.nix diff --git a/hosts/common/optional/gaming.nix b/hosts/global/common/gaming.nix similarity index 100% rename from hosts/common/optional/gaming.nix rename to hosts/global/common/gaming.nix diff --git a/hosts/common/optional/gnome.nix b/hosts/global/common/gnome.nix similarity index 100% rename from hosts/common/optional/gnome.nix rename to hosts/global/common/gnome.nix diff --git a/hosts/common/optional/hyprland/default.nix b/hosts/global/common/hyprland/default.nix similarity index 100% rename from hosts/common/optional/hyprland/default.nix rename to hosts/global/common/hyprland/default.nix diff --git a/hosts/common/optional/hyprland/foot.nix b/hosts/global/common/hyprland/foot.nix similarity index 100% rename from hosts/common/optional/hyprland/foot.nix rename to hosts/global/common/hyprland/foot.nix diff --git a/hosts/common/optional/hyprland/gnome-services.nix b/hosts/global/common/hyprland/gnome-services.nix similarity index 100% rename from hosts/common/optional/hyprland/gnome-services.nix rename to hosts/global/common/hyprland/gnome-services.nix diff --git a/hosts/common/optional/hyprland/greetd.nix b/hosts/global/common/hyprland/greetd.nix similarity index 100% rename from hosts/common/optional/hyprland/greetd.nix rename to hosts/global/common/hyprland/greetd.nix diff --git a/hosts/common/optional/hyprland/wayland.nix b/hosts/global/common/hyprland/wayland.nix similarity index 100% rename from hosts/common/optional/hyprland/wayland.nix rename to hosts/global/common/hyprland/wayland.nix diff --git a/hosts/common/optional/libvirt.nix b/hosts/global/common/libvirt.nix similarity index 100% rename from hosts/common/optional/libvirt.nix rename to hosts/global/common/libvirt.nix diff --git a/hosts/common/optional/nvtop.nix b/hosts/global/common/nvtop.nix similarity index 100% rename from hosts/common/optional/nvtop.nix rename to hosts/global/common/nvtop.nix diff --git a/hosts/common/optional/plymouth.nix b/hosts/global/common/plymouth.nix similarity index 100% rename from hosts/common/optional/plymouth.nix rename to hosts/global/common/plymouth.nix diff --git a/hosts/common/optional/system/lxc.nix b/hosts/global/common/system/lxc.nix similarity index 100% rename from hosts/common/optional/system/lxc.nix rename to hosts/global/common/system/lxc.nix diff --git a/hosts/common/optional/system/pool.nix b/hosts/global/common/system/pool.nix similarity index 100% rename from hosts/common/optional/system/pool.nix rename to hosts/global/common/system/pool.nix diff --git a/hosts/common/optional/vial.nix b/hosts/global/common/vial.nix similarity index 100% rename from hosts/common/optional/vial.nix rename to hosts/global/common/vial.nix diff --git a/hosts/common/core/default.nix b/hosts/global/core/default.nix similarity index 100% rename from hosts/common/core/default.nix rename to hosts/global/core/default.nix diff --git a/hosts/common/core/fonts.nix b/hosts/global/core/fonts.nix similarity index 100% rename from hosts/common/core/fonts.nix rename to hosts/global/core/fonts.nix diff --git a/hosts/common/core/gnupg.nix b/hosts/global/core/gnupg.nix similarity index 100% rename from hosts/common/core/gnupg.nix rename to hosts/global/core/gnupg.nix diff --git a/hosts/common/core/networking.nix b/hosts/global/core/networking.nix similarity index 100% rename from hosts/common/core/networking.nix rename to hosts/global/core/networking.nix diff --git a/hosts/common/core/ssh.nix b/hosts/global/core/ssh.nix similarity index 100% rename from hosts/common/core/ssh.nix rename to hosts/global/core/ssh.nix diff --git a/hosts/nixos/cloud/default.nix b/hosts/nixos/cloud/default.nix index 4b4055a..f7d7407 100644 --- a/hosts/nixos/cloud/default.nix +++ b/hosts/nixos/cloud/default.nix @@ -27,11 +27,11 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Optional Configs ## - "hosts/common/optional/acme" - "hosts/common/optional/docker.nix" + "hosts/global/common/acme" + "hosts/global/common/docker.nix" ## Host user ## "hosts/users/${username}" # Not the best solution but I always have one user so ¯\_(ツ)_/¯ diff --git a/hosts/nixos/cloud/hardware.nix b/hosts/nixos/cloud/hardware.nix index 2a56fdb..8df97f2 100644 --- a/hosts/nixos/cloud/hardware.nix +++ b/hosts/nixos/cloud/hardware.nix @@ -10,7 +10,7 @@ in { imports = lib.flatten [ (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/lxc.nix" + "hosts/global/common/system/lxc.nix" ]) ]; diff --git a/hosts/nixos/komodo/default.nix b/hosts/nixos/komodo/default.nix index 14dc693..342cbfb 100644 --- a/hosts/nixos/komodo/default.nix +++ b/hosts/nixos/komodo/default.nix @@ -26,11 +26,11 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Optional Configs ## - "hosts/common/optional/acme" - "hosts/common/optional/docker.nix" + "hosts/global/common/acme" + "hosts/global/common/docker.nix" ## Host User ## "hosts/users/${username}" # # Not the best solution but I always have one user so ¯\_(ツ)_/¯ diff --git a/hosts/nixos/komodo/hardware.nix b/hosts/nixos/komodo/hardware.nix index f0e401e..2390f31 100644 --- a/hosts/nixos/komodo/hardware.nix +++ b/hosts/nixos/komodo/hardware.nix @@ -5,8 +5,8 @@ { imports = lib.flatten [ (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/lxc.nix" - "hosts/common/optional/system/pool.nix" + "hosts/global/common/system/lxc.nix" + "hosts/global/common/system/pool.nix" ]) ]; } diff --git a/hosts/nixos/lxc/default.nix b/hosts/nixos/lxc/default.nix index 671011f..c09c16d 100644 --- a/hosts/nixos/lxc/default.nix +++ b/hosts/nixos/lxc/default.nix @@ -25,7 +25,7 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Proxy Specific ## "hosts/users/${username}" # # Not the best solution but I always have one user so ¯\_(ツ)_/¯ diff --git a/hosts/nixos/lxc/hardware.nix b/hosts/nixos/lxc/hardware.nix index f0e401e..2390f31 100644 --- a/hosts/nixos/lxc/hardware.nix +++ b/hosts/nixos/lxc/hardware.nix @@ -5,8 +5,8 @@ { imports = lib.flatten [ (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/lxc.nix" - "hosts/common/optional/system/pool.nix" + "hosts/global/common/system/lxc.nix" + "hosts/global/common/system/pool.nix" ]) ]; } diff --git a/hosts/nixos/nix/default.nix b/hosts/nixos/nix/default.nix index 984d2bf..5422c33 100644 --- a/hosts/nixos/nix/default.nix +++ b/hosts/nixos/nix/default.nix @@ -25,7 +25,7 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Optional Configs ## diff --git a/hosts/nixos/nix/hardware.nix b/hosts/nixos/nix/hardware.nix index f0e401e..2390f31 100644 --- a/hosts/nixos/nix/hardware.nix +++ b/hosts/nixos/nix/hardware.nix @@ -5,8 +5,8 @@ { imports = lib.flatten [ (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/lxc.nix" - "hosts/common/optional/system/pool.nix" + "hosts/global/common/system/lxc.nix" + "hosts/global/common/system/pool.nix" ]) ]; } diff --git a/hosts/nixos/proxy/default.nix b/hosts/nixos/proxy/default.nix index 60722e9..1ede06b 100644 --- a/hosts/nixos/proxy/default.nix +++ b/hosts/nixos/proxy/default.nix @@ -27,11 +27,11 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Optional Configs ## - "hosts/common/optional/acme" - "hosts/common/optional/docker.nix" + "hosts/global/common/acme" + "hosts/global/common/docker.nix" ## Proxy User ## "hosts/users/${username}" # # Not the best solution but I always have one user so ¯\_(ツ)_/¯ diff --git a/hosts/nixos/proxy/hardware.nix b/hosts/nixos/proxy/hardware.nix index f0e401e..2390f31 100644 --- a/hosts/nixos/proxy/hardware.nix +++ b/hosts/nixos/proxy/hardware.nix @@ -5,8 +5,8 @@ { imports = lib.flatten [ (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/lxc.nix" - "hosts/common/optional/system/pool.nix" + "hosts/global/common/system/lxc.nix" + "hosts/global/common/system/pool.nix" ]) ]; } diff --git a/hosts/nixos/rune/default.nix b/hosts/nixos/rune/default.nix index 2026afb..fffcfa4 100644 --- a/hosts/nixos/rune/default.nix +++ b/hosts/nixos/rune/default.nix @@ -27,21 +27,21 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Optional Configs ## - "hosts/common/optional/audio.nix" # pipewire and cli controls - "hosts/common/optional/adb.nix" # android tools - "hosts/common/optional/bluetooth.nix" - "hosts/common/optional/ddcutil.nix" # ddcutil for monitor controls - "hosts/common/optional/gaming.nix" # steam, gamescope, gamemode, and related hardware - # "hosts/common/optional/gnome.nix" # desktop - "hosts/common/optional/hyprland" # desktop - "hosts/common/optional/libvirt.nix" # vm tools - "hosts/common/optional/nvtop.nix" # GPU monitor (not available in home-manager) - "hosts/common/optional/plymouth.nix" # fancy boot screen - "hosts/common/optional/vial.nix" # KB setup - # "hosts/common/optional/ventura.nix" # macos vm + "hosts/global/common/audio.nix" # pipewire and cli controls + "hosts/global/common/adb.nix" # android tools + "hosts/global/common/bluetooth.nix" + "hosts/global/common/ddcutil.nix" # ddcutil for monitor controls + "hosts/global/common/gaming.nix" # steam, gamescope, gamemode, and related hardware + # "hosts/global/common/gnome.nix" # desktop + "hosts/global/common/hyprland" # desktop + "hosts/global/common/libvirt.nix" # vm tools + "hosts/global/common/nvtop.nix" # GPU monitor (not available in home-manager) + "hosts/global/common/plymouth.nix" # fancy boot screen + "hosts/global/common/vial.nix" # KB setup + # "hosts/global/common/ventura.nix" # macos vm ## Misc Inputs ## diff --git a/hosts/nixos/rune/hardware.nix b/hosts/nixos/rune/hardware.nix index dc782cb..66edc35 100644 --- a/hosts/nixos/rune/hardware.nix +++ b/hosts/nixos/rune/hardware.nix @@ -14,7 +14,7 @@ imports = lib.flatten [ (modulesPath + "/installer/scan/not-detected.nix") (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/pool.nix" + "hosts/global/common/system/pool.nix" ]) ]; diff --git a/hosts/nixos/vm/default.nix b/hosts/nixos/vm/default.nix index e2dcd0f..22f522e 100644 --- a/hosts/nixos/vm/default.nix +++ b/hosts/nixos/vm/default.nix @@ -24,15 +24,15 @@ in (map lib.custom.relativeToRoot [ ## Required Configs ## - "hosts/common/core" + "hosts/global/core" ## Optional Configs ## - "hosts/common/optional/audio.nix" # pipewire and cli controls - # "hosts/common/optional/gaming.nix" # steam, gamescope, gamemode, and related hardware - # "hosts/common/optional/gnome.nix" # desktop - "hosts/common/optional/hyprland" # desktop - # "hosts/common/optional/nvtop.nix" # GPU monitor (not available in home-manager) - # "hosts/common/optional/plymouth.nix" # fancy boot screen + "hosts/global/common/audio.nix" # pipewire and cli controls + # "hosts/global/common/gaming.nix" # steam, gamescope, gamemode, and related hardware + # "hosts/global/common/gnome.nix" # desktop + "hosts/global/common/hyprland" # desktop + # "hosts/global/common/nvtop.nix" # GPU monitor (not available in home-manager) + # "hosts/global/common/plymouth.nix" # fancy boot screen ## Misc Inputs ## diff --git a/hosts/nixos/vm/hardware.nix b/hosts/nixos/vm/hardware.nix index 9cd389e..ada9434 100644 --- a/hosts/nixos/vm/hardware.nix +++ b/hosts/nixos/vm/hardware.nix @@ -12,7 +12,7 @@ in imports = lib.flatten [ (modulesPath + "/profiles/qemu-guest.nix") (map lib.custom.relativeToRoot [ - "hosts/common/optional/system/pool.nix" + "hosts/global/common/system/pool.nix" ]) ]; diff --git a/hosts/readme.md b/hosts/readme.md new file mode 100644 index 0000000..8f90b13 --- /dev/null +++ b/hosts/readme.md @@ -0,0 +1,10 @@ +# TODO: + +- I dont like the current system for hosts importing their main user + - I could rework hostSpecs so its imported since flake and manage it like that? + - or just rework the users/default and the hosts/core to just work different... +- Fix up how DEs are configured, its not modular at all rn, i need to be able to select the DE from hostSpec and it should be able to change config per user +- decouple /pool from places its not needed, or should be optional + - some users should not have access to pool or just cant access it cuz not local +- ssh keys are not setup per user + - should probably fix \ No newline at end of file diff --git a/hosts/users/cesar/default.nix b/hosts/users/cesar/default.nix new file mode 100644 index 0000000..ee6b010 --- /dev/null +++ b/hosts/users/cesar/default.nix @@ -0,0 +1,23 @@ +{ config, ... }: +let + hostSpec = config.hostSpec; +in +{ + + users.groups = { + ryot = { + gid = 1004; + members = [ "${hostSpec.username}" ]; + }; + }; + + # Set a temp password for use by minimal builds like installer and iso + users.users.${hostSpec.username} = { + isNormalUser = true; + hashedPassword = hostSpec.hashedPassword; + group = "ryot"; + extraGroups = [ + "wheel" + ]; + }; +} diff --git a/hosts/users/gio/default.nix b/hosts/users/gio/default.nix new file mode 100644 index 0000000..ee6b010 --- /dev/null +++ b/hosts/users/gio/default.nix @@ -0,0 +1,23 @@ +{ config, ... }: +let + hostSpec = config.hostSpec; +in +{ + + users.groups = { + ryot = { + gid = 1004; + members = [ "${hostSpec.username}" ]; + }; + }; + + # Set a temp password for use by minimal builds like installer and iso + users.users.${hostSpec.username} = { + isNormalUser = true; + hashedPassword = hostSpec.hashedPassword; + group = "ryot"; + extraGroups = [ + "wheel" + ]; + }; +} diff --git a/hosts/users/gio/minimal/default.nix b/hosts/users/gio/minimal/default.nix new file mode 100644 index 0000000..ee6b010 --- /dev/null +++ b/hosts/users/gio/minimal/default.nix @@ -0,0 +1,23 @@ +{ config, ... }: +let + hostSpec = config.hostSpec; +in +{ + + users.groups = { + ryot = { + gid = 1004; + members = [ "${hostSpec.username}" ]; + }; + }; + + # Set a temp password for use by minimal builds like installer and iso + users.users.${hostSpec.username} = { + isNormalUser = true; + hashedPassword = hostSpec.hashedPassword; + group = "ryot"; + extraGroups = [ + "wheel" + ]; + }; +} diff --git a/hosts/users/toph/default.nix b/hosts/users/toph/default.nix index 15e26b9..938f861 100644 --- a/hosts/users/toph/default.nix +++ b/hosts/users/toph/default.nix @@ -16,12 +16,11 @@ in users.users.${username} = { name = hostSpec.username; shell = _shell; - # These get placed into /etc/ssh/authorized_keys.d/ on nixos openssh.authorizedKeys.keys = pubKeys; }; - # Create ssh sockets directory for controlpaths when homemanager not loaded (i.e. isMinimal) + # Create ssh directory when homemanager is not loaded systemd.tmpfiles.rules = let user = config.users.users.${username}.name; @@ -31,7 +30,6 @@ in "d ${homeDir}/.ssh 0750 ${user} ${group} -" ]; - # No matter what environment we are in we want these tools programs.fish.enable = true; } # Import the user's personal/home configurations, unless the environment is minimal