2017-12-21 16:16:19 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2014-04-02 16:21:00 +00:00
|
|
|
let
|
|
|
|
cfg = config.programs.dconf;
|
2023-06-14 08:22:17 +00:00
|
|
|
|
|
|
|
# Generate dconf profile
|
|
|
|
mkDconfProfile = name: value:
|
|
|
|
pkgs.runCommand "dconf-profile" { } ''
|
|
|
|
mkdir -p $out/etc/dconf/profile/
|
|
|
|
cp ${value} $out/etc/dconf/profile/${name}
|
2020-04-23 12:00:00 +00:00
|
|
|
'';
|
2014-04-02 16:21:00 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.dconf = {
|
2023-06-14 08:22:17 +00:00
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "dconf");
|
|
|
|
|
|
|
|
profiles = lib.mkOption {
|
|
|
|
type = with lib.types; attrsOf (oneOf [
|
|
|
|
path
|
|
|
|
package
|
|
|
|
]);
|
|
|
|
description = lib.mdDoc "Attrset of dconf profiles.";
|
2014-04-02 16:21:00 +00:00
|
|
|
};
|
|
|
|
|
2023-06-14 08:22:17 +00:00
|
|
|
packages = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.package;
|
|
|
|
default = [ ];
|
2022-07-20 10:32:04 +00:00
|
|
|
description = lib.mdDoc "A list of packages which provide dconf profiles and databases in {file}`/etc/dconf`.";
|
2020-04-23 12:00:00 +00:00
|
|
|
};
|
2014-04-02 16:21:00 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-06-14 08:22:17 +00:00
|
|
|
config = lib.mkIf (cfg.profiles != { } || cfg.enable) {
|
|
|
|
programs.dconf.packages = lib.mapAttrsToList mkDconfProfile cfg.profiles;
|
|
|
|
|
|
|
|
environment.etc.dconf = lib.mkIf (cfg.packages != [ ]) {
|
|
|
|
source = pkgs.symlinkJoin {
|
|
|
|
name = "dconf-system-config";
|
|
|
|
paths = map (x: "${x}/etc/dconf") cfg.packages;
|
|
|
|
nativeBuildInputs = [ (lib.getBin pkgs.dconf) ];
|
|
|
|
postBuild = ''
|
|
|
|
if test -d $out/db; then
|
|
|
|
dconf update $out/db
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2020-04-23 12:00:00 +00:00
|
|
|
};
|
2017-12-21 16:16:19 +00:00
|
|
|
|
2019-11-30 23:11:47 +00:00
|
|
|
services.dbus.packages = [ pkgs.dconf ];
|
2018-09-04 19:19:31 +00:00
|
|
|
|
2021-05-16 23:32:18 +00:00
|
|
|
systemd.packages = [ pkgs.dconf ];
|
|
|
|
|
2019-08-19 01:54:00 +00:00
|
|
|
# For dconf executable
|
2019-11-30 23:11:47 +00:00
|
|
|
environment.systemPackages = [ pkgs.dconf ];
|
2019-08-19 01:54:00 +00:00
|
|
|
|
2023-06-14 08:22:17 +00:00
|
|
|
environment.sessionVariables = lib.mkIf cfg.enable {
|
|
|
|
# Needed for unwrapped applications
|
|
|
|
GIO_EXTRA_MODULES = [ "${pkgs.dconf.lib}/lib/gio/modules" ];
|
|
|
|
};
|
2014-04-02 16:21:00 +00:00
|
|
|
};
|
|
|
|
}
|