Skip to content

Commit

Permalink
feat: flake overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
nilp0inter committed Jan 30, 2025
1 parent 1027ff8 commit 6f0b557
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
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')
'';
}

0 comments on commit 6f0b557

Please sign in to comment.