From 59a707a426bebef2b9be6f704084ddd550c6dfec Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Dec 2021 10:54:36 -0800 Subject: [PATCH] Fix broken executable paths --- common/home.nix | 6 +++--- hosts/main/home.nix | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/common/home.nix b/common/home.nix index f62106a..ae863dc 100644 --- a/common/home.nix +++ b/common/home.nix @@ -194,10 +194,10 @@ in direnv = { enable = true; nix-direnv.enable = true; - stdlib = '' + stdlib = with pkgs; '' _gopass_await() { - gopass show "$@" 2>( \ - zenity --progress --auto-close --no-cancel --pulsate \ + ${gopass}/bin/gopass show "$@" 2>( \ + ${gnome.zenity}/bin/zenity --progress --auto-close --no-cancel --pulsate \ --title 'Please tap the hardware key' \ --text "gopass show $*" \ ) diff --git a/hosts/main/home.nix b/hosts/main/home.nix index 15cccb7..1abf79e 100644 --- a/hosts/main/home.nix +++ b/hosts/main/home.nix @@ -1,5 +1,20 @@ { config, lib, pkgs, ... }: +let + organize-downloads = pkgs.writeShellScriptBin "organize-downloads" (with pkgs; '' + set -Eeuo pipefail + shopt -s nullglob + + mkdir -p '/home/ak/screenshots' + + for source in /home/ak/Downloads/Screen{s,\ S}hot\ *.png; do + destination="/home/ak/screenshots/$(basename "$source")" + + mv --no-clobber --verbose "$source" "$destination" + ${oxipng}/bin/oxipng --quiet --opt '4' --strip 'safe' --interlace '0' "$destination" + done + ''); +in { imports = [ ../../common/home.nix @@ -19,7 +34,7 @@ }; systemd.user.services.organize-downloads = { Unit.Description = "Organize downloads"; - Service.ExecStart = "%h/.local/bin/organize-downloads"; + Service.ExecStart = "${organize-downloads}/bin/organize-downloads"; Service.Nice = 10; };