feat(home): add cosmic module

This commit is contained in:
Felix Schröter 2025-06-06 16:01:52 +02:00
parent 45c4b8a3f3
commit 1ef2364f31
Signed by: felschr
GPG key ID: 671E39E6744C807D
7 changed files with 469 additions and 0 deletions

View file

@ -0,0 +1,53 @@
{ config, lib, ... }:
# Based on:
# https://github.com/tristanbeedell/home-manager/tree/efa4d272f6c2b14d4a3b67b0b1e4b38ae46e5588/modules/programs/cosmic
let
cfg = config.programs.cosmic;
ron = import ./ron.nix { inherit lib; };
in
{
imports = [ ./settings.nix ];
options.programs.cosmic = {
enable = lib.mkEnableOption "COSMIC Desktop";
settings = lib.mkOption {
default = { };
type = lib.types.submodule {
freeformType = lib.types.submodule {
freeformType = lib.types.attrsOf lib.types.anything;
};
};
description = ''
An attrset of explicit settings for COSMIC apps, using their full config path.
'';
example = lib.literalExpression ''
{
"com.system76.CosmicPanel.Dock".v1 = {
opacity = 0.8;
};
};
'';
};
};
config = lib.mkIf cfg.enable {
xdg.configFile = lib.concatMapAttrs (
component:
lib.concatMapAttrs (
version:
lib.concatMapAttrs (
option: value:
lib.optionalAttrs (value != null) {
"cosmic/${component}/${version}/${option}" = {
enable = true;
text = ron.serialise value;
};
}
)
)
) cfg.settings;
};
}