(T)im's N(ix) Flake, Multi-Host Configurations for all of my machines! 74k1.sh/
nixos nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(packages): move duvolbr to [tixpkgs](https://github.com/74k1/tixpkgs)

74k1 579e2c03 b0999bde

+35 -250
+5 -11
README.md
··· 103 103 </div> 104 104 <div> 105 105 <h2>Packages</h2> 106 - <ul> 107 - <li><a href="pkgs/duvolbr.nix">duvolbr</a></li> 108 - </ul> 106 + <p> 107 + All of my own Packages are under [tixpkgs](https://github.com/74k1/tixpkgs). Feel free to snoop around and submit PRs / Issues. Contributions are always welcome. :) 108 + </p> 109 109 </div> 110 110 <div> 111 111 <h2>Special Thanks to</h2> ··· 120 120 <h3><a href="https://gitlab.com/Nmoleo">Nmoleo</a></h3> 121 121 <h4><a href="https://gitlab.com/Nmoleo/i3-volume-brightness-indicator">i3 + dunst indicators</a></h4> 122 122 <p> 123 - I've somewhat rewritten it. (see <a href="modules/home-manager/i3wm/duvolbr.nix">this file</a>) 124 - It now uses nix functions :) no more pactl/playerctl/libnotify package dependencies. 125 - Make sure you have something of the following tho: 126 - <ul> 127 - <li>i3</li> 128 - <li>dunst</li> 129 - <li>pipewire with pulseaudio (or directly pulseaudio) enabled</li> 130 - </ul> 123 + I've somewhat rewritten it. (see <a href="https://github.com/74k1/tixpkgs/blob/main/pkgs/du/duvolbr.nix">this file</a>) 124 + It's now compatible with nix without pactl/playerctl/libnotify package dependencies. :) 131 125 </p> 132 126 <h4><a href="https://gitlab.com/Nmoleo/polybar_playerctl">polybar & playerctl</a></h4> 133 127 </div>
+3 -3
flake.lock
··· 4985 4985 ] 4986 4986 }, 4987 4987 "locked": { 4988 - "lastModified": 1744564894, 4989 - "narHash": "sha256-xE7rYsa6HP7SJe7GyviLOcF8zz1okvzm19MJ/kmVONE=", 4988 + "lastModified": 1745355433, 4989 + "narHash": "sha256-UHETUt0oD80I8w0fBMxSLkwG6QrCXMaHUqAJwXQCqwg=", 4990 4990 "owner": "74k1", 4991 4991 "repo": "tixpkgs", 4992 - "rev": "fb2142a1b1ea87d231753af73f57f6c7bf526a64", 4992 + "rev": "fccbd5f05a928e2fed2aa9a36930440ee713c888", 4993 4993 "type": "github" 4994 4994 }, 4995 4995 "original": {
-1
flake.nix
··· 159 159 imports = [ 160 160 ./modules/flake/configurations.nix 161 161 ./modules/flake/devshells.nix 162 - ./modules/flake/packages.nix 163 162 ./modules/flake/modules.nix 164 163 ./modules/flake/agenix.nix 165 164 ./modules/flake/topology.nix
+1 -4
hosts/nixos/cyberia/home.nix
··· 47 47 48 48 # nixpkgs = { 49 49 # overlays = [ 50 - # (final: prev: { 51 - # duvolbr = outputs.packages."x86_64-linux".duvolbr; 52 - # }) 53 50 # inputs.wired-notify.overlays.default 54 51 # ]; 55 52 # config = { ··· 74 71 papirus-icon-theme 75 72 76 73 # my own scriptiboo 77 - duvolbr 74 + pkgs.tix.duvolbr 78 75 inputs.unfree-fonts.packages.x86_64-linux.berkeley-nolig-nerd-otf 79 76 80 77 # term
+1 -4
hosts/nixos/psyche/home.nix
··· 39 39 40 40 nixpkgs = { 41 41 # overlays = [ 42 - # (final: prev: { 43 - # duvolbr = outputs.packages."x86_64-linux".duvolbr; 44 - # }) 45 42 # inputs.wired-notify.overlays.default 46 43 # ]; 47 44 config = { ··· 66 63 # papirus-icon-theme 67 64 68 65 # my own scriptiboo 69 - # duvolbr 66 + # pkgs.tix.duvolbr 70 67 # inputs.unfree-fonts.packages.x86_64-linux.berkeley-nolig-nerd-otf 71 68 72 69 # uhhh clipboard
+1 -4
hosts/nixos/wired/home.nix
··· 48 48 49 49 # nixpkgs = { 50 50 # overlays = [ 51 - # (final: prev: { 52 - # duvolbr = outputs.packages.${pkgs.hostPlatform.system}.duvolbr; 53 - # }) 54 51 # inputs.wired-notify.overlays.default 55 52 # ]; 56 53 # config = { ··· 75 72 papirus-icon-theme 76 73 77 74 # my own scriptiboo 78 - duvolbr 75 + pkgs.tix.duvolbr 79 76 inputs.unfree-fonts.packages.x86_64-linux.berkeley-nolig-nerd-otf 80 77 81 78 # uhhh clipboard
-10
modules/flake/packages.nix
··· 1 - { lib, config, self, inputs, withSystem, ... }: 2 - 3 - { 4 - perSystem = { self, lib, pkgs, system, inputs', ... }: { 5 - packages = import "${inputs.self}/pkgs" { 6 - # NOTE: using a fresh `pkgs` to avoid recursion 7 - pkgs = inputs.nixpkgs.legacyPackages.${system}; 8 - }; 9 - }; 10 - }
+2 -2
modules/home-manager/wayland/hyprland/default.nix
··· 77 77 # multimedia 78 78 ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" 79 79 ", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl pause" 80 - ", XF86AudioNext, exec, ${pkgs.duvolbr}/bin/duvolbr next_track" 81 - ", XF86AudioPrev, exec, ${pkgs.duvolbr}/bin/duvolbr prev_track" 80 + ", XF86AudioNext, exec, ${pkgs.tix.duvolbr}/bin/duvolbr next_track" 81 + ", XF86AudioPrev, exec, ${pkgs.tix.duvolbr}/bin/duvolbr prev_track" 82 82 83 83 # window focus 84 84 "$mod, h, movefocus, l"
+2 -2
modules/home-manager/wayland/niri/default.nix
··· 81 81 # Multimedia 82 82 "XF86AudioPlay".action = spawn "${pkgs.playerctl}/bin/playerctl" "play-pause"; 83 83 "XF86AudioPause".action = spawn "${pkgs.playerctl}/bin/playerctl" "play-pause"; 84 - "XF86AudioNext".action = spawn "${pkgs.duvolbr}/bin/duvolbr" "next_track"; 85 - "XF86AudioPrev".action = spawn "${pkgs.duvolbr}/bin/duvolbr" "prev_track"; 84 + "XF86AudioNext".action = spawn "${pkgs.tix.duvolbr}/bin/duvolbr" "next_track"; 85 + "XF86AudioPrev".action = spawn "${pkgs.tix.duvolbr}/bin/duvolbr" "prev_track"; 86 86 87 87 "XF86AudioMute".action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; 88 88
+2 -2
modules/home-manager/wayland/river/default.nix
··· 50 50 # Multimedia 51 51 "XF86AudioPlay" = "spawn ${pkgs.playerctl}/bin/playerctl play-pause"; 52 52 "XF86AudioPause" = "spawn ${pkgs.playerctl}/bin/playerctl pause"; 53 - "XF86AudioNext" = "spawn ${pkgs.duvolbr}/bin/duvolbr next_track"; 54 - "XF86AudioPrev" = "spawn ${pkgs.duvolbr}/bin/duvolbr prev_track"; 53 + "XF86AudioNext" = "spawn ${pkgs.tix.duvolbr}/bin/duvolbr next_track"; 54 + "XF86AudioPrev" = "spawn ${pkgs.tix.duvolbr}/bin/duvolbr prev_track"; 55 55 56 56 # Scrot 57 57 "Print" = "spawn ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify --cursor copy area";
+9 -9
modules/home-manager/x11/i3wm/default.nix
··· 92 92 #"XF86AudioPrev" = "exec --no-startup-id ${pkgs.playerctl}/bin/playerctl previous"; 93 93 94 94 # pactl & playerctl # with script 95 - "XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr vol_up"; 96 - "XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr vol_down"; 97 - "XF86AudioMute" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr vol_mute"; 98 - #"XF86MonBrightnessUp" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr bri_up"; 99 - #"XF86MonBrightnessDown" = "exec --no-startup-id ${pkgs.duvolbr} bri_down"; 100 - "XF86AudioPlay" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvbolbr play_pause"; 101 - "XF86AudioPause" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr play_pause"; 102 - "XF86AudioNext" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr next_track"; 103 - "XF86AudioPrev" = "exec --no-startup-id ${pkgs.duvolbr}/bin/duvolbr prev_track"; 95 + "XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr vol_up"; 96 + "XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr vol_down"; 97 + "XF86AudioMute" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr vol_mute"; 98 + #"XF86MonBrightnessUp" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr bri_up"; 99 + #"XF86MonBrightnessDown" = "exec --no-startup-id ${pkgs.tix.duvolbr} bri_down"; 100 + "XF86AudioPlay" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvbolbr play_pause"; 101 + "XF86AudioPause" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr play_pause"; 102 + "XF86AudioNext" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr next_track"; 103 + "XF86AudioPrev" = "exec --no-startup-id ${pkgs.tix.duvolbr}/bin/duvolbr prev_track"; 104 104 105 105 # Focus 106 106 "${mod}+j" = "focus down";
+9 -9
modules/home-manager/x11/sxhkd/default.nix
··· 45 45 #"XF86AudioPrev" = "${pkgs.playerctl}/bin/playerctl previous"; 46 46 47 47 # pactl & playerctl # with script 48 - "XF86AudioRaiseVolume" = "${pkgs.duvolbr}/bin/duvolbr vol_up"; 49 - "XF86AudioLowerVolume" = "${pkgs.duvolbr}/bin/duvolbr vol_down"; 50 - "XF86AudioMute" = "${pkgs.duvolbr}/bin/duvolbr vol_mute"; 51 - #"XF86MonBrightnessUp" = "${pkgs.duvolbr}/bin/duvolbr bri_up"; 52 - #"XF86MonBrightnessDown" = "${pkgs.duvolbr} bri_down"; 53 - #"XF86AudioPlay" = "${pkgs.duvolbr}/bin/duvbolbr play_pause"; 54 - #"XF86AudioPause" = "${pkgs.duvolbr}/bin/duvolbr play_pause"; 55 - "XF86AudioNext" = "${pkgs.duvolbr}/bin/duvolbr next_track"; 56 - "XF86AudioPrev" = "${pkgs.duvolbr}/bin/duvolbr prev_track"; 48 + "XF86AudioRaiseVolume" = "${pkgs.tix.duvolbr}/bin/duvolbr vol_up"; 49 + "XF86AudioLowerVolume" = "${pkgs.tix.duvolbr}/bin/duvolbr vol_down"; 50 + "XF86AudioMute" = "${pkgs.tix.duvolbr}/bin/duvolbr vol_mute"; 51 + #"XF86MonBrightnessUp" = "${pkgs.tix.duvolbr}/bin/duvolbr bri_up"; 52 + #"XF86MonBrightnessDown" = "${pkgs.tix.duvolbr} bri_down"; 53 + #"XF86AudioPlay" = "${pkgs.tix.duvolbr}/bin/duvbolbr play_pause"; 54 + #"XF86AudioPause" = "${pkgs.tix.duvolbr}/bin/duvolbr play_pause"; 55 + "XF86AudioNext" = "${pkgs.tix.duvolbr}/bin/duvolbr next_track"; 56 + "XF86AudioPrev" = "${pkgs.tix.duvolbr}/bin/duvolbr prev_track"; 57 57 }; 58 58 }; 59 59 }
-4
pkgs/default.nix
··· 1 - { pkgs, ... }: 2 - { 3 - duvolbr = pkgs.callPackage ./duvolbr.nix { }; 4 - }
-185
pkgs/duvolbr.nix
··· 1 - { libnotify 2 - , light 3 - , playerctl 4 - , pulseaudio 5 - , wget 6 - , writeShellScriptBin 7 - , ... 8 - }: 9 - let 10 - vol_step="5"; # how much the volume should step up/down on keypress 11 - bri_step="5"; # how much the brightness should step up/down on keypress 12 - max_vol="100"; # what the max volume should be 13 - notif_timeout="1000"; # the timeout of the notification in ms 14 - download_album_art="true"; # if this should download the album art in a tmp dir 15 - show_album_art="true"; # if you want to show an album art / local or tmp dir 16 - show_music_in_vol_indicator="true"; # if you want to show music in the vol indicator 17 - in 18 - writeShellScriptBin "duvolbr" '' 19 - # uses regex to get volume from pulseaudio 20 - function get_vol { 21 - ${pulseaudio}/bin/pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1 22 - } 23 - 24 - # uses regex to get mute status from pulseaudio 25 - function get_mute { 26 - ${pulseaudio}/bin/pactl get-sink-mute @DEFAULT_SINK@ | grep -Po '(?<=Mute: )(yes|no)' 27 - } 28 - 29 - # uses regex to get brightness from xbacklight 30 - function get_bri { 31 - sudo ${light}/bin/light | grep -Po '[0-9]{1,3}' | head -n 1 32 - } 33 - 34 - # returns a mute icon, volume low icon or a volume high icon depending on the volume 35 - function get_vol_icon { 36 - vol=$(get_vol) 37 - mute=$(get_mute) 38 - if [ "$vol" -eq 0 ] || [ "$mute" == "yes" ] ; then 39 - vol_icon="" 40 - elif [ "$vol" -lt 50 ]; then 41 - vol_icon="" 42 - else 43 - vol_icon="" 44 - fi 45 - } 46 - 47 - # always returns same brightness icon 48 - function get_bri_icon { 49 - bri_icon="" 50 - } 51 - 52 - # gets album art :shrug: 53 - function get_album_art { 54 - url=$(${playerctl}/bin/playerctl -f "{{mpris:artUrl}}" metadata) 55 - if [[ $url == "file://"* ]]; then 56 - album_art="''${url/file:\/\//}" 57 - elif [[ $url == "http://"* ]] && [[ "${download_album_art}" == "true" ]]; then 58 - # identify filename from URL 59 - filename="$(echo $url | sed "s/.*\///")" 60 - 61 - # download file to /tmp if it doesn't already exist 62 - if [ ! -f "/tmp/$filename" ]; then 63 - ${wget}/bin/wget -O "/tmp/$filename" "$url" 64 - fi 65 - 66 - album_art="/tmp/$filename" 67 - ## TODO - the uh, https/http stuff 68 - elif [[ $url == "https://"* ]] && [[ "${download_album_art}" == "true" ]]; then 69 - # identify filename from URL 70 - filename="$(echo $url | sed "s/.*\///")" 71 - 72 - # download file to /tmp if it doesn't already exist 73 - if [ ! -f "/tmp/$filename" ]; then 74 - ${wget}/bin/wget -O "/tmp/$filename" "$url" 75 - fi 76 - 77 - album_art="/tmp/$filename" 78 - else 79 - album_art="" 80 - fi 81 - } 82 - 83 - # displays a volume notification 84 - function show_vol_notif { 85 - vol=$(get_mute) 86 - get_vol_icon 87 - 88 - if [[ "${show_music_in_vol_indicator}" == "true" ]]; then 89 - current_song=$(${playerctl}/bin/playerctl -f "{{title}} - {{artist}}" metadata) 90 - 91 - if [[ "${show_album_art}" == "true" ]]; then 92 - get_album_art 93 - fi 94 - 95 - ${libnotify}/bin/notify-send -t ${notif_timeout} -h string:x-dunst-stack-tag:volume_notif -h int:value:$vol -i "$album_art" "$vol_icon $vol%" "$current_song" 96 - else 97 - ${libnotify}/bin/notify-send -t ${notif_timeout} -h string:x-dunst-stack-tag:volume_notif -h int:value:$vol "$vol_icon $vol%" 98 - fi 99 - } 100 - 101 - # display a music notification 102 - function show_music_notif { 103 - song_title=$(${playerctl}/bin/playerctl -f "{{title}}" metadata) 104 - song_artist=$(${playerctl}/bin/playerctl -f "{{artist}}" metadata) 105 - song_album=$(${playerctl}/bin/playerctl -f "{{album}}" metadata) 106 - 107 - if [[ ${show_album_art} == "true" ]]; then 108 - get_album_art 109 - fi 110 - 111 - ${libnotify}/bin/notify-send -t ${notif_timeout} -h string:x-dunst-stack-tag:music_notif -i "$album_art" "$song_title" "$song_artist - $song_album" 112 - } 113 - 114 - # displays a brightness notification 115 - function show_bri_notif { 116 - bri=$(get_bri) 117 - echo $bri 118 - get_bri_icon 119 - ${libnotify}/bin/notify-send -t ${notif_timeout} -h string:x-dunst-stack-tag:bri_notif -h int:value:$bri "$bri_icon $bri%" 120 - } 121 - 122 - # main function 123 - # takes user input: "vol_up" "vol_down" "vol_mute" "bri_up" "bri_down" "next_track" "prev_track" "play_pause" "pause" 124 - case $1 in 125 - vol_up) 126 - # unmutes, increases volume and displays notif 127 - ${pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ 0 128 - vol=$(get_vol) 129 - if [ $(( "$vol" + "${vol_step}" )) -gt ${max_vol} ]; then 130 - ${pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ ${max_vol}% 131 - else 132 - ${pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +${vol_step}% 133 - fi 134 - show_vol_notif 135 - ;; 136 - 137 - vol_down) 138 - # decreases volume and displays notif 139 - ${pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -${vol_step}% 140 - show_vol_notif 141 - ;; 142 - 143 - vol_mute) 144 - # toggles mute and displays notif 145 - ${pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle 146 - show_vol_notif 147 - ;; 148 - 149 - bri_up) 150 - # increases brightness and display notif 151 - sudo ${light}/bin/light -A ${bri_step} 152 - show_bri_notif 153 - ;; 154 - 155 - bri_down) 156 - # decreases brightness and display notif 157 - sudo ${light}/bin/light -U ${bri_step} 158 - show_bri_notif 159 - ;; 160 - 161 - next_track) 162 - # skips to next song and displays notif 163 - ${playerctl}/bin/playerctl next 164 - sleep 0.5 && show_music_notif 165 - ;; 166 - 167 - prev_track) 168 - # skips to previous song and displays notif 169 - ${playerctl}/bin/playerctl previous 170 - sleep 0.5 && show_music_notif 171 - ;; 172 - 173 - play_pause) 174 - # toggles play/pause and displays notif 175 - ${playerctl}/bin/playerctl play-pause 176 - show_music_notif 177 - ;; 178 - 179 - pause) 180 - # just pauses and displays notif 181 - ${playerctl}/bin/playerctl pause 182 - show_music_notif 183 - ;; 184 - esac 185 - ''