repo: move everything gtk into modules
This is mostly so that applications like ReGreet, which are managed by NixOS instead of HM, can also use the same GTK settings. It reduces repeating code by a lot and allows changing themes way more easily now.
This commit is contained in:
parent
6e0076c7ef
commit
e24ab1eb95
11 changed files with 146 additions and 50 deletions
|
@ -15,7 +15,7 @@
|
||||||
font = "monospace:size=14";
|
font = "monospace:size=14";
|
||||||
};
|
};
|
||||||
colors = let
|
colors = let
|
||||||
inherit (inputs.basix.schemeData.base16.${nixosConfig.theme.scheme}) palette;
|
inherit (inputs.basix.schemeData.base16.${nixosConfig.style.scheme}) palette;
|
||||||
in {
|
in {
|
||||||
background = "${palette.base00}ff";
|
background = "${palette.base00}ff";
|
||||||
text = "${palette.base05}ff";
|
text = "${palette.base05}ff";
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
nixosConfig,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
home.pointerCursor = {
|
home.pointerCursor = {
|
||||||
package = pkgs.bibata-cursors;
|
inherit (nixosConfig.style.cursorTheme) name package size;
|
||||||
name = "Bibata-Modern-Classic";
|
|
||||||
size = 24;
|
|
||||||
gtk.enable = true;
|
gtk.enable = true;
|
||||||
x11.enable = true;
|
x11.enable = true;
|
||||||
};
|
};
|
||||||
|
@ -30,21 +29,11 @@
|
||||||
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
|
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
|
||||||
|
|
||||||
iconTheme = {
|
iconTheme = {
|
||||||
name = "Papirus-Dark";
|
inherit (nixosConfig.style.gtk.iconTheme) name package;
|
||||||
package = pkgs.papirus-icon-theme;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
theme = let
|
theme = {
|
||||||
accent = "lavender";
|
inherit (nixosConfig.style.gtk.theme) name package;
|
||||||
variant = "frappe";
|
|
||||||
size = "standard";
|
|
||||||
in {
|
|
||||||
name = "catppuccin-${variant}-${accent}-${size}";
|
|
||||||
package = pkgs.catppuccin-gtk.override {
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
|
|
||||||
accents = [accent];
|
|
||||||
inherit variant size;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
PartOf = ["graphical-session.target"];
|
PartOf = ["graphical-session.target"];
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = builtins.trace nixosConfig.theme.wallpaper "${lib.getExe pkgs.swaybg} -i ${nixosConfig.theme.wallpaper} -m fill";
|
ExecStart = "${lib.getExe pkgs.swaybg} -i ${nixosConfig.style.wallpaper} -m fill";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
Install.WantedBy = ["graphical-session.target"];
|
Install.WantedBy = ["graphical-session.target"];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
nixosConfig,
|
nixosConfig,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (inputs.basix.schemeData.base16.${nixosConfig.theme.scheme}) palette;
|
inherit (inputs.basix.schemeData.base16.${nixosConfig.style.scheme}) palette;
|
||||||
in {
|
in {
|
||||||
# requires `security.pam.services.swaylock = { };` at the system level or else
|
# requires `security.pam.services.swaylock = { };` at the system level or else
|
||||||
# unlock will not work.
|
# unlock will not work.
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
font = "monospace:size=14";
|
font = "monospace:size=14";
|
||||||
};
|
};
|
||||||
colors = let
|
colors = let
|
||||||
inherit (nixosConfig.theme) scheme;
|
schemeData = inputs.basix.schemeData.base16.${nixosConfig.style.scheme};
|
||||||
schemeData = inputs.basix.schemeData.base16.${scheme};
|
|
||||||
in {
|
in {
|
||||||
background = schemeData.palette.base00;
|
background = schemeData.palette.base00;
|
||||||
foreground = schemeData.palette.base05;
|
foreground = schemeData.palette.base05;
|
||||||
|
|
|
@ -23,13 +23,15 @@
|
||||||
../system/services/regreet.nix
|
../system/services/regreet.nix
|
||||||
"${mod}/programs/niri"
|
"${mod}/programs/niri"
|
||||||
|
|
||||||
self.nixosModules.theme
|
self.nixosModules.style
|
||||||
|
|
||||||
{
|
{
|
||||||
theme.wallpaper = lib.mkDefault ../wallpapers/lucy-edgerunners-wallpaper.jpg;
|
style = {
|
||||||
theme.scheme = lib.mkDefault "catppuccin-frappe";
|
gtk.enable = true;
|
||||||
|
wallpaper = lib.mkDefault ../wallpapers/lucy-edgerunners-wallpaper.jpg;
|
||||||
|
scheme = lib.mkDefault "catppuccin-frappe";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
users.nezia.imports = homeImports.vamos;
|
users.nezia.imports = homeImports.vamos;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
flake.nixosModules = {
|
flake.nixosModules = {
|
||||||
theme = import ./theme;
|
style = import ./style;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
48
modules/style/default.nix
Normal file
48
modules/style/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkOption;
|
||||||
|
inherit (lib.types) string path package;
|
||||||
|
in {
|
||||||
|
imports = [./gtk.nix];
|
||||||
|
options.style = {
|
||||||
|
scheme = mkOption {
|
||||||
|
description = ''
|
||||||
|
Name of the tinted-scheming color scheme to use.
|
||||||
|
'';
|
||||||
|
type = string;
|
||||||
|
example = lib.literalExpression "catppuccin-frappe";
|
||||||
|
};
|
||||||
|
wallpaper = mkOption {
|
||||||
|
description = ''
|
||||||
|
Location of the wallpaper that will be used throughout the system.
|
||||||
|
'';
|
||||||
|
type = path;
|
||||||
|
example = lib.literalExpression "./wallpaper.png";
|
||||||
|
};
|
||||||
|
|
||||||
|
cursorTheme = {
|
||||||
|
name = mkOption {
|
||||||
|
description = ''
|
||||||
|
Name of the cursor theme.
|
||||||
|
'';
|
||||||
|
default = "Bibata-Modern-Classic";
|
||||||
|
};
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
description = ''
|
||||||
|
Package providing the cursor theme.
|
||||||
|
'';
|
||||||
|
default = pkgs.bibata-cursors;
|
||||||
|
};
|
||||||
|
size = mkOption {
|
||||||
|
description = ''
|
||||||
|
Size of the cursor.
|
||||||
|
'';
|
||||||
|
default = 24;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
66
modules/style/gtk.nix
Normal file
66
modules/style/gtk.nix
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) pathExists;
|
||||||
|
inherit (lib) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) package str;
|
||||||
|
|
||||||
|
cfg = config.style.gtk;
|
||||||
|
in {
|
||||||
|
options.style.gtk = {
|
||||||
|
enable = mkEnableOption "enable GTK theming options";
|
||||||
|
theme = {
|
||||||
|
name = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "Name for the GTK theme";
|
||||||
|
default = "catppuccin-frappe-lavender-standard";
|
||||||
|
};
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
description = "Package providing the GTK theme";
|
||||||
|
|
||||||
|
default = pkgs.catppuccin-gtk.override {
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
|
||||||
|
variant = "frappe";
|
||||||
|
accents = ["lavender"];
|
||||||
|
size = "standard";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
iconTheme = {
|
||||||
|
name = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "The name for the icon theme that will be used for GTK programs";
|
||||||
|
default = "Papirus-Dark";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
description = "The GTK icon theme to be used";
|
||||||
|
default = pkgs.catppuccin-papirus-folders.override {
|
||||||
|
accent = "lavender";
|
||||||
|
flavor = "frappe";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
assertions = [
|
||||||
|
(let
|
||||||
|
themePath = cfg.theme.package + /share/themes + "/${cfg.theme.name}";
|
||||||
|
in {
|
||||||
|
assertion = cfg.enable -> pathExists themePath;
|
||||||
|
message = ''
|
||||||
|
${toString themePath} set by the GTK module does not exist!
|
||||||
|
|
||||||
|
To suppress this message, make sure that
|
||||||
|
`config.modules.style.gtk.theme.package` contains
|
||||||
|
the path `${cfg.theme.name}`
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
{lib, ...}: {
|
|
||||||
options.theme = {
|
|
||||||
scheme = lib.mkOption {
|
|
||||||
description = ''
|
|
||||||
Name of the tinted-scheming color scheme to use.
|
|
||||||
'';
|
|
||||||
type = lib.types.string;
|
|
||||||
example = lib.literalExpression "catppuccin-frappe";
|
|
||||||
};
|
|
||||||
wallpaper = lib.mkOption {
|
|
||||||
description = ''
|
|
||||||
Location of the wallpaper that will be used throughout the system.
|
|
||||||
'';
|
|
||||||
type = lib.types.path;
|
|
||||||
example = lib.literalExpression "./wallpaper.png";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,19 +1,29 @@
|
||||||
{
|
{
|
||||||
inputs,
|
lib,
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
inherit (lib) mkForce;
|
||||||
|
in {
|
||||||
|
environment.systemPackages = [
|
||||||
|
config.style.gtk.theme.package
|
||||||
|
config.style.gtk.iconTheme.package
|
||||||
|
config.style.cursorTheme.package
|
||||||
|
];
|
||||||
|
|
||||||
programs.regreet = {
|
programs.regreet = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.greetd.regreet;
|
||||||
cageArgs = [
|
cageArgs = [
|
||||||
"-s"
|
"-s"
|
||||||
"-d"
|
"-d"
|
||||||
];
|
];
|
||||||
settings = {
|
settings = {
|
||||||
GTK = let
|
GTK = {
|
||||||
schemeData = inputs.basix.schemeData.base16.${config.theme.scheme};
|
cursor_theme_name = mkForce config.style.cursorTheme.name;
|
||||||
in {
|
icon_theme_name = mkForce config.style.gtk.iconTheme.name;
|
||||||
application_prefer_dark_theme = schemeData.variant == "dark";
|
theme_name = mkForce config.style.gtk.theme.name;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue