eww: string based config

This commit is contained in:
ben 2024-06-28 12:16:55 -07:00
parent 7e68e55d2e
commit 3182815f97
4 changed files with 70 additions and 6 deletions

View file

@ -22,18 +22,48 @@ in {
'';
};
configDir = mkOption {
type = types.path;
example = literalExpression "./eww-config-dir";
configYuck = mkOption {
type = types.lines;
example = literalExpression ''
(defwindow example
:monitor 0
:geometry (geometry :x "0%"
:y "20px"
:width "90%"
:height "30px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
"example content")
'';
description = ''
The directory that gets symlinked to
{file}`$XDG_CONFIG_HOME/eww`.
The content that gets symlinked to
{file} `$XDG_CONFIG_HOME/eww/eww.yuck`.
'';
};
configScss = mkOption {
type = types.lines;
example = literalExpression ''
window {
background: pink;
}
'';
description = ''
The content that gets symlinked to
{file} `$XDG_CONFIG_HOME/eww/eww.scss`
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."eww".source = cfg.configDir;
xdg.configFile = {
"eww/eww.yuck".text = cfg.configYuck;
"eww/eww.scss".text = cfg.configScss;
};
};
}

View file

@ -71,6 +71,7 @@ in import nmtSrc {
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/emacs
./modules/programs/eww
./modules/programs/fastfetch
./modules/programs/feh
./modules/programs/fish

View file

@ -0,0 +1,32 @@
{ pkgs, ... }: {
config = {
programs.eww = {
enable = true;
package = pkgs.writeScriptBin "dummy-eww" "";
configYuck = ''
(defwindow example
:monitor 0
:geometry (geometry :x "0%"
:y "20px"
:width "90%"
:height "30px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
"example content")
'';
configScss = ''
window {
background: pink;
}
'';
};
nmt.script = ''
assertFileExists home-files/.config/eww/eww.yuck
assertFileExists home-files/.config/eww/eww.scss
'';
};
}

View file

@ -0,0 +1 @@
{ eww-basic-configuration = ./basic-config.nix; }