From d9f50762a72cf983fcbe30a9c1f1b82025e27897 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 27 Mar 2025 20:30:53 +0000 Subject: [PATCH] Clean shared Home Manager packages --- nix/lib/shared/home-manager-packages.nix | 28 ----------------- nix/lib/shared/scripts/_timer.nix | 13 -------- nix/lib/shared/scripts/deliver.nix | 25 --------------- nix/lib/shared/scripts/export-video-list.nix | 33 -------------------- nix/lib/shared/scripts/run.nix | 16 ---------- nix/lib/shared/scripts/timer.nix | 20 ------------ 6 files changed, 135 deletions(-) delete mode 100644 nix/lib/shared/scripts/_timer.nix delete mode 100644 nix/lib/shared/scripts/deliver.nix delete mode 100644 nix/lib/shared/scripts/export-video-list.nix delete mode 100644 nix/lib/shared/scripts/run.nix delete mode 100644 nix/lib/shared/scripts/timer.nix diff --git a/nix/lib/shared/home-manager-packages.nix b/nix/lib/shared/home-manager-packages.nix index b4cdd06c..4b22f704 100644 --- a/nix/lib/shared/home-manager-packages.nix +++ b/nix/lib/shared/home-manager-packages.nix @@ -4,39 +4,21 @@ username, ... }: -let - php = pkgs.php82; - phpPackages = pkgs.php82Packages; - inherit (pkgs) writeShellApplication; - - _timer = writeShellApplication (import ./scripts/_timer.nix); - deliver = writeShellApplication (import ./scripts/deliver.nix { inherit pkgs; }); - export-video-list = writeShellApplication ( - import ./scripts/export-video-list.nix { inherit pkgs username; } - ); - run = writeShellApplication (import ./scripts/run.nix { inherit pkgs; }); - timer = writeShellApplication (import ./scripts/timer.nix); -in with pkgs; [ cachix delta - devenv - doppler entr gcc git git-crypt gnupg - go inotify-tools jq killall lua mob - php - phpPackages.composer pv simple-http-server sshs @@ -50,14 +32,4 @@ with pkgs; xclip xdg-utils zbar - - # Scripts. - deliver - run -] -++ pkgs.lib.optionals (!headless) [ - # Scripts. - _timer - export-video-list - timer ] diff --git a/nix/lib/shared/scripts/_timer.nix b/nix/lib/shared/scripts/_timer.nix deleted file mode 100644 index d670e909..00000000 --- a/nix/lib/shared/scripts/_timer.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - name = "_timer"; - - runtimeInputs = [ ]; - - text = '' - mins=$1 - message=''${2:-Time out!} - - sleep -- "$mins" * 60 - notify-send -t 0 "''${message}" "Your timer of $mins min is over" -u normal - ''; -} diff --git a/nix/lib/shared/scripts/deliver.nix b/nix/lib/shared/scripts/deliver.nix deleted file mode 100644 index d24999d1..00000000 --- a/nix/lib/shared/scripts/deliver.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs }: -{ - name = "deliver"; - - runtimeInputs = with pkgs; [ docker ]; - - text = '' - set +o pipefail - - # Based on https://github.com/jessarcher/dotfiles/blob/ef692c35d64db2c13674dfc850a23b6acf9e8f91/scripts/deliver. - - docker_compose_service_name=$(docker compose ps --services 2>/dev/null | grep '^app\|php$' | head -n1) - - if [[ "$docker_compose_service_name" != "" ]]; then - if [ -t 1 ]; then - "${pkgs.docker}/bin/docker" compose exec "$docker_compose_service_name" "$@" - else - # The command is not being run in a TTY - "${pkgs.docker}/bin/docker" compose exec -T "$docker_compose_service_name" "$@" - fi - else - "$@" - fi - ''; -} diff --git a/nix/lib/shared/scripts/export-video-list.nix b/nix/lib/shared/scripts/export-video-list.nix deleted file mode 100644 index 32c286e6..00000000 --- a/nix/lib/shared/scripts/export-video-list.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ pkgs, username, ... }: -{ - name = "export-video-list"; - - runtimeInputs = with pkgs; [ - jq - tree - udisks - ]; - - text = '' - device_name="/dev/sda2" - device_label="UNTITLED" - - source_path="/run/media/${username}/$device_label" - - # If the source path doesn't exist, try mounting the device. - if [[ ! -d "$source_path" ]]; then - ${pkgs.udisks}/bin/udisksctl mount -b "$device_name" - fi - - # Exit early if the source path still doesn't exist. - if [[ ! -d "$source_path" ]]; then - echo "Error: $source_path not found." - exit 1 - fi - - output_file="$XDG_DOCUMENTS_DIR/videos.json" - - ${pkgs.tree}/bin/tree -J "$source_path/Videos" | ${pkgs.jq}/bin/jq . > "$output_file" - ${pkgs.jq}/bin/jq . < "$output_file" - ''; -} diff --git a/nix/lib/shared/scripts/run.nix b/nix/lib/shared/scripts/run.nix deleted file mode 100644 index 8533c4e8..00000000 --- a/nix/lib/shared/scripts/run.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs }: - -{ - name = "run"; - - runtimeInputs = with pkgs; [ bashInteractive ]; - - text = '' - if [[ -e .ignored/run ]]; then - .ignored/run "$@" - exit $? - fi - - ./run "$@" - ''; -} diff --git a/nix/lib/shared/scripts/timer.nix b/nix/lib/shared/scripts/timer.nix deleted file mode 100644 index ee261589..00000000 --- a/nix/lib/shared/scripts/timer.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - name = "timer"; - - runtimeInputs = [ ]; - - text = '' - if [[ "$1" == "" ]]; then - echo "Usage: ''${0##*/} [message]" - exit 1 - fi - - mins=$1 - message=$2 - - nohup _timer "$mins" "$message" &> /dev/null & - - echo "timer started for $mins min" - echo "timer started for $mins min, message: '$message'" | systemd-cat -t timer - ''; -}