diff --git a/flake.lock b/flake.lock index f62cca1..5a3f325 100644 --- a/flake.lock +++ b/flake.lock @@ -209,11 +209,11 @@ ] }, "locked": { - "lastModified": 1740485968, - "narHash": "sha256-WK+PZHbfDjLyveXAxpnrfagiFgZWaTJglewBWniTn2Y=", + "lastModified": 1739841949, + "narHash": "sha256-lSOXdgW/1zi/SSu7xp71v+55D5Egz8ACv0STkj7fhbs=", "owner": "nix-community", "repo": "disko", - "rev": "19c1140419c4f1cdf88ad4c1cfb6605597628940", + "rev": "15dbf8cebd8e2655a883b74547108e089f051bf0", "type": "github" }, "original": { @@ -481,11 +481,11 @@ ] }, "locked": { - "lastModified": 1740281615, - "narHash": "sha256-dZWcbAQ1sF8oVv+zjSKkPVY0ebwENQEkz5vc6muXbKY=", + "lastModified": 1739676768, + "narHash": "sha256-U1HQ7nzhJyVVXUgjU028UCkbLQLEIkg42+G7iIiBmlU=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "465792533d03e6bb9dc849d58ab9d5e31fac9023", + "rev": "ae15068e79e22b76c344f0d7f8aed1bb1c5b0b63", "type": "github" }, "original": { @@ -504,11 +504,11 @@ "nixpkgs-24_11": "nixpkgs-24_11" }, "locked": { - "lastModified": 1740437053, - "narHash": "sha256-exPTta4qI1ka9sk+jPcLogGffJ1OVXnAsTRqpeAXeNw=", + "lastModified": 1739121270, + "narHash": "sha256-EmJhpy9U8sVlepl2QPjG019VfG67HcucsQNItTqW6cA=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "c8ec4d5e432f5df4838eacd39c11828d23ce66ec", + "rev": "8c1c4640b878c692dd3d8055e8cdea0a2bbd8cf3", "type": "gitlab" }, "original": { @@ -551,11 +551,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1740367490, - "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", + "lastModified": 1739736696, + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05", + "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", "type": "github" }, "original": { @@ -612,11 +612,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1740339700, - "narHash": "sha256-cbrw7EgQhcdFnu6iS3vane53bEagZQy/xyIkDWpCgVE=", + "lastModified": 1739758141, + "narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "04ef94c4c1582fd485bbfdb8c4a8ba250e359195", + "rev": "c618e28f70257593de75a7044438efc1c1fc0791", "type": "github" }, "original": { @@ -937,11 +937,11 @@ }, "vpsadminos": { "locked": { - "lastModified": 1740082937, - "narHash": "sha256-HcTWGIzG2leM0gZabg9lkY7iLwvAe49lqXEzez/Rp/s=", + "lastModified": 1739153939, + "narHash": "sha256-7z+4SMs1uD/mCruBasPeWeq1DGzzgACRHOSdLE+mHRk=", "owner": "vpsfreecz", "repo": "vpsadminos", - "rev": "521427c69173bc443de940ba88d4f58d5fa8d8e2", + "rev": "939254840fcd72bdd3cd52186171815c3f25403b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 636724e..1d0afb0 100644 --- a/flake.nix +++ b/flake.nix @@ -102,25 +102,17 @@ inputs.agenix.nixosModules.default inputs.home-manager.nixosModules.home-manager inputs.disko.nixosModules.disko - ( - { 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; - }; - } - ) + { + 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; + }; + } ] ++ lib.optional (desktop == "gnome") ./system/gnome.nix ++ lib.optional (desktop == "kde") ./system/kde.nix; @@ -141,6 +133,7 @@ ./system/monolith-gitlab-runner.nix ./system/monolith-forgejo-runner.nix ./system/nix-serve.nix + ./system/steam.nix ] ++ common_modules; }; double-rainbow = lib.nixosSystem { @@ -157,6 +150,7 @@ ++ [ { 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/amdgpu.nix b/hosts/monolith/amdgpu.nix index 4c26afa..8c42bf0 100644 --- a/hosts/monolith/amdgpu.nix +++ b/hosts/monolith/amdgpu.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, ... }: let undervoltGpu = pkgs.writeShellScript "undervolt-gpu" '' set -xe @@ -17,17 +17,6 @@ in "amdgpu.ppfeaturemask=0xfffd7fff" # enable undervolting ]; - systemd.services.amd-fan-control = { - script = '' - ${lib.getExe pkgs.amd-fan-control} /sys/class/drm/card1/device 60 85 - ''; - serviceConfig = { - Restart = "always"; - RestartSec = 10; - }; - wantedBy = [ "multi-user.target" ]; - }; - hardware.graphics.enable32Bit = true; hardware.graphics.extraPackages = with pkgs; [ diff --git a/hosts/monolith/default.nix b/hosts/monolith/default.nix index 410300e..c3764fd 100644 --- a/hosts/monolith/default.nix +++ b/hosts/monolith/default.nix @@ -41,8 +41,6 @@ in package = pkgs.unstable.opentabletdriver; }; - my.gaming.enable = true; - boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ]; boot.initrd.kernelModules = [ "amdgpu" ]; diff --git a/scripts/amd-fan-control b/scripts/amd-fan-control deleted file mode 100755 index 1f4c3e7..0000000 --- a/scripts/amd-fan-control +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEVICE="$1" # eg: /sys/class/drm/card1/device -HWMON=$(echo "$DEVICE"/hwmon/hwmon*) - -exit() { - echo "Setting controll to auto" >&2 - echo 2 > "$HWMON/pwm1_enable" -} - -trap exit EXIT INT - -bail() { - echo "Error: $@" >&2 - echo "Exiting..." >&2 - exit 1 -} - -if ! [ -d "$HWMON" ]; then - bail "Invalid HWMON" -fi - -TEMP_INPUT="$HWMON/temp2_input" - -if ! [ -f $TEMP_INPUT ]; then - bail "Invalid TEMP_INPUT" -fi - -TEMP_MIN="$2" -TEMP_MAX="$3" - -if [ -z "$TEMP_MIN" ];then - bail "No minimum temperature provided" -fi - -if [ -z "$TEMP_MAX" ];then - bail "No maximum temperature provided" -fi - -PWM_MIN=0 -PWM_MAX=255 - -echo "Running..." >&2 -while true; do - TEMPERATURE_RAW=$(cat "$TEMP_INPUT") - TEMPERATURE="$(( $TEMPERATURE_RAW / 1000 ))" - # Remap from a number between 60_000..90_000 to 0..255 - PWM=$(( ($TEMPERATURE - $TEMP_MIN) * $PWM_MAX / ($TEMP_MAX - $TEMP_MIN) )) - - if [ "$PWM" -gt $PWM_MAX ]; then - PWM=$PWM_MAX - elif [ "$PWM" -lt $PWM_MIN ]; then - PWM=$PWM_MIN - fi - - echo 1 > "$HWMON/pwm1_enable" - echo "$PWM" > "$HWMON/pwm1" - sleep .1s -done diff --git a/scripts/default.nix b/scripts/default.nix index d9824b5..78ccac8 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -23,7 +23,6 @@ in with final; createScripts { - amd-fan-control = [ bash ]; br = [ ]; bmenu = [ bemenu @@ -137,6 +136,7 @@ libinput libratbag ]; + vrr-fullscreen = [ ]; controller-battery = [ ]; _docker-block-external-connections = [ iptables diff --git a/scripts/vrr-fullscreen b/scripts/vrr-fullscreen new file mode 100755 index 0000000..8413923 --- /dev/null +++ b/scripts/vrr-fullscreen @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# List of supported outputs for VRR +output_vrr_whitelist=( + "DP-1" + "DP-2" +) + +# Toggle VRR for fullscreened apps in prespecified displays to avoid stutters while in desktop +swaymsg -t subscribe -m '[ "window" ]' | while read window_json; do + window_event=$(echo ${window_json} | jq -r '.change') + + # Process only focus change and fullscreen toggle + if [[ $window_event = "focus" || $window_event = "fullscreen_mode" ]]; then + output_json=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused == true)') + output_name=$(echo ${output_json} | jq -r '.name') + + # Use only VRR in whitelisted outputs + if [[ ${output_vrr_whitelist[*]} =~ ${output_name} ]]; then + output_vrr_status=$(echo ${output_json} | jq -r '.adaptive_sync_status') + window_fullscreen_status=$(echo ${window_json} | jq -r '.container.fullscreen_mode') + + # Only update output if nesseccary to avoid flickering + [[ $output_vrr_status = "disabled" && $window_fullscreen_status = "1" ]] && swaymsg output "${output_name}" adaptive_sync 1 + [[ $output_vrr_status = "enabled" && $window_fullscreen_status = "0" ]] && swaymsg output "${output_name}" adaptive_sync 0 + fi + fi +done diff --git a/settings/default.nix b/settings/default.nix index 1cf90df..2a2ca08 100644 --- a/settings/default.nix +++ b/settings/default.nix @@ -1,18 +1,6 @@ { lib, ... }: { options = { - 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; }; - }; + my = lib.mkOption { }; }; } diff --git a/system/android.nix b/system/android.nix deleted file mode 100644 index 3cce4af..0000000 --- a/system/android.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - 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 3e0151d..fa1ed8d 100644 --- a/system/boot.nix +++ b/system/boot.nix @@ -2,6 +2,7 @@ config, pkgs, lib, + inputs, ... }: { diff --git a/system/cachix.nix b/system/cachix.nix new file mode 100644 index 0000000..7ff9b29 --- /dev/null +++ b/system/cachix.nix @@ -0,0 +1,18 @@ +{ + pkgs, + lib, + config, + ... +}: +{ + services.cachix-watch-store = { + enable = true; + cacheName = "lelgenio"; + cachixTokenFile = config.age.secrets.lelgenio-cachix.path; + }; + systemd.services.cachix-watch-store-agent = { + serviceConfig.TimeoutStopSec = 3; + # If we don't do this, cachix tends to timeout + serviceConfig.KillMode = lib.mkForce "control-group"; + }; +} diff --git a/system/configuration.nix b/system/configuration.nix index a227e36..9b4bed3 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -1,11 +1,16 @@ # 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’). -{ pkgs, ... }: +{ + config, + pkgs, + inputs, + ... +}: { imports = [ - ./android.nix - ./gaming.nix + ./gamemode.nix + ./cachix.nix ./media-packages.nix ./boot.nix ./thunar.nix @@ -21,27 +26,39 @@ ../settings ]; - my = import ../user/variables.nix // { - android.enable = true; - media-packages.enable = true; - containers.enable = true; - }; + my = import ../user/variables.nix; 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 9032a6c..64383a6 100644 --- a/system/containers.nix +++ b/system/containers.nix @@ -1,39 +1,30 @@ +{ pkgs, lib, ... }: { - pkgs, - lib, - config, - ... -}: -{ - options.my.containers.enable = lib.mkEnableOption { }; + services.flatpak.enable = true; - config = lib.mkIf config.my.containers.enable { - services.flatpak.enable = true; - - virtualisation.docker = { + virtualisation.docker = { + enable = true; + autoPrune = { enable = true; - 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"; - }; + 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 new file mode 100644 index 0000000..92207cd --- /dev/null +++ b/system/gamemode.nix @@ -0,0 +1,27 @@ +{ + 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 deleted file mode 100644 index e32c640..0000000 --- a/system/gaming.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - 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 dec98a2..8458087 100644 --- a/system/media-packages.nix +++ b/system/media-packages.nix @@ -5,10 +5,10 @@ ... }: let - cfg = config.my.media-packages; + cfg = config.packages.media-packages; in { - options.my.media-packages = { + options.packages.media-packages = { enable = lib.mkEnableOption "media packages"; }; config = lib.mkIf cfg.enable { diff --git a/system/network.nix b/system/network.nix index e280ff5..682639d 100644 --- a/system/network.nix +++ b/system/network.nix @@ -6,6 +6,8 @@ # 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; @@ -13,7 +15,7 @@ }; # Enable CUPS to print documents. - services.printing.enable = true; + # services.printing.enable = true; security.rtkit.enable = true; services.openssh = { @@ -25,13 +27,4 @@ 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 new file mode 100644 index 0000000..f82c958 --- /dev/null +++ b/system/steam.nix @@ -0,0 +1,36 @@ +{ + 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 deleted file mode 100644 index 39043dd..0000000 --- a/user/dummy.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ 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 830d716..30893ee 100644 --- a/user/fish/default.nix +++ b/user/fish/default.nix @@ -6,12 +6,9 @@ }: let inherit (config.my) accent editor desktop; - cfg = config.my.fish; in { - options.my.fish.enable = lib.mkEnableOption { }; - - config = lib.mkIf cfg.enable { + config = { programs.fish = { enable = true; shellInit = '' diff --git a/user/fzf.nix b/user/fzf.nix index 468cae5..df16adb 100644 --- a/user/fzf.nix +++ b/user/fzf.nix @@ -2,10 +2,16 @@ config, pkgs, lib, + inputs, ... }: let - inherit (config.my) theme accent; + inherit (config.my) + key + theme + accent + font + ; inherit (theme) color; colors = { diff --git a/user/gaming.nix b/user/gaming.nix deleted file mode 100644 index 3e89361..0000000 --- a/user/gaming.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - 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/git.nix b/user/git.nix index bfc85c1..867b9a5 100644 --- a/user/git.nix +++ b/user/git.nix @@ -43,9 +43,6 @@ in home.packages = with pkgs; [ git_clean_remote_deleted - - gh - glab ]; }; } diff --git a/user/helix.nix b/user/helix.nix index 15250b4..b711055 100644 --- a/user/helix.nix +++ b/user/helix.nix @@ -7,13 +7,9 @@ let inherit (config.my) accent theme editor; inherit (theme) color; - - cfg = config.my.helix; in { - options.my.helix.enable = lib.mkEnableOption "Enable helix config"; - - config = lib.mkIf cfg.enable { + config = { programs.helix = { enable = true; settings = { diff --git a/user/home.nix b/user/home.nix index c384c60..e8ba81d 100644 --- a/user/home.nix +++ b/user/home.nix @@ -8,7 +8,6 @@ }: { imports = [ - ./dummy.nix ./waybar ./helix.nix ./kakoune @@ -22,7 +21,6 @@ ./rofi.nix ./mpv.nix ./mangohud.nix - ./gaming.nix ./pipewire.nix ./mimeapps.nix ./desktop-entries.nix @@ -46,11 +44,7 @@ ./powerplay-led-idle.nix ]; - my = import ./variables.nix // { - sway.enable = true; - pass.enable = true; - fish.enable = true; - }; + my = import ./variables.nix; # Home Manager needs a bit of information about you and the # paths it should manage. @@ -97,6 +91,14 @@ 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 @@ -128,8 +130,6 @@ unstable.blade-formatter nixfmt-rfc-style - - nix-output-monitor ]; fonts.fontconfig.enable = true; diff --git a/user/mangohud.nix b/user/mangohud.nix index fa0c8ff..440b750 100644 --- a/user/mangohud.nix +++ b/user/mangohud.nix @@ -1,68 +1,80 @@ -{ config, lib, ... }: +{ + config, + pkgs, + lib, + font, + ... +}: let - cfg = config.my.mangohud; + inherit (config.my) + key + theme + color + accent + font + ; in { - options.my.mangohud.enable = lib.mkEnableOption { }; + 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"; - 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"; + # 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"; - # 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"; + 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 b4bdad3..f4cca16 100644 --- a/user/mpd.nix +++ b/user/mpd.nix @@ -4,13 +4,8 @@ config, ... }: -let - cfg = config.my.mpd; -in { - options.my.mpd.enable = lib.mkEnableOption { }; - - config = lib.mkIf cfg.enable { + config = lib.mkIf (config.my.desktop != "gnome") { services.mpd = { enable = true; musicDirectory = config.home.homeDirectory + "/Música"; diff --git a/user/pass.nix b/user/pass.nix index c3b56c6..4a69d12 100644 --- a/user/pass.nix +++ b/user/pass.nix @@ -2,15 +2,11 @@ config, pkgs, lib, + inputs, ... }: -let - cfg = config.my.pass; -in { - options.my.pass.enable = lib.mkEnableOption { }; - - config = lib.mkIf cfg.enable { + config = { programs.password-store = { enable = true; package = pkgs.pass.withExtensions ( diff --git a/user/sway/default.nix b/user/sway/default.nix index 325cad5..6679134 100644 --- a/user/sway/default.nix +++ b/user/sway/default.nix @@ -5,10 +5,13 @@ ... }: let - inherit (config.my) accent font theme; + inherit (config.my) + key + accent + font + theme + ; inherit (theme) color; - - cfg = config.my.sway; in { imports = [ @@ -21,17 +24,10 @@ in ./swaylock.nix ./theme.nix ]; - - 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; + config = lib.mkIf (config.my.desktop == "sway") { + services.mako.enable = true; + services.swayidle.enable = true; + services.kanshi.enable = true; wayland.windowManager.sway = { enable = true; @@ -40,7 +36,7 @@ in bars = [ ]; floating.modifier = "Mod4"; - terminal = lib.getExe pkgs.alacritty; + terminal = pkgs.alacritty.executable; window.titlebar = false; gaps = { @@ -73,7 +69,7 @@ in }; output = { "*" = { - adaptive_sync = "on"; + adaptive_sync = "off"; bg = "${theme.background} fill"; mode = "1920x1080@144.000Hz"; }; @@ -126,6 +122,21 @@ in indicator = true; }; + systemd.user.services.vrr-fullscreen = { + Unit = { + Description = "Enable VRR for fullscreen windows"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${lib.getExe pkgs.vrr-fullscreen}"; + Restart = "on-failure"; + }; + Install = { + WantedBy = [ "sway-session.target" ]; + }; + }; + services.gpg-agent.pinentryPackage = pkgs.pinentry-all; xdg.configFile."OpenTabletDriver/settings.json".source = ./open-tablet-driver.json; @@ -136,6 +147,7 @@ in swaylock wdisplays + waybar dhist demoji bmenu diff --git a/user/sway/kanshi.nix b/user/sway/kanshi.nix index 486a209..c0a584b 100644 --- a/user/sway/kanshi.nix +++ b/user/sway/kanshi.nix @@ -1,12 +1,20 @@ -{ config, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let - cfg = config.my.kanshi; + inherit (config.my) + key + accent + font + theme + ; + inherit (theme) color; in { - options.my.kanshi.enable = lib.mkEnableOption { }; - - config.services.kanshi = lib.mkIf cfg.enable { - enable = true; + services.kanshi = { settings = [ { profile = { diff --git a/user/sway/mako.nix b/user/sway/mako.nix index af6c673..4f43734 100644 --- a/user/sway/mako.nix +++ b/user/sway/mako.nix @@ -6,66 +6,60 @@ }: let inherit (config.my) + key accent font theme ; inherit (theme) color; - - cfg = config.my.mako; in { - options.my.mako.enable = lib.mkEnableOption { }; + services.mako = { + borderSize = 2; + padding = "5"; + margin = "15"; + layer = "overlay"; - config = lib.mkIf cfg.enable { - services.mako = { - enable = true; - borderSize = 2; - padding = "5"; - margin = "15"; - layer = "overlay"; + font = "${font.interface} ${toString font.size.small}"; + textColor = color.txt; - font = "${font.interface} ${toString font.size.small}"; - textColor = color.txt; + backgroundColor = color.bg; + borderColor = accent.color; + progressColor = "over ${accent.color}88"; - backgroundColor = color.bg; - borderColor = accent.color; - progressColor = "over ${accent.color}88"; + defaultTimeout = 10000; - defaultTimeout = 10000; + extraConfig = '' + [app-name=volumesh] + default-timeout=5000 + group-by=app-name + format=%s\n%b + ''; - extraConfig = '' - [app-name=volumesh] - default-timeout=5000 - group-by=app-name - format=%s\n%b - ''; + # # {{@@ header() @@}} + # # text - # # {{@@ header() @@}} - # # text + # # features + # icons=1 + # markup=1 + # actions=1 + # default-timeout=10000 - # # features - # icons=1 - # markup=1 - # actions=1 - # default-timeout=10000 - - # # position - # layer=overlay + # # 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" ]; }; - 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" ]; - }; + 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 b6541f3..2c5384f 100644 --- a/user/sway/swayidle.nix +++ b/user/sway/swayidle.nix @@ -5,15 +5,18 @@ ... }: let - asScript = filename: text: toString (pkgs.writeShellScript filename text); + inherit (config.my) + key + accent + font + theme + ; + inherit (theme) color; - cfg = config.my.swayidle; + asScript = filename: text: toString (pkgs.writeShellScript filename text); in { - options.my.swayidle.enable = lib.mkEnableOption { }; - - config.services.swayidle = { - enable = cfg.enable; + services.swayidle = { timeouts = [ { timeout = 360; diff --git a/user/sway/swaylock.nix b/user/sway/swaylock.nix index 8d0a195..e46b5d9 100644 --- a/user/sway/swaylock.nix +++ b/user/sway/swaylock.nix @@ -1,14 +1,20 @@ -{ config, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let - inherit (config.my) accent font theme; + inherit (config.my) + key + accent + font + theme + ; inherit (theme) color; - - cfg = config.my.swaylock; in { - options.my.swaylock.enable = lib.mkEnableOption { }; - - config.programs.swaylock.settings = lib.mkIf cfg.enable { + programs.swaylock.settings = { 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 fc95ff1..b36dfce 100644 --- a/user/waybar/default.nix +++ b/user/waybar/default.nix @@ -14,13 +14,9 @@ let font ; inherit (theme) color; - - cfg = config.my.waybar; in { - options.my.waybar.enable = lib.mkEnableOption { }; - - config = lib.mkIf cfg.enable { + config = { programs.waybar = { enable = true; systemd.enable = true; diff --git a/user/zathura.nix b/user/zathura.nix index ae8e003..70e1c23 100644 --- a/user/zathura.nix +++ b/user/zathura.nix @@ -1,4 +1,10 @@ -{ config, lib, ... }: +{ + config, + pkgs, + lib, + font, + ... +}: let inherit (config.my) key @@ -7,62 +13,56 @@ let theme ; inherit (theme) color; - - cfg = config.my.zathura; in { - options.my.zathura.enable = lib.mkEnableOption { }; + config = { + programs.zathura.enable = true; + programs.zathura.options = { + font = "${font.mono} ${toString font.size.small}"; + guioptions = "s"; - config = lib.mkIf cfg.enable { - programs.zathura = { - enable = true; - options = { - font = "${font.mono} ${toString font.size.small}"; - guioptions = "s"; + selection-clipboard = "clipboard"; - selection-clipboard = "clipboard"; + 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; - 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; + default-bg = color.bg_dark; - default-bg = color.bg_dark; + inputbar-bg = color.bg_dark; + inputbar-fg = color.txt; - inputbar-bg = color.bg_dark; - inputbar-fg = color.txt; + statusbar-bg = color.bg; + statusbar-fg = color.txt; - statusbar-bg = color.bg; - statusbar-fg = color.txt; + completion-bg = color.bg; + completion-fg = color.txt; - completion-bg = color.bg; - completion-fg = color.txt; + completion-group-bg = color.bg_dark; + completion-group-fg = color.txt; - completion-group-bg = color.bg_dark; - completion-group-fg = color.txt; + completion-highlight-bg = accent.color; + completion-highlight-fg = accent.fg; - 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"; - }; + 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"; }; }; }