diff --git a/flake.nix b/flake.nix index b79d490..b106ac4 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,15 @@ ]; specialArgs = { inherit lib inputs; }; }; + eos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + inputs.home-manager.nixosModules.home-manager + (import ./modules) + ./hosts/eos + ]; + specialArgs = { inherit lib inputs; }; + }; }; }; } diff --git a/hosts/eos/README.md b/hosts/eos/README.md new file mode 100644 index 0000000..169d9cc --- /dev/null +++ b/hosts/eos/README.md @@ -0,0 +1,32 @@ +# Eos + +## Overview +ThinkPas X220 laptop. + +## Specs +* CPU - Intel Core i5-2520M @ 3.20GHz +* Memory - 8 GB DDR3 + +### Disks +Device | Partitions _(filesystem, usage)_ +--- | --- +Solid | `/dev/sda1` (EFI, 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 `10.0.1.0/24` subnet. +- Tailscale on `100.64.0.0/10` subnet. FQDN: `eos.mesh.vimium.net`. diff --git a/hosts/eos/default.nix b/hosts/eos/default.nix new file mode 100644 index 0000000..4ba5230 --- /dev/null +++ b/hosts/eos/default.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib.my; +{ + imports = [ + ./hardware-configuration.nix + ../desktop.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "eos"; + networking.hostId = "cc858347"; + 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/eos/hardware-configuration.nix b/hosts/eos/hardware-configuration.nix new file mode 100644 index 0000000..c71991e --- /dev/null +++ b/hosts/eos/hardware-configuration.nix @@ -0,0 +1,71 @@ +# 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" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.initrd.supportedFilesystems = [ "zfs" ]; + boot.kernelModules = [ ]; + 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" = + { device = "rpool/system/var"; + 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/disk/by-uuid/F04B-76EA"; + fsType = "vfat"; + }; + + 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.enp0s25.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}