From 454c0802f539fed853c834b08f67bc36c08d994b Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 31 Mar 2022 11:23:31 +1100 Subject: [PATCH 1/5] Fix `nixos-rebuild` when cross building flakes Fixes https://github.com/NixOS/nixpkgs/issues/166499 --- pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh index f9bda1a64b6224b..9e877e85e8d2ab4 100755 --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -397,9 +397,12 @@ if [[ -z $_NIXOS_REBUILD_REEXEC && -n $canRun && -z $fast ]]; then SHOULD_REEXEC=1 fi else - runCmd nix "${flakeFlags[@]}" build --out-link "${tmpDir}/nixos-rebuild" "$flake#$flakeAttr.config.system.build.nixos-rebuild" "${extraBuildFlags[@]}" "${lockFlags[@]}" - if p=$(readlink -e "${tmpDir}/nixos-rebuild"); then - SHOULD_REEXEC=1 + targetSystem=$(runCmd nix eval --raw "$flake#$flakeAttr.pkgs.system") + if [[ $(nix show-config --json | jq -r '.system.value') == $targetSystem ]]; then + runCmd nix "${flakeFlags[@]}" build --out-link "${tmpDir}/nixos-rebuild" "$flake#$flakeAttr.config.system.build.nixos-rebuild" "${extraBuildFlags[@]}" "${lockFlags[@]}" + if p=$(readlink -e "${tmpDir}/nixos-rebuild"); then + SHOULD_REEXEC=1 + fi fi fi From a5ebe4464d98b12a54672d10b3950046d8a92e16 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 11 Jan 2022 08:21:09 +0100 Subject: [PATCH 2/5] 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 bdd1e6fbb85400f..d4662e93b8ec25a 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 (finalAttrs: 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 6dc893e11ade86b85643d997a2ec5338c23143bd Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 6 Mar 2023 00:22:50 +0100 Subject: [PATCH 3/5] 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 9da4ebf3dfa7410d04c5f0ece08e01b533ec8e8d Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 6 Mar 2023 00:27:31 +0100 Subject: [PATCH 4/5] 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 a40a1dca3c9cb45359f0f91138bf688d881ea0b1 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 29 Nov 2023 18:21:56 +0100 Subject: [PATCH 5/5] 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 97e566b561d227b..6f86a0625f5cbef 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-6FpmDBoqGAj/JPfmmYH/y6xmpFydz3EbZWELJupxN5o="; }; - 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 = "Portable command-line driven graphing utility for many platforms";