Restructure modules/shared and update all imports

- Rename modules/hosts/common to modules/shared
- Split shared into home/general, home/linux, and nixos subdirectories
- Update all import paths in lib/ and modules/hosts/
- Fix hardcoded /Users/ path to use config.home.homeDirectory
- Update .sops.yaml path for secrets
This commit is contained in:
Gene Liverman 2026-03-14 00:10:30 -04:00
parent 14fbadd9aa
commit 5047d93b86
No known key found for this signature in database
77 changed files with 44 additions and 359 deletions

View file

@ -60,7 +60,7 @@ creation_rules:
key_groups: key_groups:
- age: - age:
- *system_rainbow_planet - *system_rainbow_planet
- path_regex: modules/hosts/common/secrets.yaml$ - path_regex: modules/shared/secrets.yaml$
key_groups: key_groups:
- age: - age:
- *system_bigboy - *system_bigboy

View file

@ -1,2 +0,0 @@
result/
result

View file

@ -1,25 +0,0 @@
{ inputs, pkgs, ... }: {
imports = [
./hardware-configuration.nix
];
system.stateVersion = "23.05";
boot = {
initrd.systemd = {
enable = true;
network.wait-online.enable = false; # Handled by NetworkManager
};
loader = {
efi.canTouchEfiVariables = true;
systemd-boot= {
enable = true;
consoleMode = "1";
};
};
};
environment.systemPackages = with pkgs; [
olm
];
}

View file

