diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-17 13:18:49 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-17 13:18:49 +0200 |
| commit | 4c55551353bb57a2fa8f25be0f6109fc324546dd (patch) | |
| tree | 51c08cd0b40d5fe764d9a8132a791f8d647c34ce /accounts/gkleen@sif/systemd.nix | |
| parent | 21311806407ac301702996a4658c1dee2bf5f80e (diff) | |
| download | nixos-4c55551353bb57a2fa8f25be0f6109fc324546dd.tar nixos-4c55551353bb57a2fa8f25be0f6109fc324546dd.tar.gz nixos-4c55551353bb57a2fa8f25be0f6109fc324546dd.tar.bz2 nixos-4c55551353bb57a2fa8f25be0f6109fc324546dd.tar.xz nixos-4c55551353bb57a2fa8f25be0f6109fc324546dd.zip | |
...
Diffstat (limited to 'accounts/gkleen@sif/systemd.nix')
| -rw-r--r-- | accounts/gkleen@sif/systemd.nix | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index be016b09..613d034a 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | { pkgs, lib, config, userName, ... }: | 1 | { pkgs, lib, config, userName, ... }: |
| 2 | let | 2 | let |
| 3 | inherit (lib) listToAttrs nameValuePair; | 3 | inherit (lib) listToAttrs nameValuePair; |
| 4 | 4 | ||
| 5 | xmobar = import ./xmobar pkgs.haskellPackages; | 5 | xmobar = import ./xmobar pkgs.haskellPackages; |
| 6 | cfg = config.home-manager.users.${userName}; | 6 | cfg = config.home-manager.users.${userName}; |
| 7 | 7 | ||
| @@ -204,6 +204,80 @@ in { | |||
| 204 | WatchdogSec = "2s"; | 204 | WatchdogSec = "2s"; |
| 205 | }; | 205 | }; |
| 206 | }; | 206 | }; |
| 207 | polkit-kde-authentication-agent-1 = { | ||
| 208 | Install = { | ||
| 209 | WantedBy = ["graphical-session.target"]; | ||
| 210 | }; | ||
| 211 | Unit = { | ||
| 212 | PartOf = ["graphical-session.target"]; | ||
| 213 | Requires = ["graphical-session-pre.target"]; | ||
| 214 | After = ["graphical-session-pre.target"]; | ||
| 215 | }; | ||
| 216 | Service = { | ||
| 217 | ExecStart = "${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"; | ||
| 218 | Restart = "on-failure"; | ||
| 219 | }; | ||
| 220 | }; | ||
| 221 | gtklock = { | ||
| 222 | Unit = { | ||
| 223 | Requisite = ["graphical-session.target"]; | ||
| 224 | PartOf = ["graphical-session.target"]; | ||
| 225 | }; | ||
| 226 | Service = { | ||
| 227 | Type = "notify"; | ||
| 228 | RuntimeDirectory = "gtklock"; | ||
| 229 | CacheDirectory = "gtklock"; | ||
| 230 | ExecStartPre = [ | ||
| 231 | "${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" | ||
| 232 | "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" | ||
| 233 | (pkgs.writeShellScript "generate-css" '' | ||
| 234 | set -x | ||
| 235 | export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.imagemagick pkgs.findutils]}:$PATH" | ||
| 236 | |||
| 237 | declare -A monitors | ||
| 238 | monitors=() | ||
| 239 | while IFS= read -r entry; do | ||
| 240 | path=$(jq -r ".path" <<<"$entry") | ||
| 241 | [[ -z "$path" || ! -f "$path" ]] && continue | ||
| 242 | blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" | ||
| 243 | monitor=$(jq -r ".display" <<<"$entry") | ||
| 244 | if [[ ! -f "$blurred_path" ]]; then | ||
| 245 | mkdir -p "$(dirname "$blurred_path")" | ||
| 246 | magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & | ||
| 247 | fi | ||
| 248 | monitors+=([$monitor]="$blurred_path") | ||
| 249 | done < <(wpaperctl all-wallpapers -j | jq -c ".[]") | ||
| 250 | wait | ||
| 251 | |||
| 252 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' | ||
| 253 | #window-box { | ||
| 254 | padding: 64px; | ||
| 255 | /* border: 1px solid black; */ | ||
| 256 | border-radius: 4px; | ||
| 257 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; | ||
| 258 | /* background-color: white; */ | ||
| 259 | background-color: rgba(0, 0, 0, 0.5); | ||
| 260 | } | ||
| 261 | ''} "$RUNTIME_DIRECTORY"/style.css | ||
| 262 | for monitor in "''${!monitors[@]}"; do | ||
| 263 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF | ||
| 264 | window#''${monitor} { | ||
| 265 | background-image: url("''${monitors[$monitor]}"); | ||
| 266 | background-repeat: no-repeat; | ||
| 267 | background-size: 100% 100%; | ||
| 268 | background-origin: content-box; | ||
| 269 | } | ||
| 270 | EOF | ||
| 271 | done | ||
| 272 | '') | ||
| 273 | ]; | ||
| 274 | NotifyAccess = "all"; | ||
| 275 | ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" '' | ||
| 276 | ${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off | ||
| 277 | ${config.systemd.package}/bin/systemd-notify --ready | ||
| 278 | ''}''; | ||
| 279 | }; | ||
| 280 | }; | ||
| 207 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { | 281 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { |
| 208 | Unit = { | 282 | Unit = { |
| 209 | Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; | 283 | Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; |
