Merge pull request #123084 from Yarny0/hylafax

hylafaxplus & nixos/hylafax: small improvements

ajs124 c455f3cc 7cb54991

Changed files
+31 -46
nixos
modules
services
pkgs
+1 -1
nixos/modules/services/networking/hylafax/faxq-wait.sh
···
-
#! @shell@ -e
# skip this if there are no modems at all
if ! stat -t "@spoolAreaPath@"/etc/config.* >/dev/null 2>&1
···
+
#! @runtimeShell@ -e
# skip this if there are no modems at all
if ! stat -t "@spoolAreaPath@"/etc/config.* >/dev/null 2>&1
+7 -8
nixos/modules/services/networking/hylafax/options.nix
···
let
inherit (lib.options) literalExample mkEnableOption mkOption;
-
inherit (lib.types) bool enum int lines attrsOf nullOr path str submodule;
inherit (lib.modules) mkDefault mkIf mkMerge;
commonDescr = ''
···
'';
str1 = lib.types.addCheck str (s: s!=""); # non-empty string
-
int1 = lib.types.addCheck int (i: i>0); # positive integer
configAttrType =
# Options in HylaFAX configuration files can be
···
# This type definition resolves all
# those types into a list of strings.
let
-
inherit (lib.types) attrsOf coercedTo listOf;
innerType = coercedTo bool (x: if x then "Yes" else "No")
(coercedTo int (toString) str);
in
···
'';
};
faxcron.infoDays = mkOption {
-
type = int1;
default = 30;
description = ''
Set the expiration time for data in the
···
'';
};
faxcron.logDays = mkOption {
-
type = int1;
default = 30;
description = ''
Set the expiration time for
···
'';
};
faxcron.rcvDays = mkOption {
-
type = int1;
default = 7;
description = ''
Set the expiration time for files in
···
'';
};
faxqclean.doneqMinutes = mkOption {
-
type = int1;
default = 15;
example = literalExample "24*60";
description = ''
···
'';
};
faxqclean.docqMinutes = mkOption {
-
type = int1;
default = 60;
example = literalExample "24*60";
description = ''
···
let
inherit (lib.options) literalExample mkEnableOption mkOption;
+
inherit (lib.types) bool enum ints lines attrsOf nullOr path str submodule;
inherit (lib.modules) mkDefault mkIf mkMerge;
commonDescr = ''
···
'';
str1 = lib.types.addCheck str (s: s!=""); # non-empty string
configAttrType =
# Options in HylaFAX configuration files can be
···
# This type definition resolves all
# those types into a list of strings.
let
+
inherit (lib.types) attrsOf coercedTo int listOf;
innerType = coercedTo bool (x: if x then "Yes" else "No")
(coercedTo int (toString) str);
in
···
'';
};
faxcron.infoDays = mkOption {
+
type = ints.positive;
default = 30;
description = ''
Set the expiration time for data in the
···
'';
};
faxcron.logDays = mkOption {
+
type = ints.positive;
default = 30;
description = ''
Set the expiration time for
···
'';
};
faxcron.rcvDays = mkOption {
+
type = ints.positive;
default = 7;
description = ''
Set the expiration time for files in
···
'';
};
faxqclean.doneqMinutes = mkOption {
+
type = ints.positive;
default = 15;
example = literalExample "24*60";
description = ''
···
'';
};
faxqclean.docqMinutes = mkOption {
+
type = ints.positive;
default = 60;
example = literalExample "24*60";
description = ''
+3 -3
nixos/modules/services/networking/hylafax/spool.sh
···
-
#! @shell@ -e
# The following lines create/update the HylaFAX spool directory:
# Subdirectories/files with persistent data are kept,
···
chown @faxuser@:@faxgroup@ clientlog faxcron.lastrun xferfaxlog
# create symlinks for frozen directories/files
-
lnsym --target-directory=. "@hylafax@"/spool/{COPYRIGHT,bin,config}
# create empty temporary directories
update --mode=0700 -d client dev status
···
cd "@spoolAreaPath@/etc"
# create symlinks to all files in template's etc
-
lnsym --target-directory=. "@hylafax@/spool/etc"/*
# set LOCKDIR in setup.cache
sed --regexp-extended 's|^(UUCP_LOCKDIR=).*$|\1'"'@lockPath@'|g" --in-place setup.cache
···
+
#! @runtimeShell@ -e
# The following lines create/update the HylaFAX spool directory:
# Subdirectories/files with persistent data are kept,
···
chown @faxuser@:@faxgroup@ clientlog faxcron.lastrun xferfaxlog
# create symlinks for frozen directories/files
+
lnsym --target-directory=. "@hylafaxplus@"/spool/{COPYRIGHT,bin,config}
# create empty temporary directories
update --mode=0700 -d client dev status
···
cd "@spoolAreaPath@/etc"
# create symlinks to all files in template's etc
+
lnsym --target-directory=. "@hylafaxplus@/spool/etc"/*
# set LOCKDIR in setup.cache
sed --regexp-extended 's|^(UUCP_LOCKDIR=).*$|\1'"'@lockPath@'|g" --in-place setup.cache
+8 -8
nixos/modules/services/networking/hylafax/systemd.nix
···
# creates hylafax config file,
# makes sure "Include" is listed *first*
let
-
mkLines = conf:
-
(lib.concatLists
-
(lib.flip lib.mapAttrsToList conf
-
(k: map (v: "${k}: ${v}")
-
)));
include = mkLines { Include = conf.Include or []; };
other = mkLines ( conf // { Include = []; } );
in
···
name = "hylafax-setup-spool.sh";
src = ./spool.sh;
isExecutable = true;
-
inherit (pkgs.stdenv) shell;
-
hylafax = pkgs.hylafaxplus;
faxuser = "uucp";
faxgroup = "uucp";
lockPath = "/var/lock";
inherit globalConfigPath modemConfigPath;
inherit (cfg) sendmailPath spoolAreaPath userAccessFile;
};
waitFaxqScript = pkgs.substituteAll {
···
src = ./faxq-wait.sh;
isExecutable = true;
timeoutSec = toString 10;
-
inherit (pkgs.stdenv) shell;
inherit (cfg) spoolAreaPath;
};
sockets.hylafax-hfaxd = {
···
PrivateDevices = true; # breaks /dev/tty...
PrivateNetwork = true;
PrivateTmp = true;
ProtectControlGroups = true;
#ProtectHome = true; # breaks custom spool dirs
ProtectKernelModules = true;
ProtectKernelTunables = true;
#ProtectSystem = "strict"; # breaks custom spool dirs
···
# creates hylafax config file,
# makes sure "Include" is listed *first*
let
+
mkLines = lib.flip lib.pipe [
+
(lib.mapAttrsToList (key: map (val: "${key}: ${val}")))
+
lib.concatLists
+
];
include = mkLines { Include = conf.Include or []; };
other = mkLines ( conf // { Include = []; } );
in
···
name = "hylafax-setup-spool.sh";
src = ./spool.sh;
isExecutable = true;
faxuser = "uucp";
faxgroup = "uucp";
lockPath = "/var/lock";
inherit globalConfigPath modemConfigPath;
inherit (cfg) sendmailPath spoolAreaPath userAccessFile;
+
inherit (pkgs) hylafaxplus runtimeShell;
};
waitFaxqScript = pkgs.substituteAll {
···
src = ./faxq-wait.sh;
isExecutable = true;
timeoutSec = toString 10;
inherit (cfg) spoolAreaPath;
+
inherit (pkgs) runtimeShell;
};
sockets.hylafax-hfaxd = {
···
PrivateDevices = true; # breaks /dev/tty...
PrivateNetwork = true;
PrivateTmp = true;
+
#ProtectClock = true; # breaks /dev/tty... (why?)
ProtectControlGroups = true;
#ProtectHome = true; # breaks custom spool dirs
+
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
#ProtectSystem = "strict"; # breaks custom spool dirs
+12 -6
pkgs/servers/hylafaxplus/default.nix
···
, lib
, fakeroot
, fetchurl
, libfaketime
, substituteAll
## runtime dependencies
···
let
-
name = "hylafaxplus-${version}";
version = "7.0.3";
sha256 = "139iwcwrn9i5lragxi33ilzah72w59wg4midfjjgx5cly3ah0iy4";
configSite = substituteAll {
-
name = "hylafaxplus-config.site";
src = ./config.site;
config_maxgid = lib.optionalString (maxgid!=null) ''CONFIG_MAXGID=${builtins.toString maxgid}'';
ghostscript_version = ghostscript.version;
···
};
postPatch = substituteAll {
-
name = "hylafaxplus-post-patch.sh";
src = ./post-patch.sh;
inherit configSite;
maxuid = lib.optionalString (maxuid!=null) (builtins.toString maxuid);
···
};
postInstall = substituteAll {
-
name = "hylafaxplus-post-install.sh";
src = ./post-install.sh;
inherit fakeroot libfaketime;
};
···
in
stdenv.mkDerivation {
-
inherit name version;
src = fetchurl {
url = "mirror://sourceforge/hylafax/hylafax-${version}.tar.gz";
inherit sha256;
};
patches = [
-
./libtiff-4.2.patch # adjust configure check to work with libtiff > 4.1
];
# Note that `configure` (and maybe `faxsetup`) are looking
# for a couple of standard binaries in the `PATH` and
···
, lib
, fakeroot
, fetchurl
+
, fetchpatch
, libfaketime
, substituteAll
## runtime dependencies
···
let
+
pname = "hylafaxplus";
version = "7.0.3";
sha256 = "139iwcwrn9i5lragxi33ilzah72w59wg4midfjjgx5cly3ah0iy4";
configSite = substituteAll {
+
name = "${pname}-config.site";
src = ./config.site;
config_maxgid = lib.optionalString (maxgid!=null) ''CONFIG_MAXGID=${builtins.toString maxgid}'';
ghostscript_version = ghostscript.version;
···
};
postPatch = substituteAll {
+
name = "${pname}-post-patch.sh";
src = ./post-patch.sh;
inherit configSite;
maxuid = lib.optionalString (maxuid!=null) (builtins.toString maxuid);
···
};
postInstall = substituteAll {
+
name = "${pname}-post-install.sh";
src = ./post-install.sh;
inherit fakeroot libfaketime;
};
···
in
stdenv.mkDerivation {
+
inherit pname version;
src = fetchurl {
url = "mirror://sourceforge/hylafax/hylafax-${version}.tar.gz";
inherit sha256;
};
patches = [
+
# adjust configure check to work with libtiff > 4.1
+
(fetchpatch {
+
name = "libtiff-4.2.patch";
+
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-misc/hylafaxplus/files/hylafaxplus-7.0.2-tiff-4.2.patch?id=82e3eefd5447f36e5bb00068a54b91d8c891ccf6";
+
sha256 = "0hhf4wpgj842gz4nxq8s55vnzmciqkyjjaaxdpqawns2746vx0sw";
+
})
];
# Note that `configure` (and maybe `faxsetup`) are looking
# for a couple of standard binaries in the `PATH` and
-13
pkgs/servers/hylafaxplus/libtiff-4.2.patch
···
-
diff --git a/configure b/configure
-
index 7456dcb..90f0e8d 100755
-
--- a/configure
-
+++ b/configure
-
@@ -2583,7 +2583,7 @@ EOF
-
echo '#define TIFFSTRIPBYTECOUNTS uint32'
-
echo '#define TIFFVERSION TIFF_VERSION'
-
echo '#define TIFFHEADER TIFFHeader';;
-
- 4.[01]) tiff_runlen_t="uint32"
-
+ 4.[012]) tiff_runlen_t="uint32"
-
tiff_offset_t="uint64"
-
echo '#define TIFFSTRIPBYTECOUNTS uint64'
-
echo '#define TIFFVERSION TIFF_VERSION_CLASSIC'
···
-7
pkgs/servers/hylafaxplus/post-patch.sh
···
-
# `configure` (maybe others) set `POSIXLY_CORRECT`, which
-
# breaks the gcc wrapper script of nixpkgs (maybe others).
-
# We simply un-export `POSIXLY_CORRECT` after each export so
-
# its effects don't apply within nixpkgs wrapper scripts.
-
grep -rlF POSIXLY_CORRECT | xargs \
-
sed '/export *POSIXLY_CORRECT/a export -n POSIXLY_CORRECT' -i
-
# Replace strange default value for the nobody account.
if test -n "@maxuid@"
then
···
# Replace strange default value for the nobody account.
if test -n "@maxuid@"
then