pantheon.elementary-gsettings-schemas: Bring closer to GNOME

- Prefer local builds to avoid costly copying.
- Quote arguments.
- Avoid `with` statements.
- Use `concatMapStringsSep`.
- Format with `nixpkgs-fmt` to fix indentation.
This commit is contained in:
Jan Tojnar 2022-09-26 00:26:22 +02:00
parent 5e408af4de
commit cb0c70b388

View File

@ -10,11 +10,13 @@
, elementary-dock
, gsettings-desktop-schemas
, extraGSettingsOverrides ? ""
, extraGSettingsOverridePackages ? []
, extraGSettingsOverridePackages ? [ ]
}:
let
inherit (lib) concatMapStringsSep;
gsettingsOverridePackages = [
elementary-dock
gnome-settings-daemon
@ -27,25 +29,24 @@ let
in
with lib;
# TODO: Having https://github.com/NixOS/nixpkgs/issues/54150 would supersede this
runCommand "elementary-gsettings-desktop-schemas" {}
runCommand "elementary-gsettings-desktop-schemas" { preferLocalBuild = true; }
''
schema_dir=$out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
data_dir="$out/share/gsettings-schemas/nixos-gsettings-overrides"
schema_dir="$data_dir/glib-2.0/schemas"
mkdir -p $schema_dir
mkdir -p "$schema_dir"
cp -rf "${glib.getSchemaPath gala}"/*.gschema.override "$schema_dir"
cp -rf ${glib.getSchemaPath gala}/*.gschema.override $schema_dir
${concatMapStringsSep "\n" (pkg: "cp -rf \"${glib.getSchemaPath pkg}\"/*.xml \"$schema_dir\"") gsettingsOverridePackages}
${concatMapStrings (pkg: "cp -rf ${glib.getSchemaPath pkg}/*.xml $schema_dir\n") gsettingsOverridePackages}
chmod -R a+w "$data_dir"
cp "${glib.getSchemaPath elementary-default-settings}"/* "$schema_dir"
chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides
cp ${glib.getSchemaPath elementary-default-settings}/* $schema_dir
cat - > "$schema_dir/nixos-defaults.gschema.override" <<- EOF
${extraGSettingsOverrides}
EOF
cat - > $schema_dir/nixos-defaults.gschema.override <<- EOF
${extraGSettingsOverrides}
EOF
${glib.dev}/bin/glib-compile-schemas $schema_dir
${glib.dev}/bin/glib-compile-schemas $schema_dir
''