nixpkgs/pkgs/by-name/ad/adi1090x-plymouth-themes/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

64 lines
1.8 KiB
Nix

{
stdenv,
fetchurl,
lib,
unzip,
# To select only certain themes, pass `selected_themes` as a list of strings.
# reference ./shas.nix for available themes
selected_themes ? [],
}: let
version = "1.0";
# this file is generated via ./update.sh
# borrowed from pkgs/data/fonts/nerdfonts
themeShas = import ./shas.nix;
knownThemes = builtins.attrNames themeShas;
selectedThemes =
if (selected_themes == [])
then knownThemes
else let
unknown = lib.subtractLists knownThemes selected_themes;
in
if (unknown != [])
then throw "Unknown theme(s): ${lib.concatStringsSep " " unknown}"
else selected_themes;
srcs = lib.lists.forEach selectedThemes (
name: (fetchurl {
url = themeShas.${name}.url;
sha256 = themeShas.${name}.sha;
})
);
in
stdenv.mkDerivation {
pname = "adi1090x-plymouth-themes";
inherit version srcs;
nativeBuildInputs = [
unzip
];
sourceRoot = ".";
unpackCmd = "tar xzf $curSrc";
installPhase = ''
mkdir -p $out/share/plymouth/themes
for theme in ${toString selectedThemes}; do
mv $theme $out/share/plymouth/themes/$theme
done
find $out/share/plymouth/themes/ -name \*.plymouth -exec sed -i "s@\/usr\/@$out\/@" {} \;
'';
meta = with lib; {
description = "Plymouth boot themes from adi1090x";
longDescription = ''
A variety of plymouth boot screens by adi1090x. Using the default value
of `selected_themes` will install all themes (~524M). Consider overriding
this with a list of the string names of each theme to install. Check
./shas.nix for available themes.
'';
homepage = "https://github.com/adi1090x/plymouth-themes";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [slwst];
};
}