1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-20 08:49:47 +01:00

darcs: add module

This commit is contained in:
Chris Martin 2023-03-27 12:25:17 -06:00 committed by Robert Helgesson
parent af715ed857
commit 050d01a62c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
9 changed files with 101 additions and 0 deletions

View file

@ -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'
'';
}
];
};
}

View file

@ -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

View 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;
})
]);
}

View file

@ -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

View file

@ -0,0 +1,2 @@
Real Person <personal@example.com>
Real Person <corporate@example.com>

View 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}
'';
};
}

View file

@ -0,0 +1,3 @@
^.idea$
.iml$
^.stack-work$

View 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}
'';
};
}

View file

@ -0,0 +1,4 @@
{
darcs-author = ./author.nix;
darcs-boring = ./boring.nix;
}