feat(home-manager): init mako module (#49)
This commit is contained in:
parent
3a12806a37
commit
4840eda13e
3 changed files with 50 additions and 0 deletions
|
@ -22,6 +22,7 @@ in
|
||||||
./helix.nix
|
./helix.nix
|
||||||
./glamour.nix
|
./glamour.nix
|
||||||
./gtk.nix
|
./gtk.nix
|
||||||
|
./mako.nix
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
./polybar.nix
|
./polybar.nix
|
||||||
./sway.nix
|
./sway.nix
|
||||||
|
|
34
modules/home-manager/mako.nix
Normal file
34
modules/home-manager/mako.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{ config
|
||||||
|
, pkgs
|
||||||
|
, lib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (builtins) readFile;
|
||||||
|
|
||||||
|
cfg = config.services.mako.catppuccin;
|
||||||
|
enable = cfg.enable && config.services.mako.enable;
|
||||||
|
theme = lib.ctp.fromINI pkgs (pkgs.fetchFromGitHub
|
||||||
|
{
|
||||||
|
owner = "catppuccin";
|
||||||
|
repo = "mako";
|
||||||
|
rev = "9dd088aa5f4529a3dd4d9760415e340664cb86df";
|
||||||
|
hash = "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ=";
|
||||||
|
} + /src/${cfg.flavour});
|
||||||
|
|
||||||
|
# Settings that need to be extracted and put in extraConfig
|
||||||
|
extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.mako.catppuccin =
|
||||||
|
lib.ctp.mkCatppuccinOpt "mako" config;
|
||||||
|
|
||||||
|
# Will cause infinite recursion if config.services.mako is directly set as a whole
|
||||||
|
config.services.mako = lib.mkIf enable {
|
||||||
|
backgroundColor = theme.background-color;
|
||||||
|
textColor = theme.text-color;
|
||||||
|
borderColor = theme.border-color;
|
||||||
|
progressColor = theme.progress-color;
|
||||||
|
extraConfig = readFile ((pkgs.formats.ini { }).generate "mako-extra-config" extraConfigAttrs);
|
||||||
|
};
|
||||||
|
}
|
|
@ -65,6 +65,21 @@ in
|
||||||
in
|
in
|
||||||
fromJSON (readFile json);
|
fromJSON (readFile json);
|
||||||
|
|
||||||
|
# a -> path -> a
|
||||||
|
# fromJSON but for ini (and without readFile)
|
||||||
|
# a should be the local pkgs attrset
|
||||||
|
fromINI = pkgs: file:
|
||||||
|
let
|
||||||
|
inherit (builtins) fromJSON readFile;
|
||||||
|
|
||||||
|
# convert to json
|
||||||
|
json = with pkgs;
|
||||||
|
runCommand "converted.json" { } ''
|
||||||
|
${jc}/bin/jc --ini < ${file} > $out
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
fromJSON (readFile json);
|
||||||
|
|
||||||
# a -> a -> [path] -> [path]
|
# a -> a -> [path] -> [path]
|
||||||
# this imports a list of paths while inheriting
|
# this imports a list of paths while inheriting
|
||||||
# multiple attributes
|
# multiple attributes
|
||||||
|
|
Loading…
Reference in a new issue