mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-04 08:01:02 +01:00
test: update tests path for new pwd-store path
This commit is contained in:
parent
14bc4c56fc
commit
a26b74229f
9 changed files with 85 additions and 8 deletions
|
|
@ -28,11 +28,10 @@ in
|
||||||
defaultText = "$HOME/.password-store";
|
defaultText = "$HOME/.password-store";
|
||||||
example = "/home/user/.local/share/password-store";
|
example = "/home/user/.local/share/password-store";
|
||||||
description = ''
|
description = ''
|
||||||
Absolute path to password store, default upstream value of which is
|
Absolute path to the password store. If the
|
||||||
{file}`$HOME/.password-store`. If the
|
{option}`programs.password-store` module is enabled, the
|
||||||
{option}`programs.password-store` module is enabled and
|
{option}`programs.password-store.settings.PASSWORD_STORE_DIR` option
|
||||||
{option}`programs.password-store.settings.PASSWORD_STORE_DIR` is set,
|
will be checked, if found it will be inherited as the default.
|
||||||
it will inherit the value from the latter.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -56,7 +55,7 @@ in
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
Unit = {
|
Unit = {
|
||||||
AssertFileIsExecutable = "${binPath}";
|
AssertFileIsExecutable = binPath;
|
||||||
Description = "Pass libsecret service";
|
Description = "Pass libsecret service";
|
||||||
Documentation = "https://github.com/mdellweg/pass_secret_service";
|
Documentation = "https://github.com/mdellweg/pass_secret_service";
|
||||||
PartOf = [ "default.target" ];
|
PartOf = [ "default.target" ];
|
||||||
|
|
@ -64,7 +63,7 @@ in
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Type = "dbus";
|
Type = "dbus";
|
||||||
ExecStart = "${binPath} ${lib.optionalString (cfg.storePath != null) "--path ${cfg.storePath}"}";
|
ExecStart = binPath + lib.optionalString (cfg.storePath != null) " --path ${cfg.storePath}";
|
||||||
BusName = busName;
|
BusName = busName;
|
||||||
Environment = [ "GNUPGHOME=${config.programs.gpg.homedir}" ];
|
Environment = [ "GNUPGHOME=${config.programs.gpg.homedir}" ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
9
tests/modules/programs/password-store/default-path.nix
Normal file
9
tests/modules/programs/password-store/default-path.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
home.stateVersion = "25.11"; # Or any other newer version
|
||||||
|
programs.password-store.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'^export PASSWORD_STORE_DIR='
|
||||||
|
'';
|
||||||
|
}
|
||||||
5
tests/modules/programs/password-store/default.nix
Normal file
5
tests/modules/programs/password-store/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
password-store-default-path = ./default-path.nix;
|
||||||
|
password-store-old-default-path = ./old-default-path.nix;
|
||||||
|
password-store-nondefault-path = ./nondefault-path.nix;
|
||||||
|
}
|
||||||
15
tests/modules/programs/password-store/nondefault-path.nix
Normal file
15
tests/modules/programs/password-store/nondefault-path.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
let
|
||||||
|
somePath = "/some/random/path/I/store/pwds";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.stateVersion = "25.11";
|
||||||
|
programs.password-store = {
|
||||||
|
enable = true;
|
||||||
|
settings.PASSWORD_STORE_DIR = somePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'export PASSWORD_STORE_DIR="${somePath}"'
|
||||||
|
'';
|
||||||
|
}
|
||||||
10
tests/modules/programs/password-store/old-default-path.nix
Normal file
10
tests/modules/programs/password-store/old-default-path.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
home.stateVersion = "25.05"; # <= 25.11
|
||||||
|
programs.password-store.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'export PASSWORD_STORE_DIR="${config.xdg.dataHome}/password-store"'
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,6 @@
|
||||||
serviceFile=home-files/.config/systemd/user/pass-secret-service.service
|
serviceFile=home-files/.config/systemd/user/pass-secret-service.service
|
||||||
|
|
||||||
assertFileExists $serviceFile
|
assertFileExists $serviceFile
|
||||||
assertFileRegex $serviceFile 'ExecStart=.*/bin/pass_secret_service'
|
assertFileRegex $serviceFile '^ExecStart=.*/bin/pass_secret_service$'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,7 @@
|
||||||
|
|
||||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
pass-secret-service-default-configuration = ./default-configuration.nix;
|
pass-secret-service-default-configuration = ./default-configuration.nix;
|
||||||
|
pass-secret-service-old-default-path = ./old-default-path.nix;
|
||||||
|
pass-secret-service-nondefault-path = ./nondefault-path.nix;
|
||||||
pass-secret-service-basic-configuration = ./basic-configuration.nix;
|
pass-secret-service-basic-configuration = ./basic-configuration.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{ config, ... }:
|
||||||
|
let
|
||||||
|
somePath = "/some/random/path/I/store/pwds";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.stateVersion = "25.11";
|
||||||
|
programs.password-store = {
|
||||||
|
enable = true;
|
||||||
|
settings.PASSWORD_STORE_DIR = somePath;
|
||||||
|
};
|
||||||
|
services.pass-secret-service = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContains home-files/.config/systemd/user/pass-secret-service.service \
|
||||||
|
'ExecStart=${config.services.pass-secret-service.package}/bin/pass_secret_service --path ${somePath}'
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
home.stateVersion = "25.05"; # <= 25.11
|
||||||
|
programs.password-store.enable = true;
|
||||||
|
services.pass-secret-service = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
serviceFile=home-files/.config/systemd/user/pass-secret-service.service
|
||||||
|
|
||||||
|
assertFileExists $serviceFile
|
||||||
|
assertFileRegex $serviceFile '^ExecStart=.*/bin/pass_secret_service --path ${config.xdg.dataHome}/password-store$'
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue