-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: autofirma sign test. Closes #37
- Loading branch information
1 parent
146bce2
commit 98eb8f8
Showing
2 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ self, pkgs, lib }: | ||
let | ||
openssl = lib.getExe pkgs.openssl; | ||
in | ||
|
||
pkgs.nixosTest { | ||
name = "test-nixos-module-sign"; | ||
nodes.machine = { config, pkgs, modulesPath, ... }: { | ||
imports = [ | ||
self.nixosModules.autofirma | ||
(modulesPath + "./../tests/common/x11.nix") | ||
]; | ||
|
||
programs.autofirma.enable = true; | ||
|
||
system.stateVersion = "${lib.versions.major lib.version}.${lib.versions.minor lib.version}"; | ||
}; | ||
|
||
testScript = '' | ||
machine.succeed('echo "NixOS AutoFirma Sign Test" > document.txt') | ||
machine.succeed('${openssl} req -x509 -newkey rsa:2048 -keyout private.key -out certificate.crt -days 365 -nodes -subj "/C=ES/O=TEST AUTOFIRMA NIX/OU=DNIE/CN=AC DNIE 004" -passout pass:1234') | ||
machine.succeed('${openssl} pkcs12 -export -out certificate.p12 -inkey private.key -in certificate.crt -name "testcert" -password pass:1234') | ||
machine.wait_for_x() | ||
machine.succeed('autofirma sign -store pkcs12:certificate.p12 -i document.txt -o document.txt.sign -filter alias.contains=testcert -password 1234 -xml') | ||
''; | ||
} |