mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
Merge branch 'nix-community:master' into nnn-configure-quitcd
This commit is contained in:
commit
20efa4aea4
5 changed files with 47 additions and 3 deletions
|
@ -68,6 +68,11 @@ in {
|
||||||
type = with lib.types;
|
type = with lib.types;
|
||||||
attrsOf (submodule {
|
attrsOf (submodule {
|
||||||
options.khard.enable = lib.mkEnableOption "khard access";
|
options.khard.enable = lib.mkEnableOption "khard access";
|
||||||
|
options.khard.defaultCollection = lib.mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
|
description = "VCARD collection to be searched by khard.";
|
||||||
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -75,11 +80,17 @@ in {
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = [ pkgs.khard ];
|
home.packages = [ pkgs.khard ];
|
||||||
|
|
||||||
xdg.configFile."khard/khard.conf".text = ''
|
xdg.configFile."khard/khard.conf".text = let
|
||||||
|
makePath = anAccount:
|
||||||
|
builtins.toString (/. + lib.concatStringsSep "/" [
|
||||||
|
anAccount.local.path
|
||||||
|
anAccount.khard.defaultCollection
|
||||||
|
]);
|
||||||
|
in ''
|
||||||
[addressbooks]
|
[addressbooks]
|
||||||
${lib.concatMapStringsSep "\n" (acc: ''
|
${lib.concatMapStringsSep "\n" (acc: ''
|
||||||
[[${acc.name}]]
|
[[${acc.name}]]
|
||||||
path = ${acc.local.path}
|
path = ${makePath acc}
|
||||||
'') (lib.attrValues accounts)}
|
'') (lib.attrValues accounts)}
|
||||||
|
|
||||||
${renderSettings cfg.settings}
|
${renderSettings cfg.settings}
|
||||||
|
|
|
@ -19,6 +19,8 @@ in {
|
||||||
options.programs.papis = {
|
options.programs.papis = {
|
||||||
enable = mkEnableOption "papis";
|
enable = mkEnableOption "papis";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "papis" { };
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = with types; attrsOf (oneOf [ bool int str ]);
|
type = with types; attrsOf (oneOf [ bool int str ]);
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -84,7 +86,7 @@ in {
|
||||||
(", namely " + concatStringsSep "," defaultLibraries);
|
(", namely " + concatStringsSep "," defaultLibraries);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
home.packages = [ pkgs.papis ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."papis/config" =
|
xdg.configFile."papis/config" =
|
||||||
mkIf (cfg.libraries != { }) { text = generators.toINI { } settingsIni; };
|
mkIf (cfg.libraries != { }) { text = generators.toINI { } settingsIni; };
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
khard_empty_config = ./empty_config.nix;
|
khard_empty_config = ./empty_config.nix;
|
||||||
khard_basic_config = ./basic_config.nix;
|
khard_basic_config = ./basic_config.nix;
|
||||||
khard_multiple_accounts = ./multiple_accounts.nix;
|
khard_multiple_accounts = ./multiple_accounts.nix;
|
||||||
|
khard_dirty_path = ./dirty_path.nix;
|
||||||
}
|
}
|
||||||
|
|
22
tests/modules/programs/khard/dirty_path.nix
Normal file
22
tests/modules/programs/khard/dirty_path.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
accounts.contact = {
|
||||||
|
basePath = "/home/user/who/likes///";
|
||||||
|
accounts.forward = {
|
||||||
|
local.type = "filesystem";
|
||||||
|
khard = {
|
||||||
|
enable = true;
|
||||||
|
defaultCollection = "////slashes//a/lot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.khard.enable = true;
|
||||||
|
|
||||||
|
test.stubs.khard = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.config/khard/khard.conf \
|
||||||
|
${./dirty_path_expected}
|
||||||
|
'';
|
||||||
|
}
|
8
tests/modules/programs/khard/dirty_path_expected
Normal file
8
tests/modules/programs/khard/dirty_path_expected
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[addressbooks]
|
||||||
|
[[forward]]
|
||||||
|
path = /home/user/who/likes/forward/slashes/a/lot
|
||||||
|
|
||||||
|
|
||||||
|
[general]
|
||||||
|
default_action=list
|
||||||
|
|
Loading…
Reference in a new issue