From 857112847dcc050fb965df5080f0380ce2732142 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 23 Feb 2026 08:35:19 +0200 Subject: [PATCH 1/6] lirc: remove no-op python version substitution --- pkgs/by-name/li/lirc/package.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/by-name/li/lirc/package.nix b/pkgs/by-name/li/lirc/package.nix index 730b003723a3..b9d12af30311 100644 --- a/pkgs/by-name/li/lirc/package.nix +++ b/pkgs/by-name/li/lirc/package.nix @@ -65,10 +65,6 @@ stdenv.mkDerivation (finalAttrs: { # Pull fix for new pyyaml pending upstream inclusion # https://sourceforge.net/p/lirc/git/merge-requests/39/ substituteInPlace python-pkg/lirc/database.py --replace 'yaml.load(' 'yaml.safe_load(' - - # cant import '/build/lirc-0.10.1/python-pkg/lirc/_client.so' while cross-compiling to check the version - substituteInPlace python-pkg/setup.py \ - --replace "VERSION='0.0.0'" "VERSION='${finalAttrs.version}'" ''; preConfigure = '' From 1bc6a50890fa9e9f3e6025dde0752e97ed72303c Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 23 Feb 2026 08:36:37 +0200 Subject: [PATCH 2/6] lirc: use --replace-fail for database.py yaml fix --- pkgs/by-name/li/lirc/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/li/lirc/package.nix b/pkgs/by-name/li/lirc/package.nix index b9d12af30311..314891a08f69 100644 --- a/pkgs/by-name/li/lirc/package.nix +++ b/pkgs/by-name/li/lirc/package.nix @@ -64,7 +64,8 @@ stdenv.mkDerivation (finalAttrs: { # Pull fix for new pyyaml pending upstream inclusion # https://sourceforge.net/p/lirc/git/merge-requests/39/ - substituteInPlace python-pkg/lirc/database.py --replace 'yaml.load(' 'yaml.safe_load(' + substituteInPlace python-pkg/lirc/database.py \ + --replace-fail 'yaml.load(' 'yaml.safe_load(' ''; preConfigure = '' From 6bfb3c6714b14f01ea34ad6536e755baae944ae6 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 23 Feb 2026 08:43:36 +0200 Subject: [PATCH 3/6] lirc: remove doing nothing PYTHONPATH sed --- pkgs/by-name/li/lirc/package.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/by-name/li/lirc/package.nix b/pkgs/by-name/li/lirc/package.nix index 314891a08f69..5a53ccacdca6 100644 --- a/pkgs/by-name/li/lirc/package.nix +++ b/pkgs/by-name/li/lirc/package.nix @@ -59,8 +59,6 @@ stdenv.mkDerivation (finalAttrs: { # fix overriding PYTHONPATH sed -i 's,^PYTHONPATH *= *,PYTHONPATH := $(PYTHONPATH):,' \ Makefile.in - sed -i 's,PYTHONPATH=,PYTHONPATH=$(PYTHONPATH):,' \ - doc/Makefile.in # Pull fix for new pyyaml pending upstream inclusion # https://sourceforge.net/p/lirc/git/merge-requests/39/ From 6743346d39c55092c75ff27aebb070b0166ee79a Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 23 Feb 2026 08:48:41 +0200 Subject: [PATCH 4/6] lirc: perform PYTHONPATH substitution with a patch It is complex enough for a patch, and it is too complex for a `substituteInPlace` command. A sed command can become a no-op and is much harder to maintain. --- pkgs/by-name/li/lirc/package.nix | 7 +++---- pkgs/by-name/li/lirc/pythonpath.patch | 13 +++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 pkgs/by-name/li/lirc/pythonpath.patch diff --git a/pkgs/by-name/li/lirc/package.nix b/pkgs/by-name/li/lirc/package.nix index 5a53ccacdca6..dab65cb7901a 100644 --- a/pkgs/by-name/li/lirc/package.nix +++ b/pkgs/by-name/li/lirc/package.nix @@ -51,15 +51,14 @@ stdenv.mkDerivation (finalAttrs: { # --with-systemdsystemunitdir # https://sourceforge.net/p/lirc/tickets/385/ ./ubuntu.diff + + # fix overriding PYTHONPATH + ./pythonpath.patch ]; postPatch = '' patchShebangs . - # fix overriding PYTHONPATH - sed -i 's,^PYTHONPATH *= *,PYTHONPATH := $(PYTHONPATH):,' \ - Makefile.in - # Pull fix for new pyyaml pending upstream inclusion # https://sourceforge.net/p/lirc/git/merge-requests/39/ substituteInPlace python-pkg/lirc/database.py \ diff --git a/pkgs/by-name/li/lirc/pythonpath.patch b/pkgs/by-name/li/lirc/pythonpath.patch new file mode 100644 index 000000000000..53605962ecaa --- /dev/null +++ b/pkgs/by-name/li/lirc/pythonpath.patch @@ -0,0 +1,13 @@ +diff --git i/Makefile.in w/Makefile.in +index d039ed3e9d6a..c40e6eac56ae 100644 +--- i/Makefile.in ++++ w/Makefile.in +@@ -493,7 +493,7 @@ AUTOMAKE_OPTIONS = 1.5 check-news dist-bzip2 -Wno-portability \ + + PYTHONPATH1 = $(abs_top_srcdir)/python-pkg/lirc: + PYTHONPATH2 = $(abs_top_srcdir)/python-pkg/lirc/lib/.libs +-PYTHONPATH = $(PYTHONPATH1):$(PYTHONPATH2) ++PYTHONPATH := $(PYTHONPATH):$(PYTHONPATH1):$(PYTHONPATH2) + PYLINT = python3-pylint + pylint_template = {path}:{line}: [{msg_id}({symbol}), {obj}] {msg} + GIT_COMMIT = $(shell git log -1 --pretty=format:%h || echo UNKNOWN) From f55f62e7450e80ada551105b15da091f0ea3e933 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 23 Feb 2026 08:57:55 +0200 Subject: [PATCH 5/6] lirc: fix systemd ExecStart lines --- pkgs/by-name/li/lirc/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/li/lirc/package.nix b/pkgs/by-name/li/lirc/package.nix index dab65cb7901a..b8dd104ef17d 100644 --- a/pkgs/by-name/li/lirc/package.nix +++ b/pkgs/by-name/li/lirc/package.nix @@ -63,6 +63,9 @@ stdenv.mkDerivation (finalAttrs: { # https://sourceforge.net/p/lirc/git/merge-requests/39/ substituteInPlace python-pkg/lirc/database.py \ --replace-fail 'yaml.load(' 'yaml.safe_load(' + + substituteInPlace systemd/*.service \ + --replace-fail "ExecStart=/usr/" "ExecStart=''${!outputBin}/" ''; preConfigure = '' From 7eb24fdfdd98c5409d76f12f2dfe45002e11d287 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 22 Feb 2026 13:29:56 +0200 Subject: [PATCH 6/6] lirc: split man, doc, dev & lib outputs --- pkgs/by-name/li/lirc/package.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkgs/by-name/li/lirc/package.nix b/pkgs/by-name/li/lirc/package.nix index b8dd104ef17d..8804bc81cf74 100644 --- a/pkgs/by-name/li/lirc/package.nix +++ b/pkgs/by-name/li/lirc/package.nix @@ -109,6 +109,30 @@ stdenv.mkDerivation (finalAttrs: { "localstatedir=$TMPDIR" ]; + outputs = [ + "out" + "man" + "doc" + "dev" + # This is the output referenced by dependent packages most of the time. + # $out on the other hand contains files used by direct users of lirc - + # systemd units, binaries, shell scripts & lirc python package. Since + # Nixpkgs' stdenv puts by default python libraries in $lib, this causes a + # cyclic reference between $out and $lib. We solve this by moving the + # Python library to $out in postFixup below. Since the Python library is + # also strongly related to the direct usage of lirc (and not only linking + # to the libraries of it), this makes sense anyway. + "lib" + ]; + + postFixup = '' + moveToOutput "${python3.sitePackages}" "$out" + # $out/bin/lirc-setup is symlinked to $lib/''${python3.sitePackages}, so it + # has to be fixed due to the above. + rm $out/bin/lirc-setup + ln -s $out/${python3.sitePackages}/lirc-setup/lirc-setup $out/bin/lirc-setup + ''; + # Upstream ships broken symlinks in docs dontCheckForBrokenSymlinks = true;