mirror of
https://github.com/nix-community/home-manager
synced 2024-11-19 17:49:45 +01:00
darcs: add module
This commit is contained in:
parent
af715ed857
commit
050d01a62c
9 changed files with 101 additions and 0 deletions
|
@ -1143,6 +1143,13 @@ in
|
|||
A new module is available: 'services.ssh-agent'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2023-07-08T08:27:41+00:00";
|
||||
message = ''
|
||||
A new modules is available: 'programs.darcs'
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ let
|
|||
./programs/chromium.nix
|
||||
./programs/command-not-found/command-not-found.nix
|
||||
./programs/comodoro.nix
|
||||
./programs/darcs.nix
|
||||
./programs/dircolors.nix
|
||||
./programs/direnv.nix
|
||||
./programs/discocss.nix
|
||||
|
|
52
modules/programs/darcs.nix
Normal file
52
modules/programs/darcs.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.darcs;
|
||||
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ chris-martin ];
|
||||
|
||||
options = {
|
||||
programs.darcs = {
|
||||
enable = mkEnableOption "darcs";
|
||||
|
||||
package = mkPackageOption pkgs "darcs" { };
|
||||
|
||||
author = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "Fred Bloggs <fred@example.net>" ];
|
||||
description = ''
|
||||
If this list has a single entry, it will be used as the author
|
||||
when you record a patch. If there are multiple entries, Darcs
|
||||
will prompt you to choose one of them.
|
||||
'';
|
||||
};
|
||||
|
||||
boring = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "^.idea$" ".iml$" "^.stack-work$" ];
|
||||
description = "File patterns to ignore";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{ home.packages = [ cfg.package ]; }
|
||||
|
||||
(mkIf (cfg.author != [ ]) {
|
||||
home.file.".darcs/author".text =
|
||||
concatMapStrings (x: x + "\n") cfg.author;
|
||||
})
|
||||
|
||||
(mkIf (cfg.boring != [ ]) {
|
||||
home.file.".darcs/boring".text =
|
||||
concatMapStrings (x: x + "\n") cfg.boring;
|
||||
})
|
||||
|
||||
]);
|
||||
}
|
|
@ -68,6 +68,7 @@ import nmt {
|
|||
./modules/programs/browserpass
|
||||
./modules/programs/btop
|
||||
./modules/programs/comodoro
|
||||
./modules/programs/darcs
|
||||
./modules/programs/dircolors
|
||||
./modules/programs/direnv
|
||||
./modules/programs/emacs
|
||||
|
|
2
tests/modules/programs/darcs/author-expected.txt
Normal file
2
tests/modules/programs/darcs/author-expected.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Real Person <personal@example.com>
|
||||
Real Person <corporate@example.com>
|
17
tests/modules/programs/darcs/author.nix
Normal file
17
tests/modules/programs/darcs/author.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.darcs = {
|
||||
enable = true;
|
||||
author = [
|
||||
"Real Person <personal@example.com>"
|
||||
"Real Person <corporate@example.com>"
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.darcs/author ${./author-expected.txt}
|
||||
'';
|
||||
};
|
||||
}
|
3
tests/modules/programs/darcs/boring-expected.txt
Normal file
3
tests/modules/programs/darcs/boring-expected.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
^.idea$
|
||||
.iml$
|
||||
^.stack-work$
|
14
tests/modules/programs/darcs/boring.nix
Normal file
14
tests/modules/programs/darcs/boring.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.darcs = {
|
||||
enable = true;
|
||||
boring = [ "^.idea$" ".iml$" "^.stack-work$" ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.darcs/boring ${./boring-expected.txt}
|
||||
'';
|
||||
};
|
||||
}
|
4
tests/modules/programs/darcs/default.nix
Normal file
4
tests/modules/programs/darcs/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
darcs-author = ./author.nix;
|
||||
darcs-boring = ./boring.nix;
|
||||
}
|
Loading…
Reference in a new issue