Merge branch 'staging-20.03' into release-20.03

This commit is contained in:
worldofpeace
2020-09-05 17:08:42 -04:00
13 changed files with 298 additions and 31 deletions

View File

@@ -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
];
};
}

View File

@@ -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 <filename>/etc/dconf/profiles/<replaceable>name</replaceable></filename>.";
internal = true;
};
packages = mkOption {
type = types.listOf types.package;
default = [];
description = "A list of packages which provide dconf profiles and databases in <filename>/etc/dconf</filename>.";
};
};
};
###### 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 ];

View File

@@ -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;
}

View File

@@ -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.
# Lets 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 derivations 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 derivations 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 derivations 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

View File

@@ -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
'';
}

View File

@@ -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

View File

@@ -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 = {

View File

@@ -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;

View File

@@ -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}"

View File

@@ -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" ];

View File

@@ -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 = [

View File

@@ -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;