From 326ab393292e2ba6ba467cc6280b251ce2e039d6 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 11 Jan 2022 08:21:09 +0100 Subject: [PATCH 1/6] AMC: Add my patches --- ...-TXT-New-global-option-ShowGroupText.patch | 57 +++++++++++++++++++ .../0002-Test-8-page-alignment.patch | 55 ++++++++++++++++++ .../misc/auto-multiple-choice/default.nix | 5 ++ 3 files changed, 117 insertions(+) create mode 100644 pkgs/applications/misc/auto-multiple-choice/0001-AMC-TXT-New-global-option-ShowGroupText.patch create mode 100644 pkgs/applications/misc/auto-multiple-choice/0002-Test-8-page-alignment.patch diff --git a/pkgs/applications/misc/auto-multiple-choice/0001-AMC-TXT-New-global-option-ShowGroupText.patch b/pkgs/applications/misc/auto-multiple-choice/0001-AMC-TXT-New-global-option-ShowGroupText.patch new file mode 100644 index 000000000000000..906ea569394a12f --- /dev/null +++ b/pkgs/applications/misc/auto-multiple-choice/0001-AMC-TXT-New-global-option-ShowGroupText.patch @@ -0,0 +1,57 @@ +From 20c120c57a65eb0ab9203cb347bb78b664b80974 Mon Sep 17 00:00:00 2001 +From: Michal Sojka +Date: Sun, 21 Jan 2018 23:13:00 +0100 +Subject: [PATCH 1/2] AMC-TXT: New global option ShowGroupText + +When this option is enabled (default), the text after group start/end +marks i.e., after "*(" or "*)", is shown in the printed tests. This is +the same behavior as before this commit. + +By setting this option to 0, no group marks are generated. This is +useful if groups are used merely as containers for similar questions +and have numquestions=1 option. In this case, it makes little sense to +add group text before and after every question. +--- + AMC-perl/AMC/Filter/plain.pm | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/AMC-perl/AMC/Filter/plain.pm b/AMC-perl/AMC/Filter/plain.pm +index 5970266d..e0f7d4be 100644 +--- a/AMC-perl/AMC/Filter/plain.pm ++++ b/AMC-perl/AMC/Filter/plain.pm +@@ -63,6 +63,7 @@ sub new { + TitleWidth + Pages + RandomSeed ++ ShowGroupText + PreAssociation PreAssociationKey PreAssociationName + / + ]; +@@ -75,6 +76,7 @@ sub new { + CompleteMulti SeparateAnswerSheet AutoMarks + Arabic + ManualDuplex SingleSided ++ ShowGroupText + / + ]; + +@@ -119,6 +121,7 @@ sub new { + namefieldlinespace => '.5em', + titlewidth => ".47\\linewidth", + randomseed => "1527384", ++ showgrouptext => 1, + lang => '', + code => 0, + 'latex-preambule' => '', +@@ -487,7 +490,7 @@ sub read_file { + if (/^\s*\*([\(\)])(?:\[([^]]*)\])?\s*(.*)/) { + my $action = $1; + my $options = $2; +- my $text = $3; ++ my $text=$self->{'options'}->{'showgrouptext'} ? $3 : ""; + debug "Group A=" . printable($action) . " O=" . printable($options); + my %oo = $self->read_options($options); + if ( $action eq '(' ) { +-- +2.34.1 + diff --git a/pkgs/applications/misc/auto-multiple-choice/0002-Test-8-page-alignment.patch b/pkgs/applications/misc/auto-multiple-choice/0002-Test-8-page-alignment.patch new file mode 100644 index 000000000000000..9c6efa571eb8744 --- /dev/null +++ b/pkgs/applications/misc/auto-multiple-choice/0002-Test-8-page-alignment.patch @@ -0,0 +1,55 @@ +From bed560fcf352343d75f8a4c719d2710c60420672 Mon Sep 17 00:00:00 2001 +From: Michal Sojka +Date: Fri, 25 Jan 2019 18:26:26 +0100 +Subject: [PATCH 2/2] Test 8-page alignment + +--- + AMC-buildpdf.cc | 2 ++ + AMC-perl/AMC/Annotate.pm | 11 +++++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/AMC-buildpdf.cc b/AMC-buildpdf.cc +index 73dea3ca..a4549e57 100644 +--- a/AMC-buildpdf.cc ++++ b/AMC-buildpdf.cc +@@ -89,6 +89,8 @@ int main(int argc, char** argv ) + processing_error = PDF.load_pdf(command + 9); + } else if(sscanf(command, "page pdf %ld", &i) == 1) { + processing_error = PDF.new_page_from_pdf(i); ++ } else if(strcmp(command, "page empty") == 0) { ++ processing_error = PDF.next_page(); + } else if(strcmp(command, "matrix identity") == 0) { + PDF.identity_matrix(); + } else if(sscanf(command, "matrix %lf %lf %lf %lf %lf %lf", +diff --git a/AMC-perl/AMC/Annotate.pm b/AMC-perl/AMC/Annotate.pm +index 6e15af59..cbb49f37 100644 +--- a/AMC-perl/AMC/Annotate.pm ++++ b/AMC-perl/AMC/Annotate.pm +@@ -1036,6 +1036,14 @@ sub student_draw_page { + } + } + ++sub draw_empty_page { ++ my ($self,$page)=@_; ++ ++ debug "Drawing empty page #$page"; ++ ++ $self->command("page empty"); ++} ++ + # process a student copy + + sub process_student { +@@ -1077,6 +1085,9 @@ sub process_student { + for my $page ( $self->student_pages($student) ) { + $self->student_draw_page( $student, $page ); + } ++ for (my $i = $self->student_pages($student); $i % 8 != 0; $i++) { ++ $self->draw_empty_page($i+1); ++ } + + $self->{data}->end_transaction('aOST'); + } +-- +2.34.1 + diff --git a/pkgs/applications/misc/auto-multiple-choice/default.nix b/pkgs/applications/misc/auto-multiple-choice/default.nix index 8617e3454239b65..5a3896ba91a389e 100644 --- a/pkgs/applications/misc/auto-multiple-choice/default.nix +++ b/pkgs/applications/misc/auto-multiple-choice/default.nix @@ -68,6 +68,11 @@ stdenv.mkDerivation rec { "GCC_PP=${stdenv.cc.targetPrefix}c++" ]; + patches = [ + ./0001-AMC-TXT-New-global-option-ShowGroupText.patch + ./0002-Test-8-page-alignment.patch + ]; + preFixup = '' makeWrapperArgs+=("''${gappsWrapperArgs[@]}") ''; From 0c5a169ed8ddb933df8b016dcef7ae0ba5c59a78 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 26 Feb 2023 19:10:31 +0100 Subject: [PATCH 2/6] gcalcli: Use the version from PR 599 This version does not duplicate existing entries during import and supports updating modified entries. --- pkgs/applications/misc/gcalcli/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/gcalcli/default.nix b/pkgs/applications/misc/gcalcli/default.nix index 90b4883ec290af4..6446a9bfb71cff2 100644 --- a/pkgs/applications/misc/gcalcli/default.nix +++ b/pkgs/applications/misc/gcalcli/default.nix @@ -5,13 +5,13 @@ with python3.pkgs; buildPythonApplication rec { pname = "gcalcli"; - version = "4.3.0"; + version = "4.3.0+pr599"; src = fetchFromGitHub { owner = "insanum"; repo = pname; - rev = "v${version}"; - sha256 = "0s5fhcmz3n0dwh3vkqr4aigi59q43v03ch5jhh6v75149icwr0df"; + rev = "d8378f7ec92b160012d867e51ceb5c73af1cc4b0"; # https://github.com/insanum/gcalcli/pull/599 + sha256 = "sha256-V4oqetDg56YksjYd/yjB7wH+t+mvxSmExVSYEFUhD/0="; }; postPatch = lib.optionalString stdenv.isLinux '' From 4fe4c0f6b3830f377a801872929462d88fce9203 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 6 Mar 2023 00:22:50 +0100 Subject: [PATCH 3/6] ucspi-tcp: replace in-tree patch with substituteInPlace This will be useful in the next commit, which will add an optional patch, that conflicts with the currently used remove-setuid.patch. By using substituteInPlace, we can apply the change in both cases: with and without the optional patch. --- pkgs/tools/networking/ucspi-tcp/default.nix | 4 +++- .../networking/ucspi-tcp/remove-setuid.patch | 15 --------------- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 pkgs/tools/networking/ucspi-tcp/remove-setuid.patch diff --git a/pkgs/tools/networking/ucspi-tcp/default.nix b/pkgs/tools/networking/ucspi-tcp/default.nix index 4b307079266b1ee..125e22994803a55 100644 --- a/pkgs/tools/networking/ucspi-tcp/default.nix +++ b/pkgs/tools/networking/ucspi-tcp/default.nix @@ -15,7 +15,6 @@ stdenv.mkDerivation rec { url = "http://ftp.de.debian.org/debian/pool/main/u/ucspi-tcp/ucspi-tcp_0.88-3.diff.gz"; sha256 = "0mzmhz8hjkrs0khmkzs5i0s1kgmgaqz07h493bd5jj5fm5njxln6"; }) - ./remove-setuid.patch ]; # Apply Debian patches @@ -24,6 +23,9 @@ stdenv.mkDerivation rec { echo "Applying patch $fname" patch < "$fname" done + + # Remove setuid + substituteInPlace hier.c --replace ',02755);' ',0755);' ''; # The build system is weird; 'make install' doesn't install anything, instead diff --git a/pkgs/tools/networking/ucspi-tcp/remove-setuid.patch b/pkgs/tools/networking/ucspi-tcp/remove-setuid.patch deleted file mode 100644 index dd693320804630d..000000000000000 --- a/pkgs/tools/networking/ucspi-tcp/remove-setuid.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/hier.c b/hier.c -index 5663ada..1d73b84 100644 ---- a/hier.c -+++ b/hier.c -@@ -2,8 +2,8 @@ - - void hier() - { -- h(auto_home,-1,-1,02755); -- d(auto_home,"bin",-1,-1,02755); -+ h(auto_home,-1,-1,0755); -+ d(auto_home,"bin",-1,-1,0755); - - c(auto_home,"bin","tcpserver",-1,-1,0755); - c(auto_home,"bin","tcprules",-1,-1,0755); From 0e4ef726b13fa41d94cd899c3ee34f50b9276b85 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 6 Mar 2023 00:27:31 +0100 Subject: [PATCH 4/6] ucspi-tcp: add IPv6 support IPv6 support is required at least by nullmailer package test suite, which is currently not executed in nixpkgs. We reuse a patch from Debian. They distribute the patched version under a new name: https://packages.debian.org/sid/ucspi-tcp-ipv6. Note that in this commit, we take the patch from the current Debian version, which is 0.88-7, but the other patches that we already use are from 0.88-3, which didn't have the IPv6 patch. I have verified that the patches from 0.88-3 are unchanged in 0.88-7, but they are distributed in different form. To make this commit smaller, I kept using the old patches. --- pkgs/tools/networking/ucspi-tcp/default.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/ucspi-tcp/default.nix b/pkgs/tools/networking/ucspi-tcp/default.nix index 125e22994803a55..9743d704bd0e7f5 100644 --- a/pkgs/tools/networking/ucspi-tcp/default.nix +++ b/pkgs/tools/networking/ucspi-tcp/default.nix @@ -1,5 +1,6 @@ -{ lib, stdenv, fetchurl }: - +{ lib, stdenv, fetchurl +, ipv6Support ? true +}: stdenv.mkDerivation rec { pname = "ucspi-tcp"; version = "0.88"; @@ -15,6 +16,11 @@ stdenv.mkDerivation rec { url = "http://ftp.de.debian.org/debian/pool/main/u/ucspi-tcp/ucspi-tcp_0.88-3.diff.gz"; sha256 = "0mzmhz8hjkrs0khmkzs5i0s1kgmgaqz07h493bd5jj5fm5njxln6"; }) + ] ++ lib.optional ipv6Support [ + (fetchurl { + url = "https://salsa.debian.org/debian/ucspi-tcp/-/raw/debian/1%250.88-7/debian/ipv6-support.patch"; + sha256 = "sha256-sFOVWJBsnLNZhsOH+TFmYt7NyMwJfbtSg/qCKEAyaQI="; + }) ]; # Apply Debian patches @@ -48,6 +54,14 @@ stdenv.mkDerivation rec { # run the newly built installer ./install + '' + lib.optionalString ipv6Support '' + # Replicate Debian's man install logic (some man pages from + # ipv6-support.patch will be overwritten below by + # debian/ucspi-tcp-man/*.1). + rm -rf "$out/usr/man/man5" # don't include tcp-environ(5) + mv -v "$out"/man/man1/*.1 "$out/share/man/man1/" + + '' + '' # Install Debian man pages (upstream has none) cp debian/ucspi-tcp-man/*.1 "$out/share/man/man1" ''; From 2b59501a49a021ae8e3417163d2ecc0785501af6 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 29 Nov 2023 18:21:56 +0100 Subject: [PATCH 5/6] gnuplot: Add info output It's optional, but enabled by default. --- pkgs/tools/graphics/gnuplot/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/graphics/gnuplot/default.nix b/pkgs/tools/graphics/gnuplot/default.nix index fa9635f0cb8aab2..a292dedc6f99921 100644 --- a/pkgs/tools/graphics/gnuplot/default.nix +++ b/pkgs/tools/graphics/gnuplot/default.nix @@ -13,6 +13,7 @@ , gnused ? null , coreutils ? null , withQt ? false, mkDerivation, qttools, qtbase, qtsvg +, enableInfo ? true, emacs }: assert libX11 != null -> (fontconfig != null && gnused != null && coreutils != null); @@ -28,7 +29,12 @@ in sha256 = "sha256-l12MHMLEHHztxOMjr/A12Xf+ual/ApbdKopm0Zelsnw="; }; - nativeBuildInputs = [ makeWrapper pkg-config texinfo ] ++ lib.optional withQt qttools; + outputs = [ "out" ] ++ lib.optional enableInfo "info"; + + nativeBuildInputs = + [ makeWrapper pkg-config texinfo ] + ++ lib.optional withQt qttools + ++ lib.optional enableInfo emacs; buildInputs = [ cairo gd libcerf pango readline zlib ] @@ -74,6 +80,10 @@ in enableParallelBuilding = true; + installTargets = + [ "install" ] + ++ lib.optional enableInfo "install-info"; + meta = with lib; { homepage = "http://www.gnuplot.info/"; description = "A portable command-line driven graphing utility for many platforms"; From b3b09c5eb29d1f1fcd6899e2d43252dde4e356a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 8 Dec 2023 14:56:40 +0100 Subject: [PATCH 6/6] nixos/nullmailer: be flexible about time related types --- nixos/modules/services/mail/nullmailer.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/mail/nullmailer.nix b/nixos/modules/services/mail/nullmailer.nix index f6befe246b12a8e..4fd0026dbe4ebeb 100644 --- a/nixos/modules/services/mail/nullmailer.nix +++ b/nixos/modules/services/mail/nullmailer.nix @@ -120,7 +120,7 @@ with lib; }; maxpause = mkOption { - type = types.nullOr types.str; + type = with types; nullOr (oneOf [ str int ]); default = null; description = lib.mdDoc '' The maximum time to pause between successive queue runs, in seconds. @@ -138,7 +138,7 @@ with lib; }; pausetime = mkOption { - type = types.nullOr types.str; + type = with types; nullOr (oneOf [ str int ]); default = null; description = lib.mdDoc '' The minimum time to pause between successive queue runs when there @@ -168,7 +168,7 @@ with lib; }; sendtimeout = mkOption { - type = types.nullOr types.str; + type = with types; nullOr (oneOf [ str int ]); default = null; description = lib.mdDoc '' The time to wait for a remote module listed above to complete sending @@ -194,7 +194,7 @@ with lib; environment = { systemPackages = [ pkgs.nullmailer ]; etc = let - validAttrs = filterAttrs (name: value: value != null) cfg.config; + validAttrs = lib.mapAttrs (_: toString) (filterAttrs (_: value: value != null) cfg.config); in (foldl' (as: name: as // { "nullmailer/${name}".text = validAttrs.${name}; }) {} (attrNames validAttrs)) // optionalAttrs (cfg.remotesFile != null) { "nullmailer/remotes".source = cfg.remotesFile; };