diff options
-rw-r--r-- | modules/by-name/lf/lf/ctpv/default.nix | 21 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix | 2 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix | 2 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix | 1 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/audio/default.nix | 3 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/default.nix | 5 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/font/default.nix | 2 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/image/default.nix | 3 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix | 2 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/inode/default.nix | 4 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/video/default.nix | 2 | ||||
-rw-r--r-- | pkgs/by-name/st/stamp/package.nix | 1 | ||||
-rwxr-xr-x | pkgs/by-name/st/stamp/stamp.sh | 60 |
13 files changed, 71 insertions, 37 deletions
diff --git a/modules/by-name/lf/lf/ctpv/default.nix b/modules/by-name/lf/lf/ctpv/default.nix index e89ae453..a7d6927a 100644 --- a/modules/by-name/lf/lf/ctpv/default.nix +++ b/modules/by-name/lf/lf/ctpv/default.nix @@ -113,15 +113,7 @@ }; dependencies = lib.mkOption { type = lib.types.listOf lib.types.package; - default = with pkgs; [ - dash - coreutils - # Dependencies of the helpers.sh script - chafa - gnused - gnugrep - unixtools.script - ]; + default = []; description = "The packages to provide to the script"; }; }; @@ -159,6 +151,17 @@ in { default = config.home-manager.users.soispha.xdg.dataHome; }; + # TODO: This is necessary, as the `./prev` dir is imported separately and as such + # cannot access the `./helpers.sh` file in it's parent directory. + # This separate import should ideally be removed. <2024-12-15> + helpers = lib.mkOption { + default = ./helpers.sh; + type = lib.types.pathInStore; + + internal = true; + readOnly = true; + }; + previewers = lib.mkOption { description = '' The previewers to add to the config file. diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix index 33c51352..40510a78 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix @@ -8,6 +8,8 @@ dependencies = with pkgs; [ bk epub-thumbnailer + chafa + gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix index b27e3ef9..d3061ea8 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix @@ -6,6 +6,8 @@ priority = 1; dependencies = [ pkgs.poppler_utils # for `pdftoppm` + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix index c219a1ed..32f42783 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix @@ -11,6 +11,7 @@ priority = 1; dependencies = [ pkgs.sequoia-sq + pkgs.unixtools.script ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix index 97731daf..0c60e9d5 100644 --- a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix @@ -6,6 +6,9 @@ dependencies = [ pkgs.ffmpegthumbnailer pkgs.ffmpeg + + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/default.nix b/modules/by-name/lf/lf/ctpv/prev/default.nix index 211a20bd..b59430f8 100644 --- a/modules/by-name/lf/lf/ctpv/prev/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/default.nix @@ -11,6 +11,11 @@ in { priority = -1; matches.mime = ["*/*"]; replacementStrings = { + # FIXME: This declaration replaces the default (although it should be merged with + # the default value.) There must be a way, so that repeating the default values is + # not needed. <2024-12-15> + HELPERS = cfg.ctpv.helpers; + STORAGE_DIRECTORY = "${cfg.ctpv.xdgDataHome}/ctpv/missing_previews"; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/font/default.nix b/modules/by-name/lf/lf/ctpv/prev/font/default.nix index f5301008..306e7892 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/font/default.nix @@ -11,6 +11,8 @@ ]; dependencies = [ pkgs.fontforge # for `fontimage` + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/image/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/default.nix index 36700fec..87fba00c 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/default.nix @@ -4,7 +4,8 @@ previewer = ./image.sh; matches.mime = ["image/*"]; dependencies = [ - # Everything is already in the default dependencies. + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix index 5b965fd7..90915c84 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix @@ -6,6 +6,8 @@ matches.mime = ["image/svg+xml"]; dependencies = [ pkgs.imagemagick + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix index bed0b81a..eaade0f1 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix @@ -1,10 +1,10 @@ -{...}: { +{pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { ls = { previewer = ./ls.sh; priority = 1; matches.mime = ["inode/directory"]; - dependencies = []; + dependencies = [pkgs.coreutils]; }; symlink = { previewer = ./symlink.sh; diff --git a/modules/by-name/lf/lf/ctpv/prev/video/default.nix b/modules/by-name/lf/lf/ctpv/prev/video/default.nix index 47749d2c..f38f61c7 100644 --- a/modules/by-name/lf/lf/ctpv/prev/video/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/video/default.nix @@ -5,6 +5,8 @@ matches.mime = ["video/*"]; dependencies = [ pkgs.ffmpegthumbnailer + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/pkgs/by-name/st/stamp/package.nix b/pkgs/by-name/st/stamp/package.nix index f39e2197..703f73e3 100644 --- a/pkgs/by-name/st/stamp/package.nix +++ b/pkgs/by-name/st/stamp/package.nix @@ -10,6 +10,7 @@ sysLib.writeShellScript { src = ./stamp.sh; generateCompletions = false; keepPath = false; + dependencies = [ findutils fd diff --git a/pkgs/by-name/st/stamp/stamp.sh b/pkgs/by-name/st/stamp/stamp.sh index c3697c99..0fced956 100755 --- a/pkgs/by-name/st/stamp/stamp.sh +++ b/pkgs/by-name/st/stamp/stamp.sh @@ -5,49 +5,48 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH help() { cat <<EOF -A simply file copyright menagment system +A simple file copyright management system. USAGE: - stamp [OPTIONS] COMMAND + stamp [OPTIONS] FILES_OR_DIRECTORIES OPTIONS: - --help | -h + --help | -h Display this help and exit. - --license | -l L + --license L | -l L Specify a license. -COMMANDS: - copyright FILES_OR_DIRECTORIES - Add your copyright information to this file [this is the default command]. + This defaults to the GPL-3.0-or-later. - c FILES_OR_DIRECTORIES - An alias for the copyright above. + --copyright C | -c C + Specify a copyright string (e.g. name and email). + By default this is constructed from the git user.name and user.email ARGUMENTS: FILES_OR_DIRECTORIES := [[ fd . --max-depth 3 ]] Possible files to stamp. L := GPL-3.0-or-later|CC-BY-SA-4.0|AGPL-3.0-or-later A possible license identifier. These above are only suggestions. + + C := [[ true ]] + This can be anything, which represents a copyright string. + Commenly that is a combination of a name and an email. EOF } reuse_run() { root="$(git rev-parse --show-toplevel)" + template="" if [ -e "$root/.reuse/templates/default.jinja2" ]; then - reuse annotate \ - --copyright "$(git config --get user.name) <$(git config --get user.email)>" \ - --copyright-style string-c \ - --template default \ - --fallback-dot-license \ - --license "$license" "$1" - else - reuse annotate \ - --copyright "$(git config --get user.name) <$(git config --get user.email)>" \ - --copyright-style string-c \ - --fallback-dot-license \ - --license "$license" "$1" + template="--template=default" fi + + reuse annotate \ + --copyright="$copyright" \ + --copyright-prefix=string-c $template \ + --fallback-dot-license \ + --license="$license" -- "$1" } for arg in "$@"; do @@ -62,21 +61,32 @@ done [ "$(git rev-parse --is-inside-work-tree)" = "true" ] || die "You need to be in a git directory" run=true +license="GPL-3.0-or-later" +copyright="$(git config --get user.name) <$(git config --get user.email)>" while [ "$#" -gt 0 ] && [ "$run" = true ]; do case "$1" in "--license" | "-l") shift 1 license="$1" - [ "$license" ] || die "No license specified. See --help for more." + [ "$license" ] || die "No license specified. See --help for usage." shift 1 ;; - "copyright" | "c") + "--copyright" | "-c") + shift 1 + copyright="$1" + [ "$copyright" ] || die "No copyright string specified. See --help for usage." shift 1 - # The files should now be in $@ + ;; + "--") run=false + shift 1 + ;; + -*) + die "Unknown option: '$1' (if you intented this to be a path use '--' before it.)" ;; *) - die "Unknown command: $1" + # We reached the end of the options. + run=false ;; esac done |