From dfe7024f7ed9a1ccf7417c9683b6839f0e6f83a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Abdelkader=20Mart=C3=ADnez=20P=C3=A9rez?= Date: Sat, 11 Mar 2023 00:10:05 +0100 Subject: [PATCH] mr: add module --- .github/CODEOWNERS | 2 ++ modules/lib/maintainers.nix | 6 +++++ modules/misc/news.nix | 7 ++++++ modules/modules.nix | 1 + modules/programs/mr.nix | 49 +++++++++++++++++++++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 modules/programs/mr.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4ad9b3753..21a05fe4c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -208,6 +208,8 @@ Makefile @thiagokokada /modules/programs/mpv.nix @tadeokondrak @thiagokokada @chuangzhu /tests/modules/programs/mpv @thiagokokada @chuangzhu +/modules/programs/mr.nix @nilp0inter + /modules/programs/mu.nix @KarlJoad /modules/programs/mujmap.nix @elizagamedev diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 83acf9911..19fa96b10 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -159,6 +159,12 @@ github = "mifom"; githubId = 23462908; }; + nilp0inter = { + name = "Roberto Abdelkader Martínez Pérez"; + email = "robertomartinezp@gmail.com"; + github = "nilp0inter"; + githubId = 1224006; + }; seylerius = { email = "sable@seyleri.us"; name = "Sable Seyler"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index c2bbedd42..af413169d 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -987,6 +987,13 @@ in A new module is available: 'services.batsignal'. ''; } + + { + time = "2023-04-19T15:33:07+00:00"; + message = '' + A new module is available: 'programs.mr'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index a6312bfd1..743bcf6d2 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -123,6 +123,7 @@ let ./programs/mercurial.nix ./programs/micro.nix ./programs/mpv.nix + ./programs/mr.nix ./programs/msmtp.nix ./programs/mu.nix ./programs/mujmap.nix diff --git a/modules/programs/mr.nix b/modules/programs/mr.nix new file mode 100644 index 000000000..2e02e7c62 --- /dev/null +++ b/modules/programs/mr.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.mr; + + listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault { }); + + iniFormat = pkgs.formats.ini { inherit listToValue; }; + +in { + meta.maintainers = [ hm.maintainers.nilp0inter ]; + + options.programs.mr = { + enable = mkEnableOption + "mr, a tool to manage all your version control repositories"; + + package = mkPackageOption pkgs "mr" { }; + + settings = mkOption { + type = iniFormat.type; + default = { }; + description = '' + Configuration written to $HOME/.mrconfig + See + for an example configuration. + ''; + example = 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 = mkIf cfg.enable { + home.packages = [ cfg.package ]; + home.file.".mrconfig".source = iniFormat.generate ".mrconfig" cfg.settings; + }; +} +