Manage data-access container declaratively
This commit is contained in:
parent
45761cb113
commit
565ee07812
8 changed files with 72 additions and 6 deletions
23
containers/data-access/config.nix
Normal file
23
containers/data-access/config.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ pkgs, ... }: {
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./config.secret.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.data = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = "/home/data";
|
||||||
|
description = "Data Access";
|
||||||
|
uid = 1000;
|
||||||
|
group = "users";
|
||||||
|
};
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
passwordAuthentication = false;
|
||||||
|
permitRootLogin = "no";
|
||||||
|
hostKeys = [
|
||||||
|
{ bits = 4096; path = "/var/secrets/ssh_host_rsa_key"; type = "rsa"; }
|
||||||
|
{ path = "/var/secrets/ssh_host_ed25519_key"; type = "ed25519"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
BIN
containers/data-access/config.secret.nix
Normal file
BIN
containers/data-access/config.secret.nix
Normal file
Binary file not shown.
30
containers/data-access/default.nix
Normal file
30
containers/data-access/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./secret.nix ];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
chvp.hasContainers = true;
|
||||||
|
|
||||||
|
containers.data-access = {
|
||||||
|
ephemeral = true;
|
||||||
|
autoStart = true;
|
||||||
|
bindMounts = {
|
||||||
|
"/home/data/data" = {
|
||||||
|
hostPath = "/srv/data";
|
||||||
|
isReadOnly = false;
|
||||||
|
};
|
||||||
|
"/var/secrets" = {
|
||||||
|
hostPath = "${config.chvp.dataPrefix}/var/secrets/data-access";
|
||||||
|
isReadOnly = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
privateNetwork = true;
|
||||||
|
hostAddress = "192.168.100.10";
|
||||||
|
hostAddress6 = "fc00::1";
|
||||||
|
localAddress = "192.168.100.11";
|
||||||
|
localAddress6 = "fc00::2";
|
||||||
|
config = import ./config.nix;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
BIN
containers/data-access/secret.nix
Normal file
BIN
containers/data-access/secret.nix
Normal file
Binary file not shown.
6
flake.lock
generated
6
flake.lock
generated
|
@ -23,11 +23,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1608506894,
|
"lastModified": 1608593447,
|
||||||
"narHash": "sha256-G2TNqzJunVXcC2sQEvtLOUs5QpI6f2y4Ben//HLQkh8=",
|
"narHash": "sha256-kPpoSldJMLKS8hdhxj4rnsRZb4f8ZzaiQFjYTuZm4mU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "2b1892e646f2e48591c53b3293622720e1a3bdca",
|
"rev": "2901044520fbed466eea8b91df55183297eacd47",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./secret.nix
|
./secret.nix
|
||||||
|
../../containers/data-access
|
||||||
];
|
];
|
||||||
|
|
||||||
time.timeZone = "Europe/Berlin";
|
time.timeZone = "Europe/Berlin";
|
||||||
|
|
Binary file not shown.
|
@ -40,6 +40,11 @@
|
||||||
default = false;
|
default = false;
|
||||||
example = true;
|
example = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hasContainers = lib.mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -61,6 +66,11 @@
|
||||||
ripgrep
|
ripgrep
|
||||||
];
|
];
|
||||||
|
|
||||||
|
console = {
|
||||||
|
font = "Lat2-Terminus16";
|
||||||
|
keyMap = "us";
|
||||||
|
};
|
||||||
|
|
||||||
i18n = {
|
i18n = {
|
||||||
defaultLocale = "en_IE.UTF-8";
|
defaultLocale = "en_IE.UTF-8";
|
||||||
extraLocaleSettings = {
|
extraLocaleSettings = {
|
||||||
|
@ -68,9 +78,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
console = {
|
networking.nat = lib.mkIf config.chvp.hasContainers {
|
||||||
font = "Lat2-Terminus16";
|
enable = true;
|
||||||
keyMap = "us";
|
enableIPv6 = true;
|
||||||
|
internalInterfaces = [ "ve-+" ];
|
||||||
|
externalInterface = "eno3";
|
||||||
};
|
};
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue