treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically importing modules following a specific convention. Co-authored-by: awwpotato <awwpotato@voidq.com> Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
fefeb0e928
commit
4fca600cb1
461 changed files with 72 additions and 474 deletions
48
modules/programs/mr/default.nix
Normal file
48
modules/programs/mr/default.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.mr;
|
||||
|
||||
listToValue = lib.concatMapStringsSep ", " (lib.generators.mkValueStringDefault { });
|
||||
|
||||
iniFormat = pkgs.formats.ini { inherit listToValue; };
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.hm.maintainers.nilp0inter ];
|
||||
|
||||
options.programs.mr = {
|
||||
enable = lib.mkEnableOption "mr, a tool to manage all your version control repositories";
|
||||
|
||||
package = lib.mkPackageOption pkgs "mr" { nullable = true; };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = iniFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration written to {file}`$HOME/.mrconfig`
|
||||
See <https://myrepos.branchable.com/>
|
||||
for an example configuration.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
foo = {
|
||||
checkout = "git clone git@github.com:joeyh/foo.git";
|
||||
update = "git pull --rebase";
|
||||
};
|
||||
".local/share/password-store" = {
|
||||
checkout = "git clone git@github.com:myuser/password-store.git";
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
home.file.".mrconfig".source = iniFormat.generate ".mrconfig" cfg.settings;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue