diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index a3d97619fc45..cf24ecf58631 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 @@ -75,5 +75,9 @@ in QT_IM_MODULE = "ibus"; XMODIFIERS = "@im=ibus"; }; + + xdg.portal.extraPortals = mkIf config.xdg.portal.enable [ + ibusPackage + ]; }; } 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 ]; 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/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..5a87893d9726 --- /dev/null +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -0,0 +1,175 @@ +{ stdenv +, lib +, makeSetupHook +, makeWrapper +, gobject-introspection +, gtk3 +, librsvg +, dconf +, callPackage +, wrapGAppsHook +, writeTextFile +}: + +makeSetupHook { + 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 = { + 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 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/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 = { 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; 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}" 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" ]; 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 = [ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 97d67c9234eb..1118edc93bb5 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;