Introduce a home-manager module

This commit is contained in:
Quentin Boyer 2024-02-09 10:19:31 +01:00
parent 7b45de8920
commit 3ec49e0230
2 changed files with 47 additions and 1 deletions

View file

@ -30,5 +30,8 @@
};
defaultPackage = naersk'.buildPackage ./.;
});
})
// {
homeManagerModules.default = import ./home-manager.nix self;
};
}

43
home-manager.nix Normal file
View file

@ -0,0 +1,43 @@
self: {
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.programs.git-series-manager;
tomlFormat = pkgs.formats.toml {};
in {
options.programs.git-series-manager = {
enable = mkEnableOption "git-series-manager, a way to manage git patchsets";
package = mkOption {
type = types.package;
description = "Package to use by git-series-manager";
default = self.defaultPackage."${pkgs.system}";
};
settings = mkOption {
inherit (tomlFormat) type;
example = lib.literalExpression ''
{
sendmail_args = ["--sendmail-cmd=customSendmail" "--to=mail@list.com"];
repo_url_base = "https://my.git-forge.com/my/project/";
ci_url = "https://my.jenkins.instance/''${component}/job/''${branch}/''${ci_job}";
editor = "nvim";
}
'';
description = ''
git-series-manager global configuration, can also be configured through ''${repo}/.patches/config.toml
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."git-series-manager/config.toml".source =
tomlFormat.generate "config.toml" cfg.settings;
};
}