mirror of
https://github.com/nix-community/home-manager
synced 2024-11-25 22:20:29 +00:00
micro: add module
This adds initial bare-bones support for the `micro` editor.
This commit is contained in:
parent
fd047c84f7
commit
65bcfaccc5
8 changed files with 86 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
43
modules/programs/micro.nix
Normal file
43
modules/programs/micro.nix
Normal file
|
@ -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
|
||||
<filename>$XDG_CONFIG_HOME/micro/settings.json</filename>. See
|
||||
<link xlink:href="https://github.com/zyedidia/micro/blob/master/runtime/help/options.md"/>
|
||||
for supported values.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.micro ];
|
||||
|
||||
xdg.configFile."micro/settings.json".source =
|
||||
jsonFormat.generate "micro-settings" cfg.settings;
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
1
tests/modules/programs/micro/default.nix
Normal file
1
tests/modules/programs/micro/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ micro = ./micro.nix; }
|
24
tests/modules/programs/micro/micro.nix
Normal file
24
tests/modules/programs/micro/micro.nix
Normal file
|
@ -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
|
||||
}
|
||||
''}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue