-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
140 lines (128 loc) · 4.82 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{
description = "A Nix flake for AutoFirma and related Spanish e-signature tools.";
nixConfig = {
extra-substituters = [
"https://autofirma-nix.cachix.org"
];
extra-trusted-public-keys = [
"autofirma-nix.cachix.org-1:cDC9Dtee+HJ7QZcM8s36836scXyRToqNX/T+yvjiI0E="
];
};
# Common inputs
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
# Autofirma sources
inputs = {
jmulticard-src = {
url = "github:ctt-gob-es/jmulticard/v1.8";
flake = false;
};
clienteafirma-external-src = {
url = "github:ctt-gob-es/clienteafirma-external/OT_14395";
flake = false;
};
autofirma-src = {
url = "github:ctt-gob-es/clienteafirma/v1.8.3";
flake = false;
};
};
outputs = inputs @ {
self,
flake-parts,
nixpkgs,
jmulticard-src,
clienteafirma-external-src,
autofirma-src,
}:
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {
homeManagerModules = rec {
autofirma = import ./nix/autofirma/hm-module.nix inputs;
dnieremote = import ./nix/dnieremote/hm-module.nix inputs;
configuradorfnmt = import ./nix/configuradorfnmt/hm-module.nix inputs;
default = {
imports = [
autofirma
dnieremote
configuradorfnmt
];
};
};
nixosModules = rec {
autofirma = import ./nix/autofirma/module.nix inputs;
dnieremote = import ./nix/dnieremote/module.nix inputs;
configuradorfnmt = import ./nix/configuradorfnmt/module.nix inputs;
default = {
imports = [
autofirma
dnieremote
configuradorfnmt
];
};
};
packages.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
ignoreVulnerable_openssl_1_1 = pkgs.openssl_1_1.overrideAttrs (oldAttrs: rec {
meta = (oldAttrs.meta or {}) // {knownVulnerabilities = [];};
});
in {
dnieremote = pkgs.callPackage ./nix/dnieremote/default.nix {openssl_1_1 = ignoreVulnerable_openssl_1_1;};
configuradorfnmt = pkgs.callPackage ./nix/configuradorfnmt/default.nix {};
};
};
systems = [
"x86_64-linux"
"i686-linux"
];
perSystem = {
config,
system,
self',
...
}: let
pkgs = nixpkgs.legacyPackages.${system};
in {
formatter = pkgs.alejandra;
packages = let
prestadores = pkgs.callPackage ./nix/autofirma/truststore/prestadores {};
pom-tools = pkgs.callPackage ./nix/tools/pom-tools {};
jmulticard = pkgs.callPackage ./nix/autofirma/dependencies/jmulticard {
inherit pom-tools;
src = jmulticard-src;
maven-dependencies-hash = "sha256-qI6gYbGKTQ4Q4tV8NI37TSd3eQTyHHgndUGS943UvNU=";
};
clienteafirma-external = pkgs.callPackage ./nix/autofirma/dependencies/clienteafirma-external {
inherit pom-tools;
src = clienteafirma-external-src;
maven-dependencies-hash = "sha256-N2lFeRM/eu/tMFTCQRYSHYrbXNgbAv49S7qTaUmb2+Q=";
};
in rec {
autofirma-truststore = pkgs.callPackage ./nix/autofirma/truststore {
caBundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
govTrustedCerts = prestadores;
};
download-autofirma-trusted-providers = pkgs.callPackage ./nix/tools/download-autofirma-trusted-providers {};
download-url-linked-CAs = pkgs.callPackage ./nix/tools/download-url-linked-CAs {};
autofirma = pkgs.callPackage ./nix/autofirma/default.nix {
inherit jmulticard clienteafirma-external pom-tools autofirma-truststore;
src = autofirma-src;
maven-dependencies-hash = "sha256-zPWjBu1YtN0U9+wy/WG0NWg1EsO3MD0nhnkUsV7h6Ew=";
};
default = self'.packages.autofirma;
};
checks = {
# autofirma-sign = pkgs.runCommand "autofirma-sign" {} ''
# mkdir -p $out
# echo "NixOS AutoFirma Sign Test" > document.txt
#
# ${inputs.nixpkgs.lib.getExe pkgs.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
# ${inputs.nixpkgs.lib.getExe pkgs.openssl} pkcs12 -export -out certificate.p12 -inkey private.key -in certificate.crt -name "testcert" -password pass:1234
#
# ${inputs.nixpkgs.lib.getExe self'.packages.autofirma} sign -store pkcs12:certificate.p12 -i document.txt -o document.txt.sign -filter alias.contains=testcert -password 1234 -xml
# '';
};
};
};
}