diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/malcontent')
4 files changed, 292 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/malcontent/better-separation.patch b/nixpkgs/pkgs/development/libraries/malcontent/better-separation.patch new file mode 100644 index 000000000000..ef42650e249d --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/malcontent/better-separation.patch @@ -0,0 +1,58 @@ +commit 363c5be465dd6dde35c3d31abd7b5cca9b1f3a9f +Author: Jan Tojnar <jtojnar@gmail.com> +Date: Thu Jul 23 18:49:03 2020 +0200 + + Improve separation between malcontent and malcontent-ui packages + + These artefacts go into both packages by default: + + * malcontent-control – a CLI tool + * PAM module + * gettext locale data + * help pages ✨ + * AccountService/D-Bus interfaces + * Polkit com.endlessm.ParentalControls rules and policy + + Items marked with ✨ will go to ui package, while the rest is installed with the base library. + + See also the packaging done by upstream in Endless: + https://github.com/endlessm/malcontent/tree/5482b7eb99aee9b8c344629bc078e193d3c26ffc/debian + + Cannot upstream this since they are worried about maintainability: + https://gitlab.freedesktop.org/pwithnall/malcontent/merge_requests/38#note_437946 + +diff --git a/meson.build b/meson.build +index 6e1dfa5..196350b 100644 +--- a/meson.build ++++ b/meson.build +@@ -123,9 +123,8 @@ test_env = [ + 'LC_ALL=C.UTF-8', + ] + +-subdir('accounts-service') +-subdir('help') + if not get_option('use_system_libmalcontent') ++ subdir('accounts-service') + subdir('libmalcontent') + else + libmalcontent_api_version = '0' +@@ -136,11 +135,16 @@ endif + if get_option('ui').enabled() + subdir('libmalcontent-ui') + endif +-subdir('malcontent-client') ++if not get_option('use_system_libmalcontent') ++ subdir('malcontent-client') ++endif + if get_option('ui').enabled() + subdir('malcontent-control') ++ subdir('help') ++endif ++if not get_option('use_system_libmalcontent') ++ subdir('pam') ++ subdir('po') + endif +-subdir('pam') +-subdir('po') + + meson.add_install_script('build-aux/meson_post_install.py') diff --git a/nixpkgs/pkgs/development/libraries/malcontent/default.nix b/nixpkgs/pkgs/development/libraries/malcontent/default.nix new file mode 100644 index 000000000000..641f3b87c3fe --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/malcontent/default.nix @@ -0,0 +1,104 @@ +{ lib, stdenv +, fetchFromGitLab +, fetchpatch +, meson +, ninja +, pkg-config +, gobject-introspection +, wrapGAppsHook +, glib +, coreutils +, accountsservice +, dbus +, pam +, polkit +, glib-testing +, python3 +, nixosTests +}: + +stdenv.mkDerivation rec { + pname = "malcontent"; + version = "0.10.0"; + + outputs = [ "bin" "out" "lib" "pam" "dev" "man" "installedTests" ]; + + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "pwithnall"; + repo = pname; + rev = version; + sha256 = "1b6rgf7h9gj2kw1b7ba0mvhsb89riwf9p4pviqjfzd1i5nmbmnyx"; + }; + + patches = [ + # Allow installing installed tests to a separate output. + ./installed-tests-path.patch + + # Do not build things that are part of malcontent-ui package + ./better-separation.patch + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + gobject-introspection + wrapGAppsHook + ]; + + buildInputs = [ + accountsservice + dbus + pam + polkit + glib-testing + (python3.withPackages (pp: with pp; [ + pygobject3 + ])) + ]; + + propagatedBuildInputs = [ + glib + ]; + + mesonFlags = [ + "-Dinstalled_tests=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" + "-Dpamlibdir=${placeholder "pam"}/lib/security" + "-Dui=disabled" + ]; + + postPatch = '' + substituteInPlace libmalcontent/tests/app-filter.c \ + --replace "/usr/bin/true" "${coreutils}/bin/true" \ + --replace "/bin/true" "${coreutils}/bin/true" \ + --replace "/usr/bin/false" "${coreutils}/bin/false" \ + --replace "/bin/false" "${coreutils}/bin/false" + ''; + + postInstall = '' + # `giDiscoverSelf` only picks up paths in `out` output. + # This needs to be in `postInstall` so that it runs before + # `gappsWrapperArgsHook` that runs as one of `preFixupPhases`. + addToSearchPath GI_TYPELIB_PATH "$lib/lib/girepository-1.0" + ''; + + passthru = { + tests = { + installedTests = nixosTests.installed-tests.malcontent; + }; + }; + + meta = with lib; { + # We need to install Polkit & AccountsService data files in `out` + # but `buildEnv` only uses `bin` when both `bin` and `out` are present. + outputsToInstall = [ "bin" "out" "man" ]; + + description = "Parental controls library"; + homepage = "https://gitlab.freedesktop.org/pwithnall/malcontent"; + license = licenses.lgpl21Plus; + maintainers = with maintainers; [ jtojnar ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/malcontent/installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/malcontent/installed-tests-path.patch new file mode 100644 index 000000000000..5d26c0f864f8 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/malcontent/installed-tests-path.patch @@ -0,0 +1,56 @@ +diff --git a/libmalcontent/tests/meson.build b/libmalcontent/tests/meson.build +index 610bc35..13e0713 100644 +--- a/libmalcontent/tests/meson.build ++++ b/libmalcontent/tests/meson.build +@@ -72,9 +72,9 @@ test_programs = [ + ], deps], + ] + +-installed_tests_metadir = join_paths(datadir, 'installed-tests', ++installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', + 'libmalcontent-' + libmalcontent_api_version) +-installed_tests_execdir = join_paths(libexecdir, 'installed-tests', ++installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', + 'libmalcontent-' + libmalcontent_api_version) + + foreach program: test_programs +@@ -105,4 +105,4 @@ foreach program: test_programs + env: envs, + args: ['--tap'], + ) +-endforeach +\ No newline at end of file ++endforeach +diff --git a/meson_options.txt b/meson_options.txt +index d516c70..583cb94 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -4,6 +4,12 @@ option( + value: false, + description: 'enable installed tests' + ) ++option( ++ 'installed_test_prefix', ++ type: 'string', ++ value: '', ++ description: 'Prefix for installed tests' ++) + option( + 'pamlibdir', + type: 'string', +diff --git a/pam/tests/meson.build b/pam/tests/meson.build +index 0560dcb..a74dab2 100644 +--- a/pam/tests/meson.build ++++ b/pam/tests/meson.build +@@ -12,9 +12,9 @@ test_programs = [ + ['pam_malcontent', [], deps], + ] + +-installed_tests_metadir = join_paths(datadir, 'installed-tests', ++installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', + 'libmalcontent-' + libmalcontent_api_version) +-installed_tests_execdir = join_paths(libexecdir, 'installed-tests', ++installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', + 'libmalcontent-' + libmalcontent_api_version) + + foreach program: test_programs diff --git a/nixpkgs/pkgs/development/libraries/malcontent/ui.nix b/nixpkgs/pkgs/development/libraries/malcontent/ui.nix new file mode 100644 index 000000000000..e306267154ae --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/malcontent/ui.nix @@ -0,0 +1,74 @@ +{ lib, stdenv +, meson +, ninja +, pkg-config +, gobject-introspection +, itstool +, wrapGAppsHook +, glib +, accountsservice +, dbus +, flatpak +, malcontent +, gtk3 +, appstream-glib +, desktop-file-utils +, polkit +, glib-testing +}: + +stdenv.mkDerivation rec { + pname = "malcontent-ui"; + + inherit (malcontent) version src; + + outputs = [ "out" "lib" "dev" ]; + + patches = [ + # Allow installing installed tests to a separate output. + ./installed-tests-path.patch + + # Do not build things that are part of malcontent package + ./better-separation.patch + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + gobject-introspection + itstool + desktop-file-utils + wrapGAppsHook + ]; + + buildInputs = [ + appstream-glib + dbus + polkit + glib-testing + flatpak + ]; + + propagatedBuildInputs = [ + accountsservice + malcontent + glib + gtk3 + ]; + + mesonFlags = [ + "-Dinstalled_tests=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" + "-Duse_system_libmalcontent=true" + "-Dui=enabled" + ]; + + meta = with lib; { + description = "UI components for parental controls library"; + homepage = "https://gitlab.freedesktop.org/pwithnall/malcontent"; + license = licenses.lgpl21Plus; + maintainers = with maintainers; [ jtojnar ]; + platforms = platforms.unix; + }; +} |