From f829b8c1084e695d2062cfd60ae003416b46e964 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 3 Aug 2024 18:33:40 -0700 Subject: [PATCH] refactor: modularize configuration to prepare for multi-machine --- flake.nix | 26 ++------- home.nix | 51 ----------------- modules/home-manager/linux/desktop.nix | 56 +++++++++++++++++++ .../linux/hyprland-conf.nix} | 0 .../linux/waybar/waybar-conf.nix} | 0 .../linux}/waybar/waybar.css | 0 modules/nixos/secureboot.nix | 17 ++++++ 7 files changed, 79 insertions(+), 71 deletions(-) create mode 100644 modules/home-manager/linux/desktop.nix rename modules/{desktop/hyprland.nix => home-manager/linux/hyprland-conf.nix} (100%) rename modules/{desktop/waybar/waybar.nix => home-manager/linux/waybar/waybar-conf.nix} (100%) rename modules/{desktop => home-manager/linux}/waybar/waybar.css (100%) create mode 100644 modules/nixos/secureboot.nix diff --git a/flake.nix b/flake.nix index 6507df5..43dc570 100755 --- a/flake.nix +++ b/flake.nix @@ -31,31 +31,13 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + ./modules/nixos/secureboot.nix catppuccin.nixosModules.catppuccin lix-module.nixosModules.default lanzaboote.nixosModules.lanzaboote - ({ pkgs, lib, ... }: { - 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"; - }; - }) - - { nixpkgs.overlays = [ (self: super: { }) ]; } home-manager.nixosModules.home-manager { @@ -63,7 +45,11 @@ home-manager.useUserPackages = true; home-manager.backupFileExtension = "backup"; home-manager.users.youwen = { - imports = [ ./home.nix catppuccin.homeManagerModules.catppuccin ]; + imports = [ + ./home.nix + ./modules/home-manager/linux/desktop.nix + catppuccin.homeManagerModules.catppuccin + ]; }; } ]; diff --git a/home.nix b/home.nix index 59a8e47..e6c1c54 100755 --- a/home.nix +++ b/home.nix @@ -81,28 +81,11 @@ libsForQt5.qt5ct ]; - services.dunst = { - enable = true; - catppuccin.enable = true; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - size = "32x32"; - }; - }; - - services.easyeffects.enable = true; - services.easyeffects.package = pkgs.easyeffects; - programs.fzf = { enable = true; catppuccin.enable = true; }; - programs.wlogout.enable = true; - - wayland.windowManager.hyprland = import ./modules/desktop/hyprland.nix; - programs.git = { enable = true; userName = "Youwen Wu"; @@ -154,40 +137,6 @@ extraConfig = "set editing-mode vi"; }; - gtk = { - enable = true; - catppuccin.enable = true; - cursorTheme = { - name = "Bibata-Modern-Ice"; - size = 26; - }; - iconTheme = { name = "Papirus-Dark"; }; - }; - - qt = { - enable = true; - platformTheme.name = "qtct"; - style.name = "kvantum"; - }; - - xdg.configFile = { - "Kvantum/kvantum.kvconfig".text = '' - [General] - theme=GraphiteNordDark - ''; - - "Kvantum/GraphiteNord".source = - "${pkgs.graphite-kde-theme}/share/Kvantum/GraphiteNord"; - }; - - programs.rofi = { - enable = true; - package = pkgs.rofi-wayland; - theme = "gruvbox-dark"; - }; - - programs.waybar = import ./modules/desktop/waybar/waybar.nix; - programs.zoxide = { enable = true; # enableZshIntegration = true; diff --git a/modules/home-manager/linux/desktop.nix b/modules/home-manager/linux/desktop.nix new file mode 100644 index 0000000..0959914 --- /dev/null +++ b/modules/home-manager/linux/desktop.nix @@ -0,0 +1,56 @@ +{ pkgs, ...}: +{ + wayland.windowManager.hyprland = import ./hyprland-conf.nix; + + # Audio effects and EQ tool + services.easyeffects.enable = true; + services.easyeffects.package = pkgs.easyeffects; + + # Notification daemon + services.dunst = { + enable = true; + catppuccin.enable = true; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + size = "32x32"; + }; + }; + + # Currently non-functional + programs.wlogout.enable = true; + + gtk = { + enable = true; + catppuccin.enable = true; + cursorTheme = { + name = "Bibata-Modern-Ice"; + size = 26; + }; + iconTheme = { name = "Papirus-Dark"; }; + }; + + qt = { + enable = true; + platformTheme.name = "qtct"; + style.name = "kvantum"; + }; + + xdg.configFile = { + "Kvantum/kvantum.kvconfig".text = '' + [General] + theme=GraphiteNordDark + ''; + + "Kvantum/GraphiteNord".source = + "${pkgs.graphite-kde-theme}/share/Kvantum/GraphiteNord"; + }; + + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + theme = "gruvbox-dark"; + }; + + programs.waybar = import ./waybar/waybar-conf.nix; +} diff --git a/modules/desktop/hyprland.nix b/modules/home-manager/linux/hyprland-conf.nix similarity index 100% rename from modules/desktop/hyprland.nix rename to modules/home-manager/linux/hyprland-conf.nix diff --git a/modules/desktop/waybar/waybar.nix b/modules/home-manager/linux/waybar/waybar-conf.nix similarity index 100% rename from modules/desktop/waybar/waybar.nix rename to modules/home-manager/linux/waybar/waybar-conf.nix diff --git a/modules/desktop/waybar/waybar.css b/modules/home-manager/linux/waybar/waybar.css similarity index 100% rename from modules/desktop/waybar/waybar.css rename to modules/home-manager/linux/waybar/waybar.css diff --git a/modules/nixos/secureboot.nix b/modules/nixos/secureboot.nix new file mode 100644 index 0000000..61ce5c5 --- /dev/null +++ b/modules/nixos/secureboot.nix @@ -0,0 +1,17 @@ + ({ pkgs, lib, ... }: { + 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"; + }; + })