kacper inspirerat

This commit is contained in:
2026-04-07 20:20:26 +02:00
parent b721630485
commit 76b7441884
21 changed files with 135 additions and 91 deletions
+45
View File
@@ -0,0 +1,45 @@
{
inputs,
...
}:
let
inherit (inputs) dotfiles home-manager-unstable;
in
{
mkHost = {
nixpkgs,
disko,
lolcat,
modules ? [ ],
}:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inputs = inputs // { "lolcat++" = lolcat; };
};
modules = [ disko.nixosModules.disko ] ++ modules;
};
mkDesktopHost = {
nixpkgs,
disko,
lolcat,
modules ? [ ],
}:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inputs = inputs // { "lolcat++" = lolcat; };
};
modules = [
disko.nixosModules.disko
home-manager-unstable.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "hm-backup";
home-manager.users.love = import "${dotfiles}/home.nix";
}
] ++ modules;
};
}
+6
View File
@@ -0,0 +1,6 @@
{ inputs }:
let
modules = import ../nixos;
flakeLib = import ./lib.nix { inherit inputs; };
in
import ../hosts ({ inherit inputs modules; } // flakeLib)
+9
View File
@@ -0,0 +1,9 @@
{ inputs, ... }:
{
systems = [ "x86_64-linux" ];
flake = {
nixosModules = import ../nixos;
nixosConfigurations = import ./nixos-configurations.nix { inherit inputs; };
};
}
+2
View File
@@ -0,0 +1,2 @@
args:
(import ./hermes args) // (import ./kronos args)
+56
View File
@@ -0,0 +1,56 @@
{
inputs,
config,
pkgs,
modules,
...
}:
let
userName = "love";
fullName = "Love";
hostName = "Hermes";
homeDir = "/home/${userName}";
installDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_115386992";
in
{
_module.args = {
inherit
fullName
homeDir
hostName
installDisk
userName
;
};
imports = [
inputs.mailserver.nixosModules.default
./disko.nix
modules.base
modules.zfsRoot
modules.desktopHyprland
modules.mailServer
modules.binBashWrapper
];
my.binBashWrapper.enable = true;
networking.hostName = hostName;
networking.hostId = "8d49a097f2";
users.mutableUsers = true;
users.users.${userName} = {
isNormalUser = true;
description = fullName;
extraGroups = [ "wheel" ];
shell = pkgs.bash;
};
zramSwap = {
enable = true;
memoryPercent = 75;
algorithm = "zstd";
};
system.stateVersion = "25.05";
}
+20
View File
@@ -0,0 +1,20 @@
{
inputs,
mkHost,
...
}:
{
Hermes = mkHost {
nixpkgs = inputs.nixpkgs-stable;
disko = inputs.disko-stable;
lolcat = inputs."lolcat++-stable";
modules = [ ./configuration.nix ];
};
hermes = mkHost {
nixpkgs = inputs.nixpkgs-stable;
disko = inputs.disko-stable;
lolcat = inputs."lolcat++-stable";
modules = [ ./configuration.nix ];
};
}
+118
View File
@@ -0,0 +1,118 @@
{ installDisk, ... }:
{
disko.devices = {
disk.main = {
type = "disk";
device = installDisk;
content = {
type = "gpt";
partitions = {
ESP = {
label = "EFI";
size = "512MiB";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
luks = {
label = "cryptroot";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings = {
allowDiscards = true;
};
content = {
type = "zfs";
pool = "rpool";
};
};
};
};
};
};
zpool.rpool = {
type = "zpool";
options = {
ashift = "12";
autotrim = "on";
};
rootFsOptions = {
acltype = "posixacl";
atime = "off";
compression = "zstd";
dnodesize = "auto";
mountpoint = "none";
normalization = "formD";
xattr = "sa";
};
datasets = {
root = {
type = "zfs_fs";
options.mountpoint = "none";
};
"root/nixos" = {
type = "zfs_fs";
mountpoint = "/";
options = {
canmount = "noauto";
mountpoint = "legacy";
};
postCreateHook = "zfs snapshot rpool/root/nixos@blank";
};
home = {
type = "zfs_fs";
mountpoint = "/home";
options.mountpoint = "legacy";
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
options.mountpoint = "legacy";
};
persist = {
type = "zfs_fs";
mountpoint = "/persist";
options.mountpoint = "legacy";
};
var = {
type = "zfs_fs";
options.mountpoint = "none";
};
"var/log" = {
type = "zfs_fs";
mountpoint = "/var/log";
options.mountpoint = "legacy";
};
"var/lib" = {
type = "zfs_fs";
mountpoint = "/var/lib";
options.mountpoint = "legacy";
};
reserved = {
type = "zfs_volume";
size = "1G";
};
};
};
};
}
+84
View File
@@ -0,0 +1,84 @@
{
config,
pkgs,
modules,
...
}:
let
userName = "love";
fullName = "Love";
hostName = "Kronos";
homeDir = "/home/${userName}";
installDisk = "/dev/disk/by-id/ata-SanDisk_SD8SB8U-256G-1006_173702422853";
in
{
_module.args = {
inherit
fullName
homeDir
hostName
installDisk
userName
;
};
imports = [
./hardware.nix
./disko.nix
modules.base
modules.zfsRoot
modules.desktopHyprland
modules.binBashWrapper
];
my.binBashWrapper.enable = true;
networking.hostName = hostName;
networking.hostId = "ff0b8826";
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
graphics = {
enable32Bit = true;
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
};
virtualisation.docker.enable = true;
users.mutableUsers = true;
users.users.${userName} = {
isNormalUser = true;
description = fullName;
extraGroups = [
"audio"
"input"
"render"
"video"
"wheel"
"cdrom"
"docker"
];
shell = pkgs.zsh;
};
zramSwap = {
enable = true;
memoryPercent = 75;
algorithm = "zstd";
};
services.mysql = {
enable = true;
package = pkgs.mariadb;
};
system.stateVersion = "25.11";
}
+20
View File
@@ -0,0 +1,20 @@
{
inputs,
mkDesktopHost,
...
}:
{
Kronos = mkDesktopHost {
nixpkgs = inputs.nixpkgs-unstable;
disko = inputs.disko-unstable;
lolcat = inputs."lolcat++-unstable";
modules = [ ./configuration.nix ];
};
kronos = mkDesktopHost {
nixpkgs = inputs.nixpkgs-unstable;
disko = inputs.disko-unstable;
lolcat = inputs."lolcat++-unstable";
modules = [ ./configuration.nix ];
};
}
+118
View File
@@ -0,0 +1,118 @@
{ installDisk, ... }:
{
disko.devices = {
disk.main = {
type = "disk";
device = installDisk;
content = {
type = "gpt";
partitions = {
ESP = {
label = "EFI";
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
luks = {
label = "cryptroot";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings = {
allowDiscards = true;
};
content = {
type = "zfs";
pool = "rpool";
};
};
};
};
};
};
zpool.rpool = {
type = "zpool";
options = {
ashift = "12";
autotrim = "on";
};
rootFsOptions = {
acltype = "posixacl";
atime = "off";
compression = "zstd";
dnodesize = "auto";
mountpoint = "none";
normalization = "formD";
xattr = "sa";
};
datasets = {
root = {
type = "zfs_fs";
options.mountpoint = "none";
};
"root/nixos" = {
type = "zfs_fs";
mountpoint = "/";
options = {
canmount = "noauto";
mountpoint = "legacy";
};
postCreateHook = "zfs snapshot rpool/root/nixos@blank";
};
home = {
type = "zfs_fs";
mountpoint = "/home";
options.mountpoint = "legacy";
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
options.mountpoint = "legacy";
};
persist = {
type = "zfs_fs";
mountpoint = "/persist";
options.mountpoint = "legacy";
};
var = {
type = "zfs_fs";
options.mountpoint = "none";
};
"var/log" = {
type = "zfs_fs";
mountpoint = "/var/log";
options.mountpoint = "legacy";
};
"var/lib" = {
type = "zfs_fs";
mountpoint = "/var/lib";
options.mountpoint = "legacy";
};
reserved = {
type = "zfs_volume";
size = "8G";
};
};
};
};
}
+28
View File
@@ -0,0 +1,28 @@
{
config,
lib,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+7
View File
@@ -0,0 +1,7 @@
{
base = import ./base.nix;
binBashWrapper = import ./bin-bash-wrapper.nix;
desktopHyprland = import ./desktop-hyprland.nix;
mailServer = import ./mail-server;
zfsRoot = import ./zfs-root.nix;
}
+6
View File
@@ -0,0 +1,6 @@
{
imports = [
./mail.nix
./roundcube.nix
];
}
+24
View File
@@ -0,0 +1,24 @@
{ config, ... }:
{
security.acme.acceptTerms = true;
networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx.virtualHosts.${config.mailserver.fqdn}.enableACME = true;
mailserver = {
enable = true;
stateVersion = 4;
fqdn = "mail.billenius.com";
domains = [ "billenius.com" ];
x509.useACMEHost = config.mailserver.fqdn;
# A list of all login accounts. To create the password hashes, use
# nix-shell -p mkpasswd --run 'mkpasswd -s'
accounts = {
"love@billenius.com" = {
hashedPasswordFile = ../../../resources/mail-server/love@billenius.com;
aliases = [ "postmaster@billenius.com" ];
};
};
};
}
+46
View File
@@ -0,0 +1,46 @@
{
config,
pkgs,
...
}:
{
services.roundcube = {
enable = true;
hostName = "mail.billenius.com";
package = pkgs.roundcube.withPlugins (
plugins: with plugins; [
persistent_login
]
);
plugins = [
"persistent_login"
"managesieve" # built-in
];
dicts = with pkgs.aspellDicts; [
# https://search.nixos.org/packages?query=aspellDicts
en
sv
];
maxAttachmentSize = config.mailserver.messageSizeLimit / 1024 / 1024;
extraConfig = ''
$config['imap_host'] = "ssl://${config.mailserver.fqdn}";
$config['smtp_host'] = "ssl://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
$config['managesieve_host'] = "tls://${config.mailserver.fqdn}";
$config['managesieve_port'] = 4190;
$config['managesieve_usetls'] = true;
'';
};
services.nginx.virtualHosts.${config.services.roundcube.hostName} = {
enableACME = true;
forceSSL = true;
};
networking.firewall.allowedTCPPorts = [
80
443
];
}