From 078bc06375d69f3b6e6afd6a80ff3d42cca97750 Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Thu, 19 Mar 2026 10:21:31 +0000 Subject: [PATCH] Working on reshuffling --- Droidnix/README.org | 215 +++++++++--------- Droidnix/flake.nix | 45 +--- Droidnix/generated/hosts/traveldroid/boot.nix | 80 +++++-- .../hosts/traveldroid/traveldroid.nix | 90 ++++---- 4 files changed, 214 insertions(+), 216 deletions(-) diff --git a/Droidnix/README.org b/Droidnix/README.org index 85102d882..01712d0d9 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -101,45 +101,24 @@ The Nix flake definition for Droidnix. }; }; - outputs = inputs@{ - flake-parts, - self, - nixpkgs, - home-manager, - emacs-overlay, - zen-browser, - hyprland, - stylix, - import-tree, - ... - }: + outputs = inputs@{ flake-parts, nixpkgs, home-manager, stylix, ... }: flake-parts.lib.mkFlake { inherit inputs; } { - - # Declare supported systems for flake-parts systems = [ "x86_64-linux" ]; - # Import dendritic/flake modules here - imports = [ - (import-tree ./generated/modules) # Only mySystem.* stuff - ]; - - # Define NixOS configurations for hosts flake = { - nixosConfigurations.traveldroid = - nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + nixosConfigurations.traveldroid = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; - modules = [ - # Host-specific configuration (NixOS context) - ./generated/hosts/traveldroid/traveldroid.nix + modules = [ + # Host module imports all reusable modules internally + ./generated/hosts/traveldroid/traveldroid.nix - # Boot configuration (NixOS context) - ./generated/hosts/traveldroid/boot.nix - - # Stylix NixOS module - stylix.nixosModules.default - ]; - }; + # Optional host-specific things + ./generated/hosts/traveldroid/boot.nix + ./generated/hosts/traveldroid/hardware-configuration.nix + ]; + }; }; }; } @@ -386,97 +365,117 @@ in ** =generated/hosts/traveldroid/boot.nix= #+BEGIN_SRC nix :tangle generated/hosts/traveldroid/boot.nix :noweb tangle :mkdirp yes :eval never-html # ./generated/hosts/traveldroid/traveldroid.nix -{ config, pkgs, lib, ... }: +# ./generated/hosts/traveldroid/traveldroid.nix +{ inputs, ... }: let - coreEnabled = config.mySystem.system.core.enable or false; -in lib.mkIf coreEnabled { - boot = { - initrd = { - verbose = false; - kernelModules = [ ]; + # Import all reusable modules under ./generated/modules + modulesDir = ../../modules; # adjust path relative to this host file + importedModules = builtins.attrValues (import modulesDir { inherit inputs; }); +in +{ + # Define the NixOS configuration for this host + flake.nixosConfigurations.traveldroid = + inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + + modules = [ + inputs.home-manager.nixosModules.home-manager + inputs.stylix.nixosModules.stylix + ] ++ importedModules ++ [ + ./hardware-configuration.nix + + # Host-specific settings + ({ config, ... }: { + networking.hostName = "traveldroid"; + system.stateVersion = "25.11"; + + boot.loader.grub = { + enable = true; + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + + boot.efi.canTouchEfiVariables = true; + + boot.kernelParams = [ + "systemd.mask=dev-tpm0.device" + "systemd.mask=dev-tpmrm0.device" + ]; + + # Optional: TPM/other features + # systemd.tpm2.enable = false; + + # User-defined modules / system features + mySystem = { + system.core.enable = true; + + # Hardware toggles + hardware.nvidia.enable = false; + + # Desktop environment modules + desktop = { + hyprland.enable = true; + noctalia.enable = true; + stylix.enable = true; + }; + }; + }) + ]; }; - - extraModulePackages = [ ]; - kernelPackages = pkgs.linuxPackages_latest; - kernelParams = [ "silent" ]; - - consoleLogLevel = 0; - plymouth.enable = true; - supportedFilesystems = [ "ntfs" ]; - - loader = { - systemd-boot.enable = true; - systemd-boot.configurationLimit = 10; - efi.canTouchEfiVariables = true; - timeout = 5; - }; - }; } #+END_SRC * First the nix-files that flake really needs and that do not fit wel in the hierarchical structure ** =generated/hosts/traveldroid/traveldroid.nix= #+BEGIN_SRC nix :tangle generated/hosts/traveldroid/traveldroid.nix :noweb tangle :mkdirp yes :eval never-html -{ inputs, config, ... }: +{ inputs, ... }: -{ - flake.nixosConfigurations."traveldroid" = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; +inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; - modules = - [ - inputs.home-manager.nixosModules.home-manager - inputs.stylix.nixosModules.stylix - ] ++ - (builtins.attrValues config.flake.nixosModules) ++ - [ - ./hardware-configuration.nix + # Optional: pass inputs to modules + specialArgs = { inherit inputs; }; - ({ ... }: { - networking.hostName = "traveldroid"; - system.stateVersion = "25.11"; + modules = [ + inputs.home-manager.nixosModules.home-manager + ] + ++ builtins.attrValues (import-tree ./generated/modules) + ++ [ + ./hardware-configuration.nix - boot = { - loader = { - grub = { - enable = true; - efiSupport = true; - device = "nodev"; - useOSProber = true; - }; + # Host-specific hardware and system settings + ({ config, lib, ... }: { + networking.hostName = "traveldroid"; + system.stateVersion = "25.11"; - efi.canTouchEfiVariables = true; - }; + boot.loader.grub = { + enable = true; + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + boot.efi.canTouchEfiVariables = true; - # initrd.systemd.tpm2.enable = false; - kernelParams = [ - "systemd.mask=dev-tpm0.device" - "systemd.mask=dev-tpmrm0.device" - ]; - }; - - # systemd.tpm2.enable = false; - - # Enable various user-defined modules - mySystem = { - # Turn on the core system - system.core.enable = true; - - # Hardware-specific modules - hardware.nvidia.enable = false; - - # Define Environment - desktop = { - hyprland.enable = true; - noctalia.enable = true; - stylix.enable = true; - }; - }; - }) + boot.kernelParams = [ + "systemd.mask=dev-tpm0.device" + "systemd.mask=dev-tpmrm0.device" ]; - }; + + # User-defined features + mySystem.system.core.enable = true; + + # Desktop environment features + desktop.hyprland.enable = true; + desktop.noctalia.enable = true; + desktop.stylix.enable = true; + + # Hardware overrides (host-specific) + hardware.nvidia.enable = false; + }) + ]; } #+END_SRC diff --git a/Droidnix/flake.nix b/Droidnix/flake.nix index 71ec339cb..63277c844 100644 --- a/Droidnix/flake.nix +++ b/Droidnix/flake.nix @@ -29,45 +29,24 @@ }; }; - outputs = inputs@{ - flake-parts, - self, - nixpkgs, - home-manager, - emacs-overlay, - zen-browser, - hyprland, - stylix, - import-tree, - ... - }: + outputs = inputs@{ flake-parts, nixpkgs, home-manager, stylix, ... }: flake-parts.lib.mkFlake { inherit inputs; } { - - # Declare supported systems for flake-parts systems = [ "x86_64-linux" ]; - # Import dendritic/flake modules here - imports = [ - (import-tree ./generated/modules) # Only mySystem.* stuff - ]; - - # Define NixOS configurations for hosts flake = { - nixosConfigurations.traveldroid = - nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + nixosConfigurations.traveldroid = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; - modules = [ - # Host-specific configuration (NixOS context) - ./generated/hosts/traveldroid/traveldroid.nix + modules = [ + # Host module imports all reusable modules internally + ./generated/hosts/traveldroid/traveldroid.nix - # Boot configuration (NixOS context) - ./generated/hosts/traveldroid/boot.nix - - # Stylix NixOS module - stylix.nixosModules.default - ]; - }; + # Optional host-specific things + ./generated/hosts/traveldroid/boot.nix + ./generated/hosts/traveldroid/hardware-configuration.nix + ]; + }; }; }; } diff --git a/Droidnix/generated/hosts/traveldroid/boot.nix b/Droidnix/generated/hosts/traveldroid/boot.nix index 74926f7ee..2a0bc81e1 100644 --- a/Droidnix/generated/hosts/traveldroid/boot.nix +++ b/Droidnix/generated/hosts/traveldroid/boot.nix @@ -1,28 +1,62 @@ # ./generated/hosts/traveldroid/traveldroid.nix -{ config, pkgs, lib, ... }: +# ./generated/hosts/traveldroid/traveldroid.nix +{ inputs, ... }: let - coreEnabled = config.mySystem.system.core.enable or false; -in lib.mkIf coreEnabled { - boot = { - initrd = { - verbose = false; - kernelModules = [ ]; + # Import all reusable modules under ./generated/modules + modulesDir = ../../modules; # adjust path relative to this host file + importedModules = builtins.attrValues (import modulesDir { inherit inputs; }); +in +{ + # Define the NixOS configuration for this host + flake.nixosConfigurations.traveldroid = + inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + + modules = [ + inputs.home-manager.nixosModules.home-manager + inputs.stylix.nixosModules.stylix + ] ++ importedModules ++ [ + ./hardware-configuration.nix + + # Host-specific settings + ({ config, ... }: { + networking.hostName = "traveldroid"; + system.stateVersion = "25.11"; + + boot.loader.grub = { + enable = true; + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + + boot.efi.canTouchEfiVariables = true; + + boot.kernelParams = [ + "systemd.mask=dev-tpm0.device" + "systemd.mask=dev-tpmrm0.device" + ]; + + # Optional: TPM/other features + # systemd.tpm2.enable = false; + + # User-defined modules / system features + mySystem = { + system.core.enable = true; + + # Hardware toggles + hardware.nvidia.enable = false; + + # Desktop environment modules + desktop = { + hyprland.enable = true; + noctalia.enable = true; + stylix.enable = true; + }; + }; + }) + ]; }; - - extraModulePackages = [ ]; - kernelPackages = pkgs.linuxPackages_latest; - kernelParams = [ "silent" ]; - - consoleLogLevel = 0; - plymouth.enable = true; - supportedFilesystems = [ "ntfs" ]; - - loader = { - systemd-boot.enable = true; - systemd-boot.configurationLimit = 10; - efi.canTouchEfiVariables = true; - timeout = 5; - }; - }; } diff --git a/Droidnix/generated/hosts/traveldroid/traveldroid.nix b/Droidnix/generated/hosts/traveldroid/traveldroid.nix index 580328b51..a2ade9dfc 100644 --- a/Droidnix/generated/hosts/traveldroid/traveldroid.nix +++ b/Droidnix/generated/hosts/traveldroid/traveldroid.nix @@ -1,60 +1,46 @@ -{ inputs, config, ... }: +{ inputs, ... }: -{ - flake.nixosConfigurations."traveldroid" = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; +inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; - modules = - [ - inputs.home-manager.nixosModules.home-manager - inputs.stylix.nixosModules.stylix - ] ++ - (builtins.attrValues config.flake.nixosModules) ++ - [ - ./hardware-configuration.nix + # Optional: pass inputs to modules + specialArgs = { inherit inputs; }; - ({ ... }: { - networking.hostName = "traveldroid"; - system.stateVersion = "25.11"; + modules = [ + inputs.home-manager.nixosModules.home-manager + ] + ++ builtins.attrValues (import-tree ./generated/modules) + ++ [ + ./hardware-configuration.nix - boot = { - loader = { - grub = { - enable = true; - efiSupport = true; - device = "nodev"; - useOSProber = true; - }; + # Host-specific hardware and system settings + ({ config, lib, ... }: { + networking.hostName = "traveldroid"; + system.stateVersion = "25.11"; - efi.canTouchEfiVariables = true; - }; + boot.loader.grub = { + enable = true; + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + boot.efi.canTouchEfiVariables = true; - # initrd.systemd.tpm2.enable = false; - kernelParams = [ - "systemd.mask=dev-tpm0.device" - "systemd.mask=dev-tpmrm0.device" - ]; - }; - - # systemd.tpm2.enable = false; - - # Enable various user-defined modules - mySystem = { - # Turn on the core system - system.core.enable = true; - - # Hardware-specific modules - hardware.nvidia.enable = false; - - # Define Environment - desktop = { - hyprland.enable = true; - noctalia.enable = true; - stylix.enable = true; - }; - }; - }) + boot.kernelParams = [ + "systemd.mask=dev-tpm0.device" + "systemd.mask=dev-tpmrm0.device" ]; - }; + + # User-defined features + mySystem.system.core.enable = true; + + # Desktop environment features + desktop.hyprland.enable = true; + desktop.noctalia.enable = true; + desktop.stylix.enable = true; + + # Hardware overrides (host-specific) + hardware.nvidia.enable = false; + }) + ]; }