From 65881c6419cf1fcb0833d4585b279dfcd0494f5b Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Fri, 10 Jul 2020 12:28:09 +0200 Subject: [PATCH 01/15] samba: 4.11.9 -> 4.11.11 Fixes: * https://nvd.nist.gov/vuln/detail/CVE-2020-10730 * https://nvd.nist.gov/vuln/detail/CVE-2020-10745 * https://nvd.nist.gov/vuln/detail/CVE-2020-10760 * https://nvd.nist.gov/vuln/detail/CVE-2020-14303 Changes: * https://www.samba.org/samba/history/samba-4.11.10.html * https://www.samba.org/samba/history/samba-4.11.11.html --- pkgs/servers/samba/4.x.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix index 77004870c825..035625acc4df 100644 --- a/pkgs/servers/samba/4.x.nix +++ b/pkgs/servers/samba/4.x.nix @@ -20,11 +20,11 @@ with lib; stdenv.mkDerivation rec { pname = "samba"; - version = "4.11.9"; + version = "4.11.11"; src = fetchurl { url = "mirror://samba/pub/samba/stable/${pname}-${version}.tar.gz"; - sha256 = "1k4dxjspl0xgabdl3nb3wyz714l3df89dj04bf1siwzk9hsyz35d"; + sha256 = "0q7z0ykzrqk4pwjvg3cgx7qna09583wcz5abg2f2cd35jni0hzs5"; }; outputs = [ "out" "dev" "man" ]; From bebdaa353ec41ff44bded509c9a165cdcd27838d Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Wed, 5 Aug 2020 14:33:32 -0400 Subject: [PATCH 02/15] vala: 0.46.5 -> 0.46.12 --- pkgs/development/compilers/vala/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix index 4f64138cb781..df6268865926 100644 --- a/pkgs/development/compilers/vala/default.nix +++ b/pkgs/development/compilers/vala/default.nix @@ -116,8 +116,8 @@ in rec { }; vala_0_46 = generic { - version = "0.46.5"; - sha256 = "07fv895sp9wq74b20qig7hic0r4ynrr5pfaqba02r44xb794fy0s"; + version = "0.46.12"; + sha256 = "07izgziih72sr9cngrvybzq1b6l76wf9whi7ws9ap9za8rjrxadn"; }; vala = vala_0_46; From e78679ed9817630af27df2696226fb9861a1c6ac Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Wed, 5 Aug 2020 14:37:32 -0400 Subject: [PATCH 03/15] Revert "Revert "pantheon.elementary-files: 4.4.3 -> 4.4.4"" This reverts commit caf8427f6ff5cf76e5a00b22dedd9a8fdd329249. --- pkgs/desktops/pantheon/apps/elementary-files/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/desktops/pantheon/apps/elementary-files/default.nix b/pkgs/desktops/pantheon/apps/elementary-files/default.nix index adf64cc76181..76396a440249 100644 --- a/pkgs/desktops/pantheon/apps/elementary-files/default.nix +++ b/pkgs/desktops/pantheon/apps/elementary-files/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { pname = "elementary-files"; - version = "4.4.3"; + version = "4.4.4"; repoName = "files"; @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { owner = "elementary"; repo = repoName; rev = version; - sha256 = "14i5icgpsy78mr7w6cav38p7shfk784b6nlxz9y72rbcxky036yc"; + sha256 = "1hsh9kg30l90r2aqrrap1nfmgjf0la8mfd8h4xm6d7acailcnhmb"; }; passthru = { From 4af94d33842555d2446f0c2ac1905d32667b1210 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 30 Apr 2020 20:12:30 +0200 Subject: [PATCH 04/15] gobject-introspection: Ensure the giDiscoverSelf is run before gappsWrapperArgsHook gappsWrapperArgsHook tries to collect GI_TYPELIB_PATH environment variable so if we want it to see the path giDiscoverSelf adds, we need to force the order. (cherry picked from commit 8f7387f2195da33dd0886a7b7dbcae0518725542) --- .../libraries/gobject-introspection/setup-hook.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/pkgs/development/libraries/gobject-introspection/setup-hook.sh index a68d544cfbe5..6bee47aeb096 100644 --- a/pkgs/development/libraries/gobject-introspection/setup-hook.sh +++ b/pkgs/development/libraries/gobject-introspection/setup-hook.sh @@ -18,7 +18,14 @@ giDiscoverSelf() { fi } -preFixupHooks+=(giDiscoverSelf) +# gappsWrapperArgsHook expects GI_TYPELIB_PATH variable to be set by this. +# Until we have dependency mechanism in generic builder, we need to use this ugly hack. +if [[ " ${preFixupPhases:-} " =~ " gappsWrapperArgsHook " ]]; then + preFixupPhases+=" " + preFixupPhases="${preFixupPhases/ gappsWrapperArgsHook / giDiscoverSelf gappsWrapperArgsHook }" +else + preFixupPhases+=" giDiscoverSelf" +fi _multioutMoveGlibGir() { moveToOutput share/gir-1.0 "${!outputDev}" From e1d83fcc0b0fc07d749a9512eaf21690b80462c0 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 11 Apr 2020 15:02:25 +0200 Subject: [PATCH 05/15] wrapGAppsHook: move to a separate file (cherry picked from commit 69b89979ba52709d5df17a6b728d796bd366aa2e) --- .../setup-hooks/wrap-gapps-hook/default.nix | 16 ++++++++++++++++ .../{ => wrap-gapps-hook}/wrap-gapps-hook.sh | 0 pkgs/top-level/all-packages.nix | 4 +--- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix rename pkgs/build-support/setup-hooks/{ => wrap-gapps-hook}/wrap-gapps-hook.sh (100%) diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix new file mode 100644 index 000000000000..83e4cd93c197 --- /dev/null +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -0,0 +1,16 @@ +{ stdenv +, lib +, makeSetupHook +, makeWrapper +, gtk3 +, librsvg +, dconf +}: + +makeSetupHook { + deps = lib.optional (!stdenv.isDarwin) dconf.lib ++ [ + gtk3 + librsvg + makeWrapper + ]; +} ./wrap-gapps-hook.sh diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh similarity index 100% rename from pkgs/build-support/setup-hooks/wrap-gapps-hook.sh rename to pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8c8e7253a87d..185a26cab76a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -477,9 +477,7 @@ in findXMLCatalogs = makeSetupHook { } ../build-support/setup-hooks/find-xml-catalogs.sh; - wrapGAppsHook = makeSetupHook { - deps = lib.optional (!stdenv.isDarwin) dconf.lib ++ [ gtk3 librsvg makeWrapper ]; - } ../build-support/setup-hooks/wrap-gapps-hook.sh; + wrapGAppsHook = callPackage ../build-support/setup-hooks/wrap-gapps-hook { }; separateDebugInfo = makeSetupHook { } ../build-support/setup-hooks/separate-debug-info.sh; From 7293136913c447f4b932f686300a3c846a78980d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 11 Apr 2020 21:17:45 +0200 Subject: [PATCH 06/15] wrapGAppsHook: add tests (cherry picked from commit 49b89afcc22ba91265beddcbfd4b1fd5393c3512) --- .../setup-hooks/wrap-gapps-hook/default.nix | 142 ++++++++++++++++++ .../setup-hooks/wrap-gapps-hook/tests/lib.nix | 30 ++++ .../tests/sample-project/Makefile | 30 ++++ 3 files changed, 202 insertions(+) create mode 100644 pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix create mode 100644 pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/sample-project/Makefile diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix index 83e4cd93c197..50ef9b0f70d0 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -2,9 +2,13 @@ , lib , makeSetupHook , makeWrapper +, gobject-introspection , gtk3 , librsvg , dconf +, callPackage +, wrapGAppsHook +, writeTextFile }: makeSetupHook { @@ -13,4 +17,142 @@ makeSetupHook { librsvg makeWrapper ]; + substitutions = { + passthru.tests = let + sample-project = ./tests/sample-project; + + testLib = callPackage ./tests/lib.nix { }; + inherit (testLib) expectSomeLineContainingYInFileXToMentionZ; + in rec { + # Simple derivation containing a program and a daemon. + basic = stdenv.mkDerivation { + name = "basic"; + + src = sample-project; + + nativeBuildInputs = [ wrapGAppsHook ]; + + installFlags = [ "bin-foo" "libexec-bar" ]; + }; + + # The wrapper for executable files should add path to dconf GIO module. + basic-contains-dconf = let + tested = basic; + in testLib.runTest "basic-contains-dconf" ( + testLib.skip stdenv.isDarwin '' + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GIO_EXTRA_MODULES=" "${dconf.lib}/lib/gio/modules"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GIO_EXTRA_MODULES=" "${dconf.lib}/lib/gio/modules"} + '' + ); + + # Simple derivation containing a gobject-introspection typelib. + typelib-Mahjong = stdenv.mkDerivation { + name = "typelib-Mahjong"; + + src = sample-project; + + installFlags = [ "typelib-Mahjong" ]; + }; + + # Simple derivation using a typelib. + typelib-user = stdenv.mkDerivation { + name = "typelib-user"; + + src = sample-project; + + nativeBuildInputs = [ + gobject-introspection + wrapGAppsHook + ]; + + buildInputs = [ + typelib-Mahjong + ]; + + installFlags = [ "bin-foo" "libexec-bar" ]; + }; + + # Testing cooperation with gobject-introspection setup hook, + # which should populate GI_TYPELIB_PATH variable with paths + # to typelibs among the derivation’s dependencies. + # The resulting GI_TYPELIB_PATH should be picked up by the wrapper. + typelib-user-has-gi-typelib-path = let + tested = typelib-user; + in testLib.runTest "typelib-user-has-gi-typelib-path" '' + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-Mahjong}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-Mahjong}/lib/girepository-1.0"} + ''; + + # Simple derivation containing a gobject-introspection typelib in lib output. + typelib-Bechamel = stdenv.mkDerivation { + name = "typelib-Bechamel"; + + outputs = [ "out" "lib" ]; + + src = sample-project; + + makeFlags = [ + "LIBDIR=${placeholder "lib"}/lib" + ]; + + installFlags = [ "typelib-Bechamel" ]; + }; + + # Simple derivation using a typelib from non-default output. + typelib-multiout-user = stdenv.mkDerivation { + name = "typelib-multiout-user"; + + src = sample-project; + + nativeBuildInputs = [ + gobject-introspection + wrapGAppsHook + ]; + + buildInputs = [ + typelib-Bechamel + ]; + + installFlags = [ "bin-foo" "libexec-bar" ]; + }; + + # Testing cooperation with gobject-introspection setup hook, + # which should populate GI_TYPELIB_PATH variable with paths + # to typelibs among the derivation’s dependencies, + # even when they are not in default output. + # The resulting GI_TYPELIB_PATH should be picked up by the wrapper. + typelib-multiout-user-has-gi-typelib-path = let + tested = typelib-multiout-user; + in testLib.runTest "typelib-multiout-user-has-gi-typelib-path" '' + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-Bechamel.lib}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-Bechamel.lib}/lib/girepository-1.0"} + ''; + + # Simple derivation that contains a typelib as well as a program using it. + typelib-self-user = stdenv.mkDerivation { + name = "typelib-self-user"; + + src = sample-project; + + nativeBuildInputs = [ + gobject-introspection + wrapGAppsHook + ]; + + installFlags = [ "typelib-Cow" "bin-foo" "libexec-bar" ]; + }; + + # Testing cooperation with gobject-introspection setup hook, + # which should add the path to derivation’s own typelibs + # to GI_TYPELIB_PATH variable. + # The resulting GI_TYPELIB_PATH should be picked up by the wrapper. + # https://github.com/NixOS/nixpkgs/issues/85515 + typelib-self-user-has-gi-typelib-path = let + tested = typelib-self-user; + in testLib.runTest "typelib-self-user-has-gi-typelib-path" '' + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-self-user}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-self-user}/lib/girepository-1.0"} + ''; + }; + }; } ./wrap-gapps-hook.sh diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix new file mode 100644 index 000000000000..1757bdbbe250 --- /dev/null +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix @@ -0,0 +1,30 @@ +{ runCommand +}: + +rec { + runTest = name: body: runCommand name { } '' + set -o errexit + ${body} + touch $out + ''; + + skip = cond: text: + if cond then '' + echo "Skipping test $name" > /dev/stderr + '' else text; + + fail = text: '' + echo "FAIL: $name: ${text}" > /dev/stderr + exit 1 + ''; + + expectSomeLineContainingYInFileXToMentionZ = file: filter: expected: '' + if ! cat "${file}" | grep "${filter}"; then + ${fail "The file “${file}” should include a line containing “${filter}”."} + fi + + if ! cat "${file}" | grep "${filter}" | grep ${expected}; then + ${fail "The file “${file}” should include a line containing “${filter}” that also contains “${expected}”."} + fi + ''; +} diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/sample-project/Makefile b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/sample-project/Makefile new file mode 100644 index 000000000000..5d234db11a0b --- /dev/null +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/sample-project/Makefile @@ -0,0 +1,30 @@ +PREFIX = $(out) +BINDIR = $(PREFIX)/bin +LIBEXECDIR = $(PREFIX)/libexec +LIBDIR = $(PREFIX)/lib +TYPELIBDIR = $(LIBDIR)/girepository-1.0 + +all: + echo "Compiling…" +install: + echo "Installing…" + +bin: + mkdir -p $(BINDIR) +# Adds `bin-${foo}` targets, that install `${foo}` executable to `$(BINDIR)`. +bin-%: bin + touch $(BINDIR)/$(@:bin-%=%) + chmod +x $(BINDIR)/$(@:bin-%=%) + +libexec: + mkdir -p $(LIBEXECDIR) +# Adds `libexec-${foo}` targets, that install `${foo}` executable to `$(LIBEXECDIR)`. +libexec-%: libexec + touch $(LIBEXECDIR)/$(@:libexec-%=%) + chmod +x $(LIBEXECDIR)/$(@:libexec-%=%) + +typelib: + mkdir -p $(TYPELIBDIR) +# Adds `typelib-${foo}` targets, that install `${foo}-1.0.typelib` file to `$(TYPELIBDIR)`. +typelib-%: typelib + touch $(TYPELIBDIR)/$(@:typelib-%=%)-1.0.typelib From 572b49b1470fc1b3369927c59ec8c11da40f098b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 24 Jul 2020 00:36:12 +0200 Subject: [PATCH 07/15] wrapGAppsHook: add comments (cherry picked from commit 0be3b18d3e172549b25acf504d31daea541acc84) --- .../setup-hooks/wrap-gapps-hook/default.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix index 50ef9b0f70d0..5a87893d9726 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -12,9 +12,26 @@ }: makeSetupHook { - deps = lib.optional (!stdenv.isDarwin) dconf.lib ++ [ + deps = lib.optionals (!stdenv.isDarwin) [ + # It is highly probable that a program will use GSettings, + # at minimum through GTK file chooser dialogue. + # Let’s add a GIO module for “dconf” GSettings backend + # to avoid falling back to “memory” backend. This is + # required for GSettings-based settings to be persisted. + # Unfortunately, it also requires the user to have dconf + # D-Bus service enabled globally (e.g. through a NixOS module). + dconf.lib + ] ++ [ + # TODO: remove this, packages should depend on GTK explicitly. gtk3 + + # librsvg provides a module for gdk-pixbuf to allow rendering + # SVG icons. Most icon themes are SVG-based and so are some + # graphics in GTK (e.g. cross for closing window in window title bar) + # so it is pretty much required for applications using GTK. librsvg + + # We use the wrapProgram function. makeWrapper ]; substitutions = { From c61471dde9fb4d9e646adbae53d396e54b3ae1cd Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Thu, 23 Apr 2020 12:00:00 +0000 Subject: [PATCH 08/15] ibus: fix generation of 00-upstream-settings (cherry picked from commit bd6c12ba32b1b076baee6cfc0f1fc80b22e04987) --- pkgs/tools/inputmethods/ibus/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index 4951074bc43a..ff775a53e6b7 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -16,6 +16,7 @@ , gtk2 , gtk3 , gtk-doc +, runCommand , isocodes , cldr-emoji-annotation , unicode-character-database @@ -47,6 +48,14 @@ let makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH ''; }; + # make-dconf-override-db.sh needs to execute dbus-launch in the sandbox, + # it will fail to read /etc/dbus-1/session.conf unless we add this flag + dbus-launch = runCommand "sandbox-dbus-launch" { + nativeBuildInputs = [ makeWrapper ]; + } '' + makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \ + --add-flags --config-file=${dbus.daemon}/share/dbus-1/session.conf + ''; in stdenv.mkDerivation rec { @@ -71,7 +80,7 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "installedTests" ]; postPatch = '' - echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh + patchShebangs --build data/dconf/make-dconf-override-db.sh cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make . ''; @@ -105,6 +114,7 @@ stdenv.mkDerivation rec { python3BuildEnv vala wrapGAppsHook + dbus-launch ]; propagatedBuildInputs = [ From 3419ccb5740ef84c6c357cdac8d9ecb3013fbcbd Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Thu, 23 Apr 2020 12:00:00 +0000 Subject: [PATCH 09/15] ibus: fix installation of dconf database Fixes this warning at ibus-daemon startup: (ibus-dconf:15691): dconf-WARNING **: 21:49:24.018: unable to open file '/etc/dconf/db/ibus': Failed to open file ?/etc/dconf/db/ibus?: open() failed: No such file or directory; expect degraded performance (cherry picked from commit a71dc0b27e82d7783d84b7113056814800538bd9) --- nixos/modules/i18n/input-method/ibus.nix | 2 +- nixos/modules/programs/dconf.nix | 35 +++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index a3d97619fc45..da7e12baced2 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -64,7 +64,7 @@ in # Without dconf enabled it is impossible to use IBus programs.dconf.enable = true; - programs.dconf.profiles.ibus = "${ibusPackage}/etc/dconf/profile/ibus"; + programs.dconf.packages = [ ibusPackage ]; services.dbus.packages = [ ibusAutostart diff --git a/nixos/modules/programs/dconf.nix b/nixos/modules/programs/dconf.nix index 6702e8efd1cb..30fbd72a9abf 100644 --- a/nixos/modules/programs/dconf.nix +++ b/nixos/modules/programs/dconf.nix @@ -4,13 +4,24 @@ with lib; let cfg = config.programs.dconf; - - mkDconfProfile = name: path: - { - name = "dconf/profile/${name}"; - value.source = path; - }; - + cfgDir = pkgs.symlinkJoin { + name = "dconf-system-config"; + paths = map (x: "${x}/etc/dconf") cfg.packages; + postBuild = '' + mkdir -p $out/profile + mkdir -p $out/db + '' + ( + concatStringsSep "\n" ( + mapAttrsToList ( + name: path: '' + ln -s ${path} $out/profile/${name} + '' + ) cfg.profiles + ) + ) + '' + ${pkgs.dconf}/bin/dconf update $out/db + ''; + }; in { ###### interface @@ -22,18 +33,22 @@ in profiles = mkOption { type = types.attrsOf types.path; default = {}; - description = "Set of dconf profile files."; + description = "Set of dconf profile files, installed at /etc/dconf/profiles/name."; internal = true; }; + packages = mkOption { + type = types.listOf types.package; + default = []; + description = "A list of packages which provide dconf profiles and databases in /etc/dconf."; + }; }; }; ###### implementation config = mkIf (cfg.profiles != {} || cfg.enable) { - environment.etc = optionalAttrs (cfg.profiles != {}) - (mapAttrs' mkDconfProfile cfg.profiles); + environment.etc.dconf.source = mkIf (cfg.profiles != {} || cfg.packages != []) cfgDir; services.dbus.packages = [ pkgs.dconf ]; From 2eda645134e52bed3a5b94f5fbacae2c8c9d7ea5 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Fri, 24 Apr 2020 12:00:00 +0000 Subject: [PATCH 10/15] nixos/tests/ibus: fix test (cherry picked from commit 5b7ffe61403bdbc955e02f40ad0270f337a56475) --- nixos/tests/installed-tests/ibus.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/nixos/tests/installed-tests/ibus.nix b/nixos/tests/installed-tests/ibus.nix index af54b612b507..a4bc2a7d7de0 100644 --- a/nixos/tests/installed-tests/ibus.nix +++ b/nixos/tests/installed-tests/ibus.nix @@ -5,16 +5,12 @@ makeInstalledTest { testConfig = { i18n.inputMethod.enabled = "ibus"; + systemd.user.services.ibus-daemon = { + serviceConfig.ExecStart = "${pkgs.ibus}/bin/ibus-daemon --xim --verbose"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + }; }; - preTestScript = '' - # ibus has ibus-desktop-testing-runner but it tries to manage desktop session so we just spawn ibus-daemon ourselves - machine.succeed("ibus-daemon --daemonize --verbose") - ''; - withX11 = true; - - # TODO: ibus-daemon is currently crashing or something - # maybe make ibus systemd service that auto-restarts? - meta.broken = true; } From 3e09a9537751bd33f3f69689c015bf547ad5fc45 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Fri, 24 Apr 2020 18:22:59 -0400 Subject: [PATCH 11/15] Revert "ibus: fix dconf db installation" (cherry picked from commit ee5cba24c31896b6aeb0af4e21b93b878e54f747) --- nixos/modules/i18n/input-method/ibus.nix | 2 +- nixos/modules/programs/dconf.nix | 35 +++++++----------------- nixos/tests/installed-tests/ibus.nix | 14 ++++++---- pkgs/tools/inputmethods/ibus/default.nix | 12 +------- 4 files changed, 21 insertions(+), 42 deletions(-) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index da7e12baced2..a3d97619fc45 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -64,7 +64,7 @@ in # Without dconf enabled it is impossible to use IBus programs.dconf.enable = true; - programs.dconf.packages = [ ibusPackage ]; + programs.dconf.profiles.ibus = "${ibusPackage}/etc/dconf/profile/ibus"; services.dbus.packages = [ ibusAutostart diff --git a/nixos/modules/programs/dconf.nix b/nixos/modules/programs/dconf.nix index 30fbd72a9abf..6702e8efd1cb 100644 --- a/nixos/modules/programs/dconf.nix +++ b/nixos/modules/programs/dconf.nix @@ -4,24 +4,13 @@ with lib; let cfg = config.programs.dconf; - cfgDir = pkgs.symlinkJoin { - name = "dconf-system-config"; - paths = map (x: "${x}/etc/dconf") cfg.packages; - postBuild = '' - mkdir -p $out/profile - mkdir -p $out/db - '' + ( - concatStringsSep "\n" ( - mapAttrsToList ( - name: path: '' - ln -s ${path} $out/profile/${name} - '' - ) cfg.profiles - ) - ) + '' - ${pkgs.dconf}/bin/dconf update $out/db - ''; - }; + + mkDconfProfile = name: path: + { + name = "dconf/profile/${name}"; + value.source = path; + }; + in { ###### interface @@ -33,22 +22,18 @@ in profiles = mkOption { type = types.attrsOf types.path; default = {}; - description = "Set of dconf profile files, installed at /etc/dconf/profiles/name."; + description = "Set of dconf profile files."; internal = true; }; - packages = mkOption { - type = types.listOf types.package; - default = []; - description = "A list of packages which provide dconf profiles and databases in /etc/dconf."; - }; }; }; ###### implementation config = mkIf (cfg.profiles != {} || cfg.enable) { - environment.etc.dconf.source = mkIf (cfg.profiles != {} || cfg.packages != []) cfgDir; + environment.etc = optionalAttrs (cfg.profiles != {}) + (mapAttrs' mkDconfProfile cfg.profiles); services.dbus.packages = [ pkgs.dconf ]; diff --git a/nixos/tests/installed-tests/ibus.nix b/nixos/tests/installed-tests/ibus.nix index a4bc2a7d7de0..af54b612b507 100644 --- a/nixos/tests/installed-tests/ibus.nix +++ b/nixos/tests/installed-tests/ibus.nix @@ -5,12 +5,16 @@ makeInstalledTest { testConfig = { i18n.inputMethod.enabled = "ibus"; - systemd.user.services.ibus-daemon = { - serviceConfig.ExecStart = "${pkgs.ibus}/bin/ibus-daemon --xim --verbose"; - wantedBy = [ "graphical-session.target" ]; - partOf = [ "graphical-session.target" ]; - }; }; + preTestScript = '' + # ibus has ibus-desktop-testing-runner but it tries to manage desktop session so we just spawn ibus-daemon ourselves + machine.succeed("ibus-daemon --daemonize --verbose") + ''; + withX11 = true; + + # TODO: ibus-daemon is currently crashing or something + # maybe make ibus systemd service that auto-restarts? + meta.broken = true; } diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index ff775a53e6b7..4951074bc43a 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -16,7 +16,6 @@ , gtk2 , gtk3 , gtk-doc -, runCommand , isocodes , cldr-emoji-annotation , unicode-character-database @@ -48,14 +47,6 @@ let makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH ''; }; - # make-dconf-override-db.sh needs to execute dbus-launch in the sandbox, - # it will fail to read /etc/dbus-1/session.conf unless we add this flag - dbus-launch = runCommand "sandbox-dbus-launch" { - nativeBuildInputs = [ makeWrapper ]; - } '' - makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \ - --add-flags --config-file=${dbus.daemon}/share/dbus-1/session.conf - ''; in stdenv.mkDerivation rec { @@ -80,7 +71,7 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "installedTests" ]; postPatch = '' - patchShebangs --build data/dconf/make-dconf-override-db.sh + echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make . ''; @@ -114,7 +105,6 @@ stdenv.mkDerivation rec { python3BuildEnv vala wrapGAppsHook - dbus-launch ]; propagatedBuildInputs = [ From 0d341125c3de3f9506874f485b2bff5a58139784 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Thu, 23 Apr 2020 12:00:00 +0000 Subject: [PATCH 12/15] ibus: fix installation of dconf database Fixes this warning at ibus-daemon startup: (ibus-dconf:15691): dconf-WARNING **: 21:49:24.018: unable to open file '/etc/dconf/db/ibus': Failed to open file ?/etc/dconf/db/ibus?: open() failed: No such file or directory; expect degraded performance (cherry picked from commit 3dbd629fa4fa6bb36eb96c8b7f2d675c30981ac1) --- nixos/modules/i18n/input-method/ibus.nix | 2 +- nixos/modules/programs/dconf.nix | 37 +++++++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index a3d97619fc45..da7e12baced2 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -64,7 +64,7 @@ in # Without dconf enabled it is impossible to use IBus programs.dconf.enable = true; - programs.dconf.profiles.ibus = "${ibusPackage}/etc/dconf/profile/ibus"; + programs.dconf.packages = [ ibusPackage ]; services.dbus.packages = [ ibusAutostart diff --git a/nixos/modules/programs/dconf.nix b/nixos/modules/programs/dconf.nix index 6702e8efd1cb..ec85cb9d18c9 100644 --- a/nixos/modules/programs/dconf.nix +++ b/nixos/modules/programs/dconf.nix @@ -4,13 +4,24 @@ with lib; let cfg = config.programs.dconf; - - mkDconfProfile = name: path: - { - name = "dconf/profile/${name}"; - value.source = path; - }; - + cfgDir = pkgs.symlinkJoin { + name = "dconf-system-config"; + paths = map (x: "${x}/etc/dconf") cfg.packages; + postBuild = '' + mkdir -p $out/profile + mkdir -p $out/db + '' + ( + concatStringsSep "\n" ( + mapAttrsToList ( + name: path: '' + ln -s ${path} $out/profile/${name} + '' + ) cfg.profiles + ) + ) + '' + ${pkgs.dconf}/bin/dconf update $out/db + ''; + }; in { ###### interface @@ -22,18 +33,24 @@ in profiles = mkOption { type = types.attrsOf types.path; default = {}; - description = "Set of dconf profile files."; + description = "Set of dconf profile files, installed at /etc/dconf/profiles/name."; internal = true; }; + packages = mkOption { + type = types.listOf types.package; + default = []; + description = "A list of packages which provide dconf profiles and databases in /etc/dconf."; + }; }; }; ###### implementation config = mkIf (cfg.profiles != {} || cfg.enable) { - environment.etc = optionalAttrs (cfg.profiles != {}) - (mapAttrs' mkDconfProfile cfg.profiles); + environment.etc.dconf = mkIf (cfg.profiles != {} || cfg.packages != []) { + source = cfgDir; + }; services.dbus.packages = [ pkgs.dconf ]; From 22fdd693d8efc425d56c4f2c34626eeaba893b73 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Tue, 2 Jun 2020 22:34:59 +0200 Subject: [PATCH 13/15] Revert "Revert "ibus: fix dconf db installation"" This reverts commit ee5cba24c31896b6aeb0af4e21b93b878e54f747. (cherry picked from commit 11d6318a0136536734f48e49b4f4f6b5e08f9b57) --- nixos/tests/installed-tests/ibus.nix | 14 +++++--------- pkgs/tools/inputmethods/ibus/default.nix | 12 +++++++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/nixos/tests/installed-tests/ibus.nix b/nixos/tests/installed-tests/ibus.nix index af54b612b507..a4bc2a7d7de0 100644 --- a/nixos/tests/installed-tests/ibus.nix +++ b/nixos/tests/installed-tests/ibus.nix @@ -5,16 +5,12 @@ makeInstalledTest { testConfig = { i18n.inputMethod.enabled = "ibus"; + systemd.user.services.ibus-daemon = { + serviceConfig.ExecStart = "${pkgs.ibus}/bin/ibus-daemon --xim --verbose"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + }; }; - preTestScript = '' - # ibus has ibus-desktop-testing-runner but it tries to manage desktop session so we just spawn ibus-daemon ourselves - machine.succeed("ibus-daemon --daemonize --verbose") - ''; - withX11 = true; - - # TODO: ibus-daemon is currently crashing or something - # maybe make ibus systemd service that auto-restarts? - meta.broken = true; } diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index 4951074bc43a..ff775a53e6b7 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -16,6 +16,7 @@ , gtk2 , gtk3 , gtk-doc +, runCommand , isocodes , cldr-emoji-annotation , unicode-character-database @@ -47,6 +48,14 @@ let makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH ''; }; + # make-dconf-override-db.sh needs to execute dbus-launch in the sandbox, + # it will fail to read /etc/dbus-1/session.conf unless we add this flag + dbus-launch = runCommand "sandbox-dbus-launch" { + nativeBuildInputs = [ makeWrapper ]; + } '' + makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \ + --add-flags --config-file=${dbus.daemon}/share/dbus-1/session.conf + ''; in stdenv.mkDerivation rec { @@ -71,7 +80,7 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "installedTests" ]; postPatch = '' - echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh + patchShebangs --build data/dconf/make-dconf-override-db.sh cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make . ''; @@ -105,6 +114,7 @@ stdenv.mkDerivation rec { python3BuildEnv vala wrapGAppsHook + dbus-launch ]; propagatedBuildInputs = [ From 6a0f658dcfde3ac40796d44ef48b0af0d79cbc7d Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sat, 28 Mar 2020 18:09:26 -0400 Subject: [PATCH 14/15] nixos/ibus: add ibus portal if portals are enabled (cherry picked from commit 76f7fc1476cb046404b97a63cb861353d6097f16) --- nixos/modules/i18n/input-method/ibus.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index da7e12baced2..437363d0ebd7 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -75,5 +75,9 @@ in QT_IM_MODULE = "ibus"; XMODIFIERS = "@im=ibus"; }; + + xdg.portal.extraPortals = mkIf xdg.portal.enable [ + ibusPackage + ]; }; } From b79747ead8fa0d4ea2294c04dcdd50f1d9ef55a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Sat, 4 Apr 2020 22:45:22 +0200 Subject: [PATCH 15/15] nixos/ibus: fix evaluation Need to reference through `config` when checking what other modules have set. (cherry picked from commit c9d988b0e19a2c7203af3b74388c0b754ac17e39) --- nixos/modules/i18n/input-method/ibus.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index 437363d0ebd7..cf24ecf58631 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -76,7 +76,7 @@ in XMODIFIERS = "@im=ibus"; }; - xdg.portal.extraPortals = mkIf xdg.portal.enable [ + xdg.portal.extraPortals = mkIf config.xdg.portal.enable [ ibusPackage ]; };