summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/co/con2pdf
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/co/con2pdf')
-rwxr-xr-xpkgs/by-name/co/con2pdf/con2pdf.sh31
-rw-r--r--pkgs/by-name/co/con2pdf/package.nix33
-rw-r--r--pkgs/by-name/co/con2pdf/package.unstable.nix43
3 files changed, 61 insertions, 46 deletions
diff --git a/pkgs/by-name/co/con2pdf/con2pdf.sh b/pkgs/by-name/co/con2pdf/con2pdf.sh
index 27c9d092..5737bc82 100755
--- a/pkgs/by-name/co/con2pdf/con2pdf.sh
+++ b/pkgs/by-name/co/con2pdf/con2pdf.sh
@@ -1,19 +1,24 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# needed for help() and version
-# shellcheck disable=2034
-AUTHORS="Soispha"
-# shellcheck disable=2034
-YEARS="2023"
-# shellcheck disable=2034
-VERSION="1.0.0"
+# TODO(@bpeetz): This should probably be rewritten in rust. <2025-04-14>
-# NAME is from the wrapper
-# shellcheck disable=SC2269
-NAME="$NAME"
+
+# shellcheck disable=SC2317,SC2329
+
+echo "Rewrite this script in something else then shell (or remove the dependency on the sh-lib)"
+exit 2
+
+NAME="con2pdf"
help() {
cat <<EOF
Scan images and turn them into a pdf.
@@ -52,7 +57,7 @@ ARGUMENTS:
NUM | *([0-9]) := 0 | 1 | 2 | 3 | 4
Possible numbers of pages, can be more than 4
- DEVICE := [[$(cat %DEVICE_FUNCTION)]]
+ DEVICE := [[$(cat "$DEVICE_FUNCTION")]]
Possible scanner names
METHOD := ADF | Flatbed
diff --git a/pkgs/by-name/co/con2pdf/package.nix b/pkgs/by-name/co/con2pdf/package.nix
deleted file mode 100644
index 8eb994fd..00000000
--- a/pkgs/by-name/co/con2pdf/package.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- sysLib,
- writeText,
- # dependencies
- sane-backends,
- imagemagick,
- coreutils,
- fd,
-}:
-sysLib.writeShellScript {
- name = "con2pdf";
- src = ./con2pdf.sh;
- generateCompletions = true;
- keepPath = false;
- dependencies = [
- sane-backends
- imagemagick
- coreutils
- fd
- ];
- replacementStrings = {
- DEVICE_FUNCTION =
- # This is here, because escaping the whole function, to use it in the shell script
- # directly just isn't possible
- writeText "DEVICE_FUNCTION"
- /*
- bash
- */
- ''
- scanimage -L | awk 'BEGIN { FS = "`" } { gsub(/'.*/, "", $2); print $2 }'
- '';
- };
-}
diff --git a/pkgs/by-name/co/con2pdf/package.unstable.nix b/pkgs/by-name/co/con2pdf/package.unstable.nix
new file mode 100644
index 00000000..11d45ab5
--- /dev/null
+++ b/pkgs/by-name/co/con2pdf/package.unstable.nix
@@ -0,0 +1,43 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{
+ writeShellApplication,
+ writeText,
+ # Dependencies
+ sane-backends,
+ imagemagick,
+ coreutils,
+ fd,
+}:
+writeShellApplication {
+ name = "con2pdf";
+ text = builtins.readFile ./con2pdf.sh;
+ inheritPath = false;
+
+ runtimeInputs = [
+ sane-backends
+ imagemagick
+ coreutils
+ fd
+ ];
+
+ runtimeEnv = {
+ DEVICE_FUNCTION =
+ # This is here, because escaping the whole function, to use it in the shell script
+ # directly just isn't possible
+ writeText "DEVICE_FUNCTION"
+ /*
+ bash
+ */
+ ''
+ scanimage -L | awk 'BEGIN { FS = "`" } { gsub(/'.*/, "", $2); print $2 }'
+ '';
+ };
+}