Force ca derivation sha change when new ca is generated.

This commit is contained in:
Jonas Juselius
2018-05-24 14:50:59 +02:00
parent 490dd3edd3
commit 4ac3287a34
5 changed files with 52 additions and 40 deletions

View File

@@ -1,2 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
nix-instantiate --add-root `pwd`/gcroots/certs --indirect -E "import ./certs.nix" # nix-store --add-root `pwd`/gcroots/initca --indirect -r $(nix-instantiate ./initca.nix)
nix-build -o gcroots/initca ./initca.nix

View File

@@ -58,7 +58,7 @@ in
]; ];
services.dnsmasq.enable = true; services.dnsmasq.enable = true;
fileSystems."/data" = { fileSystems."/data" = {
device = "k0-0:gv0"; device = "fs0-0:gv0";
fsType = "glusterfs"; fsType = "glusterfs";
}; };
environment.systemPackages = [ pkgs.lvm2 ]; environment.systemPackages = [ pkgs.lvm2 ];

View File

@@ -45,13 +45,24 @@
hosts = ""; hosts = "";
}; };
in in
pkgs.runCommand "ca" { pkgs.runCommand "initca" {
buildInputs = [ pkgs.cfssl ]; buildInputs = [ pkgs.cfssl ];
} '' cfssl genkey -initca ${ca_csr} | cfssljson -bare ca; \ } '' cfssl genkey -initca ${ca_csr} | cfssljson -bare ca; \
mkdir -p $out; cp *.pem $out''; mkdir -p $out; cp *.pem $out'';
# make ca derivation sha depend on initca cfssl output
initca' = pkgs.stdenv.mkDerivation {
name = "ca";
src = initca;
buildCommand = ''
mkdir -p $out;
cp -r $src/* $out
'';
};
ca = { ca = {
key = "${initca}/ca-key.pem"; key = "${initca'}/ca-key.pem";
cert = "${initca}/ca.pem"; cert = "${initca'}/ca.pem";
}; };
cfssl = conf: '' cfssl = conf: ''

View File

@@ -23,7 +23,7 @@
services.vmwareGuest.enable = true; services.vmwareGuest.enable = true;
# The NixOS release to be compatible with for stateful data such as databases. # The NixOS release to be compatible with for stateful data such as databases.
system.nixos.stateVersion = "18.03"; system.nixos.stateVersion = "18.09";
programs.fish.enable = true; programs.fish.enable = true;
programs.tmux.enable = true; programs.tmux.enable = true;