diff --git a/flake.nix b/flake.nix index 3415ccc..103cbba 100644 --- a/flake.nix +++ b/flake.nix @@ -122,6 +122,7 @@ ./nix/devshell.nix ./nix/hosts.nix ./nix/pkgs.nix + ./nix/patch.nix nix-topology.flakeModule ]; diff --git a/nix/devshell.nix b/nix/devshell.nix index 9a16333..48426ef 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -20,6 +20,7 @@ packages = with pkgs; [ # Nix nil + wcurl # for fetch-prs # Misc shellcheck diff --git a/nix/hosts.nix b/nix/hosts.nix index bf8160b..54c80b9 100644 --- a/nix/hosts.nix +++ b/nix/hosts.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ inputs, self, ... }: { flake = { config, lib, ... }: @@ -20,12 +20,16 @@ pkgs = config.pkgs.x86_64-linux; stateVersion = "24.05"; in - inputs.nixpkgs.lib.nixosSystem { + (import "${self.nixpkgs-patched}/nixos/lib/eval-config.nix") { + system = null; specialArgs = { # Use the correct instance lib that has our overlays inherit (pkgs) lib; inherit (config) nodes; - inherit inputs minimal stateVersion; + inherit minimal stateVersion; + inputs = inputs // { + nixpkgs = self.nixpkgs-patched; + }; }; modules = [ { diff --git a/nix/patch.nix b/nix/patch.nix new file mode 100644 index 0000000..3a0d124 --- /dev/null +++ b/nix/patch.nix @@ -0,0 +1,25 @@ +{ + inputs, + ... +}: +{ + flake = { + nixpkgs-patched = + let + system = "x86_64-linux"; + pkgs = import inputs.nixpkgs { inherit system; }; + in + pkgs.stdenvNoCC.mkDerivation { + name = "Nixpkgs with patches from open PRs"; + src = inputs.nixpkgs; + dontConfigure = true; + dontBuild = true; + doCheck = false; + dontFixup = true; + installPhase = '' + cp -r ./ $out + ''; + patches = pkgs.lib.filesystem.listFilesRecursive ../patches; + }; + }; +} diff --git a/nix/pkgs.nix b/nix/pkgs.nix index ece44a1..6937ab5 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ inputs, self, ... }: { imports = [ ( @@ -14,7 +14,7 @@ perSystem = { pkgs, system, ... }: { - _module.args.pkgs = import inputs.nixpkgs { + _module.args.pkgs = import self.nixpkgs-patched { inherit system; config.allowUnfree = true; overlays = (import ../pkgs inputs) ++ [ diff --git a/patches/353230.diff b/patches/353230.diff new file mode 100644 index 0000000..d673ce0 --- /dev/null +++ b/patches/353230.diff @@ -0,0 +1,80 @@ +diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix +index 4392b3cb60121..a5b4d28b4a7dc 100644 +--- a/pkgs/development/python-modules/pyscard/default.nix ++++ b/pkgs/development/python-modules/pyscard/default.nix +@@ -18,14 +18,14 @@ in + + buildPythonPackage rec { + pname = "pyscard"; +- version = "2.1.1"; ++ version = "2.2.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "LudovicRousseau"; + repo = "pyscard"; + rev = "refs/tags/${version}"; +- hash = "sha256-wlw2QL1vfhXba8ok/URcd9M+F7Sa+ZtekV1w5X24owE="; ++ hash = "sha256-yZeP4Tcxnwb2My+XOsMtj+H8mNIf6JYf5tpOVUYjev0="; + }; + + build-system = [ setuptools ]; +@@ -37,36 +37,31 @@ buildPythonPackage rec { + nativeCheckInputs = [ pytestCheckHook ]; + + postPatch = +- if withApplePCSC then +- '' +- substituteInPlace smartcard/scard/winscarddll.c \ +- --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \ +- "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" +- '' +- else +- '' +- substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" +- substituteInPlace smartcard/scard/winscarddll.c \ +- --replace-fail "libpcsclite.so.1" \ +- "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" +- ''; ++ '' ++ substituteInPlace pyproject.toml \ ++ --replace-fail 'requires = ["setuptools","swig"]' 'requires = ["setuptools"]' ++ '' ++ + ( ++ if withApplePCSC then ++ '' ++ substituteInPlace src/smartcard/scard/winscarddll.c \ ++ --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \ ++ "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" ++ '' ++ else ++ '' ++ substituteInPlace setup.py --replace-fail "pkg-config" "$PKG_CONFIG" ++ substituteInPlace src/smartcard/scard/winscarddll.c \ ++ --replace-fail "libpcsclite.so.1" \ ++ "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" ++ '' ++ ); + +- preCheck = '' +- # remove src module, so tests use the installed module instead +- rm -r smartcard +- ''; +- +- disabledTests = [ +- # AssertionError +- "test_hresult" +- "test_low_level" +- ]; +- +- meta = with lib; { ++ meta = { + description = "Smartcard library for python"; + homepage = "https://pyscard.sourceforge.io/"; + changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${version}"; +- license = licenses.lgpl21Plus; +- maintainers = with maintainers; [ layus ]; ++ license = lib.licenses.lgpl21Plus; ++ maintainers = with lib.maintainers; [ layus ]; + }; + } diff --git a/patches/353272.diff b/patches/353272.diff new file mode 100644 index 0000000..7e58e02 --- /dev/null +++ b/patches/353272.diff @@ -0,0 +1,12 @@ +diff --git a/pkgs/tools/archivers/7zz/default.nix b/pkgs/tools/archivers/7zz/default.nix +index ca8f8366f7f6b..d23ec4af02ee4 100644 +--- a/pkgs/tools/archivers/7zz/default.nix ++++ b/pkgs/tools/archivers/7zz/default.nix +@@ -77,6 +77,7 @@ stdenv.mkDerivation (finalAttrs: { + "CXX=${stdenv.cc.targetPrefix}c++" + ] + ++ lib.optionals useUasm [ "MY_ASM=uasm" ] ++ ++ lib.optionals (!useUasm && stdenv.hostPlatform.isx86) [ "USE_ASM=" ] + # We need at minimum 10.13 here because of utimensat, however since + # we need a bump anyway, let's set the same minimum version as the one in + # aarch64-darwin so we don't need additional changes for it diff --git a/pkgs/ccid.nix b/pkgs/ccid.nix deleted file mode 100644 index 9da29d3..0000000 --- a/pkgs/ccid.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ - lib, - stdenv, - fetchurl, - flex, - gitUpdater, - libusb1, - meson, - ninja, - pcsclite, - perl, - pkg-config, - zlib, -}: - -stdenv.mkDerivation rec { - pname = "ccid"; - version = "1.6.1"; - - src = fetchurl { - url = "https://ccid.apdu.fr/files/${pname}-${version}.tar.xz"; - hash = "sha256-LsqPsH6P58DTna6sp7l81zxA7Ztyc4okrT3L38kY4eo="; - }; - - postPatch = '' - patchShebangs . - substituteInPlace meson.build --replace-fail \ - "pcsc_dep.get_variable('usbdropdir')" \ - "'$out/pcsc/drivers'" - ''; - - mesonFlags = [ - (lib.mesonBool "serial" true) - ]; - - # error: call to undeclared function 'InterruptRead'; - # ISO C99 and later do not support implicit function declarations - env = lib.optionalAttrs stdenv.cc.isClang { - NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; - }; - - nativeBuildInputs = [ - flex - perl - pkg-config - meson - ninja - ]; - - buildInputs = [ - libusb1 - pcsclite - zlib - ]; - - postInstall = '' - install -Dm 0444 -t $out/lib/udev/rules.d ../src/92_pcscd_ccid.rules - substituteInPlace $out/lib/udev/rules.d/92_pcscd_ccid.rules \ - --replace-fail "/usr/sbin/pcscd" "${pcsclite}/bin/pcscd" - ''; - - # The resulting shared object ends up outside of the default paths which are - # usually getting stripped. - stripDebugList = [ "pcsc" ]; - - passthru.updateScript = gitUpdater { - url = "https://salsa.debian.org/rousseau/CCID.git"; - }; - - installCheckPhase = '' - [ -f $out/etc/reader.conf.d/libccidtwin ] - [ -f $out/lib/udev/rules.d/92_pcscd_ccid.rules ] - [ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist ] - [ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so ] - [ -f $out/pcsc/drivers/serial/libccidtwin.so ] - ''; - - meta = with lib; { - description = "PC/SC driver for USB CCID smart card readers"; - homepage = "https://ccid.apdu.fr/"; - license = licenses.lgpl21Plus; - maintainers = [ maintainers.anthonyroussel ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 7c3fb61..2ba32ed 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,7 +8,6 @@ _inputs: [ signal-to-blog = prev.callPackage ./signal-to-blog.nix { }; minion = prev.callPackage ./minion.nix { }; mongodb-bin = prev.callPackage ./mongodb-bin.nix { }; - ccid = prev.callPackage ./ccid.nix { }; awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix { }; neovim-clean = prev.neovim-unwrapped.overrideAttrs ( _neovimFinal: neovimPrev: { @@ -20,6 +19,7 @@ _inputs: [ ''; } ); + path-of-building = prev.path-of-building.overrideAttrs (old: { postFixup = (old.postFixup or "") diff --git a/pkgs/minion.nix b/pkgs/minion.nix index 19cd5de..4380e97 100644 --- a/pkgs/minion.nix +++ b/pkgs/minion.nix @@ -2,7 +2,7 @@ stdenvNoCC, lib, fetchzip, - openjdk22, + openjdk21, makeDesktopItem, javaPackages, gsettings-desktop-schemas, @@ -10,13 +10,13 @@ }: let - openjfx = javaPackages.openjfx22.override { withWebKit = true; }; - jdk = openjdk22.override ( + openjfx = javaPackages.openjfx21.override { withWebKit = true; }; + jdk = openjdk21.override ( prev: prev // { enableJavaFX = true; - inherit openjfx; + openjfx_jdk = openjfx; } ); in diff --git a/pkgs/scripts/fetch-prs.sh b/pkgs/scripts/fetch-prs.sh new file mode 100755 index 0000000..a3d091b --- /dev/null +++ b/pkgs/scripts/fetch-prs.sh @@ -0,0 +1,17 @@ +# dependencies: wcurl +PRS=("353272" "353230") + +if [ ! -f flake.nix ]; then + echo "Not in a flake top level" + exit 1 +fi + +mkdir -p patches +echo "Removing old patches" +rm patches/*.diff +for t in "${PRS[@]}"; do + echo "Fetching PR #$t" + url="https://github.com/NixOS/nixpkgs/pull/$t" + echo "$url" + wcurl "$url.diff" --curl-options "--output-dir patches" +done diff --git a/users/patrick/patrick.nix b/users/patrick/patrick.nix index 7dc26b4..b9a1a19 100644 --- a/users/patrick/patrick.nix +++ b/users/patrick/patrick.nix @@ -36,6 +36,7 @@ yt-dlp zathura zotero + bashInteractive ]; }; hm.programs.bat.enable = true;