Compare commits
16 commits
9893c5f059
...
18a376e8dd
Author | SHA1 | Date | |
---|---|---|---|
18a376e8dd | |||
3179d90463 | |||
540275e71c | |||
abdf08be6f | |||
a9f7c368d2 | |||
6de09da138 | |||
ec16ec8681 | |||
31593dd0ad | |||
9472794b97 | |||
f7a16924f3 | |||
805887590c | |||
3c950b278f | |||
63002031d6 | |||
c7f89489da | |||
9ed7d26952 | |||
0961e81a9f |
22 changed files with 114 additions and 43 deletions
|
@ -2,9 +2,9 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
options.out.injectNixosConfig = mkOption {
|
options.out = mkOption {
|
||||||
description = "NixOS configuration to inject into the given host.";
|
description = "Output functions.";
|
||||||
type = with types; functionTo raw;
|
type = with types; lazyAttrsOf (functionTo raw);
|
||||||
default = const [];
|
default = const [];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,11 @@ in
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.out.injectNixosConfig = hostName: (lib.flatten (lib.mapAttrsToList (getHostConfigurations hostName) config.services)) ++ [
|
config.out = {
|
||||||
introspectionModule
|
injectNixosConfigForServices = services: hostName: (lib.flatten (lib.mapAttrsToList (getHostConfigurations hostName) (lib.getAttrs services config.services))) ++ [
|
||||||
];
|
introspectionModule
|
||||||
|
];
|
||||||
|
|
||||||
|
injectNixosConfig = config.out.injectNixosConfigForServices (lib.attrNames config.services);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{ depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
services.bitwarden = {
|
||||||
|
nodes.host = [ "VEGAS" ];
|
||||||
|
nixos.host = ./host.nix;
|
||||||
|
};
|
||||||
|
|
||||||
dns.records.keychain.target = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
dns.records.keychain.target = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
{ depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
services.fbi = {
|
||||||
|
nodes.host = [ "VEGAS" ];
|
||||||
|
nixos.host = ./host.nix;
|
||||||
|
};
|
||||||
|
|
||||||
dns.records = let
|
dns.records = let
|
||||||
fbiAddr = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
fbiAddr = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
||||||
in {
|
in {
|
||||||
|
|
22
cluster/services/frangiclave/default.nix
Normal file
22
cluster/services/frangiclave/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.frangiclave = {
|
||||||
|
nodes = {
|
||||||
|
server = [ "VEGAS" "grail" "prophet" ];
|
||||||
|
cluster = config.services.frangiclave.nodes.server;
|
||||||
|
agent = []; # all nodes, for vault-agent, secret templates, etc.
|
||||||
|
};
|
||||||
|
meshLinks = {
|
||||||
|
server.link.protocol = "http";
|
||||||
|
cluster.link.protocol = "http";
|
||||||
|
};
|
||||||
|
nixos = {
|
||||||
|
server = [
|
||||||
|
./server.nix
|
||||||
|
];
|
||||||
|
cluster = [];
|
||||||
|
agent = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
23
cluster/services/frangiclave/server.nix
Normal file
23
cluster/services/frangiclave/server.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ cluster, config, depot, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
apiLink = cluster.config.hostLinks.${config.networking.hostName}.frangiclave-server;
|
||||||
|
clusterLink = cluster.config.hostLinks.${config.networking.hostName}.frangiclave-cluster;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
services.vault = {
|
||||||
|
enable = true;
|
||||||
|
package = depot.packages.openbao;
|
||||||
|
address = apiLink.tuple;
|
||||||
|
extraConfig = /*hcl*/ ''
|
||||||
|
api_addr = "${apiLink.url}"
|
||||||
|
cluster_addr = "${clusterLink.url}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
storageBackend = "raft";
|
||||||
|
storageConfig = /*hcl*/ ''
|
||||||
|
node_id = "x${builtins.hashString "sha256" "frangiclave-node-${config.networking.hostName}"}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,5 +1,10 @@
|
||||||
{ depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
services.gitlab = {
|
||||||
|
nodes.host = [ "VEGAS" ];
|
||||||
|
nixos.host = ./host.nix;
|
||||||
|
};
|
||||||
|
|
||||||
dns.records.git.target = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
dns.records.git.target = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{ depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
services.reflex = {
|
||||||
|
nodes.host = [ "VEGAS" ];
|
||||||
|
nixos.host = ./host.nix;
|
||||||
|
};
|
||||||
|
|
||||||
dns.records.reflex.target = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
dns.records.reflex.target = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
{ depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
services.soda = {
|
||||||
|
nodes.host = [ "VEGAS" ];
|
||||||
|
nixos.host = ./host.nix;
|
||||||
|
};
|
||||||
|
|
||||||
monitoring.blackbox.targets.soda-machine = {
|
monitoring.blackbox.targets.soda-machine = {
|
||||||
address = "soda.int.${depot.lib.meta.domain}:22";
|
address = "soda.int.${depot.lib.meta.domain}:22";
|
||||||
module = "sshConnect";
|
module = "sshConnect";
|
||||||
|
|
26
cluster/services/soda/host.nix
Normal file
26
cluster/services/soda/host.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ depot, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
containers.soda = {
|
||||||
|
path = depot.nixosConfigurations.soda.config.system.build.toplevel;
|
||||||
|
privateNetwork = true;
|
||||||
|
hostBridge = "vmdefault";
|
||||||
|
localAddress = "${depot.hours.soda.interfaces.primary.addr}/24";
|
||||||
|
autoStart = true;
|
||||||
|
bindMounts.sodaDir = {
|
||||||
|
hostPath = "/srv/storage/www/soda";
|
||||||
|
mountPoint = "/soda";
|
||||||
|
isReadOnly = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."container@soda".after = [ "libvirtd.service" "sys-devices-virtual-net-vmdefault.device" ];
|
||||||
|
|
||||||
|
networking.nat.forwardPorts = [
|
||||||
|
{
|
||||||
|
sourcePort = 52222;
|
||||||
|
destination = "${depot.hours.soda.interfaces.primary.addr}:22";
|
||||||
|
proto = "tcp";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,6 +1,11 @@
|
||||||
{ depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
services.sso = {
|
||||||
|
nodes.host = [ "VEGAS" ];
|
||||||
|
nixos.host = ./host.nix;
|
||||||
|
};
|
||||||
|
|
||||||
dns.records = let
|
dns.records = let
|
||||||
ssoAddr = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
ssoAddr = [ depot.hours.VEGAS.interfaces.primary.addrPublic ];
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -3,10 +3,6 @@ let
|
||||||
inherit (config.reflection) interfaces;
|
inherit (config.reflection) interfaces;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
|
||||||
./port-forward.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
networking.nat = {
|
networking.nat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
externalInterface = interfaces.primary.link;
|
externalInterface = interfaces.primary.link;
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
{ depot, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.nat.forwardPorts = [
|
|
||||||
{
|
|
||||||
sourcePort = 52222;
|
|
||||||
destination = "${depot.hours.soda.interfaces.primary.addr}:22";
|
|
||||||
proto = "tcp";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -16,15 +16,10 @@
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
./services/backbone-routing
|
./services/backbone-routing
|
||||||
./services/bitwarden
|
|
||||||
./services/cdn-shield
|
./services/cdn-shield
|
||||||
./services/fbi
|
|
||||||
./services/gitlab
|
|
||||||
./services/jokes
|
./services/jokes
|
||||||
./services/mail
|
./services/mail
|
||||||
./services/minecraft
|
./services/minecraft
|
||||||
./services/reflex
|
|
||||||
./services/sso
|
|
||||||
./services/websites
|
./services/websites
|
||||||
./services/wireguard-server
|
./services/wireguard-server
|
||||||
depot.nixosModules.hyprspace
|
depot.nixosModules.hyprspace
|
||||||
|
@ -90,18 +85,4 @@
|
||||||
|
|
||||||
system.stateVersion = "21.05";
|
system.stateVersion = "21.05";
|
||||||
services.openssh.settings.PasswordAuthentication = false;
|
services.openssh.settings.PasswordAuthentication = false;
|
||||||
|
|
||||||
containers.soda = {
|
|
||||||
path = depot.nixosConfigurations.soda.config.system.build.toplevel;
|
|
||||||
privateNetwork = true;
|
|
||||||
hostBridge = "vmdefault";
|
|
||||||
localAddress = "${depot.hours.soda.interfaces.primary.addr}/24";
|
|
||||||
autoStart = true;
|
|
||||||
bindMounts.sodaDir = {
|
|
||||||
hostPath = "/srv/storage/www/soda";
|
|
||||||
mountPoint = "/soda";
|
|
||||||
isReadOnly = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
systemd.services."container@soda".after = [ "libvirtd.service" "sys-devices-virtual-net-vmdefault.device" ];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ testers.runNixOSTest {
|
||||||
specialArgs.depot.hours.${node}.nixos
|
specialArgs.depot.hours.${node}.nixos
|
||||||
./modules/nixos/age-dummy-secrets
|
./modules/nixos/age-dummy-secrets
|
||||||
./modules/nixos/external-storage.nix
|
./modules/nixos/external-storage.nix
|
||||||
] ++ depot'.config.cluster.config.out.injectNixosConfig node;
|
] ++ depot'.config.cluster.config.out.injectNixosConfigForServices [ "consul" "certificates" "nginx" "wireguard" "frangiclave" ] node;
|
||||||
|
|
||||||
boot.kernel.sysctl."net.ipv4.ip_forward" = "1";
|
boot.kernel.sysctl."net.ipv4.ip_forward" = "1";
|
||||||
networking = {
|
networking = {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
packages.stop-using-nix-env = let
|
packages.stop-using-nix-env = let
|
||||||
site = with pkgs; stdenvNoCC.mkDerivation rec {
|
site = with pkgs; stdenvNoCC.mkDerivation rec {
|
||||||
pname = "stop-using-nix-env";
|
pname = "stop-using-nix-env";
|
||||||
version = "1.2.0";
|
version = "1.2.1";
|
||||||
src = ./src;
|
src = ./src;
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
install -Dm644 $src/* -t $out/share/www/${pname}
|
install -Dm644 $src/* -t $out/share/www/${pname}
|
||||||
|
|
|
@ -218,7 +218,7 @@
|
||||||
Do you often run into a situation where you need a particular command
|
Do you often run into a situation where you need a particular command
|
||||||
for a one-off thing, but don't feel like it should reside on your system
|
for a one-off thing, but don't feel like it should reside on your system
|
||||||
at all times?
|
at all times?
|
||||||
<a href="https://nixos.org/guides/ad-hoc-developer-environments.html">Ephemeral shells</a>
|
<a href="https://nix.dev/tutorials/first-steps/ad-hoc-shell-environments.html">Ephemeral shells</a>
|
||||||
allow you to <i>gain temporary access</i> to a command and after you exit
|
allow you to <i>gain temporary access</i> to a command and after you exit
|
||||||
out of the shell, it's as if the package was never installed.
|
out of the shell, it's as if the package was never installed.
|
||||||
If you're using Flakes,
|
If you're using Flakes,
|
||||||
|
|
Loading…
Add table
Reference in a new issue