From 0a387960a2c5e730a39cf7d160027528811dd0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Thu, 20 Feb 2025 22:01:03 -0300 Subject: [PATCH] treewide: cleanup config with enable options --- flake.nix | 32 +++++---- hosts/monolith/default.nix | 2 + settings/default.nix | 14 +++- system/android.nix | 17 +++++ system/boot.nix | 1 - system/configuration.nix | 32 +++------ system/containers.nix | 55 +++++++++------- system/gamemode.nix | 27 -------- system/gaming.nix | 63 ++++++++++++++++++ system/media-packages.nix | 4 +- system/network.nix | 13 +++- system/steam.nix | 36 ---------- user/dummy.nix | 8 +++ user/fish/default.nix | 5 +- user/fzf.nix | 8 +-- user/gaming.nix | 24 +++++++ user/helix.nix | 6 +- user/home.nix | 18 ++--- user/mangohud.nix | 132 +++++++++++++++++-------------------- user/mpd.nix | 7 +- user/pass.nix | 8 ++- user/sway/default.nix | 29 ++++---- user/sway/kanshi.nix | 20 ++---- user/sway/mako.nix | 84 ++++++++++++----------- user/sway/swayidle.nix | 15 ++--- user/sway/swaylock.nix | 20 ++---- user/waybar/default.nix | 6 +- user/zathura.nix | 92 +++++++++++++------------- 28 files changed, 420 insertions(+), 358 deletions(-) create mode 100644 system/android.nix delete mode 100644 system/gamemode.nix create mode 100644 system/gaming.nix delete mode 100644 system/steam.nix create mode 100644 user/dummy.nix create mode 100644 user/gaming.nix diff --git a/flake.nix b/flake.nix index 49c3192..0126f65 100644 --- a/flake.nix +++ b/flake.nix @@ -102,17 +102,25 @@ inputs.agenix.nixosModules.default inputs.home-manager.nixosModules.home-manager inputs.disko.nixosModules.disko - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.lelgenio = import ./user/home.nix; - home-manager.backupFileExtension = "bkp"; - # Optionally, use home-manager.extraSpecialArgs to pass - # arguments to home.nix - home-manager.extraSpecialArgs = { - inherit inputs; - }; - } + ( + { config, ... }: + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.lelgenio = { + my = config.my; + imports = [ + ./user/home.nix + ]; + }; + home-manager.backupFileExtension = "bkp"; + # Optionally, use home-manager.extraSpecialArgs to pass + # arguments to home.nix + home-manager.extraSpecialArgs = { + inherit inputs; + }; + } + ) ] ++ lib.optional (desktop == "gnome") ./system/gnome.nix ++ lib.optional (desktop == "kde") ./system/kde.nix; @@ -133,7 +141,6 @@ ./system/monolith-gitlab-runner.nix ./system/monolith-forgejo-runner.nix ./system/nix-serve.nix - ./system/steam.nix ] ++ common_modules; }; double-rainbow = lib.nixosSystem { @@ -151,7 +158,6 @@ ++ [ { packages.media-packages.enable = lib.mkOverride 0 false; - programs.steam.enable = lib.mkOverride 0 false; services.flatpak.enable = lib.mkOverride 0 false; } ]; diff --git a/hosts/monolith/default.nix b/hosts/monolith/default.nix index c3764fd..410300e 100644 --- a/hosts/monolith/default.nix +++ b/hosts/monolith/default.nix @@ -41,6 +41,8 @@ in package = pkgs.unstable.opentabletdriver; }; + my.gaming.enable = true; + boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ]; boot.initrd.kernelModules = [ "amdgpu" ]; diff --git a/settings/default.nix b/settings/default.nix index 2a2ca08..1cf90df 100644 --- a/settings/default.nix +++ b/settings/default.nix @@ -1,6 +1,18 @@ { lib, ... }: { options = { - my = lib.mkOption { }; + my = { + themes = lib.mkOption { }; + key = lib.mkOption { }; + theme = lib.mkOption { }; + accent = lib.mkOption { }; + font = lib.mkOption { }; + username = lib.mkOption { type = lib.types.str; }; + mail = lib.mkOption { }; + dmenu = lib.mkOption { type = lib.types.str; }; + desktop = lib.mkOption { type = lib.types.str; }; + browser = lib.mkOption { type = lib.types.str; }; + editor = lib.mkOption { type = lib.types.str; }; + }; }; } diff --git a/system/android.nix b/system/android.nix new file mode 100644 index 0000000..3cce4af --- /dev/null +++ b/system/android.nix @@ -0,0 +1,17 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + options.my.android.enable = lib.mkEnableOption { }; + + config = lib.mkIf config.my.android.enable { + # Open kde connect ports + programs.kdeconnect.enable = true; + + programs.adb.enable = true; + services.udev.packages = [ pkgs.android-udev-rules ]; + }; +} diff --git a/system/boot.nix b/system/boot.nix index fa1ed8d..3e0151d 100644 --- a/system/boot.nix +++ b/system/boot.nix @@ -2,7 +2,6 @@ config, pkgs, lib, - inputs, ... }: { diff --git a/system/configuration.nix b/system/configuration.nix index f4bfabf..a227e36 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -1,15 +1,11 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - pkgs, - inputs, - ... -}: +{ pkgs, ... }: { imports = [ - ./gamemode.nix + ./android.nix + ./gaming.nix ./media-packages.nix ./boot.nix ./thunar.nix @@ -25,39 +21,27 @@ ../settings ]; - my = import ../user/variables.nix; + my = import ../user/variables.nix // { + android.enable = true; + media-packages.enable = true; + containers.enable = true; + }; zramSwap.enable = true; - programs.adb.enable = true; - services.udev.packages = [ pkgs.android-udev-rules ]; - # Enable touchpad support (enabled default in most desktopManager). services.libinput.enable = true; - packages.media-packages.enable = true; environment.systemPackages = with pkgs; [ pavucontrol glib # gsettings usbutils - # dracula-theme # gtk theme adwaita-icon-theme # default gnome cursors - - nix-output-monitor ]; services.geoclue2.enable = true; - # Workaround for nm-wait-online hanging?? - # Ref: https://github.com/NixOS/nixpkgs/issues/180175 - systemd.services.NetworkManager-wait-online = { - serviceConfig.ExecStart = [ - "" - "${pkgs.networkmanager}/bin/nm-online -q" - ]; - }; - systemd.extraConfig = '' DefaultTimeoutStopSec=10s ''; diff --git a/system/containers.nix b/system/containers.nix index 64383a6..9032a6c 100644 --- a/system/containers.nix +++ b/system/containers.nix @@ -1,30 +1,39 @@ -{ pkgs, lib, ... }: { - services.flatpak.enable = true; + pkgs, + lib, + config, + ... +}: +{ + options.my.containers.enable = lib.mkEnableOption { }; - virtualisation.docker = { - enable = true; - autoPrune = { + config = lib.mkIf config.my.containers.enable { + services.flatpak.enable = true; + + virtualisation.docker = { enable = true; - dates = "monthly"; - flags = [ - "--all" - "--volumes" - ]; - }; - daemon.settings = { - # needed by bitbucket runner ??? - log-driver = "json-file"; - log-opts = { - max-size = "10m"; - max-file = "3"; + autoPrune = { + enable = true; + dates = "monthly"; + flags = [ + "--all" + "--volumes" + ]; + }; + daemon.settings = { + # needed by bitbucket runner ??? + log-driver = "json-file"; + log-opts = { + max-size = "10m"; + max-file = "3"; + }; }; }; + + networking.firewall.extraCommands = lib.getExe pkgs._docker-block-external-connections; + + programs.extra-container.enable = true; + + programs.firejail.enable = true; }; - - networking.firewall.extraCommands = lib.getExe pkgs._docker-block-external-connections; - - programs.extra-container.enable = true; - - programs.firejail.enable = true; } diff --git a/system/gamemode.nix b/system/gamemode.nix deleted file mode 100644 index 92207cd..0000000 --- a/system/gamemode.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: -{ - programs.gamemode.enable = true; - programs.gamemode.enableRenice = true; - programs.gamemode.settings = { - general = { - renice = 10; - }; - - # Warning: GPU optimisations have the potential to damage hardware - gpu = { - apply_gpu_optimisations = "accept-responsibility"; - gpu_device = 0; - amd_performance_level = "high"; - }; - - custom = { - start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; - end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; - }; - }; -} diff --git a/system/gaming.nix b/system/gaming.nix new file mode 100644 index 0000000..e32c640 --- /dev/null +++ b/system/gaming.nix @@ -0,0 +1,63 @@ +{ + config, + pkgs, + lib, + inputs, + ... +}: +{ + options.my.gaming.enable = lib.mkEnableOption { }; + + config = lib.mkIf config.my.gaming.enable { + programs.steam.enable = true; + programs.steam.extraPackages = + config.fonts.packages + ++ (with pkgs; [ + capitaine-cursors + bibata-cursors + mangohud + xdg-user-dirs + gamescope + + # gamescope compatibility?? + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + ]); + + environment.systemPackages = with pkgs; [ + protontricks + bottles + inputs.dzgui-nix.packages.${pkgs.system}.default + ]; + + programs.gamemode = { + enable = true; + enableRenice = true; + settings = { + general = { + renice = 10; + }; + + # Warning: GPU optimisations have the potential to damage hardware + gpu = { + apply_gpu_optimisations = "accept-responsibility"; + gpu_device = 0; + amd_performance_level = "high"; + }; + + custom = { + start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; + end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; + }; + }; + }; + }; +} diff --git a/system/media-packages.nix b/system/media-packages.nix index 8458087..dec98a2 100644 --- a/system/media-packages.nix +++ b/system/media-packages.nix @@ -5,10 +5,10 @@ ... }: let - cfg = config.packages.media-packages; + cfg = config.my.media-packages; in { - options.packages.media-packages = { + options.my.media-packages = { enable = lib.mkEnableOption "media packages"; }; config = lib.mkIf cfg.enable { diff --git a/system/network.nix b/system/network.nix index 682639d..e280ff5 100644 --- a/system/network.nix +++ b/system/network.nix @@ -6,8 +6,6 @@ # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Enable networking networking.networkmanager.enable = true; - # Open kde connect ports - programs.kdeconnect.enable = true; networking.firewall = { enable = true; @@ -15,7 +13,7 @@ }; # Enable CUPS to print documents. - # services.printing.enable = true; + services.printing.enable = true; security.rtkit.enable = true; services.openssh = { @@ -27,4 +25,13 @@ KbdInteractiveAuthentication = false; }; }; + + # Workaround for nm-wait-online hanging?? + # Ref: https://github.com/NixOS/nixpkgs/issues/180175 + systemd.services.NetworkManager-wait-online = { + serviceConfig.ExecStart = [ + "" + "${pkgs.networkmanager}/bin/nm-online -q" + ]; + }; } diff --git a/system/steam.nix b/system/steam.nix deleted file mode 100644 index f82c958..0000000 --- a/system/steam.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: -{ - programs.steam.enable = true; - programs.steam.extraPackages = - config.fonts.packages - ++ (with pkgs; [ - capitaine-cursors - bibata-cursors - mangohud - xdg-user-dirs - gamescope - - # gamescope compatibility?? - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - libpng - libpulseaudio - libvorbis - stdenv.cc.cc.lib - libkrb5 - keyutils - ]); - - environment.systemPackages = with pkgs; [ - protontricks - bottles - inputs.dzgui-nix.packages.${pkgs.system}.default - ]; -} diff --git a/user/dummy.nix b/user/dummy.nix new file mode 100644 index 0000000..39043dd --- /dev/null +++ b/user/dummy.nix @@ -0,0 +1,8 @@ +{ lib, ... }: +{ + options.my = { + android.enable = lib.mkEnableOption { }; + media-packages.enable = lib.mkEnableOption { }; + containers.enable = lib.mkEnableOption { }; + }; +} diff --git a/user/fish/default.nix b/user/fish/default.nix index 30893ee..830d716 100644 --- a/user/fish/default.nix +++ b/user/fish/default.nix @@ -6,9 +6,12 @@ }: let inherit (config.my) accent editor desktop; + cfg = config.my.fish; in { - config = { + options.my.fish.enable = lib.mkEnableOption { }; + + config = lib.mkIf cfg.enable { programs.fish = { enable = true; shellInit = '' diff --git a/user/fzf.nix b/user/fzf.nix index df16adb..468cae5 100644 --- a/user/fzf.nix +++ b/user/fzf.nix @@ -2,16 +2,10 @@ config, pkgs, lib, - inputs, ... }: let - inherit (config.my) - key - theme - accent - font - ; + inherit (config.my) theme accent; inherit (theme) color; colors = { diff --git a/user/gaming.nix b/user/gaming.nix new file mode 100644 index 0000000..3e89361 --- /dev/null +++ b/user/gaming.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.my.gaming; +in +{ + options.my.gaming.enable = lib.mkEnableOption { }; + config = lib.mkIf cfg.enable { + my.mangohud.enable = true; + + home.packages = with pkgs; [ + # lutris-unwrapped + # steam # It's enabled in the system config + tlauncher + gamescope + glxinfo + vulkan-tools + ]; + }; +} diff --git a/user/helix.nix b/user/helix.nix index b711055..15250b4 100644 --- a/user/helix.nix +++ b/user/helix.nix @@ -7,9 +7,13 @@ let inherit (config.my) accent theme editor; inherit (theme) color; + + cfg = config.my.helix; in { - config = { + options.my.helix.enable = lib.mkEnableOption "Enable helix config"; + + config = lib.mkIf cfg.enable { programs.helix = { enable = true; settings = { diff --git a/user/home.nix b/user/home.nix index e8ba81d..c384c60 100644 --- a/user/home.nix +++ b/user/home.nix @@ -8,6 +8,7 @@ }: { imports = [ + ./dummy.nix ./waybar ./helix.nix ./kakoune @@ -21,6 +22,7 @@ ./rofi.nix ./mpv.nix ./mangohud.nix + ./gaming.nix ./pipewire.nix ./mimeapps.nix ./desktop-entries.nix @@ -44,7 +46,11 @@ ./powerplay-led-idle.nix ]; - my = import ./variables.nix; + my = import ./variables.nix // { + sway.enable = true; + pass.enable = true; + fish.enable = true; + }; # Home Manager needs a bit of information about you and the # paths it should manage. @@ -91,14 +97,6 @@ mate.engrampa # gnome.nautilus - ## games - # lutris-unwrapped - # steam # It's enabled in the system config - tlauncher - gamescope - glxinfo - vulkan-tools - ## Theming orchis_theme_compact papirus_red @@ -130,6 +128,8 @@ unstable.blade-formatter nixfmt-rfc-style + + nix-output-monitor ]; fonts.fontconfig.enable = true; diff --git a/user/mangohud.nix b/user/mangohud.nix index 440b750..fa0c8ff 100644 --- a/user/mangohud.nix +++ b/user/mangohud.nix @@ -1,80 +1,68 @@ -{ - config, - pkgs, - lib, - font, - ... -}: +{ config, lib, ... }: let - inherit (config.my) - key - theme - color - accent - font - ; + cfg = config.my.mangohud; in { - config = { - programs.mangohud = { - enable = true; - enableSessionWide = true; - settings = { - full = true; - # histogram = true; - no_display = true; - fps_limit = "0,30,60,72,90,120,144,240,288,320"; - toggle_fps_limit = "Shift_R+F10"; - toggle_preset = "Control_R+F9"; - fps_metrics = "Control_R+F8"; + options.my.mangohud.enable = lib.mkEnableOption { }; - # legacy_layout = "false"; - # gpu_stats = true; - # gpu_temp = true; - # gpu_core_clock = true; - # gpu_mem_clock = true; - # gpu_power = true; - # gpu_load_change = true; - # gpu_load_value = "50,90"; - gpu_load_color = "FFFFFF,FFAA7F,CC0000"; - # gpu_text = "GPU"; - # cpu_stats = true; - # cpu_temp = true; - # cpu_power = true; - # cpu_mhz = true; - # cpu_load_change = true; - # core_load_change = true; - # cpu_load_value = "50,90"; - cpu_load_color = "FFFFFF,FFAA7F,CC0000"; - cpu_color = "2e97cb"; - # cpu_text = "CPU"; - # io_stats = true; - # io_read = true; - # io_write = true; - io_color = "a491d3"; - # swap = true; - # vram = true; - vram_color = "ad64c1"; - # ram = true; - ram_color = "c26693"; - # fps = true; - engine_color = "eb5b5b"; - gpu_color = "2e9762"; - wine_color = "eb5b5b"; - # frame_timing = "1"; - frametime_color = "00ff00"; - media_player_color = "ffffff"; - background_alpha = "0.8"; - font_size = "24"; + config.programs.mangohud = lib.mkIf cfg.enable { + enable = true; + enableSessionWide = true; + settings = { + full = true; + # histogram = true; + no_display = true; + fps_limit = "0,30,60,72,90,120,144,240,288,320"; + toggle_fps_limit = "Shift_R+F10"; + toggle_preset = "Control_R+F9"; + fps_metrics = "Control_R+F8"; - background_color = "020202"; - position = "top-left"; - # text_color = "ffffff"; - round_corners = "10"; - toggle_hud = "Shift_R+F12"; - # toggle_logging = "Shift_L+F12"; - # output_folder = "/home/lelgenio"; - }; + # legacy_layout = "false"; + # gpu_stats = true; + # gpu_temp = true; + # gpu_core_clock = true; + # gpu_mem_clock = true; + # gpu_power = true; + # gpu_load_change = true; + # gpu_load_value = "50,90"; + gpu_load_color = "FFFFFF,FFAA7F,CC0000"; + # gpu_text = "GPU"; + # cpu_stats = true; + # cpu_temp = true; + # cpu_power = true; + # cpu_mhz = true; + # cpu_load_change = true; + # core_load_change = true; + # cpu_load_value = "50,90"; + cpu_load_color = "FFFFFF,FFAA7F,CC0000"; + cpu_color = "2e97cb"; + # cpu_text = "CPU"; + # io_stats = true; + # io_read = true; + # io_write = true; + io_color = "a491d3"; + # swap = true; + # vram = true; + vram_color = "ad64c1"; + # ram = true; + ram_color = "c26693"; + # fps = true; + engine_color = "eb5b5b"; + gpu_color = "2e9762"; + wine_color = "eb5b5b"; + # frame_timing = "1"; + frametime_color = "00ff00"; + media_player_color = "ffffff"; + background_alpha = "0.8"; + font_size = "24"; + + background_color = "020202"; + position = "top-left"; + # text_color = "ffffff"; + round_corners = "10"; + toggle_hud = "Shift_R+F12"; + # toggle_logging = "Shift_L+F12"; + # output_folder = "/home/lelgenio"; }; }; } diff --git a/user/mpd.nix b/user/mpd.nix index f4cca16..b4bdad3 100644 --- a/user/mpd.nix +++ b/user/mpd.nix @@ -4,8 +4,13 @@ config, ... }: +let + cfg = config.my.mpd; +in { - config = lib.mkIf (config.my.desktop != "gnome") { + options.my.mpd.enable = lib.mkEnableOption { }; + + config = lib.mkIf cfg.enable { services.mpd = { enable = true; musicDirectory = config.home.homeDirectory + "/Música"; diff --git a/user/pass.nix b/user/pass.nix index 4a69d12..c3b56c6 100644 --- a/user/pass.nix +++ b/user/pass.nix @@ -2,11 +2,15 @@ config, pkgs, lib, - inputs, ... }: +let + cfg = config.my.pass; +in { - config = { + options.my.pass.enable = lib.mkEnableOption { }; + + config = lib.mkIf cfg.enable { programs.password-store = { enable = true; package = pkgs.pass.withExtensions ( diff --git a/user/sway/default.nix b/user/sway/default.nix index 2633c23..325cad5 100644 --- a/user/sway/default.nix +++ b/user/sway/default.nix @@ -5,13 +5,10 @@ ... }: let - inherit (config.my) - key - accent - font - theme - ; + inherit (config.my) accent font theme; inherit (theme) color; + + cfg = config.my.sway; in { imports = [ @@ -24,10 +21,17 @@ in ./swaylock.nix ./theme.nix ]; - config = lib.mkIf (config.my.desktop == "sway") { - services.mako.enable = true; - services.swayidle.enable = true; - services.kanshi.enable = true; + + options.my.sway.enable = lib.mkEnableOption { }; + + config = lib.mkIf cfg.enable { + my.mako.enable = true; + my.kanshi.enable = true; + my.swayidle.enable = true; + my.swaylock.enable = true; + my.mpd.enable = true; + my.zathura.enable = true; + my.waybar.enable = true; wayland.windowManager.sway = { enable = true; @@ -36,7 +40,7 @@ in bars = [ ]; floating.modifier = "Mod4"; - terminal = pkgs.alacritty.executable; + terminal = lib.getExe pkgs.alacritty; window.titlebar = false; gaps = { @@ -69,7 +73,7 @@ in }; output = { "*" = { - adaptive_sync = "off"; + adaptive_sync = "on"; bg = "${theme.background} fill"; mode = "1920x1080@144.000Hz"; }; @@ -132,7 +136,6 @@ in swaylock wdisplays - waybar dhist demoji bmenu diff --git a/user/sway/kanshi.nix b/user/sway/kanshi.nix index c0a584b..486a209 100644 --- a/user/sway/kanshi.nix +++ b/user/sway/kanshi.nix @@ -1,20 +1,12 @@ -{ - config, - pkgs, - lib, - ... -}: +{ config, lib, ... }: let - inherit (config.my) - key - accent - font - theme - ; - inherit (theme) color; + cfg = config.my.kanshi; in { - services.kanshi = { + options.my.kanshi.enable = lib.mkEnableOption { }; + + config.services.kanshi = lib.mkIf cfg.enable { + enable = true; settings = [ { profile = { diff --git a/user/sway/mako.nix b/user/sway/mako.nix index 4f43734..af6c673 100644 --- a/user/sway/mako.nix +++ b/user/sway/mako.nix @@ -6,60 +6,66 @@ }: let inherit (config.my) - key accent font theme ; inherit (theme) color; + + cfg = config.my.mako; in { - services.mako = { - borderSize = 2; - padding = "5"; - margin = "15"; - layer = "overlay"; + options.my.mako.enable = lib.mkEnableOption { }; - font = "${font.interface} ${toString font.size.small}"; - textColor = color.txt; + config = lib.mkIf cfg.enable { + services.mako = { + enable = true; + borderSize = 2; + padding = "5"; + margin = "15"; + layer = "overlay"; - backgroundColor = color.bg; - borderColor = accent.color; - progressColor = "over ${accent.color}88"; + font = "${font.interface} ${toString font.size.small}"; + textColor = color.txt; - defaultTimeout = 10000; + backgroundColor = color.bg; + borderColor = accent.color; + progressColor = "over ${accent.color}88"; - extraConfig = '' - [app-name=volumesh] - default-timeout=5000 - group-by=app-name - format=%s\n%b - ''; + defaultTimeout = 10000; - # # {{@@ header() @@}} - # # text + extraConfig = '' + [app-name=volumesh] + default-timeout=5000 + group-by=app-name + format=%s\n%b + ''; - # # features - # icons=1 - # markup=1 - # actions=1 - # default-timeout=10000 + # # {{@@ header() @@}} + # # text - # # position - # layer=overlay - }; - systemd.user.services.mako = lib.mkIf (config.services.mako.enable) { - Unit = { - Description = "Notification daemon"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" ]; + # # features + # icons=1 + # markup=1 + # actions=1 + # default-timeout=10000 + + # # position + # layer=overlay }; - Service = { - ExecStart = "${pkgs.mako}/bin/mako"; - Restart = "on-failure"; - }; - Install = { - WantedBy = [ "sway-session.target" ]; + systemd.user.services.mako = lib.mkIf (config.services.mako.enable) { + Unit = { + Description = "Notification daemon"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${pkgs.mako}/bin/mako"; + Restart = "on-failure"; + }; + Install = { + WantedBy = [ "sway-session.target" ]; + }; }; }; } diff --git a/user/sway/swayidle.nix b/user/sway/swayidle.nix index 2c5384f..b6541f3 100644 --- a/user/sway/swayidle.nix +++ b/user/sway/swayidle.nix @@ -5,18 +5,15 @@ ... }: let - inherit (config.my) - key - accent - font - theme - ; - inherit (theme) color; - asScript = filename: text: toString (pkgs.writeShellScript filename text); + + cfg = config.my.swayidle; in { - services.swayidle = { + options.my.swayidle.enable = lib.mkEnableOption { }; + + config.services.swayidle = { + enable = cfg.enable; timeouts = [ { timeout = 360; diff --git a/user/sway/swaylock.nix b/user/sway/swaylock.nix index e46b5d9..8d0a195 100644 --- a/user/sway/swaylock.nix +++ b/user/sway/swaylock.nix @@ -1,20 +1,14 @@ -{ - config, - pkgs, - lib, - ... -}: +{ config, lib, ... }: let - inherit (config.my) - key - accent - font - theme - ; + inherit (config.my) accent font theme; inherit (theme) color; + + cfg = config.my.swaylock; in { - programs.swaylock.settings = { + options.my.swaylock.enable = lib.mkEnableOption { }; + + config.programs.swaylock.settings = lib.mkIf cfg.enable { image = toString theme.background; font = font.interface; font-size = font.size.medium; diff --git a/user/waybar/default.nix b/user/waybar/default.nix index b36dfce..fc95ff1 100644 --- a/user/waybar/default.nix +++ b/user/waybar/default.nix @@ -14,9 +14,13 @@ let font ; inherit (theme) color; + + cfg = config.my.waybar; in { - config = { + options.my.waybar.enable = lib.mkEnableOption { }; + + config = lib.mkIf cfg.enable { programs.waybar = { enable = true; systemd.enable = true; diff --git a/user/zathura.nix b/user/zathura.nix index 70e1c23..ae8e003 100644 --- a/user/zathura.nix +++ b/user/zathura.nix @@ -1,10 +1,4 @@ -{ - config, - pkgs, - lib, - font, - ... -}: +{ config, lib, ... }: let inherit (config.my) key @@ -13,56 +7,62 @@ let theme ; inherit (theme) color; + + cfg = config.my.zathura; in { - config = { - programs.zathura.enable = true; - programs.zathura.options = { - font = "${font.mono} ${toString font.size.small}"; - guioptions = "s"; + options.my.zathura.enable = lib.mkEnableOption { }; - selection-clipboard = "clipboard"; + config = lib.mkIf cfg.enable { + programs.zathura = { + enable = true; + options = { + font = "${font.mono} ${toString font.size.small}"; + guioptions = "s"; - recolor = true; - # Turn images grayscale, so they don't look weird - recolor-keephue = false; - recolor-lightcolor = "rgba(0,0,0,0)"; - recolor-darkcolor = color.txt; + selection-clipboard = "clipboard"; - default-bg = color.bg_dark; + recolor = true; + # Turn images grayscale, so they don't look weird + recolor-keephue = false; + recolor-lightcolor = "rgba(0,0,0,0)"; + recolor-darkcolor = color.txt; - inputbar-bg = color.bg_dark; - inputbar-fg = color.txt; + default-bg = color.bg_dark; - statusbar-bg = color.bg; - statusbar-fg = color.txt; + inputbar-bg = color.bg_dark; + inputbar-fg = color.txt; - completion-bg = color.bg; - completion-fg = color.txt; + statusbar-bg = color.bg; + statusbar-fg = color.txt; - completion-group-bg = color.bg_dark; - completion-group-fg = color.txt; + completion-bg = color.bg; + completion-fg = color.txt; - completion-highlight-bg = accent.color; - completion-highlight-fg = accent.fg; + completion-group-bg = color.bg_dark; + completion-group-fg = color.txt; - index-active-bg = accent.color; - index-active-fg = accent.fg; - }; - programs.zathura.mappings = { - "" = "toggle_statusbar"; - ${key.left} = "scroll left"; - ${key.down} = "scroll down"; - ${key.up} = "scroll up"; - ${key.right} = "scroll right"; - "[index] ${key.left}" = "navigate_index collapse"; - "[index] ${key.down}" = "navigate_index down"; - "[index] ${key.up}" = "navigate_index up"; - "[index] ${key.right}" = "navigate_index expand"; - ${lib.toUpper key.down} = "navigate next"; - ${lib.toUpper key.up} = "navigate previous"; - ${key.next} = "search forward"; - ${lib.toUpper key.next} = "search backward"; + completion-highlight-bg = accent.color; + completion-highlight-fg = accent.fg; + + index-active-bg = accent.color; + index-active-fg = accent.fg; + }; + mappings = { + "" = "toggle_statusbar"; + ${key.left} = "scroll left"; + ${key.down} = "scroll down"; + ${key.up} = "scroll up"; + ${key.right} = "scroll right"; + "[index] ${key.left}" = "navigate_index collapse"; + "[index] ${key.down}" = "navigate_index down"; + "[index] ${key.up}" = "navigate_index up"; + "[index] ${key.right}" = "navigate_index expand"; + ${lib.toUpper key.down} = "navigate next"; + ${lib.toUpper key.up} = "navigate previous"; + ${key.next} = "search forward"; + ${lib.toUpper key.next} = "search backward"; + }; }; }; }