From 157c6b37886f116d4b03004ae553f72a5a5e571c Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Mon, 3 Feb 2025 20:12:31 +0100 Subject: move around disk conf stuff --- hardware/zfs-impermanence-disk-config.nix | 80 +++++++++++++++++++++++++++++++ hosts/disk-config/zfs-impermanence.nix | 80 ------------------------------- hosts/snorlax/configuration.nix | 9 ---- hosts/snorlax/disk-config.nix | 80 ------------------------------- hosts/snorlax/flake.nix | 44 ----------------- hosts/snorlax/hardware-configuration.nix | 32 ------------- 6 files changed, 80 insertions(+), 245 deletions(-) create mode 100644 hardware/zfs-impermanence-disk-config.nix delete mode 100644 hosts/disk-config/zfs-impermanence.nix delete mode 100644 hosts/snorlax/configuration.nix delete mode 100644 hosts/snorlax/disk-config.nix delete mode 100644 hosts/snorlax/flake.nix delete mode 100644 hosts/snorlax/hardware-configuration.nix diff --git a/hardware/zfs-impermanence-disk-config.nix b/hardware/zfs-impermanence-disk-config.nix new file mode 100644 index 0000000..9087825 --- /dev/null +++ b/hardware/zfs-impermanence-disk-config.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/disk-config/zfs-impermanence.nix b/hosts/disk-config/zfs-impermanence.nix deleted file mode 100644 index 9087825..0000000 --- a/hosts/disk-config/zfs-impermanence.nix +++ /dev/null @@ -1,80 +0,0 @@ -# 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/snorlax/configuration.nix b/hosts/snorlax/configuration.nix deleted file mode 100644 index c130114..0000000 --- a/hosts/snorlax/configuration.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: -{ - imports = [ - ./hardware-configuration.nix - ../../roles/server.nix - ]; - - system.stateVersion = "24.05"; -} diff --git a/hosts/snorlax/disk-config.nix b/hosts/snorlax/disk-config.nix deleted file mode 100644 index 9087825..0000000 --- a/hosts/snorlax/disk-config.nix +++ /dev/null @@ -1,80 +0,0 @@ -# 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/snorlax/flake.nix b/hosts/snorlax/flake.nix deleted file mode 100644 index 49f2c4f..0000000 --- a/hosts/snorlax/flake.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.disko.url = "github:nix-community/disko"; - inputs.disko.inputs.nixpkgs.follows = "nixpkgs"; - inputs.nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; - - outputs = - { - nixpkgs, - disko, - nixos-facter-modules, - ... - }: - { - # Use this for all other targets - # nixos-anywhere --flake .#generic-nixos-facter --generate-hardware-config nixos-generate-config ./hardware-configuration.nix - nixosConfigurations.generic = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - disko.nixosModules.disko - ./configuration.nix - ./hardware-configuration.nix - ]; - }; - - # Slightly experimental: Like generic, but with nixos-facter (https://github.com/numtide/nixos-facter) - # nixos-anywhere --flake .#generic-nixos-facter --generate-hardware-config nixos-facter facter.json - nixosConfigurations.generic-nixos-facter = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - disko.nixosModules.disko - ./configuration.nix - nixos-facter-modules.nixosModules.facter - { - config.facter.reportPath = - if builtins.pathExists ./facter.json then - ./facter.json - else - throw "Have you forgotten to run nixos-anywhere with `--generate-hardware-config nixos-facter ./facter.json`?"; - } - ]; - }; - }; -} diff --git a/hosts/snorlax/hardware-configuration.nix b/hosts/snorlax/hardware-configuration.nix deleted file mode 100644 index 77df044..0000000 --- a/hosts/snorlax/hardware-configuration.nix +++ /dev/null @@ -1,32 +0,0 @@ -# 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..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; -} -- cgit v1.2.3