Clean shared Home Manager packages

This commit is contained in:
Oliver Davies 2025-03-27 20:30:53 +00:00
parent 70b5185faf
commit d9f50762a7
6 changed files with 0 additions and 135 deletions

View file

@ -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
]

View file

@ -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
'';
}

View file

@ -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
'';
}

View file

@ -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"
'';
}

View file

@ -1,16 +0,0 @@
{ pkgs }:
{
name = "run";
runtimeInputs = with pkgs; [ bashInteractive ];
text = ''
if [[ -e .ignored/run ]]; then
.ignored/run "$@"
exit $?
fi
./run "$@"
'';
}

View file

@ -1,20 +0,0 @@
{
name = "timer";
runtimeInputs = [ ];
text = ''
if [[ "$1" == "" ]]; then
echo "Usage: ''${0##*/} <mins> [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
'';
}