
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
80 lines
2.4 KiB
Nix
80 lines
2.4 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
stdenv,
|
|
fetchzip,
|
|
nixosTests,
|
|
}:
|
|
|
|
let
|
|
|
|
buildGnomeExtension =
|
|
{
|
|
# Every gnome extension has a UUID. It's the name of the extension folder once unpacked
|
|
# and can always be found in the metadata.json of every extension.
|
|
uuid,
|
|
name,
|
|
pname,
|
|
description,
|
|
# extensions.gnome.org extension URL
|
|
link,
|
|
# Extension version numbers are integers
|
|
version,
|
|
sha256,
|
|
# Hex-encoded string of JSON bytes
|
|
metadata,
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
pname = "gnome-shell-extension-${pname}";
|
|
version = builtins.toString version;
|
|
src = fetchzip {
|
|
url = "https://extensions.gnome.org/extension-data/${
|
|
builtins.replaceStrings [ "@" ] [ "" ] uuid
|
|
}.v${builtins.toString version}.shell-extension.zip";
|
|
inherit sha256;
|
|
stripRoot = false;
|
|
# The download URL may change content over time. This is because the
|
|
# metadata.json is automatically generated, and parts of it can be changed
|
|
# without making a new release. We simply substitute the possibly changed fields
|
|
# with their content from when we last updated, and thus get a deterministic output
|
|
# hash.
|
|
postFetch = ''
|
|
echo "${metadata}" | base64 --decode > $out/metadata.json
|
|
'';
|
|
};
|
|
nativeBuildInputs = with pkgs; [ buildPackages.glib ];
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
if [ -d schemas ]; then
|
|
glib-compile-schemas --strict schemas
|
|
fi
|
|
runHook postBuild
|
|
'';
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/share/gnome-shell/extensions/
|
|
cp -r -T . $out/share/gnome-shell/extensions/${uuid}
|
|
runHook postInstall
|
|
'';
|
|
meta = {
|
|
description = builtins.head (lib.splitString "\n" description);
|
|
longDescription = description;
|
|
homepage = link;
|
|
license = lib.licenses.gpl2Plus; # https://gjs.guide/extensions/review-guidelines/review-guidelines.html#licensing
|
|
platforms = lib.platforms.linux;
|
|
maintainers = [ lib.maintainers.honnip ];
|
|
};
|
|
passthru = {
|
|
extensionPortalSlug = pname;
|
|
# Store the extension's UUID, because we might need it at some places
|
|
extensionUuid = uuid;
|
|
|
|
tests = {
|
|
gnome-extensions = nixosTests.gnome-extensions;
|
|
};
|
|
};
|
|
};
|
|
in
|
|
lib.makeOverridable buildGnomeExtension
|