Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: flake overlay #107

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
systems = [
"x86_64-linux"
];
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
perSystem = {
config,
system,
Expand Down Expand Up @@ -116,6 +119,9 @@

in {
formatter = pkgs.alejandra;
overlayAttrs = {
inherit (config.packages) autofirma; # configuradorfnmt dnieremote are specific to x86_64-linux
};
devShells.default = let
update-fixed-output-derivations = pkgs.callPackage ./nix/tools/update-fixed-output-derivations {};
download-autofirma-trusted-providers = pkgs.callPackage ./nix/tools/download-autofirma-trusted-providers {};
Expand Down Expand Up @@ -216,6 +222,9 @@
hm-standalone-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-no.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/wifiport.nix { inherit self home-manager; };

# Overlay
overlay = pkgs.callPackage ./nix/tests/overlay { inherit self; };

};
in
checks // packages;
Expand Down
32 changes: 32 additions & 0 deletions nix/tests/overlay/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ self, pkgs, lib }:
let
openssl = lib.getExe pkgs.openssl;
in

pkgs.nixosTest {
name = "test-overlay";
nodes.machine = { config, pkgs, modulesPath, ... }: let
pkgs' = pkgs.extend self.overlays.default;
in {
imports = [
(modulesPath + "./../tests/common/x11.nix")
../_common/nixos/stateVersion.nix
];

environment.systemPackages = with pkgs'; [
autofirma
];

};

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