From 6620a988cd659d3ed16a81f321ee94270a1948bc Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Sat, 9 Jun 2018 02:41:51 +0200 Subject: [PATCH] Add git and borg containers --- hosts/hera/borg.nix | 26 ++++++++++++++++++++++++++ hosts/hera/git.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 hosts/hera/borg.nix create mode 100644 hosts/hera/git.nix diff --git a/hosts/hera/borg.nix b/hosts/hera/borg.nix new file mode 100644 index 00000000..3935a90c --- /dev/null +++ b/hosts/hera/borg.nix @@ -0,0 +1,26 @@ +{ config, ... }: +let + me = config.m-0.private.me; +in { + containers.borg = { + autoStart = true; + privateNetwork = true; + hostBridge = "bridge"; + config = { pkgs, ... }: { + imports = [../../system]; + + networking = { + interfaces.eth0 = { + ipv6.addresses = [{ address = config.m-0.hosts.borg; prefixLength = 64; }]; + }; + inherit (config.networking) nameservers; + defaultGateway6 = { address = config.m-0.hosts.hera-intern; interface = "eth0"; }; + }; + + services.borgbackup.repos.backups = { + authorizedKeys = me.keys; + quota = "150G"; + }; + }; + }; +} diff --git a/hosts/hera/git.nix b/hosts/hera/git.nix new file mode 100644 index 00000000..2abac84c --- /dev/null +++ b/hosts/hera/git.nix @@ -0,0 +1,35 @@ +{ config, ... }: +let + me = config.m-0.private.me; +in { + containers.git = { + autoStart = true; + privateNetwork = true; + bindMounts = { + "/home/git" = { hostPath = "/home/maralorn/data/git"; isReadOnly = false; }; + }; + hostBridge = "bridge"; + config = { pkgs, ... }: { + imports = [../../system]; + + users.users.git = { + isNormalUser = true; + uid = 1000; + openssh.authorizedKeys.keys = me.keys; + }; + networking = { + interfaces.eth0 = { + ipv6.addresses = [{ address = config.m-0.hosts.git; prefixLength = 64; }]; + }; + inherit (config.networking) nameservers; + defaultGateway6 = { address = config.m-0.hosts.hera-intern; interface = "eth0"; }; + }; + + environment.systemPackages = [ pkgs.git ]; + + services = { + sshd.enable = true; + }; + }; + }; +}