From 46f778107bdfd5d5ca82e25ddb9e8a900aed0abb Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 5 Apr 2024 22:51:24 -0400 Subject: [PATCH] chore: Improve formatting --- flake.nix | 12 ++++++++++-- home/eww.nix | 3 ++- home/fish.nix | 27 +++++++++++++++------------ home/git.nix | 6 ++---- home/hyprland.nix | 34 +++++++++++++++++++++------------- 5 files changed, 50 insertions(+), 32 deletions(-) diff --git a/flake.nix b/flake.nix index 26c3af05..9a425b7e 100644 --- a/flake.nix +++ b/flake.nix @@ -60,14 +60,22 @@ value = let directory = replaceStrings flakeOutputs flakeDirectories attributeName; + attributeValue = (listToAttrs (map (file: { name = replaceStrings [ ".nix" ] [ "" ] file; - value = if directory == packageDirectory then callPackage ./${directory}/${file} { } else import ./${directory}/${file}; + value = + if directory == packageDirectory + then callPackage ./${directory}/${file} { } + else import ./${directory}/${file}; }) (attrNames (readDir ./${directory})))); - attributeSet = if directory == packageDirectory then { x86_64-linux = attributeValue; } else attributeValue; + + attributeSet = + if directory == packageDirectory + then { x86_64-linux = attributeValue; } + else attributeValue; in (attributeSet); }) diff --git a/home/eww.nix b/home/eww.nix index 436a0d58..a93f9c08 100644 --- a/home/eww.nix +++ b/home/eww.nix @@ -3,9 +3,10 @@ let inherit (config.home) homeDirectory; inherit (config.xdg.userDirs) download documents music pictures videos; + inherit (pkgs) eww; in { - home.packages = with pkgs; [ eww ]; + home.packages = [ eww ]; xdg.configFile."eww/eww.yuck".text = /* yuck */ '' (defwidget icons [] diff --git a/home/fish.nix b/home/fish.nix index 220d9b2f..9eb3d528 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -1,7 +1,10 @@ { pkgs, ... }: +let + inherit (pkgs) gsettings-desktop-schemas prisma-engines gtk3; +in { - xdg.configFile."fish/config.fish".text = with pkgs; /* fish */ '' + xdg.configFile."fish/config.fish".text = /* fish */ '' set -U fish_greeting "" export PATH="$HOME/.deno/bin:$HOME/.cargo/bin:$HOME/.yarn/bin:$HOME/.local/bin:$HOME/.go/bin:$PATH" @@ -33,31 +36,31 @@ # Convert unnecessarily large wav files to flac function wav2flac - set ORIGINAL_SIZE (du -hs | cut -f1) + set ORIGINAL_SIZE (du -hs | cut -f1) - fd -e wav -x ffmpeg -i "{}" -loglevel quiet -stats "{.}.flac" - fd -e wav -X trash + fd -e wav -x ffmpeg -i "{}" -loglevel quiet -stats "{.}.flac" + fd -e wav -X trash - set NEW_SIZE (du -hs | cut -f1) + set NEW_SIZE (du -hs | cut -f1) - echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" + echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" end # Convert wav/flac to opus function opus - set ORIGINAL_SIZE (du -hs | cut -f1) + set ORIGINAL_SIZE (du -hs | cut -f1) - fd -e wav -e flac -x ffmpeg -i "{}" -c:a libopus -b:a 128K -loglevel quiet -stats "{.}.opus" - fd -e wav -e flac -X rm -I + fd -e wav -e flac -x ffmpeg -i "{}" -c:a libopus -b:a 128K -loglevel quiet -stats "{.}.opus" + fd -e wav -e flac -X rm -I - set NEW_SIZE (du -hs | cut -f1) + set NEW_SIZE (du -hs | cut -f1) - echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" + echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" end # Always use kitty ssh since it's our default terminal if string match -qe -- "/dev/pts/" (tty) - alias ssh="kitty +kitten ssh" + alias ssh="kitty +kitten ssh" end ''; } diff --git a/home/git.nix b/home/git.nix index 516612e0..784b2d4b 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,12 +1,10 @@ { pkgs, ... }: let - inherit (builtins) attrValues; + inherit (pkgs) tig mgitstatus; in { - home.packages = attrValues { - inherit (pkgs) tig mgitstatus; - }; + home.packages = [ tig mgitstatus ]; xdg.configFile."tig/config".text = '' color cursor black green bold diff --git a/home/hyprland.nix b/home/hyprland.nix index 6699b226..8502e2e2 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -1,11 +1,19 @@ { pkgs, ... }: let + inherit (pkgs) hyprdim hyprnome hypridle hyprlock swww grimblast polkit_gnome; + opacity = "0.95"; super = "SUPER"; + + raiseVolumeScript = "hypr/raise-volume.fish"; + lowerVolumeScript = "hypr/lower-volume.fish"; + gapsScript = "hypr/gaps.sh"; + randomBackgroundScript = "hypr/random-bg.fish"; + swapBackgroundScript = "hypr/swap-bg.fish"; in { - home.packages = with pkgs; [ + home.packages = [ hyprdim hyprnome hypridle @@ -49,11 +57,11 @@ in "ironbar" "fcitx5" "hyprctl dispatch workspace 5000000" - "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" + "${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" "hyprdim --no-dim-when-only --persist --ignore-leaving-special --dialog-dim" "hypridle" "sleep 1 && eww open desktop-icons" - "~/.config/hypr/random-bg.fish" + "~/.config/${randomBackgroundScript}" ]; input = { @@ -180,15 +188,15 @@ in bind = [ "${super}_SHIFT, Return, exec, kitty" "${super}_SHIFT, Q, killactive" - "${super}, W, exec, ~/.config/hypr/random-bg.fish" - "${super}_SHIFT, W, exec, ~/.config/hypr/swap-bg.fish" + "${super}, W, exec, ~/.config/${randomBackgroundScript}" + "${super}_SHIFT, W, exec, ~/.config/${swapBackgroundScript}" "${super}, P, exec, dunstify --icon=$(grimblast save screen) Screenshot Captured." ", Print, exec, grimblast --freeze copy area" "${super}_ALT, delete, exit" "${super}, T, exec, tessen" "${super}, V, togglefloating" "${super}, B, centerwindow" - "${super}, U, exec, ~/.config/hypr/gaps.sh" + "${super}, U, exec, ~/.config/${gapsScript}" "${super}, X, pin" "${super}, F, fullscreen" "${super}, S, swapactiveworkspaces, 0 1" @@ -245,8 +253,8 @@ in bindl = [ ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && notify-send -t 2000 \"Muted\" \"$(wpctl get-volume @DEFAULT_AUDIO_SINK@)\"" - ", XF86AudioRaiseVolume, exec, ~/.config/hypr/raise-volume.fish" - ", XF86AudioLowerVolume, exec, ~/.config/hypr/lower-volume.fish" + ", XF86AudioRaiseVolume, exec, ~/.config/${raiseVolumeScript}" + ", XF86AudioLowerVolume, exec, ~/.config/${lowerVolumeScript}" ", XF86MonBrightnessDown, exec, brightnessctl set 5%- && notify-send -t 2000 \"Decreased brightness to\" \"$(brightnessctl get)\"" ", XF86MonBrightnessUp, exec, brightnessctl set +5% && notify-send -t 2000 \"Increased brightness to\" \"$(brightnessctl get)\"" ]; @@ -260,7 +268,7 @@ in ''; }; - xdg.configFile."hypr/gaps.sh" = { + xdg.configFile.${gapsScript} = { executable = true; text = /* bash */ '' #!/usr/bin/env bash @@ -271,7 +279,7 @@ in ''; }; - xdg.configFile."hypr/raise-volume.fish" = { + xdg.configFile.${raiseVolumeScript} = { executable = true; text = /* fish */ '' #!/usr/bin/env fish @@ -284,7 +292,7 @@ in ''; }; - xdg.configFile."hypr/lower-volume.fish" = { + xdg.configFile.${lowerVolumeScript} = { executable = true; text = /* fish */ '' #!/usr/bin/env fish @@ -323,7 +331,7 @@ in ''; }; - xdg.configFile."hypr/random-bg.fish" = { + xdg.configFile.${randomBackgroundScript} = { executable = true; text = /* fish */ '' #!/usr/bin/env fish @@ -336,7 +344,7 @@ in ''; }; - xdg.configFile."hypr/swap-bg.fish" = { + xdg.configFile.${swapBackgroundScript} = { executable = true; text = /* fish */ '' #!/usr/bin/env fish