From 59fb76c7782b45983729745f70d3098b4a158fcc Mon Sep 17 00:00:00 2001 From: iFargle Date: Thu, 31 Aug 2023 20:22:44 +0900 Subject: [PATCH] Testing a theme switcher --- README.md | 4 ++++ flake.nix | 16 ++++++++++---- .../common/desktops/hyprland/default.nix | 9 ++++++++ .../desktops/hyprland/gruvbox/mako-conf.nix | 0 .../desktops/hyprland/gruvbox/rofi-conf.nix | 2 +- .../hyprland/gruvbox/swaylock-conf.nix | 2 +- .../hyprland/gruvbox/swayosd-conf.nix | 2 +- .../desktops/hyprland/gruvbox/wlogout.nix | 0 home-manager/default.nix | 6 +++-- .../desktops/hyprland/default.nix | 10 ++------- lib/default.nix | 22 +++++++++++++++---- nixos/default.nix | 2 +- 12 files changed, 53 insertions(+), 22 deletions(-) create mode 100644 home-manager/common/desktops/hyprland/default.nix rename home-manager/{hosts/nixos-laptop => common}/desktops/hyprland/gruvbox/mako-conf.nix (100%) rename home-manager/{hosts/nixos-laptop => common}/desktops/hyprland/gruvbox/rofi-conf.nix (99%) rename home-manager/{hosts/nixos-laptop => common}/desktops/hyprland/gruvbox/swaylock-conf.nix (99%) rename home-manager/{hosts/nixos-laptop => common}/desktops/hyprland/gruvbox/swayosd-conf.nix (58%) rename home-manager/{hosts/nixos-laptop => common}/desktops/hyprland/gruvbox/wlogout.nix (100%) diff --git a/README.md b/README.md index 397e0225..264527e7 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,10 @@ Completed ToDo List [here](complete.md) # Theming * To change system-wide themes, you need to change the following: +* Current themes: +1. gruvbox +2. synthwave + ## Desktops ### gnome 1. `nixos/common/desktops/gnome/default.nix` - Change the imports at the bottom. diff --git a/flake.nix b/flake.nix index e0eb11b0..7e4a9b3b 100644 --- a/flake.nix +++ b/flake.nix @@ -21,12 +21,20 @@ libx = import ./lib { inherit inputs outputs stateVersion hmStateVersion; }; in { nixosConfigurations = { - nixos-laptop = libx.mkHost { hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; gpu = "intel"; }; - nixos-desktop = libx.mkHost { hostname = "nixos-desktop"; username = "albert"; desktop = "gnome"; gpu = "nvidia"; }; + nixos-laptop = libx.mkHost { + hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; gpu = "intel"; theme = "gruvbox"; + }; + nixos-desktop = libx.mkHost { + hostname = "nixos-desktop"; username = "albert"; desktop = "gnome"; gpu = "nvidia"; theme = "gruvbox"; + }; }; homeConfigurations = { - "albert@nixos-laptop" = libx.mkHome { hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; }; - "albert@nixos-desktop" = libx.mkHome { hostname = "nixos-desktop"; username = "albert"; desktop = "gnome"; }; + "albert@nixos-laptop" = libx.mkHome { + hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; theme = "gruvbox"; + }; + "albert@nixos-desktop" = libx.mkHome { + hostname = "nixos-desktop"; username = "albert"; desktop = "gnome"; theme = "gruvbox"; + }; }; }; } diff --git a/home-manager/common/desktops/hyprland/default.nix b/home-manager/common/desktops/hyprland/default.nix new file mode 100644 index 00000000..32364180 --- /dev/null +++ b/home-manager/common/desktops/hyprland/default.nix @@ -0,0 +1,9 @@ +{ pkgs, theme, ... }: { + imports = [ + ./${theme}/mako-conf.nix + ./${theme}/rofi-conf.nix + ./${theme}/swaylock-conf.nix + ./${theme}/swayosd-conf.nix + ./${theme}/wlogout-conf.nix + ]; +} \ No newline at end of file diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/mako-conf.nix b/home-manager/common/desktops/hyprland/gruvbox/mako-conf.nix similarity index 100% rename from home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/mako-conf.nix rename to home-manager/common/desktops/hyprland/gruvbox/mako-conf.nix diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/rofi-conf.nix b/home-manager/common/desktops/hyprland/gruvbox/rofi-conf.nix similarity index 99% rename from home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/rofi-conf.nix rename to home-manager/common/desktops/hyprland/gruvbox/rofi-conf.nix index bf40bae8..ea37ad72 100644 --- a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/rofi-conf.nix +++ b/home-manager/common/desktops/hyprland/gruvbox/rofi-conf.nix @@ -1,4 +1,4 @@ -{ hostname, ...}: { +{ ...}: { home.file = { # https://github.com/davatorium/rofi/blob/next/CONFIG.md # Rofi configuration diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/swaylock-conf.nix b/home-manager/common/desktops/hyprland/gruvbox/swaylock-conf.nix similarity index 99% rename from home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/swaylock-conf.nix rename to home-manager/common/desktops/hyprland/gruvbox/swaylock-conf.nix index f644ca05..69e34675 100644 --- a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/swaylock-conf.nix +++ b/home-manager/common/desktops/hyprland/gruvbox/swaylock-conf.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: { +{ pkgs, ... }: { programs.swaylock = { enable = true; # swaylock-effects has extra effects like image blur and stuff. diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/swayosd-conf.nix b/home-manager/common/desktops/hyprland/gruvbox/swayosd-conf.nix similarity index 58% rename from home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/swayosd-conf.nix rename to home-manager/common/desktops/hyprland/gruvbox/swayosd-conf.nix index 946f0186..0942eaa0 100644 --- a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/swayosd-conf.nix +++ b/home-manager/common/desktops/hyprland/gruvbox/swayosd-conf.nix @@ -1,3 +1,3 @@ -{ pkgs, config, ... }: { +{ ... }: { services.swayosd.enable = true; } \ No newline at end of file diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/wlogout.nix b/home-manager/common/desktops/hyprland/gruvbox/wlogout.nix similarity index 100% rename from home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/wlogout.nix rename to home-manager/common/desktops/hyprland/gruvbox/wlogout.nix diff --git a/home-manager/default.nix b/home-manager/default.nix index c688f2de..bcbdebcc 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, inputs, hostname, username, desktop, hmStateVersion, ... }: { +{ lib, config, pkgs, inputs, hostname, username, desktop, theme, hmStateVersion, ... }: { home = { inherit username; @@ -28,12 +28,14 @@ ./users/${username} ] ++ lib.optional (builtins.isString desktop) ./common/software/gui/firefox.nix - # ++ lib.optional (builtins.isString desktop) ./common/software/gui/thunderbird.nix + ++ lib.optional (builtins.isString desktop) ./common/software/gui/thunderbird.nix ++ lib.optional (builtins.isString desktop) ./common/software/gui/vscodium.nix + ++ lib.optional (builtins.isString desktop) ./common/desktops/${desktop}/ # Machine-agnostic desktop configs ++ lib.optional (builtins.isString desktop) ./hosts/${hostname}/desktops/${desktop}; # Machine-specific desktop configs nixpkgs = { overlays = [ + # Currently in use in the Firefox config inputs.nur.overlay ]; }; diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix b/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix index e9df6132..dc048413 100644 --- a/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix +++ b/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix @@ -1,11 +1,5 @@ -{ ... }: { +{ theme, ... }: { imports = [ - ./gruvbox/hyprland-conf.nix - ./gruvbox/mako-conf.nix - ./gruvbox/rofi-conf.nix - ./gruvbox/swaylock-conf.nix - ./gruvbox/waybar/waybar-conf.nix - ./gruvbox/swayosd-conf.nix - ./gruvbox/wlogout.nix + ./${theme}/hyprland-conf.nix ]; } \ No newline at end of file diff --git a/lib/default.nix b/lib/default.nix index 9442c848..eea0dd3a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,15 @@ { inputs, outputs, stateVersion, hmStateVersion, ... }: { # Helper function for generating home-manager configs - mkHome = { hostname, username, desktop ? null, platform ? "x86_64-linux" }: inputs.home-manager.lib.homeManagerConfiguration { + mkHome = { + hostname, + username, + desktop ? null, + platform ? "x86_64-linux", + theme ? null + }: inputs.home-manager.lib.homeManagerConfiguration { pkgs = inputs.nixpkgs.legacyPackages.${platform}; - extraSpecialArgs = { inherit inputs outputs desktop hostname platform username hmStateVersion; }; + extraSpecialArgs = { inherit inputs outputs desktop hostname platform username hmStateVersion theme; }; modules = [ ../home-manager inputs.doom-emacs.hmModule @@ -11,8 +17,16 @@ }; # Helper function for generating host configs - mkHost = { hostname, username, desktop ? null, installer ? null, gpu ? null, platform ? "x86_64-linux" }: inputs.nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu platform; }; + mkHost = { + hostname, + username, + desktop ? null, + installer ? null, + gpu ? null, + platform ? "x86_64-linux", + theme ? null + }: inputs.nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu platform theme; }; modules = [ ../nixos inputs.sops-nix.nixosModules.sops diff --git a/nixos/default.nix b/nixos/default.nix index 6730efb7..35766604 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, hostname, stateVersion, username, desktop, gpu, inputs, platform, ... }: { +{ lib, config, pkgs, hostname, stateVersion, username, desktop, gpu, inputs, platform, theme, ... }: { imports = [ # Services ./common/services/openssh.nix