git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #123084 from Yarny0/hylafax

hylafaxplus & nixos/hylafax: small improvements

commitc455f3ccaf7e4881f1435c33fc5583bad9053acb authorajs124 <ajs124@users.noreply.github.com> dateFri 21 May 2021, 14:20 (5 years ago) parent7cb5499c2af1ff
7 files changed+31−46
nixos/modules/services/networking/hylafax/faxq-wait.sh+1−1 nixos/modules/services/networking/hylafax/options.nix+7−8 nixos/modules/services/networking/hylafax/spool.sh+3−3 nixos/modules/services/networking/hylafax/systemd.nix+8−8 pkgs/servers/hylafaxplus/default.nix+12−6 pkgs/servers/hylafaxplus/libtiff-4.2.patch−13 pkgs/servers/hylafaxplus/post-patch.sh−7
nixos/modules/services/networking/hylafax/faxq-wait.sh+1−1
@@ -1,4 +1,4 @@
1−#! @shell@ -e
1+#! @runtimeShell@ -e
22
33# skip this if there are no modems at all
44if ! stat -t "@spoolAreaPath@"/etc/config.* >/dev/null 2>&1
nixos/modules/services/networking/hylafax/options.nix+7−8
@@ -3,7 +3,7 @@
33let
44
55 inherit (lib.options) literalExample mkEnableOption mkOption;
6− inherit (lib.types) bool enum int lines attrsOf nullOr path str submodule;
6+ inherit (lib.types) bool enum ints lines attrsOf nullOr path str submodule;
77 inherit (lib.modules) mkDefault mkIf mkMerge;
88
99 commonDescr = ''
@@ -18,7 +18,6 @@ let
1818 '';
1919
2020 str1 = lib.types.addCheck str (s: s!=""); # non-empty string
21− int1 = lib.types.addCheck int (i: i>0); # positive integer
2221
2322 configAttrType =
2423 # Options in HylaFAX configuration files can be
@@ -27,7 +26,7 @@ let
2726 # This type definition resolves all
2827 # those types into a list of strings.
2928 let
30− inherit (lib.types) attrsOf coercedTo listOf;
29+ inherit (lib.types) attrsOf coercedTo int listOf;
3130 innerType = coercedTo bool (x: if x then "Yes" else "No")
3231 (coercedTo int (toString) str);
3332 in
@@ -290,7 +289,7 @@ in
290289 '';
291290 };
292291 faxcron.infoDays = mkOption {
293− type = int1;
292+ type = ints.positive;
294293 default = 30;
295294 description = ''
296295 Set the expiration time for data in the
@@ -298,7 +297,7 @@ in
298297 '';
299298 };
300299 faxcron.logDays = mkOption {
301− type = int1;
300+ type = ints.positive;
302301 default = 30;
303302 description = ''
304303 Set the expiration time for
@@ -306,7 +305,7 @@ in
306305 '';
307306 };
308307 faxcron.rcvDays = mkOption {
309− type = int1;
308+ type = ints.positive;
310309 default = 7;
311310 description = ''
312311 Set the expiration time for files in
@@ -343,7 +342,7 @@ in
343342 '';
344343 };
345344 faxqclean.doneqMinutes = mkOption {
346− type = int1;
345+ type = ints.positive;
347346 default = 15;
348347 example = literalExample "24*60";
349348 description = ''
@@ -353,7 +352,7 @@ in
353352 '';
354353 };
355354 faxqclean.docqMinutes = mkOption {
356− type = int1;
355+ type = ints.positive;
357356 default = 60;
358357 example = literalExample "24*60";
359358 description = ''
nixos/modules/services/networking/hylafax/spool.sh+3−3
@@ -1,4 +1,4 @@
1−#! @shell@ -e
1+#! @runtimeShell@ -e
22
33# The following lines create/update the HylaFAX spool directory:
44# Subdirectories/files with persistent data are kept,
@@ -80,7 +80,7 @@ touch clientlog faxcron.lastrun xferfaxlog
8080chown @faxuser@:@faxgroup@ clientlog faxcron.lastrun xferfaxlog
8181
8282# create symlinks for frozen directories/files
83−lnsym --target-directory=. "@hylafax@"/spool/{COPYRIGHT,bin,config}
83+lnsym --target-directory=. "@hylafaxplus@"/spool/{COPYRIGHT,bin,config}
8484
8585# create empty temporary directories
8686update --mode=0700 -d client dev status
@@ -93,7 +93,7 @@ install -d "@spoolAreaPath@/etc"
9393cd "@spoolAreaPath@/etc"
9494
9595# create symlinks to all files in template's etc
96−lnsym --target-directory=. "@hylafax@/spool/etc"/*
96+lnsym --target-directory=. "@hylafaxplus@/spool/etc"/*
9797
9898# set LOCKDIR in setup.cache
9999sed --regexp-extended 's|^(UUCP_LOCKDIR=).*$|\1'"'@lockPath@'|g" --in-place setup.cache
nixos/modules/services/networking/hylafax/systemd.nix+8−8
@@ -13,11 +13,10 @@ let
1313 # creates hylafax config file,
1414 # makes sure "Include" is listed *first*
1515 let
16− mkLines = conf:
17− (lib.concatLists
18− (lib.flip lib.mapAttrsToList conf
19− (k: map (v: "${k}: ${v}")
20− )));
16+ mkLines = lib.flip lib.pipe [
17+ (lib.mapAttrsToList (key: map (val: "${key}: ${val}")))
18+ lib.concatLists
19+ ];
2120 include = mkLines { Include = conf.Include or []; };
2221 other = mkLines ( conf // { Include = []; } );
2322 in
@@ -48,13 +47,12 @@ let
4847 name = "hylafax-setup-spool.sh";
4948 src = ./spool.sh;
5049 isExecutable = true;
51− inherit (pkgs.stdenv) shell;
52− hylafax = pkgs.hylafaxplus;
5350 faxuser = "uucp";
5451 faxgroup = "uucp";
5552 lockPath = "/var/lock";
5653 inherit globalConfigPath modemConfigPath;
5754 inherit (cfg) sendmailPath spoolAreaPath userAccessFile;
55+ inherit (pkgs) hylafaxplus runtimeShell;
5856 };
5957
6058 waitFaxqScript = pkgs.substituteAll {
@@ -64,8 +62,8 @@ let
6462 src = ./faxq-wait.sh;
6563 isExecutable = true;
6664 timeoutSec = toString 10;
67− inherit (pkgs.stdenv) shell;
6865 inherit (cfg) spoolAreaPath;
66+ inherit (pkgs) runtimeShell;
6967 };
7068
7169 sockets.hylafax-hfaxd = {
@@ -108,8 +106,10 @@ let
108106 PrivateDevices = true; # breaks /dev/tty...
109107 PrivateNetwork = true;
110108 PrivateTmp = true;
109+ #ProtectClock = true; # breaks /dev/tty... (why?)
111110 ProtectControlGroups = true;
112111 #ProtectHome = true; # breaks custom spool dirs
112+ ProtectKernelLogs = true;
113113 ProtectKernelModules = true;
114114 ProtectKernelTunables = true;
115115 #ProtectSystem = "strict"; # breaks custom spool dirs
pkgs/servers/hylafaxplus/default.nix+12−6
@@ -2,6 +2,7 @@
22, lib
33, fakeroot
44, fetchurl
5+, fetchpatch
56, libfaketime
67, substituteAll
78## runtime dependencies
@@ -29,12 +30,12 @@
2930
3031let
3132
32− name = "hylafaxplus-${version}";
33+ pname = "hylafaxplus";
3334 version = "7.0.3";
3435 sha256 = "139iwcwrn9i5lragxi33ilzah72w59wg4midfjjgx5cly3ah0iy4";
3536
3637 configSite = substituteAll {
37− name = "hylafaxplus-config.site";
38+ name = "${pname}-config.site";
3839 src = ./config.site;
3940 config_maxgid = lib.optionalString (maxgid!=null) ''CONFIG_MAXGID=${builtins.toString maxgid}'';
4041 ghostscript_version = ghostscript.version;
@@ -43,7 +44,7 @@ let
4344 };
4445
4546 postPatch = substituteAll {
46− name = "hylafaxplus-post-patch.sh";
47+ name = "${pname}-post-patch.sh";
4748 src = ./post-patch.sh;
4849 inherit configSite;
4950 maxuid = lib.optionalString (maxuid!=null) (builtins.toString maxuid);
@@ -54,7 +55,7 @@ let
5455 };
5556
5657 postInstall = substituteAll {
57− name = "hylafaxplus-post-install.sh";
58+ name = "${pname}-post-install.sh";
5859 src = ./post-install.sh;
5960 inherit fakeroot libfaketime;
6061 };
@@ -62,13 +63,18 @@ let
6263in
6364
6465stdenv.mkDerivation {
65− inherit name version;
66+ inherit pname version;
6667 src = fetchurl {
6768 url = "mirror://sourceforge/hylafax/hylafax-${version}.tar.gz";
6869 inherit sha256;
6970 };
7071 patches = [
71− ./libtiff-4.2.patch # adjust configure check to work with libtiff > 4.1
72+ # adjust configure check to work with libtiff > 4.1
73+ (fetchpatch {
74+ name = "libtiff-4.2.patch";
75+ url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-misc/hylafaxplus/files/hylafaxplus-7.0.2-tiff-4.2.patch?id=82e3eefd5447f36e5bb00068a54b91d8c891ccf6";
76+ sha256 = "0hhf4wpgj842gz4nxq8s55vnzmciqkyjjaaxdpqawns2746vx0sw";
77+ })
7278 ];
7379 # Note that `configure` (and maybe `faxsetup`) are looking
7480 # for a couple of standard binaries in the `PATH` and
pkgs/servers/hylafaxplus/libtiff-4.2.patchdeleted−13
@@ -1,13 +0,0 @@
1−diff --git a/configure b/configure
2−index 7456dcb..90f0e8d 100755
3−--- a/configure
4−+++ b/configure
5−@@ -2583,7 +2583,7 @@ EOF
6− echo '#define TIFFSTRIPBYTECOUNTS uint32'
7− echo '#define TIFFVERSION TIFF_VERSION'
8− echo '#define TIFFHEADER TIFFHeader';;
9−- 4.[01]) tiff_runlen_t="uint32"
10−+ 4.[012]) tiff_runlen_t="uint32"
11− tiff_offset_t="uint64"
12− echo '#define TIFFSTRIPBYTECOUNTS uint64'
13− echo '#define TIFFVERSION TIFF_VERSION_CLASSIC'
pkgs/servers/hylafaxplus/post-patch.sh−7
@@ -1,10 +1,3 @@
1−# `configure` (maybe others) set `POSIXLY_CORRECT`, which
2−# breaks the gcc wrapper script of nixpkgs (maybe others).
3−# We simply un-export `POSIXLY_CORRECT` after each export so
4−# its effects don't apply within nixpkgs wrapper scripts.
5−grep -rlF POSIXLY_CORRECT | xargs \
6− sed '/export *POSIXLY_CORRECT/a export -n POSIXLY_CORRECT' -i
7−
81# Replace strange default value for the nobody account.
92if test -n "@maxuid@"
103then