Refactor to pass host vars as arguments

Remove per‑host imports across flake, modules, and profiles, exposing
needed
variables (system, printer settings, consoleKeyMap, etc.) as arguments.
Drop unused printEnable flags from host variable files.
This commit is contained in:
2026-05-24 15:43:18 +02:00
parent 077d8f07e7
commit 98069fa8d9
18 changed files with 53 additions and 75 deletions
+5 -16
View File
@@ -65,25 +65,14 @@
hostDirs = builtins.attrNames (builtins.readDir ./hosts);
mkHost = hostName: let
inherit
(import ./hosts/${hostName}/variables.nix)
host
username
profile
system
;
hostVars = import ./hosts/${hostName}/variables.nix;
hostPrinterVars = import ./hosts/${hostName}/printers.nix;
in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit username;
inherit host;
inherit profile;
inherit system;
};
inherit (hostVars) system;
specialArgs = hostVars // hostPrinterVars // {inherit inputs;};
modules = [
./profiles/${profile}
./profiles/${hostVars.profile}
nix-flatpak.nixosModules.nix-flatpak
garandos-tui.nixosModules.garandos-tui
];
-3
View File
@@ -39,9 +39,6 @@
# Enable NFS
enableNFS = false;
# Enable Printing Support
printEnable = true;
# Set Stylix Image
# This will set your color palette
# Default background
-3
View File
@@ -41,9 +41,6 @@
# Enable NFS
enableNFS = false;
# Enable Printing Support
printEnable = false;
# Themes, waybar and animation.
# Only uncomment your selection
# The others much be commented out.
+2 -4
View File
@@ -2,11 +2,9 @@
pkgs,
lib,
config,
host,
profile,
...
}: let
inherit (import ../../hosts/${host}/variables.nix) profile;
in {
}: {
options.docker.enable = lib.mkEnableOption "Docker";
config.virtualisation.docker = lib.mkIf config.docker.enable {
+2 -3
View File
@@ -1,10 +1,9 @@
{
host,
hostId,
options,
...
}: let
inherit (import ../../hosts/${host}/variables.nix) hostId;
in {
}: {
# Defensive assertion for hostname validity (clearer message at eval time)
assertions = [
{
+1 -3
View File
@@ -1,6 +1,4 @@
{host, ...}: let
inherit (import ../../hosts/${host}/variables.nix) enableNFS;
in {
{enableNFS, ...}: {
services = {
rpcbind.enable = enableNFS;
nfs.server.enable = enableNFS;
+4 -4
View File
@@ -1,11 +1,11 @@
{
pkgs,
lib,
host,
printEnable,
ensureDefaultPrinter,
ensurePrinters,
...
}: let
inherit (import ../../hosts/${host}/printers.nix) printEnable ensureDefaultPrinter ensurePrinters;
in {
}: {
services = lib.mkIf printEnable {
printing = {
enable = true;
+2 -4
View File
@@ -1,10 +1,8 @@
{
pkgs,
host,
stylixImage,
...
}: let
inherit (import ../../hosts/${host}/variables.nix) stylixImage;
in {
}: {
# Styling Options
stylix = {
enable = true;
+2 -4
View File
@@ -1,10 +1,8 @@
{
host,
consoleKeyMap,
inputs,
...
}: let
inherit (import ../../hosts/${host}/variables.nix) consoleKeyMap;
in {
}: {
nix = {
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
settings = {
+13 -3
View File
@@ -5,10 +5,14 @@
host,
profile,
system,
gitUsername,
shell,
extraMonitorSettings,
keyboardLayout,
gitEmail,
location,
...
}: let
inherit (import ../../hosts/${host}/variables.nix) gitUsername shell;
in {
}: {
imports = [inputs.home-manager.nixosModules.home-manager];
home-manager = {
useUserPackages = true;
@@ -21,6 +25,12 @@ in {
host
profile
system
extraMonitorSettings
shell
keyboardLayout
gitEmail
gitUsername
location
;
};
users.${username} = {
+1 -3
View File
@@ -1,6 +1,4 @@
{host, ...}: let
inherit (import ../../hosts/${host}/variables.nix) keyboardLayout;
in {
{keyboardLayout, ...}: {
services.xserver = {
enable = true;
xkb = {
+1 -3
View File
@@ -1,6 +1,4 @@
{host, ...}: let
inherit (import ../../../hosts/${host}/variables.nix) shell;
in {
{shell, ...}: {
programs.bash = {
enable =
if shell == "bash"
+2 -4
View File
@@ -1,10 +1,8 @@
{
pkgs,
host,
shell,
...
}: let
inherit (import ../../../hosts/${host}/variables.nix) shell;
in {
}: {
programs = {
fish = {
enable =
+5 -3
View File
@@ -1,6 +1,8 @@
{host, ...}: let
inherit (import ../../hosts/${host}/variables.nix) gitUsername gitEmail;
in {
{
gitUsername,
gitEmail,
...
}: {
programs.git = {
enable = true;
settings = {
+3 -4
View File
@@ -1,10 +1,9 @@
{
host,
extraMonitorSettings,
keyboardLayout,
pkgs,
...
}: let
inherit (import ../../../hosts/${host}/variables.nix) extraMonitorSettings keyboardLayout;
in {
}: {
systemd.user.targets.hyprland-session.Unit.Wants = [
"xdg-desktop-autostart.target"
];
+2 -4
View File
@@ -1,11 +1,9 @@
{
lib,
host,
keyboardLayout,
username,
...
}: let
inherit (import ../../../../hosts/${host}/variables.nix) keyboardLayout;
in {
}: {
programs.noctalia-shell.settings.general = lib.mkForce {
avatarImage = "/home/${username}/.face.icon";
dimmerOpacity = 0.2;
+2 -4
View File
@@ -1,10 +1,8 @@
{
lib,
host,
location,
...
}: let
inherit (import ../../../../hosts/${host}/variables.nix) location;
in {
}: {
programs.noctalia-shell.settings.location = lib.mkForce {
name = "${location}";
weatherEnabled = true;
+6 -3
View File
@@ -1,6 +1,9 @@
{host, ...}: let
inherit (import ../../hosts/${host}/variables.nix) intelID nvidiaID;
in {
{
host,
intelID,
nvidiaID,
...
}: {
imports = [
../../hosts/${host}
../../modules/drivers