From 3e12af7daa2d73666e6d826e633a787e4d813d40 Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Fri, 5 May 2023 20:23:24 +0100 Subject: [PATCH] Add helios configuration --- flake.nix | 9 ++++ hosts/desktop.nix | 7 ++- hosts/helios/README.md | 33 +++++++++++++ hosts/helios/default.nix | 50 +++++++++++++++++++ hosts/helios/hardware-configuration.nix | 65 +++++++++++++++++++++++++ 5 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 hosts/helios/README.md create mode 100644 hosts/helios/default.nix create mode 100644 hosts/helios/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index b106ac4..6b291d6 100644 --- a/flake.nix +++ b/flake.nix @@ -50,6 +50,15 @@ ]; specialArgs = { inherit lib inputs; }; }; + helios = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + inputs.home-manager.nixosModules.home-manager + (import ./modules) + ./hosts/helios + ]; + specialArgs = { inherit lib inputs; }; + }; }; }; } diff --git a/hosts/desktop.nix b/hosts/desktop.nix index a85c66a..b5fb5d8 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -32,5 +32,10 @@ with lib.my; pulse.enable = true; }; + environment.systemPackages = with pkgs; [ + git + neovim + ]; + modules.desktop.gnome.enable = true; -} \ No newline at end of file +} diff --git a/hosts/helios/README.md b/hosts/helios/README.md new file mode 100644 index 0000000..a832a1c --- /dev/null +++ b/hosts/helios/README.md @@ -0,0 +1,33 @@ +# Helios + +## Overview +Dell OptiPlex 980 small form factor desktop. + +## Specs +* CPU - Intel Core i7-860 @ 2.8GHz +* Memory - 8 GB DDR3 +* GPU - AMD FirePro 2460 + +### Disks +Device | Partitions _(filesystem, usage)_ +--- | --- +SanDisk Ultra II | `/dev/sda1` (ext2, NixOS Boot)
`/dev/sda2` (ZFS, NixOS Root) + +#### ZFS pool layout +``` +rpool/ +├── local +│ ├── nix +│ └── tmp +├── system +│ ├── root +│ └── var +└── user + └── home +``` + +See [Graham Christensen's article](https://grahamc.com/blog/nixos-on-zfs/#datasets) for the motivation behind these datasets. + +### Networks +- DHCP on `192.168.0.0/32` subnet. +- Tailscale on `100.64.0.0/10` subnet. FQDN: `helios.mesh.vimium.net`. diff --git a/hosts/helios/default.nix b/hosts/helios/default.nix new file mode 100644 index 0000000..9d39c89 --- /dev/null +++ b/hosts/helios/default.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +with lib.my; +{ + imports = [ + ./hardware-configuration.nix + ../desktop.nix + ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/sda"; + boot.loader.grub.zfsSupport = true; + + networking.hostName = "helios"; + networking.hostId = "47d23505"; + networking.networkmanager.enable = true; + + nix.package = pkgs.nixFlakes; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + users.defaultUserShell = pkgs.zsh; + + system.stateVersion = "22.11"; + + modules = { + desktop = { + apps.qbittorrent.enable = true; + browsers = { + firefox.enable = true; + }; + }; + dev = { + node.enable = true; + }; + editors = { + neovim.enable = true; + }; + security = { + gpg.enable = true; + pass.enable = true; + }; + shell = { + git.enable = true; + zsh.enable = true; + }; + }; +} diff --git a/hosts/helios/hardware-configuration.nix b/hosts/helios/hardware-configuration.nix new file mode 100644 index 0000000..f8bad89 --- /dev/null +++ b/hosts/helios/hardware-configuration.nix @@ -0,0 +1,65 @@ +# 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, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" "zfs" ]; + boot.initrd.kernelModules = [ ]; + boot.initrd.supportedFilesystems = [ "zfs" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.kernelParams = [ "elevator=none" ]; + boot.extraModulePackages = [ ]; + boot.supportedFilesystems = [ "zfs" ]; + + fileSystems."/" = + { device = "rpool/system/root"; + fsType = "zfs"; + }; + + fileSystems."/home" = + { device = "rpool/user/home"; + fsType = "zfs"; + }; + + fileSystems."/nix" = + { device = "rpool/local/nix"; + fsType = "zfs"; + }; + + fileSystems."/tmp" = + { device = "rpool/local/tmp"; + fsType = "zfs"; + }; + + fileSystems."/var/log" = + { device = "rpool/system/var/log"; + fsType = "zfs"; + }; + + fileSystems."/var/tmp" = + { device = "rpool/system/var/tmp"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/sda1"; + fsType = "ext2"; + }; + + 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; +}