sapling: add module
Adds a program module for [Sapling](https://sapling-scm.com/). Since Sapling itself is very similar in nature to Mercurial, `modules/programs/mercurial.nix` was copied to make this module with the ignore pieces removed (Sapling respects gitignore).
This commit is contained in:
parent
ebeeef94ab
commit
efc177c15f
7 changed files with 170 additions and 0 deletions
4
tests/modules/programs/sapling/default.nix
Normal file
4
tests/modules/programs/sapling/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
sapling-basic = ./sapling-basic.nix;
|
||||
sapling-most = ./sapling-most.nix;
|
||||
}
|
||||
26
tests/modules/programs/sapling/sapling-basic.nix
Normal file
26
tests/modules/programs/sapling/sapling-basic.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.sapling = {
|
||||
enable = true;
|
||||
userName = "John Doe";
|
||||
userEmail = "johndoe@example.com";
|
||||
};
|
||||
|
||||
test.stubs.sapling = { };
|
||||
|
||||
nmt.script = let
|
||||
configfile = if pkgs.stdenv.isDarwin then
|
||||
"Library/Preferences/sapling/sapling.conf"
|
||||
else
|
||||
".config/sapling/sapling.conf";
|
||||
|
||||
expected = builtins.toFile "sapling.conf" ''
|
||||
[ui]
|
||||
username=John Doe <johndoe@example.com>
|
||||
'';
|
||||
in ''
|
||||
assertFileExists home-files/${configfile}
|
||||
assertFileContent home-files/${configfile} ${expected}
|
||||
'';
|
||||
}
|
||||
48
tests/modules/programs/sapling/sapling-most.nix
Normal file
48
tests/modules/programs/sapling/sapling-most.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.sapling = {
|
||||
enable = true;
|
||||
userName = "John Doe";
|
||||
userEmail = "johndoe@example.com";
|
||||
aliases = {
|
||||
cm = "commit";
|
||||
d = "diff --exclude=*.lock";
|
||||
s = "status";
|
||||
view = "!$HG config paths.default | xargs open";
|
||||
};
|
||||
extraConfig = {
|
||||
pager.pager = "delta";
|
||||
gpg.key = "not-an-actual-key";
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.sapling = { };
|
||||
|
||||
nmt.script = let
|
||||
configfile = if pkgs.stdenv.isDarwin then
|
||||
"Library/Preferences/sapling/sapling.conf"
|
||||
else
|
||||
".config/sapling/sapling.conf";
|
||||
|
||||
expected = builtins.toFile "sapling.conf" ''
|
||||
[alias]
|
||||
cm=commit
|
||||
d=diff --exclude=*.lock
|
||||
s=status
|
||||
view=!$HG config paths.default | xargs open
|
||||
|
||||
[gpg]
|
||||
key=not-an-actual-key
|
||||
|
||||
[pager]
|
||||
pager=delta
|
||||
|
||||
[ui]
|
||||
username=John Doe <johndoe@example.com>
|
||||
'';
|
||||
in ''
|
||||
assertFileExists home-files/${configfile}
|
||||
assertFileContent home-files/${configfile} ${expected}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue