First dnf test
This commit is contained in:
commit
d481a5e669
165 changed files with 41270 additions and 0 deletions
73
dnf/hosts/disko/btrfs-1-disk.nix
Normal file
73
dnf/hosts/disko/btrfs-1-disk.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# Simple machine with 1 disk, BTRFS
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
||||
# EFI
|
||||
boot = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"umask=0077"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
system = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
|
||||
# System partition
|
||||
"@system" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Nix store
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Home files from home directories (little files, compressed, snapshotted)
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Snapshots (not mounted)
|
||||
"@snapshots-home" = { };
|
||||
"@snapshots-system" = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
50
dnf/hosts/disko/ext4-1-disk.nix
Normal file
50
dnf/hosts/disko/ext4-1-disk.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Simple machine with 1 disk, EXT4
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
||||
# EFI
|
||||
boot = {
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
|
||||
# MAIN
|
||||
root = {
|
||||
size = "-4G";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
|
||||
# Non encrypted swap
|
||||
swap = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "swap";
|
||||
discardPolicy = "both";
|
||||
resumeDevice = true; # resume from hiberation from this device
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
130
dnf/hosts/disko/server-1-disk.nix
Normal file
130
dnf/hosts/disko/server-1-disk.nix
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
# Full server with 3 nvme disks, RAID0, BTRFS + EXT4
|
||||
#
|
||||
# /dev/nvme0n1
|
||||
# ├── /boot (EFI, 1GB, vfat)
|
||||
# ├── BTRFS
|
||||
# ├ ├── subvol=@system → / (compress=zstd:1)
|
||||
# ├ ├── subvol=@nix → /nix (compress=zstd:1)
|
||||
# ├ ├── subvol=@home → /home (compress=zstd:1)
|
||||
# ├ ├── subvol=@media → /mnt/media (compress=zstd:1)
|
||||
# ├ ├── subvol=@backup → /mnt/backup (compress=no)
|
||||
# ├ ├── subvol=@databases → /mnt/databases (nodatacow,compress=no)
|
||||
# ├ ├── subvol=@snapshots-home
|
||||
# ├ ├── subvol=@snapshots-system
|
||||
# ├ └── subvol=@snapshots-databases
|
||||
# └── swap (4GB)
|
||||
#
|
||||
# Do not remove:
|
||||
# NEEDEDFORBOOT:/boot;/nix;/home;/mnt/databases;/mnt/medias
|
||||
#
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
|
||||
# NVME1 - Main disk
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
||||
# EFI
|
||||
boot = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"umask=0077"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Main disk
|
||||
system = {
|
||||
size = "100%";
|
||||
end = "-32";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # Force overwrite
|
||||
subvolumes = {
|
||||
|
||||
# Root partition
|
||||
"@system" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Nix store
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Files from home directories (little files, compressed, snapshotted)
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Media files (compressed, not snapshotted)
|
||||
"@media" = {
|
||||
mountpoint = "/mnt/media";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Backup files (not compressed - already compressed by backup tool, not snapshotted)
|
||||
"@backup" = {
|
||||
mountpoint = "/mnt/backup";
|
||||
mountOptions = [
|
||||
"compress=no"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Databases files (nodatacow, not compressed)
|
||||
"@databases" = {
|
||||
mountpoint = "/mnt/databases";
|
||||
mountOptions = [
|
||||
"nodatacow"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Snapshots (not mounted)
|
||||
"@snapshots-home" = { };
|
||||
"@snapshots-system" = { };
|
||||
"@snapshots-databases" = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "4G";
|
||||
content = {
|
||||
type = "swap";
|
||||
randomEncryption = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
191
dnf/hosts/disko/server-4-disks.nix
Normal file
191
dnf/hosts/disko/server-4-disks.nix
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
# Full server with 3 nvme disks, RAID0, BTRFS + EXT4
|
||||
#
|
||||
# /dev/nvme0n1 (8TB)
|
||||
# ├── /boot (EFI, 1GB, vfat)
|
||||
# ├── BTRFS (~7.97TB)
|
||||
# ├ ├── subvol=@system → / (compress=zstd:1)
|
||||
# ├ ├── subvol=@nix → /nix (compress=zstd:1)
|
||||
# ├ ├── subvol=@home → /home (compress=zstd:1)
|
||||
# ├ ├── subvol=@databases → /mnt/databases (nodatacow,compress=no)
|
||||
# ├ ├── subvol=@snapshots-home
|
||||
# ├ ├── subvol=@snapshots-system
|
||||
# ├ └── subvol=@snapshots-databases
|
||||
# └── swap (32GB)
|
||||
#
|
||||
# /dev/nvme1n1 + /dev/nvme2n1 (8TB + 8TB RAID0)
|
||||
# └── ext4 → /mnt/medias (noatime, writeback)
|
||||
#
|
||||
# /dev/sda (20TB USB)
|
||||
# └── ext4 → /mnt/backup (noatime, automount)
|
||||
#
|
||||
# Do not remove:
|
||||
# NEEDEDFORBOOT:/boot;/nix;/home;/mnt/databases;/mnt/medias
|
||||
#
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
|
||||
# NVME1 - Main disk
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
||||
# EFI
|
||||
boot = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"umask=0077"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Main disk
|
||||
system = {
|
||||
size = "100%";
|
||||
end = "-32";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # Force overwrite
|
||||
subvolumes = {
|
||||
|
||||
# Root partition
|
||||
"@system" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Nix store
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Files from home directories (little files, compressed, snapshotted)
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Databases files (nodatacow, not compressed)
|
||||
"@databases" = {
|
||||
mountpoint = "/mnt/databases";
|
||||
mountOptions = [
|
||||
"nodatacow"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
# Snapshots (not mounted)
|
||||
"@snapshots-home" = { };
|
||||
"@snapshots-system" = { };
|
||||
"@snapshots-databases" = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "32G";
|
||||
content = {
|
||||
type = "swap";
|
||||
randomEncryption = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# NVME2 - RAID0
|
||||
media1 = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme1n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
raid = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "medias";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# NVME3 - RAID0
|
||||
media2 = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme2n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
raid = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "medias";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# External USB disk (hot-pluggable)
|
||||
backup = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
backup = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/mnt/backup";
|
||||
mountOptions = [
|
||||
"noatime"
|
||||
"data=writeback"
|
||||
"noauto" # Do not auto-mount at boot
|
||||
"x-systemd.automount" # On-demand mount
|
||||
"x-systemd.idle-timeout=300" # Auto unmount after 5 min idle
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# RAID0
|
||||
mdadm = {
|
||||
medias = {
|
||||
type = "mdadm";
|
||||
level = 0;
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/mnt/medias";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
34
dnf/hosts/iso.nix
Normal file
34
dnf/hosts/iso.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ modulesPath, pkgs, lib, ... }:
|
||||
{
|
||||
imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" ];
|
||||
|
||||
config = {
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
boot.loader.systemd-boot.editor = false;
|
||||
hardware.enableAllFirmware = true;
|
||||
users.users.nix = {
|
||||
uid = 65000;
|
||||
password = "p";
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
openssh.authorizedKeys.keyFiles = [ ./../../usr/secrets/nix.pub ];
|
||||
};
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
environment.systemPackages = with pkgs; [ vim ];
|
||||
nix.settings = {
|
||||
substituters = [
|
||||
"http://gateway:8501"
|
||||
"https://cache.nixos.org"
|
||||
];
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
services.openssh.enable = true;
|
||||
system.stateVersion = "25.11";
|
||||
};
|
||||
}
|
||||
23
dnf/hosts/templates/install.nix
Normal file
23
dnf/hosts/templates/install.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Standalone machine used to install a new host
|
||||
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.loader.systemd-boot.editor = false;
|
||||
hardware.enableAllFirmware = true;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
users.users.nix = {
|
||||
uid = 65000;
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
openssh.authorizedKeys.keyFiles = [ ./../../../usr/secrets/nix.pub ];
|
||||
};
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
environment.systemPackages = with pkgs; [ vim ];
|
||||
nix.settings = {
|
||||
substituters = [ "http://{{gateway}}:8501" ];
|
||||
};
|
||||
services.openssh.enable = true;
|
||||
system.stateVersion = "{{currentStateVersion}}";
|
||||
}
|
||||
12
dnf/hosts/templates/usr-machines-default.nix
Normal file
12
dnf/hosts/templates/usr-machines-default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Host specific configuration (writable)
|
||||
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./generated-configuration.nix
|
||||
./hardware-configuration.nix
|
||||
./disko.nix
|
||||
];
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue