From ceb66c03cf763080b482a17ee87f077506312319 Mon Sep 17 00:00:00 2001 From: ooks-io Date: Mon, 5 Aug 2024 17:29:53 +1200 Subject: [PATCH] feat(nixos:appearance): move appearance options to nixos --- flake.lock | 8 +- home/modules/appearance/cursor.nix | 21 +-- home/modules/appearance/default.nix | 1 - home/modules/appearance/fonts.nix | 24 ++- home/modules/appearance/gtk.nix | 10 +- home/modules/appearance/wallpaper.nix | 29 ---- home/modules/console/editor/helix/default.nix | 8 +- home/modules/console/editor/helix/theme.nix | 140 ------------------ .../console/multiplexer/tmux/default.nix | 5 +- .../console/multiplexer/zellij/default.nix | 14 +- .../zellij/layouts/defaultLayout.nix | 9 +- .../zellij/layouts/flakeLayout.nix | 6 +- .../zellij/layouts/scriptLayout.nix | 6 +- .../desktop/browser/firefox/default.nix | 8 +- .../desktop/browser/firefox/theme/ooksfox.nix | 7 +- .../desktop/browser/firefox/tridactyl.nix | 8 +- .../desktop/communication/discord/vesktop.nix | 11 +- home/modules/desktop/media/music/tui.nix | 12 +- .../desktop/productivity/pdf/zathura.nix | 7 +- home/modules/desktop/terminal/foot.nix | 7 +- home/modules/desktop/terminal/kitty.nix | 9 +- .../desktop/wayland/bar/waybar/default.nix | 10 +- .../hyprland/settings/appearance.nix | 9 +- .../hyprland/settings/hyprpaper.nix | 5 +- .../modules/desktop/wayland/launcher/rofi.nix | 12 +- .../modules/desktop/wayland/launcher/tofi.nix | 7 +- .../desktop/wayland/lockscreen/hyprlock.nix | 7 +- .../desktop/wayland/lockscreen/swaylock.nix | 10 +- .../desktop/wayland/notification/mako.nix | 15 +- home/options/appearance/cursor.nix | 25 ---- home/options/appearance/default.nix | 4 - home/options/appearance/fonts.nix | 22 --- home/options/appearance/theme.nix | 9 -- home/options/appearance/wallpaper.nix | 12 -- home/profiles/themes/default.nix | 1 - home/profiles/themes/minimal.nix | 1 - home/roles/ooks-desktop-workstation.nix | 1 - home/roles/ooks-laptop-workstation.nix | 1 - home/roles/ooks-micro-workstation.nix | 1 - hosts/ooksmicro/default.nix | 2 +- nixos/modules/default.nix | 1 + nixos/modules/theme/default.nix | 5 + nixos/modules/theme/generatedWallpaper.nix | 49 ++++++ nixos/modules/theme/minimal.nix | 41 +++++ nixos/options/appearance/colors.nix | 30 ++++ nixos/options/appearance/default.nix | 77 ++++++++++ nixos/options/appearance/palettes/default.nix | 3 + .../appearance/palettes/hozen-dark.nix | 57 +++++++ nixos/options/default.nix | 1 + nixos/roles/desktop-workstation.nix | 1 + nixos/roles/laptop-workstation.nix | 1 + 51 files changed, 393 insertions(+), 377 deletions(-) delete mode 100644 home/modules/appearance/wallpaper.nix delete mode 100644 home/modules/console/editor/helix/theme.nix delete mode 100644 home/options/appearance/cursor.nix delete mode 100644 home/options/appearance/fonts.nix delete mode 100644 home/options/appearance/theme.nix delete mode 100644 home/options/appearance/wallpaper.nix create mode 100644 nixos/modules/theme/default.nix create mode 100644 nixos/modules/theme/generatedWallpaper.nix create mode 100644 nixos/modules/theme/minimal.nix create mode 100644 nixos/options/appearance/colors.nix create mode 100644 nixos/options/appearance/default.nix create mode 100644 nixos/options/appearance/palettes/default.nix create mode 100644 nixos/options/appearance/palettes/hozen-dark.nix diff --git a/flake.lock b/flake.lock index 6a44a0f..8493f99 100644 --- a/flake.lock +++ b/flake.lock @@ -1769,11 +1769,11 @@ "systems": "systems_11" }, "locked": { - "lastModified": 1722223311, - "narHash": "sha256-C6Jp8Y/qOo4t8j9tZG8Znnvhhp2k7wbNwknVV5A6yjE=", + "lastModified": 1722678438, + "narHash": "sha256-7egl3tmEWz40S31MKI8FTgoUQQLWPJ7OIBEUN0YU7JA=", "ref": "refs/heads/master", - "rev": "aeba1bfbb4f93bfb2bdc22aca13fbebc3d104f6d", - "revCount": 18, + "rev": "d78920d714ebd5518ca385a96abbb1239725b728", + "revCount": 19, "type": "git", "url": "ssh://git@github.com/ooks-io/ooks-vim" }, diff --git a/home/modules/appearance/cursor.nix b/home/modules/appearance/cursor.nix index 43b57a8..d5cd3d6 100644 --- a/home/modules/appearance/cursor.nix +++ b/home/modules/appearance/cursor.nix @@ -1,18 +1,7 @@ -{ - lib, - config, - ... -}: let - inherit (lib) mkIf; - cfg = config.ooknet.cursor; -in { - config = mkIf cfg.enable { - home.pointerCursor = { - package = cfg.package; - name = cfg.name; - size = cfg.size; - gtk.enable = true; - x11.enable = true; - }; +{osConfig, ...}: { + home.pointerCursor = { + inherit (osConfig.ooknet.appearance.cursor) package name size; + gtk.enable = true; + x11.enable = true; }; } diff --git a/home/modules/appearance/default.nix b/home/modules/appearance/default.nix index e18447b..8742d9d 100644 --- a/home/modules/appearance/default.nix +++ b/home/modules/appearance/default.nix @@ -4,6 +4,5 @@ ./cursor.nix ./gtk.nix ./qt.nix - ./wallpaper.nix ]; } diff --git a/home/modules/appearance/fonts.nix b/home/modules/appearance/fonts.nix index edf77a8..e86c3ac 100644 --- a/home/modules/appearance/fonts.nix +++ b/home/modules/appearance/fonts.nix @@ -1,21 +1,17 @@ { - lib, - config, + osConfig, pkgs, ... }: let - inherit (lib) mkIf; - cfg = config.ooknet.fonts; + inherit (osConfig.ooknet.appearance.fonts) monospace regular; in { - config = mkIf cfg.enable { - fonts.fontconfig.enable = true; - home.packages = [ - cfg.monospace.package - cfg.regular.package + fonts.fontconfig.enable = true; + home.packages = [ + monospace.package + regular.package - pkgs.noto-fonts - pkgs.noto-fonts-cjk - pkgs.noto-fonts-emoji - ]; - }; + pkgs.noto-fonts + pkgs.noto-fonts-cjk + pkgs.noto-fonts-emoji + ]; } diff --git a/home/modules/appearance/gtk.nix b/home/modules/appearance/gtk.nix index 73e27a6..a571a50 100644 --- a/home/modules/appearance/gtk.nix +++ b/home/modules/appearance/gtk.nix @@ -1,12 +1,12 @@ { config, + osConfig, pkgs, - inputs, lib, ... }: let - inherit (inputs.nix-colors.lib-contrib {inherit pkgs;}) gtkThemeFromScheme; inherit (lib) mkIf; + inherit (osConfig.ooknet.appearance.colorscheme) palette; cfg = config.ooknet.gtk; in { config = mkIf cfg.enable rec { @@ -17,8 +17,8 @@ in { size = 12; }; theme = { - name = config.colorscheme.slug; - package = gtkThemeFromScheme {scheme = config.colorscheme;}; + name = "adw-gtk3"; + package = pkgs.adw-gtk3; }; iconTheme = { name = "Papirus-Dark"; @@ -26,6 +26,8 @@ in { }; }; + #TODO: add gtk css configuration + services.xsettingsd = { enable = true; settings = { diff --git a/home/modules/appearance/wallpaper.nix b/home/modules/appearance/wallpaper.nix deleted file mode 100644 index e35d4de..0000000 --- a/home/modules/appearance/wallpaper.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - lib, - config, - inputs, - pkgs, - osConfig, - ... -}: let - inherit (inputs.nix-colors.lib-contrib {inherit pkgs;}) nixWallpaperFromScheme; - inherit (lib) mkDefault mkIf; - - monitors = osConfig.ooknet.host.hardware.monitors; - cfg = config.ooknet.wallpaper; -in { - config = mkIf cfg.enable { - ooknet.wallpaper.path = let - largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs)); - largestWidth = largest (x: x.width) monitors; - largestHeight = largest (x: x.height) monitors; - in - mkDefault (nixWallpaperFromScheme - { - scheme = config.colorscheme; - width = largestWidth; - height = largestHeight; - logoScale = 4; - }); - }; -} diff --git a/home/modules/console/editor/helix/default.nix b/home/modules/console/editor/helix/default.nix index 44bd528..cf8c7a8 100644 --- a/home/modules/console/editor/helix/default.nix +++ b/home/modules/console/editor/helix/default.nix @@ -1,14 +1,15 @@ { inputs, config, + osConfig, pkgs, lib, ... }: let - inherit (config) colorscheme; + inherit (osConfig.ooknet.appearance) colorscheme; + inherit (config.ooknet) console; inherit (lib) mkIf; cfg = config.ooknet.editor.helix; - console = config.ooknet.console; in { imports = [ ./languages.nix @@ -37,7 +38,7 @@ in { ]; }); settings = { - theme = colorscheme.slug; + theme = "base16_transparent"; editor = { color-modes = true; middle-click-paste = false; @@ -66,7 +67,6 @@ in { W = ":set whitespace.render none"; }; }; - themes = import ./theme.nix {inherit colorscheme;}; }; }; } diff --git a/home/modules/console/editor/helix/theme.nix b/home/modules/console/editor/helix/theme.nix deleted file mode 100644 index 644b091..0000000 --- a/home/modules/console/editor/helix/theme.nix +++ /dev/null @@ -1,140 +0,0 @@ -{colorscheme}: { - "${colorscheme.slug}" = { - palette = builtins.mapAttrs (_name: value: "#${value}") colorscheme.colors; # Add leading '#' - "attributes" = "base09"; - "comment" = { - fg = "base03"; - modifiers = ["italic"]; - }; - "constant" = "base09"; - "constant.character.escape" = "base0C"; - "constant.numeric" = "base09"; - "constructor" = "base0D"; - "debug" = "base03"; - "diagnostic" = {modifiers = ["underlined"];}; - "diagnostic.error" = {underline = {style = "curl";};}; - "diagnostic.hint" = {underline = {style = "curl";};}; - "diagnostic.info" = {underline = {style = "curl";};}; - "diagnostic.warning" = {underline = {style = "curl";};}; - "diff.delta" = "base09"; - "diff.minus" = "base08"; - "diff.plus" = "base0B"; - "error" = "base08"; - "function" = "base0D"; - "hint" = "base03"; - "info" = "base0D"; - "keyword" = "base0E"; - "label" = "base0E"; - "markup.bold" = { - fg = "base0A"; - modifiers = ["bold"]; - }; - "markup.heading" = "base0D"; - "markup.italic" = { - fg = "base0E"; - modifiers = ["italic"]; - }; - "markup.link.text" = "base08"; - "markup.link.url" = { - fg = "base09"; - modifiers = ["underlined"]; - }; - "markup.list" = "base08"; - "markup.quote" = "base0C"; - "markup.raw" = "base0B"; - "markup.strikethrough" = {modifiers = ["crossed_out"];}; - "namespace" = "base0E"; - "operator" = "base05"; - "special" = "base0D"; - "string" = "base0B"; - "type" = "base0A"; - "ui.background" = {bg = "base00";}; - "ui.bufferline" = { - fg = "base04"; - bg = "base00"; - }; - "ui.bufferline.active" = { - fg = "base00"; - bg = "base03"; - modifiers = ["bold"]; - }; - "ui.cursor" = { - fg = "base04"; - modifiers = ["reversed"]; - }; - "ui.cursor.insert" = { - fg = "base0A"; - modifiers = ["underlined"]; - }; - "ui.cursor.match" = { - fg = "base0A"; - modifiers = ["underlined"]; - }; - "ui.cursor.select" = { - fg = "base0A"; - modifiers = ["underlined"]; - }; - "ui.cursorline.primary" = { - fg = "base05"; - bg = "base01"; - }; - "ui.gutter" = {bg = "base00";}; - "ui.help" = { - fg = "base06"; - bg = "base01"; - }; - "ui.linenr" = { - fg = "base03"; - bg = "base00"; - }; - "ui.linenr.selected" = { - fg = "base04"; - bg = "base01"; - modifiers = ["bold"]; - }; - "ui.menu" = { - fg = "base05"; - bg = "base01"; - }; - "ui.menu.scroll" = { - fg = "base03"; - bg = "base01"; - }; - "ui.menu.selected" = { - fg = "base01"; - bg = "base04"; - }; - "ui.popup" = {bg = "base01";}; - "ui.selection" = {bg = "base02";}; - "ui.selection.primary" = {bg = "base02";}; - "ui.statusline" = { - fg = "base0B"; - bg = "base02"; - }; - "ui.statusline.inactive" = { - bg = "base01"; - fg = "base02"; - }; - "ui.statusline.insert" = { - fg = "base00"; - bg = "base0B"; - }; - "ui.statusline.normal" = { - fg = "base00"; - bg = "base04"; - }; - "ui.statusline.select" = { - fg = "base00"; - bg = "base0E"; - }; - "ui.text" = "base05"; - "ui.text.focus" = "base05"; - "ui.virtual.indent-guide" = {fg = "base03";}; - "ui.virtual.ruler" = {bg = "base01";}; - "ui.virtual.whitespace" = {fg = "base01";}; - "ui.window" = {bg = "base01";}; - "variable" = "base08"; - "variable.other.member" = "base08"; - "warning" = "base09"; - }; -} diff --git a/home/modules/console/multiplexer/tmux/default.nix b/home/modules/console/multiplexer/tmux/default.nix index 95e295d..8462e51 100644 --- a/home/modules/console/multiplexer/tmux/default.nix +++ b/home/modules/console/multiplexer/tmux/default.nix @@ -1,13 +1,14 @@ { config, + osConfig, lib, pkgs, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance.colorscheme) palette; + inherit (config.ooknet) console; inherit (lib) mkIf; cfg = config.ooknet.multiplexer.tmux; - console = config.ooknet.console; in { config = mkIf (cfg.enable || console.multiplexer == "tmux") { programs.tmux = { diff --git a/home/modules/console/multiplexer/zellij/default.nix b/home/modules/console/multiplexer/zellij/default.nix index 28cea32..2395229 100644 --- a/home/modules/console/multiplexer/zellij/default.nix +++ b/home/modules/console/multiplexer/zellij/default.nix @@ -5,23 +5,23 @@ pkgs, ... }: let - inherit (config.colorscheme) palette; - inherit (lib) mkIf; + inherit (osConfig.ooknet.appearance.colorscheme) slug palette; inherit (config.ooknet) console; inherit (osConfig.ooknet.host) admin; + inherit (lib) mkIf; cfg = config.ooknet.multiplexer.zellij; in { config = mkIf (cfg.enable || console.multiplexer == "zellij") { programs.zellij = { enable = true; settings = { - theme = "${config.colorscheme.slug}"; + theme = "${slug}"; default_shell = "${admin.shell}"; default_layout = "default"; pane_frames = false; scrollback_editor = "${console.editor}"; themes = { - "${config.colorscheme.slug}" = { + "${slug}" = { fg = "#${palette.base05}"; bg = "#${palette.base00}"; black = "#${palette.base00}"; @@ -41,11 +41,11 @@ in { # Layouts xdg.configFile = { # Default layout - "zellij/layouts/default.kdl" = import ./layouts/defaultLayout.nix {inherit pkgs config;}; + "zellij/layouts/default.kdl" = import ./layouts/defaultLayout.nix {inherit pkgs config osConfig;}; # Layout for bash scripts - "zellij/layouts/script.kdl" = import ./layouts/scriptLayout.nix {inherit pkgs config;}; + "zellij/layouts/script.kdl" = import ./layouts/scriptLayout.nix {inherit pkgs config osConfig;}; # Layout for configuring my flake - "zellij/layouts/flake.kdl" = import ./layouts/flakeLayout.nix {inherit pkgs config;}; + "zellij/layouts/flake.kdl" = import ./layouts/flakeLayout.nix {inherit pkgs config osConfig;}; # Additional keybinds "zellij/config.kdl".text = # kdl diff --git a/home/modules/console/multiplexer/zellij/layouts/defaultLayout.nix b/home/modules/console/multiplexer/zellij/layouts/defaultLayout.nix index c216f7b..3755376 100644 --- a/home/modules/console/multiplexer/zellij/layouts/defaultLayout.nix +++ b/home/modules/console/multiplexer/zellij/layouts/defaultLayout.nix @@ -1,14 +1,13 @@ { pkgs, + osConfig, config, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance.colorscheme) palette; in { text = - /* - kdl - */ + # kdl '' layout { default_tab_template { @@ -51,7 +50,7 @@ in { datetime "#[fg=#${palette.base05},bold] {format} " datetime_format "%I:%M %p" - datetime_timezone "${config.home.sessionVariables.TZ}" + datetime_timezone "${osConfig.time.timeZone}" } } children diff --git a/home/modules/console/multiplexer/zellij/layouts/flakeLayout.nix b/home/modules/console/multiplexer/zellij/layouts/flakeLayout.nix index 438d145..565ba13 100644 --- a/home/modules/console/multiplexer/zellij/layouts/flakeLayout.nix +++ b/home/modules/console/multiplexer/zellij/layouts/flakeLayout.nix @@ -1,9 +1,9 @@ { pkgs, - config, + osConfig, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance.colorscheme) palette; in { text = /* @@ -51,7 +51,7 @@ in { datetime "#[fg=#${palette.base05},bold] {format} " datetime_format "%I:%M %p" - datetime_timezone "${config.home.sessionVariables.TZ}" + datetime_timezone "${osConfig.time.timeZone}" } } children diff --git a/home/modules/console/multiplexer/zellij/layouts/scriptLayout.nix b/home/modules/console/multiplexer/zellij/layouts/scriptLayout.nix index f31dec9..a1c7e9a 100644 --- a/home/modules/console/multiplexer/zellij/layouts/scriptLayout.nix +++ b/home/modules/console/multiplexer/zellij/layouts/scriptLayout.nix @@ -1,9 +1,9 @@ { pkgs, - config, + osConfig, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance.colorscheme) palette; in { text = /* @@ -51,7 +51,7 @@ in { datetime "#[fg=#${palette.base05},bold] {format} " datetime_format "%I:%M %p" - datetime_timezone "${config.home.sessionVariables.TZ}" + datetime_timezone "${osConfig.time.timeZone}" } } children diff --git a/home/modules/desktop/browser/firefox/default.nix b/home/modules/desktop/browser/firefox/default.nix index cc395d7..c68ae5d 100644 --- a/home/modules/desktop/browser/firefox/default.nix +++ b/home/modules/desktop/browser/firefox/default.nix @@ -7,13 +7,13 @@ ... }: let inherit (lib) mkIf mkMerge; - fonts = config.ooknet.fonts; - palette = config.colorscheme.palette; + inherit (osConfig.ooknet.host) admin; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet.desktop) browser; addons = inputs.firefox-addons.packages.${pkgs.system}; cfg = config.ooknet.browser.firefox; - browser = config.ooknet.desktop.browser; - admin = osConfig.ooknet.host.admin; firefoxMime = { "text/html" = ["firefox.desktop"]; "x-scheme-handler/http" = ["firefox.desktop"]; diff --git a/home/modules/desktop/browser/firefox/theme/ooksfox.nix b/home/modules/desktop/browser/firefox/theme/ooksfox.nix index b0e7ebd..1a05b6b 100644 --- a/home/modules/desktop/browser/firefox/theme/ooksfox.nix +++ b/home/modules/desktop/browser/firefox/theme/ooksfox.nix @@ -2,7 +2,9 @@ palette, fonts, ... -}: '' +}: +# css +'' /* minimal firefox css ooks */ /* ===== Color Variables and Root Styles ===== */ @@ -106,8 +108,7 @@ } /* Expand navigation bar on focus */ - #nav-bar:focus-within, - #nav-bar:hover { + #nav-bar:focus-within { opacity: 1; max-height: 40px !important; height: 60px !important; diff --git a/home/modules/desktop/browser/firefox/tridactyl.nix b/home/modules/desktop/browser/firefox/tridactyl.nix index 74adb86..cb4787c 100644 --- a/home/modules/desktop/browser/firefox/tridactyl.nix +++ b/home/modules/desktop/browser/firefox/tridactyl.nix @@ -1,14 +1,14 @@ { lib, config, + osConfig, ... }: let inherit (lib) mkIf; - inherit (config.colorscheme) palette; - + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet.desktop) browser; cfg = config.ooknet.browser.firefox; - browser = config.ooknet.desktop.browser; - fonts = config.ooknet.fonts; in { config = mkIf (browser == "firefox" || cfg.enable) { xdg.configFile = { diff --git a/home/modules/desktop/communication/discord/vesktop.nix b/home/modules/desktop/communication/discord/vesktop.nix index aac48e4..b894b10 100644 --- a/home/modules/desktop/communication/discord/vesktop.nix +++ b/home/modules/desktop/communication/discord/vesktop.nix @@ -1,18 +1,17 @@ { config, + osConfig, lib, pkgs, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet.desktop) discord; inherit (lib) mkIf mkMerge; cfg = config.ooknet.communication.discord; - discord = config.ooknet.desktop.discord; - fonts = config.ooknet.fonts; - vesktopMime = { - "x-scheme-handler/discord" = ["vesktop.desktop"]; - }; + vesktopMime = {"x-scheme-handler/discord" = ["vesktop.desktop"];}; in { config = mkMerge [ (mkIf (cfg.enable || discord == "vesktop") { diff --git a/home/modules/desktop/media/music/tui.nix b/home/modules/desktop/media/music/tui.nix index 10c1c7a..820775e 100644 --- a/home/modules/desktop/media/music/tui.nix +++ b/home/modules/desktop/media/music/tui.nix @@ -5,13 +5,13 @@ lib, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance.colorscheme) palette; + inherit (osConfig.networking) hostName; + inherit (config.ooknet.multiplexer) zellij; + inherit (config.ooknet.console) multiplexer; + inherit (config.ooknet) binds; inherit (lib) mkIf getExe; - cfg = config.ooknet.media.music.tui; - zellij = config.ooknet.multiplexer.zellij; - multiplexer = config.ooknet.console.multiplexer; - hostName = osConfig.networking.hostName; in { config = mkIf cfg.enable { home.packages = with pkgs; [ @@ -22,7 +22,7 @@ in { ]; ooknet.binds.spotify = { - launch = "${config.ooknet.binds.terminalLaunch} spotify_player"; + launch = "${binds.terminalLaunch} spotify_player"; next = "spotify_player playback next"; previous = "spotify_player playback previous"; play = "spotify_player playback play-pause"; diff --git a/home/modules/desktop/productivity/pdf/zathura.nix b/home/modules/desktop/productivity/pdf/zathura.nix index 60c8e73..76dc48a 100644 --- a/home/modules/desktop/productivity/pdf/zathura.nix +++ b/home/modules/desktop/productivity/pdf/zathura.nix @@ -1,15 +1,16 @@ { lib, config, + osConfig, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance.colorscheme) palette; + inherit (osConfig.ooknet.appearance) fonts; + inherit (config.ooknet.desktop) pdf; inherit (lib) mkIf; zathura = {"application/pdf" = ["org.pwmt.zathura.desktop"];}; cfg = config.ooknet.productivity.pdf.zathura; - pdf = config.ooknet.desktop.pdf; - fonts = config.ooknet.fonts; in { config = mkIf (cfg.enable || pdf == "zathura") { programs.zathura = { diff --git a/home/modules/desktop/terminal/foot.nix b/home/modules/desktop/terminal/foot.nix index 564cef9..624227a 100644 --- a/home/modules/desktop/terminal/foot.nix +++ b/home/modules/desktop/terminal/foot.nix @@ -1,13 +1,14 @@ { config, + osConfig, lib, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet) desktop; inherit (lib) mkMerge mkIf; - fonts = config.ooknet.fonts; cfg = config.ooknet.terminal.foot; - desktop = config.ooknet.desktop; in { config = mkMerge [ (mkIf (cfg.enable || desktop.terminal == "foot") { diff --git a/home/modules/desktop/terminal/kitty.nix b/home/modules/desktop/terminal/kitty.nix index b160cc4..328e1e6 100644 --- a/home/modules/desktop/terminal/kitty.nix +++ b/home/modules/desktop/terminal/kitty.nix @@ -5,11 +5,12 @@ ... }: let inherit (lib) mkIf; - inherit (config.colorscheme) palette; - fonts = config.ooknet.fonts; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet) host desktop; + inherit (desktop) terminal; + inherit (host.admin) shell; cfg = config.ooknet.terminal.kitty; - terminal = config.ooknet.desktop.terminal; - shell = osConfig.ooknet.host.admin.shell; in { config = mkIf (cfg.enable || terminal == "kitty") { home.sessionVariables = mkIf (terminal == "kitty") { diff --git a/home/modules/desktop/wayland/bar/waybar/default.nix b/home/modules/desktop/wayland/bar/waybar/default.nix index db4fd0e..afcddbc 100644 --- a/home/modules/desktop/wayland/bar/waybar/default.nix +++ b/home/modules/desktop/wayland/bar/waybar/default.nix @@ -5,11 +5,13 @@ osConfig, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + + inherit (osConfig.ooknet.host.hardware) monitors; + + inherit (config.ooknet) wayland; inherit (lib) mkIf head; - fonts = config.ooknet.fonts; - wayland = config.ooknet.wayland; - monitors = osConfig.ooknet.host.hardware.monitors; monitorWidth = (head monitors).width - 20; in { config = mkIf (wayland.bar == "waybar") { diff --git a/home/modules/desktop/wayland/compositor/hyprland/settings/appearance.nix b/home/modules/desktop/wayland/compositor/hyprland/settings/appearance.nix index 8073ed5..3ecd897 100644 --- a/home/modules/desktop/wayland/compositor/hyprland/settings/appearance.nix +++ b/home/modules/desktop/wayland/compositor/hyprland/settings/appearance.nix @@ -1,11 +1,12 @@ { config, + osConfig, lib, ... }: let - wayland = config.ooknet.wayland; - pointer = config.home.pointerCursor; - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) colorscheme cursor; + inherit (colorscheme) palette; + inherit (config.ooknet) wayland; inherit (lib) mkIf; in { config = mkIf (wayland.compositor == "hyprland") { @@ -23,7 +24,7 @@ in { }; exec-once = [ - "hyprctl setcursor ${pointer.name} ${toString pointer.size}" + "hyprctl setcursor ${cursor.name} ${toString cursor.size}" ]; decoration = { diff --git a/home/modules/desktop/wayland/compositor/hyprland/settings/hyprpaper.nix b/home/modules/desktop/wayland/compositor/hyprland/settings/hyprpaper.nix index 9c9bd6c..f6807b9 100644 --- a/home/modules/desktop/wayland/compositor/hyprland/settings/hyprpaper.nix +++ b/home/modules/desktop/wayland/compositor/hyprland/settings/hyprpaper.nix @@ -1,11 +1,12 @@ { lib, config, + osConfig, ... }: let inherit (lib) mkIf; - wayland = config.ooknet.wayland; - wallpaperPath = config.ooknet.wallpaper.path; + inherit (config.ooknet) wayland; + wallpaperPath = osConfig.ooknet.appearance.wallpaper.path; in { config = mkIf (wayland.compositor == "hyprland") { services.hyprpaper = { diff --git a/home/modules/desktop/wayland/launcher/rofi.nix b/home/modules/desktop/wayland/launcher/rofi.nix index 2493264..2d74b79 100644 --- a/home/modules/desktop/wayland/launcher/rofi.nix +++ b/home/modules/desktop/wayland/launcher/rofi.nix @@ -1,12 +1,15 @@ { lib, config, + osConfig, pkgs, ... }: let inherit (lib) mkIf; - fonts = config.ooknet.fonts; - wayland = config.ooknet.wayland; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet) wayland; + inherit (config.lib.formats.rasi) mkLiteral; in { config = mkIf (wayland.launcher == "rofi") { programs.rofi = { @@ -14,10 +17,7 @@ in { font = "${fonts.monospace.family}"; package = pkgs.rofi-wayland; terminal = "${config.home.sessionVariables.TERMINAL}"; - theme = let - inherit (config.colorscheme) palette; - inherit (config.lib.formats.rasi) mkLiteral; - in { + theme = { "*" = { background = mkLiteral "#${palette.base00}"; foreground = mkLiteral "#${palette.base05}"; diff --git a/home/modules/desktop/wayland/launcher/tofi.nix b/home/modules/desktop/wayland/launcher/tofi.nix index 0d11804..bfc81c6 100644 --- a/home/modules/desktop/wayland/launcher/tofi.nix +++ b/home/modules/desktop/wayland/launcher/tofi.nix @@ -1,13 +1,14 @@ { lib, config, + osConfig, pkgs, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet) wayland; inherit (lib) mkIf; - wayland = config.ooknet.wayland; - fonts = config.ooknet.fonts; in { config = mkIf (wayland.launcher == "tofi") { home.packages = [pkgs.tofi]; diff --git a/home/modules/desktop/wayland/lockscreen/hyprlock.nix b/home/modules/desktop/wayland/lockscreen/hyprlock.nix index b06f43a..7bb2312 100644 --- a/home/modules/desktop/wayland/lockscreen/hyprlock.nix +++ b/home/modules/desktop/wayland/lockscreen/hyprlock.nix @@ -1,12 +1,13 @@ { lib, config, + osConfig, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet) wayland; inherit (lib) mkIf; - wayland = config.ooknet.wayland; - fonts = config.ooknet.fonts; in { config = mkIf (wayland.locker == "hyprlock") { ooknet.binds.lock = "hyprlock"; diff --git a/home/modules/desktop/wayland/lockscreen/swaylock.nix b/home/modules/desktop/wayland/lockscreen/swaylock.nix index bf6970c..4f46663 100644 --- a/home/modules/desktop/wayland/lockscreen/swaylock.nix +++ b/home/modules/desktop/wayland/lockscreen/swaylock.nix @@ -1,20 +1,20 @@ { config, + osConfig, lib, ... }: let - inherit (config.colorscheme) palette; + inherit (osConfig.ooknet.appearance) wallpaper colorscheme fonts; + inherit (colorscheme) palette; + inherit (config.ooknet) wayland; inherit (lib) mkIf; - fonts = config.ooknet.fonts; - wallpaperPath = config.ooknet.wallpaper.path; - wayland = config.ooknet.wayland; in { config = mkIf (wayland.locker == "swaylock") { ooknet.binds.lock = "swaylock"; programs.swaylock = { enable = true; settings = { - image = "${wallpaperPath}"; + image = "${wallpaper.path}"; font = fonts.monospace.family; color = "#${palette.base01}"; ring-color = "#${palette.base02}"; diff --git a/home/modules/desktop/wayland/notification/mako.nix b/home/modules/desktop/wayland/notification/mako.nix index c85e2a9..350b3af 100644 --- a/home/modules/desktop/wayland/notification/mako.nix +++ b/home/modules/desktop/wayland/notification/mako.nix @@ -1,20 +1,21 @@ { config, + osConfig, lib, ... }: let - inherit (config.colorscheme) palette variant; + inherit (osConfig.ooknet.appearance) colorscheme fonts; + inherit (colorscheme) palette variant; + inherit (config.ooknet) wayland; inherit (lib) mkIf; - fonts = config.ooknet.fonts; - wayland = config.ooknet.wayland; in { config = mkIf (wayland.notification == "mako") { services.mako = { enable = true; - iconPath = - if variant == "dark" - then "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark" - else "${config.gtk.iconTheme.package}/share/icons/Papirus-Light"; + #iconPath = + # #if variant == "dark" + # #then "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark" + # #else "${config.gtk.iconTheme.package}/share/icons/Papirus-Light"; font = "${fonts.regular.family} 12"; padding = "10,10"; anchor = "top-right"; diff --git a/home/options/appearance/cursor.nix b/home/options/appearance/cursor.nix deleted file mode 100644 index 56af79d..0000000 --- a/home/options/appearance/cursor.nix +++ /dev/null @@ -1,25 +0,0 @@ -{lib, ...}: let - inherit (lib) mkEnableOption mkOption types; -in { - options.ooknet.cursor = { - enable = mkEnableOption "Enable cursor module"; - package = mkOption { - type = types.package; - default = null; - description = "Package for cursor"; - example = "pkgs.bibata-cursors"; - }; - name = mkOption { - type = types.str; - default = ""; - description = "Name of cursor"; - example = "Bibata-Modern-Ice"; - }; - size = lib.mkOption { - type = types.int; - default = 22; - description = "Size of cursor"; - example = "22"; - }; - }; -} diff --git a/home/options/appearance/default.nix b/home/options/appearance/default.nix index 9a933de..4b6902f 100644 --- a/home/options/appearance/default.nix +++ b/home/options/appearance/default.nix @@ -1,10 +1,6 @@ { imports = [ - ./cursor.nix - ./fonts.nix ./gtk.nix ./qt.nix - ./theme.nix - ./wallpaper.nix ]; } diff --git a/home/options/appearance/fonts.nix b/home/options/appearance/fonts.nix deleted file mode 100644 index e5ac475..0000000 --- a/home/options/appearance/fonts.nix +++ /dev/null @@ -1,22 +0,0 @@ -{lib, ...}: let - mkFontOption = kind: { - family = lib.mkOption { - type = lib.types.str; - default = ""; - description = "Family name for ${kind} font profile"; - example = "Fira Code"; - }; - package = lib.mkOption { - type = lib.types.package; - default = null; - description = "Package for ${kind} font profile"; - example = "pkgs.fira-code"; - }; - }; -in { - options.ooknet.fonts = { - enable = lib.mkEnableOption "Whether to enable font profiles"; - monospace = mkFontOption "monospace"; - regular = mkFontOption "regular"; - }; -} diff --git a/home/options/appearance/theme.nix b/home/options/appearance/theme.nix deleted file mode 100644 index b03c69d..0000000 --- a/home/options/appearance/theme.nix +++ /dev/null @@ -1,9 +0,0 @@ -{lib, ...}: let - inherit (lib) mkOption; - inherit (lib.types) nullOr enum; -in { - options.ooknet.theme = mkOption { - type = nullOr (enum ["minimal" "phone"]); - default = null; - }; -} diff --git a/home/options/appearance/wallpaper.nix b/home/options/appearance/wallpaper.nix deleted file mode 100644 index 73ee232..0000000 --- a/home/options/appearance/wallpaper.nix +++ /dev/null @@ -1,12 +0,0 @@ -{lib, ...}: let - inherit (lib) types mkEnableOption mkOption; -in { - options.ooknet.wallpaper = { - enable = mkEnableOption ""; - path = mkOption { - type = types.path; - default = null; - description = "Wallpaper Path"; - }; - }; -} diff --git a/home/profiles/themes/default.nix b/home/profiles/themes/default.nix index a5310d5..a8b9a0c 100644 --- a/home/profiles/themes/default.nix +++ b/home/profiles/themes/default.nix @@ -1,6 +1,5 @@ { imports = [ - ./minimal.nix # ./phone.nix ]; } diff --git a/home/profiles/themes/minimal.nix b/home/profiles/themes/minimal.nix index 2dfa068..c5351e3 100644 --- a/home/profiles/themes/minimal.nix +++ b/home/profiles/themes/minimal.nix @@ -5,7 +5,6 @@ inputs, ... }: let - inherit (inputs.nix-colors) colorSchemes; inherit (lib) mkIf; theme = config.ooknet.theme; in { diff --git a/home/roles/ooks-desktop-workstation.nix b/home/roles/ooks-desktop-workstation.nix index 7bfb09a..2552094 100644 --- a/home/roles/ooks-desktop-workstation.nix +++ b/home/roles/ooks-desktop-workstation.nix @@ -8,7 +8,6 @@ in { config = mkIf (host.admin.name == "ooks" && host.type == "desktop" && host.role == "workstation") { ooknet = { - theme = "minimal"; desktop = { environment = "hyprland"; browser = "firefox"; diff --git a/home/roles/ooks-laptop-workstation.nix b/home/roles/ooks-laptop-workstation.nix index 66f2291..9576792 100644 --- a/home/roles/ooks-laptop-workstation.nix +++ b/home/roles/ooks-laptop-workstation.nix @@ -8,7 +8,6 @@ in { config = mkIf (host.admin.name == "ooks" && host.type == "laptop" && host.role == "workstation") { ooknet = { - theme = "minimal"; desktop = { environment = "hyprland"; browser = "firefox"; diff --git a/home/roles/ooks-micro-workstation.nix b/home/roles/ooks-micro-workstation.nix index 3d64c86..cc6f78a 100644 --- a/home/roles/ooks-micro-workstation.nix +++ b/home/roles/ooks-micro-workstation.nix @@ -8,7 +8,6 @@ in { config = mkIf (host.admin.name == "ooks" && host.type == "micro" && host.role == "workstation") { ooknet = { - theme = "minimal"; desktop = { environment = "hyprland"; browser = "firefox"; diff --git a/hosts/ooksmicro/default.nix b/hosts/ooksmicro/default.nix index e8d2688..c8b1a05 100644 --- a/hosts/ooksmicro/default.nix +++ b/hosts/ooksmicro/default.nix @@ -11,7 +11,7 @@ in { ooknet.host = { name = "ooksmicro"; - type = "micro"; + type = "laptop"; role = "workstation"; profiles = ["console-tools"]; admin = { diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 204ae88..9bbf800 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -5,5 +5,6 @@ ./host ./programs ./services + ./theme ]; } diff --git a/nixos/modules/theme/default.nix b/nixos/modules/theme/default.nix new file mode 100644 index 0000000..a153a13 --- /dev/null +++ b/nixos/modules/theme/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./minimal.nix + ]; +} diff --git a/nixos/modules/theme/generatedWallpaper.nix b/nixos/modules/theme/generatedWallpaper.nix new file mode 100644 index 0000000..ee6b5f1 --- /dev/null +++ b/nixos/modules/theme/generatedWallpaper.nix @@ -0,0 +1,49 @@ +{ + pkgs, + config, +}: let + inherit (config.ooknet.host.hardware) monitors; + inherit (config.ooknet.appearance) colorscheme; + largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs)); + largestWidth = largest (x: x.width) monitors; + largestHeight = largest (x: x.height) monitors; +in + { + width ? largestWidth, + height ? largestHeight, + logoScale ? 4, + backgroundColor ? colorscheme.palette.mantle, + logoColor1 ? colorscheme.palette.yellow, + logoColor2 ? colorscheme.palette.green, + }: + pkgs.stdenv.mkDerivation { + name = "generated-nix-wallpaper-${colorscheme.slug}.png"; + src = pkgs.writeTextFile { + name = "template.svg"; + text = '' + + + + + + + + + + + + ''; + }; + buildInputs = [pkgs.inkscape]; + unpackPhase = "true"; + buildPhase = '' + inkscape --export-type="png" $src -w ${toString width} -h ${toString height} -o wallpaper.png + ''; + installPhase = "install -Dm0644 wallpaper.png $out"; + } diff --git a/nixos/modules/theme/minimal.nix b/nixos/modules/theme/minimal.nix new file mode 100644 index 0000000..9adfa5e --- /dev/null +++ b/nixos/modules/theme/minimal.nix @@ -0,0 +1,41 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf; + inherit (config.ooknet.appearance) theme; + + generatedWallpaper = import ./generatedWallpaper.nix {inherit config pkgs;} {}; +in { + config = mkIf (theme == "minimal") { + ooknet.appearance = { + fonts = { + monospace = { + family = "JetBrainsMono Nerd Font"; + package = pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];}; + }; + regular = { + family = "Fira Sans"; + package = pkgs.fira; + }; + }; + + cursor = { + name = "Bibata-Modern-Ice"; + package = pkgs.bibata-cursors; + size = 22; + }; + + wallpaper = { + path = "${generatedWallpaper}"; + }; + + colorscheme = { + name = "hozen"; + variant = "dark"; + }; + }; + }; +} diff --git a/nixos/options/appearance/colors.nix b/nixos/options/appearance/colors.nix new file mode 100644 index 0000000..6ad26aa --- /dev/null +++ b/nixos/options/appearance/colors.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkOption; + inherit (lib.types) str enum attrsOf; + + cfg = config.ooknet.colorscheme; +in { + # simple colorscheme module bases on misterio77/nix-colors + options.ooknet.colorscheme = { + name = mkOption { + type = enum ["hozen"]; + default = "hozen"; + }; + variant = mkOption { + type = enum ["dark" "light"]; + default = "dark"; + }; + slug = mkOption { + type = str; + default = "${toString cfg.name-cfg.variant}"; + }; + palette = { + type = attrsOf str; + default = (import ./palettes/${cfg.slug}.nix).colorscheme.palette; + }; + }; +} diff --git a/nixos/options/appearance/default.nix b/nixos/options/appearance/default.nix new file mode 100644 index 0000000..70d25c2 --- /dev/null +++ b/nixos/options/appearance/default.nix @@ -0,0 +1,77 @@ +{ + config, + lib, + ... +}: let + inherit (lib) isString hasPrefix removePrefix mkOption mkOptionType; + inherit (lib.types) enum str nullOr package path int attrsOf coercedTo; + hexColorType = mkOptionType { + name = "hex-color"; + descriptionClass = "noun"; + description = "RGB color in hex format"; + check = x: isString x && !(hasPrefix "#" x); + }; + + mkFontOption = { + family = mkOption { + type = str; + default = ""; + }; + package = mkOption { + type = package; + default = null; + }; + }; + + cfg = config.ooknet.appearance; +in { + imports = [./palettes]; + options.ooknet.appearance = { + theme = mkOption { + type = nullOr (enum ["minimal" "phone"]); + default = null; + }; + fonts = { + monospace = mkFontOption; + regular = mkFontOption; + }; + wallpaper = { + path = mkOption { + type = path; + default = null; + }; + }; + cursor = { + package = mkOption { + type = package; + default = null; + }; + name = mkOption { + type = str; + default = ""; + }; + size = mkOption { + type = int; + default = 22; + }; + }; + colorscheme = { + name = mkOption { + type = enum ["hozen"]; + default = "hozen"; + }; + variant = mkOption { + type = enum ["dark" "light"]; + default = "dark"; + }; + slug = mkOption { + type = str; + default = "${toString cfg.colorscheme.name}-${toString cfg.colorscheme.variant}"; + }; + palette = mkOption { + type = attrsOf (coercedTo str (removePrefix "#") hexColorType); + default = {}; + }; + }; + }; +} diff --git a/nixos/options/appearance/palettes/default.nix b/nixos/options/appearance/palettes/default.nix new file mode 100644 index 0000000..5b5a834 --- /dev/null +++ b/nixos/options/appearance/palettes/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./hozen-dark.nix]; +} diff --git a/nixos/options/appearance/palettes/hozen-dark.nix b/nixos/options/appearance/palettes/hozen-dark.nix new file mode 100644 index 0000000..a2f6492 --- /dev/null +++ b/nixos/options/appearance/palettes/hozen-dark.nix @@ -0,0 +1,57 @@ +{ + config, + lib, + ... +}: let + cfg = config.ooknet.appearance.colorscheme; + inherit (lib) mkIf; +in { + ooknet.appearance.colorscheme = mkIf (cfg.name == "hozen" && cfg.variant == "dark") { + palette = { + crust = "2b2927"; + mantle = "33312e"; + base = "3f3b37"; + surface-0 = "48423c"; + surface-1 = "534d46"; + surface-2 = "655c53"; + overlay-0 = "766b60"; + overlay-1 = "9c8c7c"; + overlay-2 = "ac9a86"; + subtext-0 = "bfaa92"; + subtext-1 = "c9b39c"; + text = "d2bda7"; + red = "cc6666"; + dull-red = "b87a7a"; + orange = "cc8566"; + dull-orange = "b88d7a"; + yellow = "ccad66"; + dull-yellow = "ada185"; + green = "a0cc66"; + dull-green = "9db87a"; + cyan = "85ad98"; + dull-cyan = "92a099"; + blue = "7A9EBB"; + dull-blue = "8a94a8"; + purple = "8166cc"; + dull-purple = "998aa8"; + + base00 = "2b2927"; + base01 = "33312e"; + base02 = "48423c"; + base03 = "534d46"; + base04 = "655c53"; + base05 = "c9B39C"; + base06 = "deccba"; + base07 = "e7d9cb"; + + base08 = "CC6666"; #red + base09 = "C28970"; #orange + base0A = "C2A970"; #yellow + base0B = "ACC270"; #green + base0C = "70C296"; #cyan + base0D = "7A9EB8"; #blue + base0E = "C982B0"; #purple + base0F = "B88D7A"; #dim-orange + }; + }; +} diff --git a/nixos/options/default.nix b/nixos/options/default.nix index b47f5c6..54c6f19 100644 --- a/nixos/options/default.nix +++ b/nixos/options/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./appearance ./gaming.nix ./host.nix ./programs.nix diff --git a/nixos/roles/desktop-workstation.nix b/nixos/roles/desktop-workstation.nix index 2b4916b..b85ac34 100644 --- a/nixos/roles/desktop-workstation.nix +++ b/nixos/roles/desktop-workstation.nix @@ -8,6 +8,7 @@ in { config = mkIf (host.type == "desktop" && host.role == "workstation") { ooknet = { + appearance.theme = "minimal"; services = { gnomeServices.enable = true; gvfs.enable = true; diff --git a/nixos/roles/laptop-workstation.nix b/nixos/roles/laptop-workstation.nix index c7c182a..52874f0 100644 --- a/nixos/roles/laptop-workstation.nix +++ b/nixos/roles/laptop-workstation.nix @@ -8,6 +8,7 @@ in { config = mkIf (host.type == "laptop" && host.role == "workstation") { ooknet = { + appearance.theme = "minimal"; services = { gnomeServices.enable = true; gvfs.enable = true;