I’m writting a module for tint2 since it a program i use, i’m very new to nix lenguage but i really would like to contribute to the source code, here is my module:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.tint2;
buildConfig = config:
concatStringsSep "\n" (mapAttrsToList renderConfig config);
renderConfig = name: value: "${name}=${renderValue value}";
renderValue = option:
{
int = toString option;
bool = if option then "yes" else "no";
string = option;
}.${builtins.typeOf option};
valueType = with types; oneOf [ bool int str ];
in
{
options.programs.tint2 = {
enable = mkEnableOption "tint2, a simple, unobtrusive and light panel for Xorg";
config = mkOption {
type = types.attrsOf valueType;
default = { };
example = { rounded=0; border_with=2; background_color="#282828 100"; };
description = ''
tint2 configuration file.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.tint2 ];
xdg.configFile = {
"tint2/tint2rc" = mkIf (cfg.config != { }) {
text = buildConfig config + "\n";
};
};
};
}
when trying to run home-manager switch
it complains:
error: attribute 'set' missing
at /home/MyUser/dev/home-manager/modules/programs/tint2.nix:15:5:
14| renderValue = option:
15| {
| ^
16| int = toString option;
i’ve no idea what i’m doing wrong here. Any idea?