diff --git a/config/nixos/core/home-manager.nix b/config/nixos/core/home-manager.nix deleted file mode 100644 index f7bfbf6..0000000 --- a/config/nixos/core/home-manager.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - config, - inputs, - ... -}: let - inherit (config.local.systemVars) username; -in { - imports = [ - inputs.home-manager.nixosModules.default - ]; - - home-manager = { - backupFileExtension = "backup"; - useGlobalPkgs = true; - useUserPackages = true; - }; - - home-manager.users.${username} = { - home = { - homeDirectory = "/home/${username}"; - stateVersion = "24.05"; - }; - - programs.home-manager.enable = true; - }; - - programs = { - # make HM-managed GTK stuff work - dconf.enable = true; - }; -} diff --git a/config/nixos/core/lanzaboote.nix b/config/nixos/core/lanzaboote.nix deleted file mode 100644 index d6cc73d..0000000 --- a/config/nixos/core/lanzaboote.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - pkgs, - lib, - inputs, - ... -}: { - imports = [ - inputs.lanzaboote.nixosModules.lanzaboote - ]; - - environment.systemPackages = [ - # For debugging and troubleshooting Secure Boot. - pkgs.sbctl - ]; - - # Lanzaboote currently replaces the systemd-boot module. - # This setting is usually set to true in configuration.nix - # generated at installation time. So we force it to false - # for now. - boot.loader.systemd-boot.enable = lib.mkForce false; - - boot.lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; -} diff --git a/config/nixos/core/networking.nix b/config/nixos/core/networking.nix deleted file mode 100644 index 3e48d2f..0000000 --- a/config/nixos/core/networking.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - networking.nameservers = ["1.1.1.1" "1.0.0.1"]; -} diff --git a/config/nixos/core/users.nix b/config/nixos/core/users.nix deleted file mode 100644 index 8f9f138..0000000 --- a/config/nixos/core/users.nix +++ /dev/null @@ -1,13 +0,0 @@ -{config, ...}: { - users.users.${config.local.systemVars.username} = { - isNormalUser = true; - description = config.local.homeVars.fullName or "User"; - extraGroups = [ - "networkmanager" - "audio" - "video" - "wheel" - "plugdev" - ]; - }; -} diff --git a/config/nixos/default.nix b/config/nixos/default.nix index 48a6962..8b85f66 100644 --- a/config/nixos/default.nix +++ b/config/nixos/default.nix @@ -1,6 +1,5 @@ { imports = [ - ./core ./nix ./hardware/printing.nix diff --git a/hosts/default.nix b/hosts/default.nix index 6ef58aa..9c38fb2 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -13,7 +13,6 @@ base = [ ../modules "${self}/config/nixos" - "${self}/config/nixos/core/home-manager.nix" "${self}/config/nixos/services/documentation.nix" diff --git a/config/nixos/core/boot.nix b/modules/nix/core/boot.nix similarity index 100% rename from config/nixos/core/boot.nix rename to modules/nix/core/boot.nix diff --git a/modules/nix/core/default.nix b/modules/nix/core/default.nix new file mode 100644 index 0000000..8f83d15 --- /dev/null +++ b/modules/nix/core/default.nix @@ -0,0 +1,12 @@ +{lib, ...}: { + imports = [ + ./boot.nix + ./home-manager.nix + ./locales.nix + ./networking.nix + ./users.nix + ./security.nix + ]; + system.stateVersion = lib.mkDefault "24.05"; + zramSwap.enable = true; +} diff --git a/modules/nix/core/home-manager.nix b/modules/nix/core/home-manager.nix new file mode 100644 index 0000000..c1f3655 --- /dev/null +++ b/modules/nix/core/home-manager.nix @@ -0,0 +1,34 @@ +{ + inputs, + lib, + config, + ... +}: let + inherit (config.local.systemVars) username; +in { + imports = [ + inputs.home-manager.nixosModules.default + ]; + + config = lib.mkIf (!config.local.profiles.server.enable) { + home-manager = { + backupFileExtension = "backup"; + useGlobalPkgs = true; + useUserPackages = true; + }; + + home-manager.users.${username} = { + home = { + homeDirectory = "/home/${username}"; + stateVersion = "24.05"; + }; + + programs.home-manager.enable = true; + }; + + programs = { + # make HM-managed GTK stuff work + dconf.enable = true; + }; + }; +} diff --git a/config/nixos/core/default.nix b/modules/nix/core/locales.nix similarity index 73% rename from config/nixos/core/default.nix rename to modules/nix/core/locales.nix index fd481b2..7e36090 100644 --- a/config/nixos/core/default.nix +++ b/modules/nix/core/locales.nix @@ -1,10 +1,4 @@ {lib, ...}: { - imports = [ - ./boot.nix - ./users.nix - ./security.nix - ./networking.nix - ]; i18n = { defaultLocale = "en_US.UTF-8"; extraLocaleSettings = { @@ -20,7 +14,5 @@ }; }; - system.stateVersion = lib.mkDefault "24.05"; time.timeZone = lib.mkDefault "Europe/Paris"; - zramSwap.enable = true; } diff --git a/modules/nix/core/networking.nix b/modules/nix/core/networking.nix new file mode 100644 index 0000000..854128e --- /dev/null +++ b/modules/nix/core/networking.nix @@ -0,0 +1,9 @@ +{ + lib, + config, + ... +}: { + config = lib.mkIf (!config.local.profiles.server.enable) { + networking.nameservers = ["1.1.1.1" "1.0.0.1"]; + }; +} diff --git a/config/nixos/core/security.nix b/modules/nix/core/security.nix similarity index 100% rename from config/nixos/core/security.nix rename to modules/nix/core/security.nix diff --git a/modules/nix/core/users.nix b/modules/nix/core/users.nix new file mode 100644 index 0000000..8ec21af --- /dev/null +++ b/modules/nix/core/users.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: { + config = lib.mkIf (!config.local.profiles.server.enable) { + users.users.${config.local.systemVars.username} = { + isNormalUser = true; + description = config.local.homeVars.fullName or "User"; + extraGroups = [ + "networkmanager" + "audio" + "video" + "wheel" + "plugdev" + ]; + }; + }; +} diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 3d9d981..95dcc30 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -1,3 +1,6 @@ { - imports = [./style]; + imports = [ + ./core + ./style + ]; }