fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
1.2 KiB49 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.programs.mr;
8
9  listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault { });
10
11  iniFormat = pkgs.formats.ini { inherit listToValue; };
12
13in {
14  meta.maintainers = [ hm.maintainers.nilp0inter ];
15
16  options.programs.mr = {
17    enable = mkEnableOption
18      "mr, a tool to manage all your version control repositories";
19
20    package = mkPackageOption pkgs "mr" { };
21
22    settings = mkOption {
23      type = iniFormat.type;
24      default = { };
25      description = ''
26        Configuration written to {file}`$HOME/.mrconfig`
27        See <https://myrepos.branchable.com/>
28        for an example configuration.
29      '';
30      example = literalExpression ''
31        {
32          foo = {
33            checkout = "git clone git@github.com:joeyh/foo.git";
34            update = "git pull --rebase";
35          };
36          ".local/share/password-store" = {
37            checkout = "git clone git@github.com:myuser/password-store.git";
38          };
39        }
40      '';
41    };
42  };
43
44  config = mkIf cfg.enable {
45    home.packages = [ cfg.package ];
46    home.file.".mrconfig".source = iniFormat.generate ".mrconfig" cfg.settings;
47  };
48}
49