Compare commits
9 commits
4efb3f26fe
...
5d68fbf0a1
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d68fbf0a1 | |||
| 5cd943d3e5 | |||
| e72b9a144a | |||
| 2e3fc206f4 | |||
| c3e19aae29 | |||
| f5659c14d8 | |||
| 3dcd186132 | |||
| 5b6e05ebf6 | |||
| 227b4c5fd4 |
6 changed files with 95 additions and 34 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
{
|
{
|
||||||
networking.hostName = "hyp-01";
|
networking.hostName = "hyp-01";
|
||||||
networking.hostId = "ae2c05d3";
|
networking.hostId = "ae2c05d3";
|
||||||
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,5 @@
|
||||||
boot.loader.systemd-boot.enable = false;
|
boot.loader.systemd-boot.enable = false;
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
efiSupport = false;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,60 +9,82 @@ in
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = disk1;
|
device = disk1;
|
||||||
content = {
|
content = {
|
||||||
type = "table";
|
type = "gpt";
|
||||||
format = "mbr";
|
efiGptPartitionFirst = false;
|
||||||
partitions = [
|
partitions = {
|
||||||
{
|
boot = {
|
||||||
name = "boot-primary";
|
priority = 1;
|
||||||
size = "1G";
|
|
||||||
bootable = true;
|
|
||||||
type = "EF02";
|
type = "EF02";
|
||||||
|
size = "32M";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = null;
|
||||||
|
};
|
||||||
|
hybrid = {
|
||||||
|
mbrPartitionType = "0x0c";
|
||||||
|
mbrBootableFlag = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
esp = {
|
||||||
|
size = "1G";
|
||||||
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "vfat";
|
format = "vfat";
|
||||||
mountpoint = "/boot";
|
mountpoint = "/boot";
|
||||||
mountOptions = [ "nofail" ];
|
mountOptions = [ "nofail" ];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
{
|
zfs = {
|
||||||
name = "zfs-a";
|
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "zfs";
|
||||||
pool = "zroot";
|
pool = "zroot";
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
];
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
disk2 = {
|
disk2 = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = disk2;
|
device = disk2;
|
||||||
content = {
|
content = {
|
||||||
type = "table";
|
type = "gpt";
|
||||||
format = "mbr";
|
efiGptPartitionFirst = false;
|
||||||
partitions = [
|
partitions = {
|
||||||
{
|
boot = {
|
||||||
name = "boot-secondary";
|
priority = 1;
|
||||||
size = "1G";
|
|
||||||
bootable = true;
|
|
||||||
type = "EF02";
|
type = "EF02";
|
||||||
|
size = "32M";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = null;
|
||||||
|
};
|
||||||
|
hybrid = {
|
||||||
|
mbrPartitionType = "0x0c";
|
||||||
|
mbrBootableFlag = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
esp = {
|
||||||
|
size = "1G";
|
||||||
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "vfat";
|
format = "vfat";
|
||||||
mountpoint = "/boot-fallback";
|
mountpoint = "/boot-fallback";
|
||||||
mountOptions = [ "nofail" ];
|
mountOptions = [ "nofail" ];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
{
|
zfs = {
|
||||||
name = "zfs-b";
|
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "zfs";
|
||||||
pool = "zroot";
|
pool = "zroot";
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
];
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -104,8 +126,14 @@ in
|
||||||
|
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
device = disk1;
|
device = disk1;
|
||||||
|
version = 2;
|
||||||
|
zfsSupport = true;
|
||||||
|
efiSupport = true;
|
||||||
mirroredBoots = [
|
mirroredBoots = [
|
||||||
|
{
|
||||||
|
devices = [ disk1 ];
|
||||||
|
path = "/boot";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
devices = [ disk2 ];
|
devices = [ disk2 ];
|
||||||
path = "/boot-fallback";
|
path = "/boot-fallback";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
{ lib, ... }:
|
|
||||||
{
|
{
|
||||||
boot.initrd.systemd.enable = true;
|
boot.initrd.systemd.enable = true;
|
||||||
boot.initrd.postDeviceCommands = lib.mkAfter "zfs mount -a";
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
device = "none";
|
device = "none";
|
||||||
|
|
@ -13,10 +11,14 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems."/persist".neededForBoot = true;
|
||||||
|
|
||||||
environment.persistence."/persist" = {
|
environment.persistence."/persist" = {
|
||||||
directories = [
|
directories = [
|
||||||
"/etc/nixos"
|
"/etc/nixos"
|
||||||
|
"/etc/secrets"
|
||||||
"/var/log"
|
"/var/log"
|
||||||
|
"/var/lib/nixos"
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
networking.hyp-01.ipv4.address = lib.mkOption {
|
networking.hyp-01.ipv4.address = lib.mkOption {
|
||||||
|
|
@ -40,12 +45,36 @@
|
||||||
|
|
||||||
systemd.network.networks."10-uplink".networkConfig.Address = config.networking.hyp-01.ipv6.address;
|
systemd.network.networks."10-uplink".networkConfig.Address = config.networking.hyp-01.ipv6.address;
|
||||||
|
|
||||||
boot.initrd.systemd.network.networks."10-uplink" = config.systemd.networks."10-uplink";
|
boot.kernelParams = [ "ip=dhcp" ];
|
||||||
|
boot.initrd = {
|
||||||
|
availableKernelModules = [ "e1000e" ];
|
||||||
|
|
||||||
boot.initrd.network = {
|
systemd =
|
||||||
enable = true;
|
let
|
||||||
|
askPass = pkgs.writeShellScriptBin "zfs-askpass" ''
|
||||||
|
systemd-tty-ask-password-agent --watch
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
storePaths = [ "${askPass}/bin/zfs-askpass" ];
|
||||||
|
users.root.shell = "${askPass}/bin/zfs-askpass";
|
||||||
|
};
|
||||||
|
|
||||||
|
network = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
ssh = {
|
||||||
|
enable = true;
|
||||||
|
port = 2222;
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPnthKtz0fE4yQ/X10cJgKVCjYCNkRNoqV28xAhD7h2M cardno:22_498_026"
|
||||||
|
];
|
||||||
|
hostKeys = [
|
||||||
|
"/etc/secrets/initrd/ssh_host_ed25519_key"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "igb" ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,6 @@ in
|
||||||
];
|
];
|
||||||
openssh.authorizedKeys.keys = [ sshKey ];
|
openssh.authorizedKeys.keys = [ sshKey ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue