136 lines
3.7 KiB
Nix
136 lines
3.7 KiB
Nix
{
|
|
description = "Thunderbird quick access extensions";
|
|
|
|
inputs = {
|
|
nixpkgs = {
|
|
url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
};
|
|
flake-parts = {
|
|
url = "github:hercules-ci/flake-parts";
|
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
|
};
|
|
systems = {
|
|
url = "github:nix-systems/default";
|
|
};
|
|
|
|
ytmusic-logo = {
|
|
url = "https://upload.wikimedia.org/wikipedia/commons/6/6a/Youtube_Music_icon.svg";
|
|
flake = false;
|
|
};
|
|
discord-logo = {
|
|
url = "https://upload.wikimedia.org/wikipedia/fr/4/4f/Discord_Logo_sans_texte.svg";
|
|
flake = false;
|
|
};
|
|
slack-logo = {
|
|
url = "https://upload.wikimedia.org/wikipedia/commons/d/d5/Slack_icon_2019.svg";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = inputs @ {
|
|
nixpkgs,
|
|
flake-parts,
|
|
...
|
|
}:
|
|
flake-parts.lib.mkFlake {inherit inputs;} {
|
|
systems = import inputs.systems;
|
|
imports = [
|
|
inputs.flake-parts.flakeModules.easyOverlay
|
|
];
|
|
|
|
perSystem = {
|
|
config,
|
|
pkgs,
|
|
system,
|
|
...
|
|
}: {
|
|
overlayAttrs = {
|
|
genericExtension = {
|
|
name,
|
|
slug,
|
|
url,
|
|
logo_file,
|
|
...
|
|
}:
|
|
pkgs.stdenvNoCC.mkDerivation {
|
|
name = name;
|
|
dontUnpack = true;
|
|
|
|
redirect_file = pkgs.writeText "redirect.js" ''
|
|
browser.spacesToolbar.addButton('${slug}', {
|
|
title: "${name}",
|
|
defaultIcons: "logo.svg",
|
|
url: "${url}"
|
|
});
|
|
'';
|
|
|
|
manifest_file = pkgs.writeText "manifest.json" ''
|
|
{
|
|
"manifest_version": 2,
|
|
"name": "Quick Access - ${name}",
|
|
"description": "Quick access to ${name}.",
|
|
"version": "0.1",
|
|
"author": "quick.access",
|
|
"browser_specific_settings": {
|
|
"gecko": {
|
|
"id": "@${slug}.quick.access",
|
|
"strict_min_version": "106.0"
|
|
}
|
|
},
|
|
"icons": {
|
|
"32": "logo.svg"
|
|
},
|
|
"background": {
|
|
"scripts": [
|
|
"redirect.js"
|
|
]
|
|
}
|
|
}
|
|
'';
|
|
|
|
buildInputs = [
|
|
pkgs.minify
|
|
pkgs.zip
|
|
];
|
|
|
|
installPhase = ''
|
|
cp ${logo_file} logo.svg
|
|
cp $redirect_file redirect.js
|
|
cp $manifest_file manifest.json
|
|
minify logo.svg -o logo.svg
|
|
minify redirect.js -o redirect.js
|
|
minify manifest.json -o manifest.json
|
|
|
|
zip -j ${slug}.xpi logo.svg manifest.json redirect.js
|
|
mkdir -p $out
|
|
cp ${slug}.xpi $out
|
|
'';
|
|
};
|
|
};
|
|
|
|
packages = {
|
|
ytmusic = config.overlayAttrs.genericExtension {
|
|
name = "YouTube Music";
|
|
slug = "ytmusic";
|
|
url = "https://music.youtube.com/";
|
|
logo_file = inputs.ytmusic-logo;
|
|
};
|
|
|
|
discord = config.overlayAttrs.genericExtension {
|
|
name = "Discord";
|
|
slug = "discord";
|
|
url = "https://discord.com/channels/@me";
|
|
logo_file = inputs.discord-logo;
|
|
};
|
|
|
|
slack = config.overlayAttrs.genericExtension {
|
|
name = "Slack";
|
|
slug = "slack";
|
|
url = "https://app.slack.com/";
|
|
logo_file = inputs.slack-logo;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|