nixpkgs/pkgs/data/themes/nordic/default.nix

158 lines
4.9 KiB
Nix

{ lib
, stdenvNoCC
, fetchFromGitHub
, gtk-engine-murrine
, breeze-icons
, plasma-framework
, plasma-workspace
, jdupes
}:
stdenvNoCC.mkDerivation rec {
pname = "nordic";
version = "2.2.0-unstable-2024-01-20";
srcs = [
(fetchFromGitHub {
owner = "EliverLara";
repo = pname;
rev = "218a1a8679fdb97aa0aa7997fdf8c5344d68fb2f";
hash = "sha256-a315U4HsQP1omluTJjq9U76L3ANP7uN831mCY54vZnk=";
name = "Nordic";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = pname;
rev = "59873a54c8524adb36411d17d473eb7b7c910eac";
hash = "sha256-RisW5W0onNrtsSPHtFW66OdrQWOQX3uDmLiM+5ckzSY=";
name = "Nordic-standard-buttons";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = pname;
rev = "6e2b8fb8017c34344ec6b70884f09ebb44863efb";
hash = "sha256-B4qH8L5r16gaPS1wpiIHPyS3g/g53Xi2C6F0rcZKgWk=";
name = "Nordic-darker";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = pname;
rev = "2160a7bc69f55dd0b9efa64f029344256a4ef086";
hash = "sha256-1WdorWByZE4sXTfwsjFxvvSI0qQcAcfFoPXN5fGhEpc=";
name = "Nordic-darker-standard-buttons";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = pname;
rev = "63e0844bc04e1500e4b0ef8031cb3812e15e12fb";
hash = "sha256-b0Zs2WsD913Ai8wvi7mPraFme93WZXm+7rnwhDvGuZM=";
name = "Nordic-bluish-accent";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = pname;
rev = "53e44ca5045a57903c0024197fa7a7a267432afb";
hash = "sha256-vF2f4PuQP0QkmPT6kR35eWYvQ9xLCYihEsobERURuBk=";
name = "Nordic-bluish-accent-standard-buttons";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = "${pname}-polar";
rev = "4ec6f09782394d24d4d8cc78ac53c4692ec28985";
hash = "sha256-Z50ciafgfTHBahjpcVTapnsU88ioPUZ1RjggNpruJP0=";
name = "Nordic-Polar";
})
(fetchFromGitHub {
owner = "EliverLara";
repo = "${pname}-polar";
rev = "c6c7ee8e642a9df07f7d69ed048a6ef37a26153c";
hash = "sha256-e+B9oUKbPr2MKmaz+l5GTOP4iVmw24vVpS98mAxEekA=";
name = "Nordic-Polar-standard-buttons";
})
];
sourceRoot = ".";
outputs = [ "out" "sddm" ];
nativeBuildInputs = [ jdupes ];
propagatedUserEnvPkgs = [ gtk-engine-murrine ];
dontWrapQtApps = true;
installPhase = ''
runHook preInstall
# install theme files
mkdir -p $out/share/themes
cp -a Nordic* $out/share/themes
# remove uneeded files
rm -r $out/share/themes/*/.gitignore
rm -r $out/share/themes/*/Art
rm -r $out/share/themes/*/FUNDING.yml
rm -r $out/share/themes/*/LICENSE
rm -r $out/share/themes/*/README.md
rm -r $out/share/themes/*/{package.json,package-lock.json,Gulpfile.js}
rm -r $out/share/themes/*/src
rm -r $out/share/themes/*/cinnamon/*.scss
rm -r $out/share/themes/*/gnome-shell/{earlier-versions,extensions,*.scss}
rm -r $out/share/themes/*/gtk-2.0/{assets.svg,assets.txt,links.fish,render-assets.sh}
rm -r $out/share/themes/*/gtk-3.0/{apps,widgets,*.scss}
rm -r $out/share/themes/*/gtk-4.0/{apps,widgets,*.scss}
rm -r $out/share/themes/*/xfwm4/{assets,render_assets.fish}
# move wallpapers to appropriate directory
mkdir -p $out/share/wallpapers/Nordic
mv -v $out/share/themes/Nordic/extras/wallpapers/* $out/share/wallpapers/Nordic/
rmdir $out/share/themes/Nordic/extras{/wallpapers,}
# move kde related contents to appropriate directories
mkdir -p $out/share/{aurorae/themes,color-schemes,Kvantum,plasma,icons}
mv -v $out/share/themes/Nordic/kde/aurorae/* $out/share/aurorae/themes/
mv -v $out/share/themes/Nordic/kde/colorschemes/* $out/share/color-schemes/
mv -v $out/share/themes/Nordic/kde/konsole $out/share/
mv -v $out/share/themes/Nordic/kde/kvantum/* $out/share/Kvantum/
mv -v $out/share/themes/Nordic/kde/plasma/look-and-feel $out/share/plasma/
mv -v $out/share/themes/Nordic/kde/folders/* $out/share/icons/
mv -v $out/share/themes/Nordic/kde/cursors/*-cursors $out/share/icons/
mkdir -p $sddm/share/sddm/themes
mv -v $out/share/themes/Nordic/kde/sddm/* $sddm/share/sddm/themes/
rm -rf $out/share/themes/Nordic/kde
# Replace duplicate files with symbolic links to the first file in
# each set of duplicates, reducing the installed size in about 53%
jdupes --quiet --link-soft --recurse $out/share
runHook postInstall
'';
postFixup = ''
# Propagate sddm theme dependencies to user env otherwise sddm
# does not find them. Putting them in buildInputs is not enough.
mkdir -p $sddm/nix-support
printWords ${breeze-icons} ${plasma-framework} ${plasma-workspace} \
>> $sddm/nix-support/propagated-user-env-packages
'';
meta = with lib; {
description = "Gtk and KDE themes using the Nord color pallete";
homepage = "https://github.com/EliverLara/Nordic";
license = licenses.gpl3Only;
platforms = platforms.all;
maintainers = [ maintainers.romildo ];
};
}