1
0
mirror of https://github.com/kmein/niveum synced 2026-03-22 12:51:08 +01:00

feat(packages): package tolino-screensaver, fzf-wrappers, dirmir

This commit is contained in:
Kierán Meinhardt
2019-08-26 16:40:52 +02:00
parent aaf4b54c04
commit 55041ff122
13 changed files with 100 additions and 73 deletions

27
packages/dirmir.nix Normal file
View File

@@ -0,0 +1,27 @@
{ writers, coreutils, findutils }:
let name = "dirmir";
in writers.writeDashBin name ''
export PATH=$PATH:${coreutils}/bin:${findutils}/bin
SOURCE="$1"
TARGET="$2"
if [ ! -d "$SOURCE" ] || [ $# -ne 2 ]; then
echo >/dev/stderr "Usage: ${name} SOURCE TARGET"
exit 1
fi
if [ -e "$TARGET" ]; then
echo >/dev/stderr "$TARGET" already exists. Please use a different name.
exit 1
fi
for entry in $(find "$SOURCE"); do
if [ -d "$entry" ]; then
mkdir -p "$TARGET/$entry"
else
# create a file with the same permissions as $entry
install -m "$(stat -c %a "$entry")" /dev/null "$TARGET/$entry"
fi
done
''