WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit f2d74c5

Browse files
feat(home-manager): add support for COSMIC
1 parent d75e3fe commit f2d74c5

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

modules/home-manager/all-modules.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
./btop.nix
99
./cava.nix
1010
./chrome.nix
11+
./cosmic.nix
1112
./cursors.nix
1213
./delta.nix
1314
./dunst.nix

modules/home-manager/cosmic.nix

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{ catppuccinLib }:
2+
{ config, lib, ... }:
3+
{
4+
options.catppuccin = {
5+
cosmic-desktop = catppuccinLib.mkCatppuccinOption {
6+
accentSupport = true;
7+
name = "cosmic-desktop";
8+
};
9+
10+
cosmic-term = catppuccinLib.mkCatppuccinOption { name = "cosmic-term"; };
11+
};
12+
13+
config =
14+
let
15+
cfg = config.catppuccin;
16+
in
17+
lib.mkMerge [
18+
(lib.mkIf cfg.cosmic-desktop.enable {
19+
wayland.desktopManager.cosmic.components.config =
20+
let
21+
version = 1;
22+
in
23+
{
24+
"com.system76.CosmicTheme.Dark.Builder" = {
25+
inherit version;
26+
entries = lib.ron.importRON "${config.catppuccin.sources.cosmic-desktop}/themes/cosmic-settings/catppuccin-${cfg.cosmic-desktop.flavor}-${cfg.cosmic-desktop.accent}+round.ron";
27+
};
28+
29+
"com.system76.CosmicTheme.Light.Builder" = {
30+
inherit version;
31+
entries = lib.ron.importRON "${config.catppuccin.sources.cosmic-desktop}/themes/cosmic-settings/catppuccin-latte-${cfg.cosmic-desktop.accent}+round.ron";
32+
};
33+
34+
"com.system76.CosmicTheme.Mode" = {
35+
inherit version;
36+
entries.is_dark = cfg.cosmic-desktop.flavor != "latte";
37+
};
38+
};
39+
})
40+
41+
(lib.mkIf cfg.cosmic-term.enable {
42+
wayland.desktopManager.cosmic.components.config."com.system76.CosmicTerm" = {
43+
version = 1;
44+
45+
entries =
46+
let
47+
existingDark =
48+
config.wayland.desktopManager.cosmic.components.config."com.system76.CosmicTerm".entries.color_schemes_dark.attrs
49+
or [ ];
50+
existingLight =
51+
config.wayland.desktopManager.cosmic.components.config."com.system76.CosmicTerm".entries.color_schemes_light.attrs
52+
or [ ];
53+
maxDarkKey =
54+
if existingDark == [ ] then -1 else lib.foldl lib.max (-1) (map (t: t.key) existingDark);
55+
maxLightKey =
56+
if existingLight == [ ] then -1 else lib.foldl lib.max (-1) (map (t: t.key) existingLight);
57+
darkTheme = lib.ron.importRON "${config.catppuccin.sources.cosmic-desktop}/themes/cosmic-term/catppuccin-${cfg.cosmic-term.flavor}.ron";
58+
lightTheme = lib.ron.importRON "${config.catppuccin.sources.cosmic-desktop}/themes/cosmic-term/catppuccin-latte.ron";
59+
in
60+
{
61+
color_schemes_dark = lib.ron.mkMap (
62+
existingDark
63+
++ [
64+
{
65+
key = maxDarkKey + 1;
66+
value = darkTheme;
67+
}
68+
]
69+
);
70+
color_schemes_light = lib.ron.mkMap (
71+
existingLight
72+
++ [
73+
{
74+
key = maxLightKey + 1;
75+
value = lightTheme;
76+
}
77+
]
78+
);
79+
syntax_theme_dark = darkTheme.name;
80+
syntax_theme_light = lightTheme.name;
81+
};
82+
};
83+
})
84+
];
85+
}

pkgs/sources.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
"lastModified": "2024-09-03",
3535
"rev": "0746f77974330338ee2e1e4d1ef9872eba57eb26"
3636
},
37+
"cosmic-desktop": {
38+
"hash": "sha256-NAQnHS+XrMJ/rPgSS5nEQOMBhQtF6mP1i/0QP5arQ64=",
39+
"lastModified": "2025-04-22",
40+
"rev": "95e81098042dd2102f0b258f6990f886c5759692"
41+
},
3742
"cursors": {
3843
"hash": "sha256-qis6p+/m7+DdRDYzLq9yB2eZGpfZe5z5xRsa/1HoIG4=",
3944
"lastModified": "2025-02-22",

0 commit comments

Comments
 (0)