add build03 nixos configuration

This commit is contained in:
Jörg Thalheim 2021-03-06 08:27:39 +01:00
parent 11ee3fee98
commit 4d1ba7f0d3
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4
4 changed files with 132 additions and 0 deletions

39
build03/configuration.nix Normal file
View file

@ -0,0 +1,39 @@
{ config, pkgs, lib, ... }:
{
# Boot recovery:
# Activate 64-bit Rescue system in https://robot.your-server.de/server
# ssh root@build03.nix-community.org "mount /dev/md0 /mnt && /mnt/kexec_bundle"
#
# In kexec image:
# zpool import -f zroot && mount -t zfs zroot/root/nixos /mnt && mount -t zfs zroot/root/home /mnt/home && mount /dev/md0 /mnt/boot
# nixos-enter
imports = [
./hardware-configuration.nix
../profiles/common.nix
../profiles/hetzner-network.nix
];
# /boot is a mirror raid
boot.loader.grub.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.extraConfig = ''
# for mdraid 1.1
insmod mdraid1x
'';
networking.nix-community = {
ipv4.address = "135.181.218.169";
ipv4.gateway = "135.181.218.129";
ipv6.address = "2a01:4f9:3a:3b16::1";
};
networking.hostName = "nix-community-build03";
networking.hostId = "8daf74c0";
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.supportedFilesystems = [ "zfs" ];
system.stateVersion = "21.05";
}

View file

@ -0,0 +1,33 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "zroot/root/nixos";
fsType = "zfs";
};
fileSystems."/home" =
{ device = "zroot/root/home";
fsType = "zfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/0d4f251e-2d79-4769-85a3-4c56e757d545";
fsType = "ext4";
};
swapDevices = [ ];
}

View file

@ -155,4 +155,13 @@ in
};
build03 =
{ resources, ... }:
{
imports = [
./build03/configuration.nix
];
deployment.targetHost = "build03.nix-community.org";
};
}

View file

@ -0,0 +1,51 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.networking.nix-community;
in {
options = {
networking.nix-community.ipv4.address = mkOption {
type = types.str;
};
networking.nix-community.ipv4.cidr = mkOption {
type = types.str;
default = "26";
};
networking.nix-community.ipv4.gateway = mkOption {
type = types.str;
};
networking.nix-community.ipv6.address = mkOption {
type = types.str;
};
networking.nix-community.ipv6.cidr = mkOption {
type = types.str;
default = "64";
};
networking.nix-community.ipv6.gateway = mkOption {
type = types.str;
default = "fe80::1";
};
};
config = {
networking.usePredictableInterfaceNames = false;
networking.dhcpcd.enable = false;
systemd.network = {
enable = true;
networks."eth0".extraConfig = ''
[Match]
Name = eth0
[Network]
Address = ${cfg.ipv6.address}/${cfg.ipv6.cidr}
Gateway = ${cfg.ipv6.gateway}
Address = ${cfg.ipv4.address}/${cfg.ipv4.cidr}
Gateway = ${cfg.ipv4.gateway}
'';
};
};
}