{ pkgs, config }: let rendersvg = pkgs.runCommand "rendersvg" { } '' mkdir -p $out/bin ln -s ${pkgs.resvg}/bin/resvg $out/bin/rendersvg ''; scheme = config.colorScheme; in pkgs.stdenv.mkDerivation rec { name = "generated-gtk-theme-${scheme.slug}"; src = pkgs.fetchFromGitHub { owner = "nana-4"; repo = "materia-theme"; rev = "6e5850388a25f424b8193fe4523504d1dc364175"; sha256 = "sha256-I6hpH0VTmftU4+/pRbztuTQcBKcOFBFbNZXJL/2bcgU="; }; buildInputs = with pkgs; [ sassc bc which rendersvg meson ninja nodePackages.sass gtk4.dev optipng ]; phases = [ "unpackPhase" "installPhase" ]; installPhase = '' HOME=/build chmod 777 -R . patchShebangs . mkdir -p $out/share/themes mkdir bin sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt cat > /build/gtk-colors << EOF BG=${scheme.palette.base00} FG=${scheme.palette.base07} HDR_BG=${scheme.palette.base00} HDR_FG=${scheme.palette.base07} SEL_BG=${scheme.palette.base03} SEL_FG=${scheme.palette.base07} TXT_BG=${scheme.palette.base01} TXT_FG=${scheme.palette.base07} BTN_BG=${scheme.palette.base01} BTN_FG=${scheme.palette.base07} HDR_BTN_BG=${scheme.palette.base01} HDR_BTN_FG=${scheme.palette.base07} MENU_BG=${scheme.palette.base00} MENU_FG=${scheme.palette.base07} ACCENT_BG=${scheme.palette.base0C} ACCENT_FG=${scheme.palette.base00} MATERIA_SURFACE=${scheme.palette.base01} MATERIA_VIEW=${scheme.palette.base00} WM_BORDER_FOCUS=${scheme.palette.base02} WM_BORDER_UNFOCUS=${scheme.palette.base02} UNITY_DEFAULT_LAUNCHER_STYLE=False ROUNDNESS=7 NAME=${scheme.slug} MATERIA_STYLE_COMPACT=True EOF echo "Changing colours:" ./change_color.sh -o ${scheme.slug} /build/gtk-colors -i False -t "$out/share/themes" chmod 555 -R . ''; }