From e5c3d9c52bee545b870635b972971e2fea2df1ed Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 7 Aug 2024 01:01:58 -0700 Subject: [PATCH] refactor: change hosts configuration to be more modular --- flake.nix | 50 ++++++++++++++++--- .../nixos/default.nix | 6 +-- .../nixos/hardware-configuration.nix | 0 3 files changed, 46 insertions(+), 10 deletions(-) rename modules/nixos/nixos-configuration.nix => hosts/nixos/default.nix (97%) rename {machines => hosts}/nixos/hardware-configuration.nix (100%) diff --git a/flake.nix b/flake.nix index 09facdd..389c073 100755 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,42 @@ formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt; nixosConfigurations = { nixos = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + system = "x86_64-linux"; + modules = [ + ./hosts/nixos + ./modules/nixos/secureboot.nix + ./modules/nixos/gaming.nix + ./modules/nixos/audio.nix + ./modules/nixos/nvidia.nix + ./modules/nixos/networking.nix + ./modules/common/fonts.nix + + catppuccin.nixosModules.catppuccin + + lix-module.nixosModules.default + + lanzaboote.nixosModules.lanzaboote + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + home-manager.users.youwen = { + imports = [ + ./users/youwen/linux/linux-home.nix + ./users/youwen/linux/desktop.nix + ./users/youwen/linux/programs.nix + ./users/youwen/common/core.nix + ./users/youwen/linux/catppuccin.nix + inputs.catppuccin.homeManagerModules.catppuccin + ]; + }; + } + ]; + }; + callisto = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; system = "x86_64-linux"; modules = [ @@ -64,11 +100,11 @@ home-manager.backupFileExtension = "backup"; home-manager.users.youwen = { imports = [ - ./users/youwen/home-manager/linux/linux-home.nix - ./users/youwen/home-manager/linux/desktop.nix - ./users/youwen/home-manager/linux/programs.nix - ./users/youwen/home-manager/common/core.nix - ./users/youwen/home-manager/linux/catppuccin.nix + ./users/youwen/linux/linux-home.nix + ./users/youwen/linux/desktop.nix + ./users/youwen/linux/programs.nix + ./users/youwen/common/core.nix + ./users/youwen/linux/catppuccin.nix inputs.catppuccin.homeManagerModules.catppuccin ]; }; @@ -88,8 +124,8 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.youwen.imports = [ - ./modules/home-manager/darwin/darwin-home.nix - ./modules/home-manager/common/core.nix + ./users/youwen/darwin/darwin-home.nix + ./users/youwen/common/core.nix ]; home-manager.backupFileExtension = "backup"; diff --git a/modules/nixos/nixos-configuration.nix b/hosts/nixos/default.nix similarity index 97% rename from modules/nixos/nixos-configuration.nix rename to hosts/nixos/default.nix index d401f9d..24ff9ab 100755 --- a/modules/nixos/nixos-configuration.nix +++ b/hosts/nixos/default.nix @@ -5,9 +5,9 @@ { config, inputs, pkgs, ... }: { - # imports = [ # Include the results of the hardware scan. - # ./hardware-configuration.nix - # ]; + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; # Bootloader. boot.loader = { diff --git a/machines/nixos/hardware-configuration.nix b/hosts/nixos/hardware-configuration.nix similarity index 100% rename from machines/nixos/hardware-configuration.nix rename to hosts/nixos/hardware-configuration.nix