theme.nix (2751B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ## System Theming ## { config, inputs, ... }: let inherit (config.flake) files; in { flake.modules = { nixos.theme = { config, lib, pkgs, ... }: let cfg = config.gui; stl = config.stylix; inherit (cfg) enable; in { imports = [inputs.stylix.nixosModules.stylix]; options.gui = { enable = lib.mkEnableOption "Graphical Desktop Session"; fancy = lib.mkEnableOption "Enable Fancy GUI Effects"; display = lib.mkOption { description = "Main GUI Display"; type = lib.types.str; default = "eDP-1"; example = "HDMI-A-1"; }; wallpaper = lib.mkOption { type = lib.types.enum (lib.attrNames files.wallpapers); default = "Beauty"; apply = image: files.wallpapers."${image}"; }; }; config = { stylix = { inherit enable; autoEnable = true; homeManagerIntegration = { autoImport = true; followSystem = true; }; image = cfg.wallpaper; polarity = "dark"; icons = { enable = true; package = lib.mkDefault pkgs.papirus-icon-theme; light = "Papirus-Dark"; dark = "Papirus-Dark"; }; cursor = { name = "Bibata-Original-Classic"; package = pkgs.bibata-cursors; size = 28; }; opacity = { popups = 0.9; terminal = 0.9; }; targets = { console.enable = true; plymouth.enable = false; chromium.enable = false; }; }; home-manager.sharedModules = lib.optionals (!enable) [ config.stylix.homeManagerIntegration.module ]; environment.systemPackages = lib.optionals enable [ stl.icons.package stl.cursor.package ]; programs.gnupg.agent.pinentryPackage = pkgs.pinentry-gtk2; }; }; homeManager.theme = { config, lib, ... }: { options.gui._unmanaged = lib.mkOption { description = "Stylix targets handled manually"; type = lib.types.listOf lib.types.str; default = []; }; config.stylix = { enable = lib.mkDefault true; targets = lib.mkMerge [ { gnome.enable = lib.mkDefault false; firefox.enable = lib.mkDefault false; vscode.enable = lib.mkDefault false; obsidian.enable = lib.mkDefault false; } (lib.genAttrs (lib.unique config.gui._unmanaged) (_: {enable = false;})) ]; }; }; }; } |