Skip to content

Commit

Permalink
stylix: add flatpak gtk theme target
Browse files Browse the repository at this point in the history
  • Loading branch information
brckd committed Dec 18, 2024
1 parent d98ea6b commit 6499c65
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions configs/nixos/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@ with lib; {

services.flatpak.packages = [
"app.fotema.Fotema"
"org.gnome.design.Palette"
];
}
2 changes: 1 addition & 1 deletion modules/home/stylix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with lib; let
cfg = config.stylix;
in {
imports = [./targets/steam ./targets/firefox];
imports = [./targets/steam ./targets/firefox ./targets/flatpak];

config = mkIf cfg.enable {
stylix = {
Expand Down
31 changes: 31 additions & 0 deletions modules/home/stylix/targets/flatpak/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
config,
lib,
pkgs,
...
}: {
options.stylix.targets.flatpak.enable = config.lib.stylix.mkEnableTarget "Flatpak" true;

config = lib.mkIf (config.stylix.enable && config.stylix.targets.flatpak.enable) {
services.flatpak.overrides.global = {
Context.filesystems = ["/nix/store" config.home.homeDirectory];
Environment.GTK_THEME = config.gtk.theme.name;
};

home.file.".themes/${config.gtk.theme.name}".source = pkgs.stdenv.mkDerivation {
name = "flattenedGtkTheme";
src = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}";

installPhase = ''
mkdir $out
cp -rL . $out
config="${config.xdg.configFile."gtk-3.0/gtk.css".source}"
cat "$config" >> $out/gtk-3.0/gtk.css
cat "$config" >> $out/gtk-4.0/gtk.css
'';
};

gtk.theme.package = lib.mkDefault null;
};
}
6 changes: 3 additions & 3 deletions modules/home/stylix/targets/steam/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
config = lib.mkIf (config.stylix.enable && config.stylix.targets.steam.enable) {
home.packages = with pkgs; [adwsteamgtk];

home.activation.applyAdwaitaForSteam = let
shellScript = pkgs.writeShellScript "aplyAdwaitaForSteam" ''
home.activation.adwaitaForSteam = let
shellScript = pkgs.writeShellScript "adwaitaForSteam" ''
rm -f "$HOME/.cache/AdwSteamInstaller/extracted/custom/custom.css"
${lib.getExe pkgs.adwsteamgtk} -i
'';
in
config.lib.dag.entryAfter ["writeBoundary" "dconfSettings"] ''
run ${shellScript}
run --quiet ${shellScript}
'';

xdg.configFile."AdwSteamGtk/custom.css".source = config.lib.stylix.colors {
Expand Down

0 comments on commit 6499c65

Please sign in to comment.