2015-09-14 17:38:59 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
configuration = { config, pkgs, ... }: {
|
|
|
|
imports = [ ./configuration.nix ];
|
|
|
|
|
|
|
|
users.extraUsers.gebner.password = "";
|
|
|
|
users.users.root.password = "";
|
2015-10-18 12:25:54 +00:00
|
|
|
|
|
|
|
boot.enableContainers = true;
|
|
|
|
|
|
|
|
systemd.services.createSSLKeys = {
|
|
|
|
path = [ pkgs.easyrsa ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = "yes";
|
|
|
|
};
|
|
|
|
script = ''
|
|
|
|
rm -rf /etc/sslcerts
|
2016-04-24 14:44:51 +00:00
|
|
|
mkdir -p /etc/sslcerts
|
2015-10-18 12:25:54 +00:00
|
|
|
cd /etc/sslcerts
|
|
|
|
|
2016-04-24 14:44:51 +00:00
|
|
|
easyrsa-init
|
|
|
|
easyrsa init-pki
|
|
|
|
easyrsa --batch --req-cn=testing.gebner.org build-ca nopass
|
|
|
|
easyrsa --req-cn=gebner.org build-server-full gebner_org nopass
|
2015-10-18 12:25:54 +00:00
|
|
|
|
2016-04-24 14:44:51 +00:00
|
|
|
cat pki/issued/gebner_org.crt pki/ca.crt >fullchain.pem
|
|
|
|
cp pki/private/gebner_org.key key.pem
|
2015-12-05 13:14:55 +00:00
|
|
|
cp key.pem key-dovecot.pem && chown dovecot2 key-dovecot.pem
|
2015-10-18 12:25:54 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.setupVM = rec {
|
2016-04-24 14:44:51 +00:00
|
|
|
wantedBy = [ "gogs.service" "dovecot2.service" "nginx.service" ];
|
2015-10-18 12:25:54 +00:00
|
|
|
before = wantedBy;
|
|
|
|
wants = [ "createSSLKeys.service" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = "yes";
|
|
|
|
};
|
|
|
|
script = ''
|
|
|
|
mkdir -p /srv/git.gebner.org
|
|
|
|
chown git:git -R /srv/git.gebner.org
|
|
|
|
'';
|
|
|
|
};
|
2016-05-31 09:22:48 +00:00
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [ elinks ];
|
2015-09-14 17:38:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nixos = import <nixpkgs/nixos> { configuration = configuration; };
|
|
|
|
|
2015-10-18 12:25:54 +00:00
|
|
|
in nixos.vm
|