Split up code to support server configuration
This commit is contained in:
1 parent
6364d8afa0
commit
fa2413f272
15 files changed
+524
-256
No files matched your search
@@ -37,7 +37,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
config = mkIf config.desktop.enable (
|
||||
lib.recursiveUpdate
|
||||
{
|
||||
# Ensure desktop related systemd services (xdg) have access to session variables.
|
||||
@@ -84,5 +84,6 @@ in
|
||||
# }
|
||||
# ."${cfg.decorations}"
|
||||
{ }
|
||||
);
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -54,6 +54,7 @@ in
|
||||
];
|
||||
|
||||
options.desktop = {
|
||||
enable = mkEnableOption "desktop";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "Shell";
|
||||
@@ -90,7 +91,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
config = mkIf cfg.enable {
|
||||
specialisation = mapAttrs (name: value: {
|
||||
configuration = (environmentBuilders."${value.type}" value);
|
||||
}) cfg.environments;
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.desktop.theming;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# Import all themes
|
||||
./themes/catppuccin.nix
|
||||
./themes/gruvbox.nix
|
||||
./themes/oxocarbon.nix
|
||||
./themes/papercolor.nix
|
||||
./themes/sakura.nix
|
||||
./themes/nord.nix
|
||||
];
|
||||
|
||||
options.desktop.theming =
|
||||
let
|
||||
colors = config.desktop.theming.schemeColors;
|
||||
in
|
||||
{
|
||||
darkMode = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether the app should use dark mode.";
|
||||
};
|
||||
|
||||
colorScheme = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
|
||||
description = "Base 16 color scheme to use for styling. See stylix documentation for more information.";
|
||||
};
|
||||
|
||||
schemeColors = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = config.lib.stylix.colors;
|
||||
description = "Generated colors from scheme";
|
||||
};
|
||||
|
||||
colors = {
|
||||
bg = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base00;
|
||||
};
|
||||
fg = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base05;
|
||||
};
|
||||
bg-status = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base01;
|
||||
};
|
||||
fg-status = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base04;
|
||||
};
|
||||
bg-selection = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base02;
|
||||
};
|
||||
bg-highlight = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base03;
|
||||
};
|
||||
fg-search = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base0A;
|
||||
};
|
||||
accent = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base0E;
|
||||
};
|
||||
border-focused = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.colors.fg;
|
||||
};
|
||||
border-unfocused = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.colors.bg-selection;
|
||||
};
|
||||
};
|
||||
|
||||
colorsCSS = mkOption {
|
||||
type = types.lines;
|
||||
default =
|
||||
":root {\n"
|
||||
+ concatStrings (
|
||||
map (color: " --nix-color-${color.name}: #${color.value};\n") (attrsToList cfg.colors)
|
||||
)
|
||||
+ "}\n\n";
|
||||
description = "Colors as css variables";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# Configure gnome theme
|
||||
dconf.settings = {
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = if cfg.darkMode then "prefer-dark" else "prefer-light";
|
||||
};
|
||||
};
|
||||
|
||||
# Configure qt theme
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "adwaita";
|
||||
style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light";
|
||||
};
|
||||
|
||||
# Configure gtk theme
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = if cfg.darkMode then "Adwaita-dark" else "Adwaita-light";
|
||||
package = pkgs.gnome-themes-extra;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: This should just straight up not be here
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
modules.git.ignores = [
|
||||
".direnv"
|
||||
];
|
||||
|
||||
# Enable stylix
|
||||
# TODO: Move to own module
|
||||
stylix = {
|
||||
enable = true;
|
||||
autoEnable = false;
|
||||
|
||||
targets = {
|
||||
foot.enable = true;
|
||||
nixvim.enable = true;
|
||||
qutebrowser.enable = true;
|
||||
vscode = {
|
||||
enable = true;
|
||||
profileNames = [ "Default" ];
|
||||
};
|
||||
zathura.enable = true;
|
||||
};
|
||||
|
||||
base16Scheme = cfg.colorScheme;
|
||||
polarity = if cfg.darkMode then "dark" else "light";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -91,186 +91,88 @@ in
|
||||
{
|
||||
imports = [
|
||||
./background.nix
|
||||
|
||||
# Import all themes
|
||||
./themes/catppuccin.nix
|
||||
./themes/gruvbox.nix
|
||||
./themes/oxocarbon.nix
|
||||
./themes/papercolor.nix
|
||||
./themes/sakura.nix
|
||||
./themes/nord.nix
|
||||
./colors.nix
|
||||
];
|
||||
|
||||
options.desktop.theming =
|
||||
let
|
||||
colors = config.desktop.theming.schemeColors;
|
||||
in
|
||||
{
|
||||
darkMode = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether the app should use dark mode.";
|
||||
options.desktop.theming = {
|
||||
layout = {
|
||||
borderRadius = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
description = "Border radius of windows.";
|
||||
};
|
||||
|
||||
colorScheme = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Base 16 color scheme to use for styling. See stylix documentation for more information.";
|
||||
borderSize = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = "Size of borders used throughout UI.";
|
||||
};
|
||||
|
||||
schemeColors = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = config.lib.stylix.colors;
|
||||
description = "Generated colors from scheme";
|
||||
};
|
||||
|
||||
colors = {
|
||||
bg = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base00;
|
||||
};
|
||||
fg = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base05;
|
||||
};
|
||||
bg-status = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base01;
|
||||
};
|
||||
fg-status = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base04;
|
||||
};
|
||||
bg-selection = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base02;
|
||||
};
|
||||
bg-highlight = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base03;
|
||||
};
|
||||
fg-search = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base0A;
|
||||
};
|
||||
accent = mkOption {
|
||||
type = types.str;
|
||||
default = colors.base0E;
|
||||
};
|
||||
border-focused = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.colors.fg;
|
||||
};
|
||||
border-unfocused = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.colors.bg-selection;
|
||||
};
|
||||
};
|
||||
|
||||
colorsCSS = mkOption {
|
||||
type = types.lines;
|
||||
default =
|
||||
":root {\n"
|
||||
+ concatStrings (
|
||||
map (color: " --nix-color-${color.name}: #${color.value};\n") (attrsToList cfg.colors)
|
||||
)
|
||||
+ "}\n\n";
|
||||
description = "Colors as css variables";
|
||||
};
|
||||
|
||||
layout = {
|
||||
borderRadius = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
description = "Border radius of windows.";
|
||||
};
|
||||
|
||||
borderSize = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = "Size of borders used throughout UI.";
|
||||
};
|
||||
|
||||
windowPadding = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Margin of each window, actual space between windows will be twice this number.";
|
||||
};
|
||||
};
|
||||
|
||||
fonts = {
|
||||
pkgs = mkOption {
|
||||
type = types.attrsOf fontModule;
|
||||
default = builtins.listToAttrs (
|
||||
map (module: {
|
||||
name = module.name;
|
||||
value = module;
|
||||
}) (map (module: (import module) { inherit lib config pkgs; }) fontModules)
|
||||
);
|
||||
description = "All available font modules.";
|
||||
};
|
||||
|
||||
installed = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = fontNameList;
|
||||
description = "List of installed fonts.";
|
||||
};
|
||||
|
||||
serif = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default serif font";
|
||||
};
|
||||
|
||||
sansSerif = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default sansSerif font.";
|
||||
};
|
||||
|
||||
monospace = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default monospace font.";
|
||||
};
|
||||
|
||||
emoji = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default emoji font.";
|
||||
};
|
||||
|
||||
interface = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default emoji font.";
|
||||
};
|
||||
|
||||
extraFonts = mkOption {
|
||||
type = types.listOf fontModule;
|
||||
default = [ ];
|
||||
description = "Additional fonts to install.";
|
||||
};
|
||||
windowPadding = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Margin of each window, actual space between windows will be twice this number.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
fonts = {
|
||||
pkgs = mkOption {
|
||||
type = types.attrsOf fontModule;
|
||||
default = builtins.listToAttrs (
|
||||
map (module: {
|
||||
name = module.name;
|
||||
value = module;
|
||||
}) (map (module: (import module) { inherit lib config pkgs; }) fontModules)
|
||||
);
|
||||
description = "All available font modules.";
|
||||
};
|
||||
|
||||
installed = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = fontNameList;
|
||||
description = "List of installed fonts.";
|
||||
};
|
||||
|
||||
serif = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default serif font";
|
||||
};
|
||||
|
||||
sansSerif = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default sansSerif font.";
|
||||
};
|
||||
|
||||
monospace = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default monospace font.";
|
||||
};
|
||||
|
||||
emoji = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default emoji font.";
|
||||
};
|
||||
|
||||
interface = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default emoji font.";
|
||||
};
|
||||
|
||||
extraFonts = mkOption {
|
||||
type = types.listOf fontModule;
|
||||
default = [ ];
|
||||
description = "Additional fonts to install.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.desktop.enable {
|
||||
# Enable fontconfig
|
||||
modules.fontconfig.enable = true;
|
||||
|
||||
# Install configured fonts
|
||||
home.packages = fontPackageList;
|
||||
|
||||
# Configure gnome theme
|
||||
dconf.settings = {
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = if cfg.darkMode then "prefer-dark" else "prefer-light";
|
||||
};
|
||||
};
|
||||
|
||||
# Configure qt theme
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "adwaita";
|
||||
style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light";
|
||||
};
|
||||
|
||||
# Configure gtk theme
|
||||
gtk =
|
||||
let
|
||||
@@ -287,26 +189,11 @@ in
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
||||
theme = {
|
||||
name = if cfg.darkMode then "Adwaita-dark" else "Adwaita-light";
|
||||
package = pkgs.gnome-themes-extra;
|
||||
};
|
||||
|
||||
# TODO: Toggles
|
||||
gtk3.extraCss = disableCSD;
|
||||
gtk4.extraCss = disableCSD;
|
||||
};
|
||||
|
||||
# TODO: This should just straight up not be here
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
modules.git.ignores = [
|
||||
".direnv"
|
||||
];
|
||||
|
||||
# TODO: Make cursors configurable using modules.
|
||||
home.pointerCursor = {
|
||||
gtk.enable = true;
|
||||
@@ -322,23 +209,6 @@ in
|
||||
# Enable stylix
|
||||
# TODO: Move to own module
|
||||
stylix = {
|
||||
enable = true;
|
||||
autoEnable = false;
|
||||
|
||||
targets = {
|
||||
foot.enable = true;
|
||||
nixvim.enable = true;
|
||||
qutebrowser.enable = true;
|
||||
vscode = {
|
||||
enable = true;
|
||||
profileNames = [ "NixOS" ];
|
||||
};
|
||||
zathura.enable = true;
|
||||
};
|
||||
|
||||
base16Scheme = cfg.colorScheme;
|
||||
polarity = if cfg.darkMode then "dark" else "light";
|
||||
|
||||
fonts = {
|
||||
serif = getAttrs [
|
||||
"name"
|
||||
|
||||
Reference in new issue
Block a user