2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, runCommand
|
|
|
|
, mutter
|
|
|
|
, elementary-default-settings
|
|
|
|
, glib
|
|
|
|
, gala
|
|
|
|
, epiphany
|
2021-09-22 15:38:15 +00:00
|
|
|
, gnome-settings-daemon
|
2020-04-24 23:36:52 +00:00
|
|
|
, gtk3
|
2020-09-25 04:45:31 +00:00
|
|
|
, elementary-dock
|
2020-04-24 23:36:52 +00:00
|
|
|
, gsettings-desktop-schemas
|
|
|
|
, extraGSettingsOverrides ? ""
|
2022-10-06 18:32:54 +00:00
|
|
|
, extraGSettingsOverridePackages ? [ ]
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
inherit (lib) concatMapStringsSep;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
gsettingsOverridePackages = [
|
2020-09-25 04:45:31 +00:00
|
|
|
elementary-dock
|
2021-09-22 15:38:15 +00:00
|
|
|
gnome-settings-daemon
|
2020-04-24 23:36:52 +00:00
|
|
|
epiphany
|
|
|
|
gala
|
|
|
|
gsettings-desktop-schemas
|
|
|
|
gtk3
|
2020-09-25 04:45:31 +00:00
|
|
|
mutter
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ extraGSettingsOverridePackages;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Having https://github.com/NixOS/nixpkgs/issues/54150 would supersede this
|
2022-10-06 18:32:54 +00:00
|
|
|
runCommand "elementary-gsettings-desktop-schemas" { preferLocalBuild = true; }
|
2020-04-24 23:36:52 +00:00
|
|
|
''
|
2022-10-06 18:32:54 +00:00
|
|
|
data_dir="$out/share/gsettings-schemas/nixos-gsettings-overrides"
|
|
|
|
schema_dir="$data_dir/glib-2.0/schemas"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
mkdir -p "$schema_dir"
|
|
|
|
cp -rf "${glib.getSchemaPath gala}"/*.gschema.override "$schema_dir"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
${concatMapStringsSep "\n" (pkg: "cp -rf \"${glib.getSchemaPath pkg}\"/*.xml \"$schema_dir\"") gsettingsOverridePackages}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
chmod -R a+w "$data_dir"
|
|
|
|
cp "${glib.getSchemaPath elementary-default-settings}"/* "$schema_dir"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
cat - > "$schema_dir/nixos-defaults.gschema.override" <<- EOF
|
|
|
|
${extraGSettingsOverrides}
|
|
|
|
EOF
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
${glib.dev}/bin/glib-compile-schemas $schema_dir
|
2020-04-24 23:36:52 +00:00
|
|
|
''
|