From c7b32f0f3158eb9992e4e440cd55a365c749dc49 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 19 Dec 2024 19:56:45 -0600 Subject: [PATCH] feat: added themes and other stuff --- config/default.nix | 22 ++++++ config/themes/config/theme.nix | 31 ++++++++ config/themes/default.nix | 17 +++++ flake.lock | 84 ++++++++++----------- home/modules/nushell.nix | 4 + home/modules/starship/config/settings.nix | 60 ++++++++++++++- home/modules/starship/default.nix | 9 ++- home/modules/vscode/config/userSettings.nix | 10 ++- home/modules/vscode/default.nix | 3 +- home/modules/wezterm/config/extraConfig.nix | 9 ++- home/modules/wezterm/default.nix | 4 +- home/modules/yazi/config/keymap.nix | 12 +++ home/modules/yazi/default.nix | 1 + nixos/modules/environment.nix | 2 +- nixos/modules/fonts.nix | 19 ++++- nixos/modules/home-manager.nix | 2 +- nixos/modules/services/upRootNutrition.nix | 19 ++++- systems/desktop/config/networking.nix | 1 + 18 files changed, 248 insertions(+), 61 deletions(-) create mode 100755 config/themes/config/theme.nix create mode 100755 config/themes/default.nix create mode 100755 home/modules/yazi/config/keymap.nix diff --git a/config/default.nix b/config/default.nix index ada3aed..339520d 100755 --- a/config/default.nix +++ b/config/default.nix @@ -8,6 +8,9 @@ listType = lib.mkOption { type = lib.types.listOf lib.types.str; }; + attrList = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + }; numOptions = 20; @@ -83,6 +86,13 @@ // genOptions mountConfig "samba" // genOptions mountConfig "storage"; }; + + themesSubmodule = lib.types.submodule { + options = { + colors = attrList; + font = stringType; + }; + }; in { options = { services = lib.mkOption { @@ -122,11 +132,23 @@ in { }; }; }; + aesthetics = lib.mkOption { + type = lib.types.submodule { + options = + mkOptionsFromDir ./themes/config + // { + themes = lib.mkOption { + type = lib.types.attrsOf themesSubmodule; + }; + }; + }; + }; }; config = { people = import ./users; services = import ./instances; machines = import ./devices; + aesthetics = import ./themes; }; } diff --git a/config/themes/config/theme.nix b/config/themes/config/theme.nix new file mode 100755 index 0000000..9daa5bf --- /dev/null +++ b/config/themes/config/theme.nix @@ -0,0 +1,31 @@ +{themeFunctions}: { + colors = { + rosewater = "f4dbd6"; + flamingo = "f0c6c6"; + pink = "f5bde6"; + mauve = "c6a0f6"; + red = "ed8796"; + maroon = "ee99a0"; + peach = "f5a97f"; + yellow = "eed49f"; + green = "a6da95"; + teal = "8bd5ca"; + sky = "91d7e3"; + sapphire = "7dc4e4"; + blue = "8aadf4"; + lavender = "b7bdf8"; + text = "cad3f5"; + subtext1 = "b8c0e0"; + subtext0 = "a5adcb"; + overlay2 = "939ab7"; + overlay1 = "8087a2"; + overlay0 = "6e738d"; + surface2 = "5b6078"; + surface1 = "494d64"; + surface0 = "363a4f"; + base = "24273a"; + mantle = "1e2030"; + crust = "181926"; + }; + font = "MonaspiceRn Nerd Font"; +} diff --git a/config/themes/default.nix b/config/themes/default.nix new file mode 100755 index 0000000..87d77bc --- /dev/null +++ b/config/themes/default.nix @@ -0,0 +1,17 @@ +let + configPath = ./config; + + themeFunctions = { + dummy = []; + }; + + themes = builtins.listToAttrs (map (name: { + name = builtins.substring 0 (builtins.stringLength name - 4) name; + value = import (configPath + "/${name}") {inherit themeFunctions;}; + }) + (builtins.filter (name: + builtins.match ".*\\.nix$" name != null) (builtins.attrNames + (builtins.readDir configPath)))); +in { + themes = themes; +} diff --git a/flake.lock b/flake.lock index a00b2a6..dddea81 100755 --- a/flake.lock +++ b/flake.lock @@ -11,11 +11,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1733663126, - "narHash": "sha256-hsmuCRS1eCEL5/V06thNje/GVDcnogefkcrK3v1cTSk=", + "lastModified": 1734342536, + "narHash": "sha256-ofvzJJG/aW4GFlCx4AF+ZV2sSpQyTcna45XItu6SLf8=", "owner": "nix-community", "repo": "buildbot-nix", - "rev": "00b597260df14f06997f0ab86b3ba1610bb7e37c", + "rev": "8dc24d5432b02a44b34f42916676b60b62dd3478", "type": "github" }, "original": { @@ -124,11 +124,11 @@ ] }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", "type": "github" }, "original": { @@ -269,11 +269,11 @@ ] }, "locked": { - "lastModified": 1730903510, - "narHash": "sha256-mnynlrPeiW0nUQ8KGZHb3WyxAxA3Ye/BH8gMjdoKP6E=", + "lastModified": 1733333617, + "narHash": "sha256-nMMQXREGvLOLvUa0ByhYFdaL0Jov0t1wzLbKjr05P2w=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "b89ac4d66d618b915b1f0a408e2775fe3821d141", + "rev": "56f8ea8d502c87cf62444bec4ee04512e8ea24ea", "type": "github" }, "original": { @@ -289,11 +289,11 @@ ] }, "locked": { - "lastModified": 1734093295, - "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=", + "lastModified": 1734622215, + "narHash": "sha256-OOfI0XhSJGHblfdNDhfnn8QnZxng63rWk9eeJ2tCbiI=", "owner": "nix-community", "repo": "home-manager", - "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8", + "rev": "1395379a7a36e40f2a76e7b9936cc52950baa1be", "type": "github" }, "original": { @@ -349,11 +349,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1733751617, - "narHash": "sha256-+r65QeqajIQOL7BJ5ko+x7chjbReGyTKwgnocAsgUbU=", + "lastModified": 1734391563, + "narHash": "sha256-L2MTQEXOpXc5nWPWAKiOyugGl2MwIHIA3IztVNiTSfg=", "owner": "ngi-nix", "repo": "ngipkgs", - "rev": "1afffc1a1279fbbc15c9969e41e5b553c8ab6e4b", + "rev": "40be4af909abc7e0e11ab45b90f34c8f8714aa56", "type": "github" }, "original": { @@ -364,11 +364,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1733376361, - "narHash": "sha256-aLJxoTDDSqB+/3orsulE6/qdlX6MzDLIITLZqdgMpqo=", + "lastModified": 1734126203, + "narHash": "sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "929116e316068c7318c54eb4d827f7d9756d5e9c", + "rev": "71a6392e367b08525ee710a93af2e80083b5b3e2", "type": "github" }, "original": { @@ -380,11 +380,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1733384649, - "narHash": "sha256-K5DJ2LpPqht7K76bsxetI+YHhGGRyVteTPRQaIIKJpw=", + "lastModified": 1734202038, + "narHash": "sha256-LwcGIkORU8zfQ/8jAgptgPY8Zf9lGKB0vtNdQyEkaN8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "190c31a89e5eec80dd6604d7f9e5af3802a58a13", + "rev": "bcba2fbf6963bf6bed3a749f9f4cf5bff4adb96d", "type": "github" }, "original": { @@ -412,11 +412,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1733940404, - "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=", + "lastModified": 1734424634, + "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713", + "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "type": "github" }, "original": { @@ -435,11 +435,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1734161914, - "narHash": "sha256-ExfXU3QblJezWnfHSxKSe5k4zC08jfuNvwZxDOtKSOY=", + "lastModified": 1734656871, + "narHash": "sha256-SnAL5IMs8K35xrKJFBqVAHDomXTkveaXk7aftqglXcc=", "owner": "nix-community", "repo": "NUR", - "rev": "3a6a25e030e226a50877d6b9bd64f6743c4ebb0a", + "rev": "646b957d7d1d1aef1e5b0d59ecbe2661a56722d9", "type": "github" }, "original": { @@ -462,11 +462,11 @@ ] }, "locked": { - "lastModified": 1733665616, - "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", + "lastModified": 1734379367, + "narHash": "sha256-Keu8z5VgT5gnCF4pmB+g7XZFftHpfl4qOn7nqBcywdE=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", + "rev": "0bb4be58f21ff38fc3cdbd6c778eb67db97f0b99", "type": "github" }, "original": { @@ -485,11 +485,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1733665616, - "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", + "lastModified": 1734425854, + "narHash": "sha256-nzE5UbJ41aPEKf8R2ZFYtLkqPmF7EIUbNEdHMBLg0Ig=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", + "rev": "0ddd26d0925f618c3a5d85a4fa5eb1e23a09491d", "type": "github" }, "original": { @@ -583,11 +583,11 @@ ] }, "locked": { - "lastModified": 1733128155, - "narHash": "sha256-m6/qwJAJYcidGMEdLqjKzRIjapK4nUfMq7rDCTmZajc=", + "lastModified": 1733965552, + "narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c6134b6fff6bda95a1ac872a2a9d5f32e3c37856", + "rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004", "type": "github" }, "original": { @@ -603,11 +603,11 @@ ] }, "locked": { - "lastModified": 1733965552, - "narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=", + "lastModified": 1734546875, + "narHash": "sha256-6OvJbqQ6qPpNw3CA+W8Myo5aaLhIJY/nNFDk3zMXLfM=", "owner": "Mic92", "repo": "sops-nix", - "rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004", + "rev": "ed091321f4dd88afc28b5b4456e0a15bd8374b4d", "type": "github" }, "original": { @@ -670,11 +670,11 @@ ] }, "locked": { - "lastModified": 1730321837, - "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "lastModified": 1733761991, + "narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085", "type": "github" }, "original": { diff --git a/home/modules/nushell.nix b/home/modules/nushell.nix index 9811854..c0c2c77 100755 --- a/home/modules/nushell.nix +++ b/home/modules/nushell.nix @@ -4,5 +4,9 @@ configFile.text = '' $env.config = {show_banner: false} ''; + shellAliases = { + y = "yy"; + lg = "lazygit"; + }; }; } diff --git a/home/modules/starship/config/settings.nix b/home/modules/starship/config/settings.nix index cfeb2ab..3dc2ee9 100755 --- a/home/modules/starship/config/settings.nix +++ b/home/modules/starship/config/settings.nix @@ -1,9 +1,63 @@ { + flake, + lib, + ... +}: let + inherit (flake.config.aesthetics.themes.theme) colors; + makeColor = c: "#" + c; + makeStyle = bg: fg: "bg:" + bg + " fg:" + fg + " bold"; + surround = fg: text: "[](fg:" + makeColor colors.base + " bg:" + fg + ")" + "[█](fg:" + fg + ")" + text + "[█](fg:" + fg + ")"; +in { settings = { add_newline = false; - character = { - success_symbol = "[ ➜](bold #8bd5ca)"; - error_symbol = "[ ¬◇](bold #ee99a0)"; + character = let + makeChar = bg: c: surround (makeColor bg) ("[" + c + "](" + makeStyle (makeColor bg) (makeColor colors.crust) + ")"); + in { + error_symbol = makeChar colors.maroon "⊥"; + format = "$symbol"; + success_symbol = makeChar colors.teal "λ"; }; + cmd_duration = { + format = surround (makeColor colors.mauve) "[ $duration]($style)"; + min_time = 0; + show_milliseconds = true; + style = makeStyle (makeColor colors.mauve) (makeColor colors.crust); + }; + directory = { + format = surround (makeColor colors.blue) "[󰉋 $path]($style)[$read_only]($read_only_style)"; + read_only = "  "; + read_only_style = makeStyle (makeColor colors.blue) (makeColor colors.crust); + style = makeStyle (makeColor colors.blue) (makeColor colors.crust); + truncation_length = 1; + truncate_to_repo = false; + }; + git_branch = { + format = surround (makeColor colors.peach) "[$symbol $branch]($style)"; + style = makeStyle (makeColor colors.peach) (makeColor colors.crust); + symbol = ""; + }; + git_status = { + format = "[ \\[$all_status$ahead_behind\\]]($style)"; + style = makeStyle (makeColor colors.yellow) (makeColor colors.crust); + }; + hostname = { + format = surround (makeColor colors.sapphire) "[$ssh_symbol$hostname]($style)"; + ssh_symbol = "󰖟 "; + style = makeStyle (makeColor colors.sapphire) (makeColor colors.crust); + }; + pijul_channel = { + disabled = false; + format = surround (makeColor colors.peach) "[$symbol $channel]($style)"; + style = makeStyle (makeColor colors.peach) (makeColor colors.crust); + symbol = ""; + }; + format = lib.concatStrings [ + "$hostname" + "$directory" + "$pijul_channel" + "$git_branch" + "$cmd_duration" + "$character " + ]; }; } diff --git a/home/modules/starship/default.nix b/home/modules/starship/default.nix index 660fd98..820edb4 100755 --- a/home/modules/starship/default.nix +++ b/home/modules/starship/default.nix @@ -1,9 +1,16 @@ { + flake, + lib, + ... +}: { programs.starship = let configPath = ./config; in { enable = true; } - // (import (configPath + /settings.nix)); + // (import (configPath + /settings.nix) { + inherit flake; + inherit lib; + }); } diff --git a/home/modules/vscode/config/userSettings.nix b/home/modules/vscode/config/userSettings.nix index 1573ac7..7cc0249 100755 --- a/home/modules/vscode/config/userSettings.nix +++ b/home/modules/vscode/config/userSettings.nix @@ -1,8 +1,11 @@ { lib, pkgs, + flake, ... -}: { +}: let + inherit (flake.config.aesthetics.themes.theme) font; +in { userSettings = { "git.confirmSync" = false; "editor.insertSpaces" = false; @@ -20,5 +23,10 @@ "elmLS.disableElmLSDiagnostics" = true; "elmLS.elmReviewDiagnostics" = "warning"; "editor.wordWrap" = "on"; + "editor.fontSize" = 14; + "editor.fontFamily" = "'${font}', 'monospace', monospace"; + "terminal.integrated.fontSize" = 14; + "terminal.integrated.fontFamily" = "'${font}', 'monospace', monospace"; + "editor.fontLigatures" = true; }; } diff --git a/home/modules/vscode/default.nix b/home/modules/vscode/default.nix index 489c60d..d20922f 100755 --- a/home/modules/vscode/default.nix +++ b/home/modules/vscode/default.nix @@ -1,6 +1,7 @@ { pkgs, lib, + flake, ... }: { programs = { @@ -13,6 +14,6 @@ } // (import (configPath + /keybindings.nix)) // (import (configPath + /extensions.nix)) {inherit pkgs;} - // (import (configPath + /userSettings.nix)) {inherit pkgs lib;}; + // (import (configPath + /userSettings.nix)) {inherit pkgs lib flake;}; }; } diff --git a/home/modules/wezterm/config/extraConfig.nix b/home/modules/wezterm/config/extraConfig.nix index cd02910..8e23527 100755 --- a/home/modules/wezterm/config/extraConfig.nix +++ b/home/modules/wezterm/config/extraConfig.nix @@ -1,12 +1,15 @@ -{ +{flake, ...}: let + inherit (flake.config.aesthetics.themes.theme) font; +in { extraConfig = '' return { color_scheme = "Catppuccin Macchiato", - font_size = 10, + font_size = 11, + font = wezterm.font('${font}'), enable_tab_bar = false, window_close_confirmation = 'NeverPrompt', term = 'wezterm', - enable_wayland = false, + enable_wayland = true, front_end = "WebGpu", max_fps = 200 } diff --git a/home/modules/wezterm/default.nix b/home/modules/wezterm/default.nix index f5918a0..04445b1 100755 --- a/home/modules/wezterm/default.nix +++ b/home/modules/wezterm/default.nix @@ -1,9 +1,9 @@ -{ +{flake, ...}: { programs.wezterm = let configPath = ./config; in { enable = true; } - // (import (configPath + /extraConfig.nix)); + // (import (configPath + /extraConfig.nix) {inherit flake;}); } diff --git a/home/modules/yazi/config/keymap.nix b/home/modules/yazi/config/keymap.nix new file mode 100755 index 0000000..34df0cd --- /dev/null +++ b/home/modules/yazi/config/keymap.nix @@ -0,0 +1,12 @@ +{ + keymap.manager.prepend_keymap = [ + { + on = ["Q"]; + run = "quit"; + } + { + on = ["q"]; + run = "quit --no-cwd-file"; + } + ]; +} diff --git a/home/modules/yazi/default.nix b/home/modules/yazi/default.nix index 05ceeb4..bfa8b5f 100755 --- a/home/modules/yazi/default.nix +++ b/home/modules/yazi/default.nix @@ -6,6 +6,7 @@ enable = true; enableNushellIntegration = true; } + // (import (configPath + /keymap.nix)) // (import (configPath + /settings.nix)); # Keymap # https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/keymap.toml diff --git a/nixos/modules/environment.nix b/nixos/modules/environment.nix index 2d9d0a5..a17b46e 100755 --- a/nixos/modules/environment.nix +++ b/nixos/modules/environment.nix @@ -13,7 +13,7 @@ }; variables = { VIDEO_PLAYER = "vlc"; - EDITOR = "nano"; + EDITOR = "hx"; WLR_NO_HARDWARE_CURSORS = "1"; WLR_DRM_NO_ATOMIC = "1"; NIXPKGS_ALLOW_INSECURE = "1"; diff --git a/nixos/modules/fonts.nix b/nixos/modules/fonts.nix index f318963..784e8e5 100755 --- a/nixos/modules/fonts.nix +++ b/nixos/modules/fonts.nix @@ -1,11 +1,26 @@ {pkgs, ...}: { fonts = { - fontconfig.defaultFonts.emoji = ["Noto Fonts Color Emoji"]; + fontconfig = { + enable = true; + defaultFonts = { + # serif = []; + # monospace = []; + # sansSerif = []; + emoji = ["Noto Fonts Color Emoji"]; + }; + antialias = true; + }; packages = builtins.attrValues { inherit (pkgs) noto-fonts-color-emoji - open-dyslexic + ; + inherit + (pkgs.nerd-fonts) + jetbrains-mono + droid-sans-mono + victor-mono + monaspace ; }; }; diff --git a/nixos/modules/home-manager.nix b/nixos/modules/home-manager.nix index b482604..d046f9a 100755 --- a/nixos/modules/home-manager.nix +++ b/nixos/modules/home-manager.nix @@ -2,7 +2,7 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; - backupFileExtension = "backup"; + backupFileExtension = "backup2"; extraSpecialArgs = { inherit flake; }; diff --git a/nixos/modules/services/upRootNutrition.nix b/nixos/modules/services/upRootNutrition.nix index b7fb445..21be32d 100755 --- a/nixos/modules/services/upRootNutrition.nix +++ b/nixos/modules/services/upRootNutrition.nix @@ -14,12 +14,23 @@ in { virtualHosts = { "${host}" = { extraConfig = '' - redir /.well-known/carddav /remote.php/dav/ 301 - redir /.well-known/caldav /remote.php/dav/ 301 - reverse_proxy ${localhost}:${toString service.ports.port1} + root * /var/lib/website - tls ${service.ssl.cert} ${service.ssl.key} + file_server + + try_files {path} /index.html + encode gzip + + header { + # Disable FLoC tracking + Permissions-Policy interest-cohort=() + # Enable HSTS + Strict-Transport-Security "max-age=31536000; includeSubDomains" + # Prevent MIME-type sniffing + X-Content-Type-Options nosniff + + tls ${service.ssl.cert} ${service.ssl.key} ''; }; }; diff --git a/systems/desktop/config/networking.nix b/systems/desktop/config/networking.nix index 2013579..ecbd656 100755 --- a/systems/desktop/config/networking.nix +++ b/systems/desktop/config/networking.nix @@ -17,6 +17,7 @@ in { 4333 # Feishin 2234 # Soulseek 3131 # Deskreen + 1234 # Elm-land server 55473 ]; };