From 6ce6559ad89a385fb99a1973914351793ed1f112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Sat, 13 Apr 2024 19:40:13 +0200 Subject: [PATCH 1/3] polkit: upstream moved to github --- pkgs/development/libraries/polkit/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix index dabba056b487..5758132044ae 100644 --- a/pkgs/development/libraries/polkit/default.nix +++ b/pkgs/development/libraries/polkit/default.nix @@ -1,6 +1,6 @@ { lib , stdenv -, fetchFromGitLab +, fetchFromGitHub , pkg-config , glib , expat @@ -43,9 +43,8 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "out" ]; # small man pages in $bin # Tarballs do not contain subprojects. - src = fetchFromGitLab { - domain = "gitlab.freedesktop.org"; - owner = "polkit"; + src = fetchFromGitHub { + owner = "polkit-org"; repo = "polkit"; rev = version; hash = "sha256-/kjWkh6w2FYgtYWzw3g3GlWJKKpkJ3cqwfE0iDqJctw="; @@ -175,7 +174,7 @@ stdenv.mkDerivation rec { ''; meta = with lib; { - homepage = "https://gitlab.freedesktop.org/polkit/polkit/"; + homepage = "https://github.com/polkit-org/polkit"; description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes"; license = licenses.lgpl2Plus; platforms = platforms.linux; From 5ea359c878c6f82ed9cbcd510aaee8d23d528de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Sat, 13 Apr 2024 19:40:49 +0200 Subject: [PATCH 2/3] polkit: 123 -> 124 in the new release the meson option `systemdsystemunitdir` is broken by the new `sysusers.d` code in `meson.build`. we fix this by setting both of these pkg-config variables through environment variables. Changes: https://github.com/polkit-org/polkit/compare/123...124 --- pkgs/development/libraries/polkit/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix index 5758132044ae..54c86e42ad91 100644 --- a/pkgs/development/libraries/polkit/default.nix +++ b/pkgs/development/libraries/polkit/default.nix @@ -38,7 +38,7 @@ let in stdenv.mkDerivation rec { pname = "polkit"; - version = "123"; + version = "124"; outputs = [ "bin" "dev" "out" ]; # small man pages in $bin @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { owner = "polkit-org"; repo = "polkit"; rev = version; - hash = "sha256-/kjWkh6w2FYgtYWzw3g3GlWJKKpkJ3cqwfE0iDqJctw="; + hash = "sha256-Vc9G2xK6U1cX+xW2BnKp3oS/ACbSXS/lztbFP5oJOlM="; }; patches = [ @@ -107,10 +107,14 @@ stdenv.mkDerivation rec { ])) ]; + env = { + PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system"; + PKG_CONFIG_SYSTEMD_SYSUSERS_DIR = "${placeholder "out"}/lib/sysusers.d"; + }; + mesonFlags = [ "--datadir=${system}/share" "--sysconfdir=/etc" - "-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system" "-Dpolkitd_user=polkituser" #TODO? config.ids.uids.polkituser "-Dos_type=redhat" # only affects PAM includes "-Dintrospection=${lib.boolToString withIntrospection}" From 4b8fa41e8346f39387fd49538153944c59b4a444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Mon, 11 Mar 2024 21:23:35 +0100 Subject: [PATCH 3/3] polkit: move patch from archived upstream to local since the repo at gitlab.fredesktop.org is archived, it's likely safer to pull down this patch into nixpkgs directly. in case the archived repo vanishes in the future. --- ...otdir-in-Meson-generated-pkg-config-.patch | 53 +++++++++++++++++++ pkgs/development/libraries/polkit/default.nix | 6 +-- 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/libraries/polkit/0001-build-Use-datarootdir-in-Meson-generated-pkg-config-.patch diff --git a/pkgs/development/libraries/polkit/0001-build-Use-datarootdir-in-Meson-generated-pkg-config-.patch b/pkgs/development/libraries/polkit/0001-build-Use-datarootdir-in-Meson-generated-pkg-config-.patch new file mode 100644 index 000000000000..4e38660217fe --- /dev/null +++ b/pkgs/development/libraries/polkit/0001-build-Use-datarootdir-in-Meson-generated-pkg-config-.patch @@ -0,0 +1,53 @@ +From 7ba07551dfcd4ef9a87b8f0d9eb8b91fabcb41b3 Mon Sep 17 00:00:00 2001 +From: Jan Tojnar +Date: Mon, 1 Nov 2021 14:17:17 +0100 +Subject: [PATCH] build: Use datarootdir in Meson-generated pkg-config files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With datadir outside of prefix (currently unsupported by Meson[1] +but a frequent occurrence in Nixpkgs), the `datadir` entry, +in the `polkit-gobject-1` pkg-config file will be an absolute path. +This will prevent changing the base directory of `policydir` +with `--define-variable=prefix=…`, which many projects use +to install policy files to their own prefix. + +Previously, this worked without changes on Nixpkgs’s part because +the pkg-config template used by Autotools contained `@datarootdir@`, +which resolves to `$(prefix)/share`[2], taking no heed of the changed datadir. + +Similar issue can happen when a distribution package redefines datadir +like Debian does/did.[3] + +This patch changes Meson-based build system to use `$(prefix)/share` +in the generated pkg-config files, mirroring Autotools. + +--- + +1. Likely to change in the future: https://github.com/mesonbuild/meson/issues/2561#issuecomment-939253717 +2. https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +3. https://blogs.gnome.org/hughsie/2014/06/16/datarootdir-v-s-datadir/ +--- + src/polkit/meson.build | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/polkit/meson.build b/src/polkit/meson.build +index 63dc1e85..c92cb70f 100644 +--- a/src/polkit/meson.build ++++ b/src/polkit/meson.build +@@ -113,9 +113,8 @@ pkg.generate( + requires: common_deps, + variables: [ + 'exec_prefix=${prefix}', +- 'datadir=' + ('${prefix}' / pk_datadir), +- 'policydir=' + ('${datadir}' / pk_actiondir), +- 'actiondir=' + ('${datadir}' / pk_actiondir), ++ 'policydir=' + ('${prefix}' / 'share' / pk_actiondir), ++ 'actiondir=' + ('${prefix}' / 'share' / pk_actiondir), + 'pkcheck_supports_uid=true', + ], + ) +-- +GitLab + diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix index 54c86e42ad91..69b2233a8559 100644 --- a/pkgs/development/libraries/polkit/default.nix +++ b/pkgs/development/libraries/polkit/default.nix @@ -10,7 +10,6 @@ , ninja , perl , python3 -, fetchpatch , gettext , duktape , gobject-introspection @@ -53,10 +52,7 @@ stdenv.mkDerivation rec { patches = [ # Allow changing base for paths in pkg-config file as before. # https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/100 - (fetchpatch { - url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/7ba07551dfcd4ef9a87b8f0d9eb8b91fabcb41b3.patch"; - sha256 = "ebbLILncq1hAZTBMsLm+vDGw6j0iQ0crGyhzyLZQgKA="; - }) + ./0001-build-Use-datarootdir-in-Meson-generated-pkg-config-.patch ]; depsBuildBuild = [