diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index fe4a326e..96015153 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -158,6 +158,9 @@
/modules/programs/mcfly.nix @marsam
+/modules/programs/micro.nix @MForster
+/tests/modules/programs/micro @MForster
+
/modules/programs/mpv.nix @tadeokondrak @thiagokokada
/tests/modules/programs/mpv @thiagokokada
diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix
index 17fc4407..fec5c034 100644
--- a/modules/lib/maintainers.nix
+++ b/modules/lib/maintainers.nix
@@ -107,6 +107,12 @@
github = "matrss";
githubId = 9308656;
};
+ mforster = {
+ name = "Michael Forster";
+ email = "email@michael-forster.de";
+ github = "MForster";
+ githubId = 4067975;
+ };
mifom = {
name = "mifom";
email = "mifom@users.noreply.github.com";
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 98bfa982..fd8ca1bc 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -561,6 +561,13 @@ in
A new module is available: 'programs.mujmap'.
'';
}
+
+ {
+ time = "2022-06-24T17:18:32+00:00";
+ message = ''
+ A new module is available: 'programs.micro'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index d494d63b..363e127b 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -106,6 +106,7 @@ let
./programs/mbsync.nix
./programs/mcfly.nix
./programs/mercurial.nix
+ ./programs/micro.nix
./programs/mpv.nix
./programs/msmtp.nix
./programs/mu.nix
diff --git a/modules/programs/micro.nix b/modules/programs/micro.nix
new file mode 100644
index 00000000..f2f8b6bf
--- /dev/null
+++ b/modules/programs/micro.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.micro;
+
+ jsonFormat = pkgs.formats.json { };
+
+in {
+ meta.maintainers = [ hm.maintainers.mforster ];
+
+ options = {
+ programs.micro = {
+ enable = mkEnableOption "micro, a terminal-based text editor";
+
+ settings = mkOption {
+ type = jsonFormat.type;
+ default = { };
+ example = literalExpression ''
+ {
+ autosu = false;
+ cursorline = false;
+ }
+ '';
+ description = ''
+ Configuration written to
+ $XDG_CONFIG_HOME/micro/settings.json. See
+
+ for supported values.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ pkgs.micro ];
+
+ xdg.configFile."micro/settings.json".source =
+ jsonFormat.generate "micro-settings" cfg.settings;
+ };
+}
diff --git a/tests/default.nix b/tests/default.nix
index a0093f08..3c6cc654 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -75,6 +75,7 @@ import nmt {
./modules/programs/lieer
./modules/programs/man
./modules/programs/mbsync
+ ./modules/programs/micro
./modules/programs/mpv
./modules/programs/mu
./modules/programs/mujmap
diff --git a/tests/modules/programs/micro/default.nix b/tests/modules/programs/micro/default.nix
new file mode 100644
index 00000000..984b9fa6
--- /dev/null
+++ b/tests/modules/programs/micro/default.nix
@@ -0,0 +1 @@
+{ micro = ./micro.nix; }
diff --git a/tests/modules/programs/micro/micro.nix b/tests/modules/programs/micro/micro.nix
new file mode 100644
index 00000000..92ab90e8
--- /dev/null
+++ b/tests/modules/programs/micro/micro.nix
@@ -0,0 +1,24 @@
+{ ... }:
+
+{
+ programs.micro = {
+ enable = true;
+
+ settings = {
+ autosu = false;
+ cursorline = false;
+ };
+ };
+
+ test.stubs.micro = { };
+
+ nmt.script = ''
+ assertFileContent home-files/.config/micro/settings.json \
+ ${builtins.toFile "micro-expected-settings.json" ''
+ {
+ "autosu": false,
+ "cursorline": false
+ }
+ ''}
+ '';
+}