@ -1,183 +0,0 @@
{
"nodes": {
"config": {
"locked": {
"dir": "templates/config",
"lastModified": 1719931926,
"narHash": "sha256-B8j9lHX0LqWlZkm8JxZRN6919RQjJEu/1J1SR8pU/ww=",
"owner": "stackbuilders",
"repo": "nixpkgs-terraform",
"rev": "034287ee462c87dadc14a94d4b53a48ed66c7b3d",
"type": "github"
},
"original": {
"dir": "templates/config",
"owner": "stackbuilders",
"repo": "nixpkgs-terraform",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733050161,
"narHash": "sha256-lYnT+EYE47f5yY3KS/Kd4pJ6CO9fhCqumkYYkQ3TK20=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "62d536255879be574ebfe9b87c4ac194febf47c5",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1733120037,
"narHash": "sha256-En+gSoVJ3iQKPDU1FHrR6zIxSLXKjzKY+pnh9tt+Yts=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f9f0d5c5380be0a599b1fb54641fa99af8281539",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-1_0": {
"locked": {
"lastModified": 1699291058,
"narHash": "sha256-5ggduoaAMPHUy4riL+OrlAZE14Kh7JWX4oLEs22ZqfU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "41de143fda10e33be0f47eab2bfe08a50f234267",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "41de143fda10e33be0f47eab2bfe08a50f234267",
"type": "github"
}
},
"nixpkgs-1_6": {
"locked": {
"lastModified": 1712757991,
"narHash": "sha256-kR7C7Fqt3JP40h0mzmSZeWI5pk1iwqj4CSeGjnUbVHc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d6b3ddd253c578a7ab98f8011e59990f21dc3932",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d6b3ddd253c578a7ab98f8011e59990f21dc3932",
"type": "github"
}
},
"nixpkgs-1_9": {
"locked": {
"lastModified": 1732617236,
"narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1722555339,
"narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
}
},
"nixpkgs-terraform": {
"inputs": {
"config": "config",
"flake-parts": "flake-parts",
"nixpkgs-1_0": "nixpkgs-1_0",
"nixpkgs-1_6": "nixpkgs-1_6",
"nixpkgs-1_9": "nixpkgs-1_9",
"systems": "systems"
},
"locked": {
"lastModified": 1732844581,
"narHash": "sha256-BwHD1d6Bl5LL/HciTf+mQmBN3I3S6nYqcB+5BXVozNk=",
"owner": "stackbuilders",
"repo": "nixpkgs-terraform",
"rev": "b4db1b59d8f62cd37b6f9540e368d0e2627c4a2d",
"type": "github"
},
"original": {
"owner": "stackbuilders",
"repo": "nixpkgs-terraform",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-terraform": "nixpkgs-terraform"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,30 +0,0 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-terraform = {
url = "github:stackbuilders/nixpkgs-terraform";
# inputs.nixpkgs-1_6.follows = "nixpkgs";
# inputs.nixpkgs-1_9.follows = "nixpkgs-unstable";
};
};
outputs = inputs: {
nixosConfigurations = {
rainbow-planet = inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [
./configuration.nix
./nixpkgs-settings.nix
inputs.home-manager.nixosModules.home-manager
];
};
};
};
}

View file

@ -1,44 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.kernelParams = [
"i915.enable_fbc=1"
"i915.enable_psr=2"
];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/eb9a2c7e-ae61-4d06-9464-49b98d576f7c";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/924D-E7A4";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/166d24ca-401c-492e-845d-bb1d0d6d7d86"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,9 +0,0 @@
{ inputs, ... }: {
nixpkgs = {
config = {
allowUnfree = true;
permittedInsecurePackages = [ "olm-3.2.16" "electron-27.3.11" ];
};
overlays = [ inputs.nixpkgs-terraform.overlays.default ];
};
}

View file

@ -87,28 +87,6 @@
# Functions that setup systems # Functions that setup systems
localLib = import ./lib { inherit inputs; }; localLib = import ./lib { inherit inputs; };
linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: inputs.home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = { inherit inputs hostname username;
pkgs = import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [ "olm-3.2.16" "electron-21.4.4" ];
};
};
} // additionalSpecialArgs;
modules = [
./modules/home-manager/hosts/${hostname}/${username}.nix
{
home = {
username = "${username}";
homeDirectory = "/home/${username}";
};
}
inputs.sops-nix.homeManagerModules.sops
] ++ additionalModules;
}; # end homeManagerConfiguration
in { in {
# Darwin (macOS) hosts # Darwin (macOS) hosts
darwinConfigurations = { darwinConfigurations = {

View file

@ -26,8 +26,8 @@
useUserPackages = true; useUserPackages = true;
users.${username}.imports = [ users.${username}.imports = [
inputs.sops-nix.homeManagerModule # user-level secrets management inputs.sops-nix.homeManagerModule # user-level secrets management
../modules/hosts/common ../modules/shared/home/general
../modules/hosts/common/all-gui.nix ../modules/shared/home/general/all-gui.nix
../modules/hosts/darwin/home.nix ../modules/hosts/darwin/home.nix
../modules/hosts/darwin/${hostname}/home-${username}.nix ../modules/hosts/darwin/${hostname}/home-${username}.nix
]; ];

View file

@ -12,7 +12,7 @@
# the path to your home.nix. # the path to your home.nix.
modules = [ modules = [
./nixpkgs-settings.nix ./nixpkgs-settings.nix
../modules/hosts/common ../modules/shared/home/general
../modules/hosts/home-manager-only ../modules/hosts/home-manager-only
../modules/hosts/home-manager-only/home-${username}.nix ../modules/hosts/home-manager-only/home-${username}.nix

View file

@ -19,8 +19,8 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users.${username}.imports = [ users.${username}.imports = [
../modules/hosts/common ../modules/shared/home/general
../modules/hosts/common/linux/home.nix ../modules/shared/home/linux
../modules/hosts/nixos/${hostname}/home-${username}.nix ../modules/hosts/nixos/${hostname}/home-${username}.nix
]; ];
}; };

View file

@ -10,8 +10,8 @@
{ {
imports = [ # Include the results of the hardware scan. imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
../../common/linux/flatpaks.nix ../../../shared/nixos/flatpaks.nix
../../common/linux/ripping.nix ../../../shared/nixos/ripping.nix
]; ];
system.stateVersion = "24.11"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?

View file

@ -1,9 +1,9 @@
{ ... }: { { ... }: {
home.stateVersion = "24.05"; home.stateVersion = "24.05";
imports = [ imports = [
../../common/all-gui.nix ../../../shared/home/general/all-gui.nix
../../common/linux/apps/tilix.nix ../../../shared/home/linux/apps/tilix.nix
../../common/linux/apps/xfce4-terminal.nix ../../../shared/home/linux/apps/xfce4-terminal.nix
]; ];
programs = { programs = {

View file

@ -1,6 +1,6 @@
{ hostname, pkgs, username, ... }: { { hostname, pkgs, username, ... }: {
imports = [ imports = [
../common/linux/internationalisation.nix ../shared/nixos/internationalisation.nix
]; ];
environment = { environment = {

View file

@ -1,6 +1,6 @@
{ inputs, pkgs, username, ... }: { { inputs, pkgs, username, ... }: {
imports = [ imports = [
../../common/linux/nixroutes.nix ../../../shared/nixos/nixroutes.nix
./disk-config.nix ./disk-config.nix
./hardware-configuration.nix ./hardware-configuration.nix
./post-install ./post-install

View file

@ -3,8 +3,8 @@
restic_backup_time = "01:00"; restic_backup_time = "01:00";
in { in {
imports = [ imports = [
../../../common/linux/lets-encrypt.nix ../../../../shared/nixos/lets-encrypt.nix
../../../common/linux/restic.nix ../../../../shared/nixos/restic.nix
./containers/emqx.nix ./containers/emqx.nix
./matrix-synapse.nix ./matrix-synapse.nix
./monitoring.nix ./monitoring.nix

View file

@ -120,7 +120,7 @@ in {
vmagent_push_pw = { vmagent_push_pw = {
owner = "vmagent"; owner = "vmagent";
restartUnits = ["vmagent.service"]; restartUnits = ["vmagent.service"];
sopsFile = ../../../common/secrets.yaml; sopsFile = ../../../../shared/secrets.yaml;
}; };
}; };
}; };

View file

@ -1,6 +1,6 @@
{ inputs, pkgs, username, ... }: { { inputs, pkgs, username, ... }: {
imports = [ imports = [
../../common/linux/nixroutes.nix ../../../shared/nixos/nixroutes.nix
./disk-config.nix ./disk-config.nix
./hardware-configuration.nix ./hardware-configuration.nix
./post-install ./post-install

View file

@ -1,6 +1,6 @@
{ config, username, ... }: { { config, username, ... }: {
imports = [ imports = [
../../../common/linux/lets-encrypt.nix ../../../../shared/nixos/lets-encrypt.nix
./monitoring.nix ./monitoring.nix
./nginx.nix ./nginx.nix
]; ];

View file

@ -120,7 +120,7 @@ in {
vmagent_push_pw = { vmagent_push_pw = {
owner = "vmagent"; owner = "vmagent";
restartUnits = ["vmagent.service"]; restartUnits = ["vmagent.service"];
sopsFile = ../../../common/secrets.yaml; sopsFile = ../../../../shared/secrets.yaml;
}; };
}; };
}; };

View file

@ -97,7 +97,7 @@
path = "${config.users.users.${username}.home}/.private-env"; path = "${config.users.users.${username}.home}/.private-env";
}; };
wifi_creds = { wifi_creds = {
sopsFile = ../../common/secrets.yaml; sopsFile = ../../../shared/secrets.yaml;
restartUnits = [ restartUnits = [
"wpa_supplicant.service" "wpa_supplicant.service"
]; ];

View file

@ -120,7 +120,7 @@ in {
vmagent_push_pw = { vmagent_push_pw = {
owner = "vmagent"; owner = "vmagent";
restartUnits = ["vmagent.service"]; restartUnits = ["vmagent.service"];
sopsFile = ../../../common/secrets.yaml; sopsFile = ../../../../shared/secrets.yaml;
}; };
}; };
}; };

View file

@ -90,7 +90,7 @@
path = "${config.users.users.${username}.home}/.private-env"; path = "${config.users.users.${username}.home}/.private-env";
}; };
wifi_creds = { wifi_creds = {
sopsFile = ../../common/secrets.yaml; sopsFile = ../../../shared/secrets.yaml;
restartUnits = [ restartUnits = [
"wpa_supplicant.service" "wpa_supplicant.service"
]; ];

View file

@ -2,7 +2,7 @@
imports = [ imports = [
./disk-config.nix ./disk-config.nix
./hardware-configuration.nix ./hardware-configuration.nix
../../../system/common/linux/restic.nix ../../../shared/nixos/restic.nix
]; ];
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View file

@ -11,8 +11,8 @@ in {
./containers/mountain-mesh-bot-discord.nix ./containers/mountain-mesh-bot-discord.nix
./containers/psitransfer.nix ./containers/psitransfer.nix
./monitoring-stack.nix ./monitoring-stack.nix
../../common/linux/lets-encrypt.nix ../../../shared/nixos/lets-encrypt.nix
../../common/linux/restic.nix ../../../shared/nixos/restic.nix
]; ];
system.stateVersion = "23.11"; system.stateVersion = "23.11";

View file

@ -363,7 +363,7 @@ in {
uptimekuma_grafana_api_key = { uptimekuma_grafana_api_key = {
owner = "vmagent"; owner = "vmagent";
restartUnits = ["vmagent.service"]; restartUnits = ["vmagent.service"];
sopsFile = ../../common/secrets.yaml; sopsFile = ../../../shared/secrets.yaml;
}; };
}; };
}; };

View file

@ -1,8 +1,8 @@
{ inputs, config, pkgs, username, ... }: { { inputs, config, pkgs, username, ... }: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../common/linux/flatpaks.nix ../../../shared/nixos/flatpaks.nix
../../common/linux/ripping.nix ../../../shared/nixos/ripping.nix
]; ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";

View file

@ -1,12 +1,12 @@
{ pkgs, ... }: { { pkgs, ... }: {
home.stateVersion = "23.11"; home.stateVersion = "23.11";
imports = [ imports = [
../../common/all-gui.nix ../../../shared/home/general/all-gui.nix
../../common/linux/apps/hexchat.nix ../../../shared/home/linux/apps/hexchat.nix
../../common/linux/apps/pidgin.nix ../../../shared/home/linux/apps/pidgin.nix
../../common/linux/apps/tilix.nix ../../../shared/home/linux/apps/tilix.nix
../../common/linux/apps/waybar.nix ../../../shared/home/linux/apps/waybar.nix
../../common/linux/apps/xfce4-terminal.nix ../../../shared/home/linux/apps/xfce4-terminal.nix
]; ];
home.file = { home.file = {

View file

@ -1,4 +1,4 @@
{ inputs, pkgs, username, ... }: let { config, inputs, pkgs, ... }: let
sqlite_lib = if builtins.elem pkgs.stdenv.hostPlatform.system [ sqlite_lib = if builtins.elem pkgs.stdenv.hostPlatform.system [
"aarch64-darwin" "aarch64-darwin"
"x86_64-darwin" "x86_64-darwin"
@ -166,7 +166,7 @@ in {
}; };
nh = { nh = {
enable = true; enable = true;
flake = "/Users/${username}/repos/dots"; flake = "${config.home.homeDirectory}/repos/dots";
}; };
oh-my-posh = { oh-my-posh = {
enable = true; enable = true;
@ -353,14 +353,14 @@ in {
home.file = { home.file = {
".config/nvim/lua/config" = { ".config/nvim/lua/config" = {
source = ./files/nvim/lua/config; source = ../../files/nvim/lua/config;
recursive = true; recursive = true;
}; };
".config/nvim/lua/plugins" = { ".config/nvim/lua/plugins" = {
source = ./files/nvim/lua/plugins; source = ../../files/nvim/lua/plugins;
recursive = true; recursive = true;
}; };
".config/powershell/Microsoft.PowerShell_profile.ps1".source = ./files/Microsoft.PowerShell_profile.ps1; ".config/powershell/Microsoft.PowerShell_profile.ps1".source = ../../files/Microsoft.PowerShell_profile.ps1;
".config/powershell/Microsoft.VSCode_profile.ps1".source = ./files/Microsoft.PowerShell_profile.ps1; ".config/powershell/Microsoft.VSCode_profile.ps1".source = ../../files/Microsoft.PowerShell_profile.ps1;
}; };
} }

View file

@ -19,7 +19,7 @@
}; };
home.file = { home.file = {
".config/tilix/schemes/Beanbag-Mathias.json".source = ../../files/tilix/Beanbag-Mathias.json; ".config/tilix/schemes/Beanbag-Mathias.json".source = ../../../files/tilix/Beanbag-Mathias.json;
".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub { ".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub {
owner = "catppuccin"; owner = "catppuccin";
repo = "tilix"; repo = "tilix";

View file

@ -1,13 +1,13 @@
{ pkgs, ... }: { { pkgs, ... }: {
home.file = { home.file = {
".config/waybar/config".source = ../../files/waybar/config; ".config/waybar/config".source = ../../../files/waybar/config;
".config/waybar/frappe.css".source = (pkgs.fetchFromGitHub { ".config/waybar/frappe.css".source = (pkgs.fetchFromGitHub {
owner = "catppuccin"; owner = "catppuccin";
repo = "waybar"; repo = "waybar";
rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff";
hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8=";
} + "/themes/frappe.css"); } + "/themes/frappe.css");
".config/waybar/style.css".source = ../../files/waybar/style.css; ".config/waybar/style.css".source = ../../../files/waybar/style.css;
}; };
programs = { programs = {

View file

@ -1,6 +1,6 @@
{ ... }: { { ... }: {
home.file = { home.file = {
".config/xfce4/terminal/accels.scm".source = ../../files/xfce4/terminal/accels.scm; ".config/xfce4/terminal/accels.scm".source = ../../../files/xfce4/terminal/accels.scm;
}; };
xfconf.settings = { xfconf.settings = {