Commit 4dfa4a34ad13
Changed files (2)
imperative
aomi
imperative/aomi/bootstrap.sh
@@ -5,7 +5,7 @@
#
# Prerequisites: Fedora CSB installed, user has sudo access
# Usage: ./bootstrap.sh
-# Or remotely: ssh vincent@aomi.home 'bash -s' < imperative/aomi/bootstrap.sh
+# Or remotely: ssh vdemeest@aomi.home 'bash -s' < imperative/aomi/bootstrap.sh
set -euo pipefail
@@ -216,7 +216,7 @@ setup_home_manager() {
cd "$REPO_PATH"
# Build and activate home-manager
- nix run home-manager -- switch --flake ".#vincent@${SYSTEM_CONFIG}"
+ nix run home-manager -- switch --flake ".#vdemeest@${SYSTEM_CONFIG}"
log_info "Home-manager activated!"
}
@@ -268,7 +268,7 @@ print_summary() {
log_info "║ nix build .#systemConfigs.aomi ║"
log_info "║ sudo ./result/bin/activate ║"
log_info "║ Rebuild home: ║"
- log_info "║ home-manager switch --flake .#vincent@aomi ║"
+ log_info "║ home-manager switch --flake .#vdemeest@aomi ║"
log_info "╚══════════════════════════════════════════╝"
}
flake.nix
@@ -54,8 +54,8 @@
# FIXME set this up
homeConfigurations = {
# Fedora CSB workstation
- "vincent@aomi" = libx.mkHome {
- username = "vincent";
+ "vdemeest@aomi" = libx.mkHome {
+ username = "vdemeest";
hostname = "aomi";
};
# headless machine
@@ -215,6 +215,57 @@
);
in
lib.listToAttrs (map (n: lib.nameValuePair n pkgs.${n}) drvAttrs)
+ // {
+ dns-zones =
+ let
+ globals = import ./globals.nix { };
+ dns = inputs.dns;
+ mkZoneFile =
+ zoneName: zoneFile:
+ pkgs.writeText "db.${zoneName}" (
+ dns.lib.toString zoneName (import zoneFile { inherit dns globals; })
+ );
+ in
+ pkgs.runCommand "dns-zones" { } ''
+ mkdir -p $out
+ cp ${mkZoneFile "sbr.pm" ./systems/common/services/dns/sbr.pm.nix} $out/db.sbr.pm
+ cp ${mkZoneFile "home" ./systems/common/services/dns/home.nix} $out/db.home
+ cp ${mkZoneFile "vpn" ./systems/common/services/dns/vpn.nix} $out/db.vpn
+ cp ${mkZoneFile "demeester.fr" ./systems/common/services/dns/demeester.fr.nix} $out/db.demeester.fr
+ cp ${mkZoneFile "192.168.1.in-addr.arpa" ./systems/common/services/dns/192.168.1.nix} $out/db.192.168.1
+ cp ${mkZoneFile "10.100.0.in-addr.arpa" ./systems/common/services/dns/10.100.0.nix} $out/db.10.100.0
+ '';
+
+ wg-configs =
+ let
+ globals = import ./globals.nix { };
+ serverPubkey = globals.machines.carthage.net.vpn.pubkey;
+ endpoint = globals.net.vpn.endpoint;
+ mkWgConfig =
+ hostname:
+ let
+ machine = globals.machines.${hostname};
+ vpnIp = builtins.head machine.net.vpn.ips;
+ in
+ pkgs.writeText "wg0-${hostname}.conf" ''
+ [Interface]
+ Address = ${vpnIp}/32
+ PostUp = test -f /persist/wireguard/private.key && wg set %%i private-key /persist/wireguard/private.key || true
+
+ [Peer]
+ PublicKey = ${serverPubkey}
+ Endpoint = ${endpoint}:51820
+ AllowedIPs = 10.100.0.0/24
+ PersistentKeepalive = 25
+ '';
+ in
+ pkgs.runCommand "wg-configs" { } ''
+ mkdir -p $out
+ cp ${mkWgConfig "athena"} $out/wg0-athena.conf
+ cp ${mkWgConfig "demeter"} $out/wg0-demeter.conf
+ cp ${mkWgConfig "aix"} $out/wg0-aix.conf
+ '';
+ }
);
checks = forAllSystems (system: {