summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
Diffstat (limited to 'hosts')
-rw-r--r--hosts/disk-config/zfs-impermanence.nix80
-rw-r--r--hosts/hardware-configuration/snorlex.nix32
-rw-r--r--hosts/snorlex.nix9
-rw-r--r--hosts/tarreltaart.nix51
4 files changed, 132 insertions, 40 deletions
diff --git a/hosts/disk-config/zfs-impermanence.nix b/hosts/disk-config/zfs-impermanence.nix
new file mode 100644
index 0000000..9087825
--- /dev/null
+++ b/hosts/disk-config/zfs-impermanence.nix
@@ -0,0 +1,80 @@
+# USAGE in your configuration.nix.
+# Update devices to match your hardware.
+# {
+# imports = [ ./disko-config.nix ];
+# disko.devices.disk.main.device = "/dev/sda";
+# }
+{
+ disko.devices = {
+ disk = {
+ main = {
+ type = "disk";
+ content = {
+ type = "gpt";
+ partitions = {
+ ESP = {
+ size = "1G";
+ type = "EF00";
+ content = {
+ type = "filesystem";
+ format = "vfat";
+ mountpoint = "/boot";
+ mountOptions = [ "umask=0077" ];
+ };
+ };
+ zfs = {
+ size = "100%";
+ content = {
+ type = "zfs";
+ pool = "zroot";
+ };
+ };
+ };
+ };
+ };
+ };
+ zpool = {
+ zroot = {
+ type = "zpool";
+ rootFsOptions = {
+ # https://wiki.archlinux.org/title/Install_Arch_Linux_on_ZFS
+ acltype = "posixacl";
+ atime = "off";
+ compression = "zstd";
+ mountpoint = "none";
+ xattr = "sa";
+ };
+ options.ashift = "12";
+
+ datasets = {
+ "local" = {
+ type = "zfs_fs";
+ options.mountpoint = "none";
+ };
+ "local/home" = {
+ type = "zfs_fs";
+ mountpoint = "/home";
+ # Used by services.zfs.autoSnapshot options.
+ options."com.sun:auto-snapshot" = "true";
+ };
+ "local/nix" = {
+ type = "zfs_fs";
+ mountpoint = "/nix";
+ options."com.sun:auto-snapshot" = "false";
+ };
+ "local/persist" = {
+ type = "zfs_fs";
+ mountpoint = "/persist";
+ options."com.sun:auto-snapshot" = "false";
+ };
+ "local/root" = {
+ type = "zfs_fs";
+ mountpoint = "/";
+ options."com.sun:auto-snapshot" = "false";
+ postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/local/root@blank$' || zfs snapshot zroot/local/root@blank";
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/hosts/hardware-configuration/snorlex.nix b/hosts/hardware-configuration/snorlex.nix
new file mode 100644
index 0000000..77df044
--- /dev/null
+++ b/hosts/hardware-configuration/snorlex.nix
@@ -0,0 +1,32 @@
+# 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, modulesPath, ... }:
+
+{
+ imports =
+ [ (modulesPath + "/installer/scan/not-detected.nix")
+ ];
+
+ boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "uas" "sd_mod" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-intel" ];
+ boot.extraModulePackages = [ ];
+
+ fileSystems."/" =
+ { device = "/dev/disk/by-uuid/f8724a86-f440-49a2-a6df-8183b451449c";
+ fsType = "ext4";
+ };
+
+ swapDevices = [ ];
+
+ # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
+ # (the default) this is the recommended approach. When using systemd-networkd it's
+ # still possible to use this option, but it's recommended to use it in conjunction
+ # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
+ networking.useDHCP = lib.mkDefault true;
+ # networking.interfaces.eno1.useDHCP = lib.mkDefault true;
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+ hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
diff --git a/hosts/snorlex.nix b/hosts/snorlex.nix
new file mode 100644
index 0000000..9ba6e6c
--- /dev/null
+++ b/hosts/snorlex.nix
@@ -0,0 +1,9 @@
+{ ... }:
+{
+ imports = [
+ ./hardware-configuration/snorlex.nix
+ ../roles/server.nix
+ ];
+
+ system.stateVersion = "24.05";
+}
diff --git a/hosts/tarreltaart.nix b/hosts/tarreltaart.nix
index edcb5fd..42461f6 100644
--- a/hosts/tarreltaart.nix
+++ b/hosts/tarreltaart.nix
@@ -1,45 +1,16 @@
-{ pkgs, ... }:
+{ ... }:
{
- imports = [ ./hardware-configuration/tarreltaart.nix ];
- # Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
- boot.loader.grub.enable = false;
- # Enables the generation of /boot/extlinux/extlinux.conf
- boot.loader.generic-extlinux-compatible.enable = true;
-
- networking.hostName = "tarreltaart"; # Define your hostname.
- time.timeZone = "Europe/Amsterdam";
-
- users.users.jras = {
- isNormalUser = true;
- extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
- packages = with pkgs; [
- tree
- ];
- };
- users.users.git.isNormalUser = true;
+ imports = [
+ ./hardware-configuration/tarreltaart.nix
+ ../roles/server.nix
+ ../roles/git-server.nix
+ ];
- environment.systemPackages = with pkgs; [
- git
- vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
- wget
- ];
- programs.mtr.enable = true;
- services.openssh = {
- enable = true;
- allowSFTP = false;
- settings = {
- PermitRootLogin = "no";
- AllowUsers = [ "jras" "git" ];
- };
- };
- services.gitea = {
- enable = true;
- appName = "JAP56 Git Server";
- };
+ system.stateVersion = "24.11";
- networking.firewall.allowedTCPPorts = [ 22 ];
-
- # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
- system.stateVersion = "24.11"; # Did you read the comment?
+ networking.hostName = "tarreltaart";
+ time.timeZone = "Europe/Amsterdam";
+ boot.loader.grub.enable = false;
+ boot.loader.generic-extlinux-compatible.enable = true;
}