All my system configs and packages in one repo
1{
2 config,
3 pkgs,
4 lib,
5 ...
6}:
7let
8 cfg = config.ext.programs.jujutsu;
9 format = pkgs.formats.toml { };
10in
11{
12 options.ext.programs.jujutsu = {
13 enable = lib.mkEnableOption "Jujutsu";
14 package = lib.mkPackageOption pkgs "jujutsu" { };
15 settings = lib.mkOption {
16 type = lib.types.submodule {
17 freeformType = format.type;
18 };
19 default = { };
20 };
21 };
22
23 config = lib.mkIf cfg.enable {
24 packages = [ cfg.package ];
25 xdg.config.files."jj/config.toml" = lib.mkIf (cfg.settings != { }) {
26 generator = format.generate "jj-config.toml";
27 value = cfg.settings;
28 };
29 };
30}