about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/malcontent
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/malcontent')
-rw-r--r--nixpkgs/pkgs/development/libraries/malcontent/better-separation.patch35
-rw-r--r--nixpkgs/pkgs/development/libraries/malcontent/default.nix99
-rw-r--r--nixpkgs/pkgs/development/libraries/malcontent/installed-tests-path.patch56
-rw-r--r--nixpkgs/pkgs/development/libraries/malcontent/ui.nix70
4 files changed, 260 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..cd91760bff59
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/malcontent/better-separation.patch
@@ -0,0 +1,35 @@
+diff --git a/meson.build b/meson.build
+index a6c477d..f7b2f0a 100644
+--- a/meson.build
++++ b/meson.build
+@@ -125,8 +125,8 @@ test_env = [
+   'LC_ALL=C.UTF-8',
+ ]
+ 
+-subdir('accounts-service')
+ if not get_option('use_system_libmalcontent')
++  subdir('accounts-service')
+   subdir('libmalcontent')
+ else
+   libmalcontent_api_version = '0'
+@@ -137,11 +137,17 @@ 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')
+ endif
+-subdir('pam')
++if not get_option('use_system_libmalcontent')
++  subdir('pam')
++endif
+ subdir('po')
+ 
+-meson.add_install_script('build-aux/meson_post_install.py')
++if get_option('ui').enabled()
++  meson.add_install_script('build-aux/meson_post_install.py')
++endif
diff --git a/nixpkgs/pkgs/development/libraries/malcontent/default.nix b/nixpkgs/pkgs/development/libraries/malcontent/default.nix
new file mode 100644
index 000000000000..f574ab196930
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/malcontent/default.nix
@@ -0,0 +1,99 @@
+{ stdenv
+, fetchFromGitLab
+, fetchpatch
+, meson
+, ninja
+, pkgconfig
+, gobject-introspection
+, wrapGAppsHook
+, glib
+, coreutils
+, accountsservice
+, dbus
+, pam
+, polkit
+, glib-testing
+, python3
+, nixosTests
+}:
+
+stdenv.mkDerivation rec {
+  pname = "malcontent";
+  version = "0.7.0";
+
+  outputs = [ "bin" "out" "dev" "man" "installedTests" ];
+
+  src = fetchFromGitLab {
+    domain = "gitlab.freedesktop.org";
+    owner = "pwithnall";
+    repo = pname;
+    rev = version;
+    sha256 = "0lxakzj75pvpgwbjfyfkg0gyzvry00zhc9h9cd8f0wksg7mabzbh";
+  };
+
+  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
+
+    # Fix pam installed test
+    # https://gitlab.freedesktop.org/pwithnall/malcontent/merge_requests/50
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/pwithnall/malcontent/commit/5d102eeb0604e65fc977ca77d4b249e986e634cc.patch";
+      sha256 = "1vs35zfp2sa2rps5h1240h73kvlspmv7mfr6f8mcbzvhj1wgzw74";
+    })
+  ];
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkgconfig
+    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"}"
+    "-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"
+  '';
+
+  passthru = {
+    tests = {
+      installedTests = nixosTests.installed-tests.malcontent;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    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..af1fa6b41387
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/malcontent/ui.nix
@@ -0,0 +1,70 @@
+{ stdenv
+, meson
+, ninja
+, pkg-config
+, gobject-introspection
+, wrapGAppsHook
+, glib
+, accountsservice
+, dbus
+, flatpak
+, malcontent
+, gtk3
+, desktop-file-utils
+, polkit
+, glib-testing
+}:
+
+stdenv.mkDerivation rec {
+  pname = "malcontent-ui";
+
+  inherit (malcontent) version src;
+
+  outputs = [ "bin" "out" "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
+    desktop-file-utils
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    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 stdenv.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;
+  };
+}