From 0fb3056a4cf1d25bf38e53eff448e76fa66a60c8 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 20 Jul 2024 12:38:57 +0100 Subject: [PATCH] Add citadel host --- home/citadel.nix | 84 ++++++++++++++++++++++++ hosts/citadel/default.nix | 60 +++++++++++++++++ hosts/citadel/hardware-configuration.nix | 24 +++++++ 3 files changed, 168 insertions(+) create mode 100644 home/citadel.nix create mode 100644 hosts/citadel/default.nix create mode 100644 hosts/citadel/hardware-configuration.nix diff --git a/home/citadel.nix b/home/citadel.nix new file mode 100644 index 0000000..6a37395 --- /dev/null +++ b/home/citadel.nix @@ -0,0 +1,84 @@ +{ config +, ... +}: { + imports = [ + # Import users + ./users/sam + + ./common/core + + # Import optional + ./common/optional/git.nix + ./common/optional/sops.nix + ./common/optional/syncthing.nix + ./common/optional/desktop/dwm + ./common/optional/desktop/common/themes/standard-dark.nix + + ]; + + colorScheme = { + slug = "serene"; + name = "Serene"; + author = "Bitlab21"; + palette = { + base00 = "#1F1F28"; + base01 = "#16161D"; + base02 = "#223249"; + base03 = "#363646"; + base04 = "#727169"; + base05 = "#DCD7BA"; + base06 = "#C8C093"; + base07 = "#717C7C"; + base08 = "#C34043"; + base09 = "#FFA066"; + base0A = "#C0A36E"; + base0B = "#76946A"; + base0C = "#6A9589"; + base0D = "#7E9CD8"; + base0E = "#957FB8"; + base0F = "#D27E99"; + }; + }; + + home.file.".Xresources" = { + recursive = true; + text = '' + ! scale + Xft.dpi: 192 + + ! st + st.alpha: 0.8 + St.font: monospace:pixelsize=31:antialias=true:autohint=true; + St.font2: NotoColorEmoji:pixelsize=24:antialias=true:autohint=true; + + ! dwm + dwm.borderpx: 6 + dwm.font: monospace:size=14 + dwm.col_base00: #${config.colorScheme.colors.base00} + dwm.col_base03: #${config.colorScheme.colors.base03} + dwm.col_base04: #${config.colorScheme.colors.base04} + dwm.col_base05: #${config.colorScheme.colors.base05} + dwm.col_base08: #${config.colorScheme.colors.base08} + dwm.col_base0B: #${config.colorScheme.colors.base0B} + + ! dmenu + dmenu.font: monospace:size=14 + dmenu.font2: NotoColorEmoji:pixelsize=44:antialias=true:autohint=true + dmenu.topbar: 1 + dmenu.normfgcolor: #${config.colorScheme.colors.base05} + dmenu.normbgcolor: #${config.colorScheme.colors.base03} + dmenu.selfgcolor: #${config.colorScheme.colors.base00} + dmenu.selbgcolor: #${config.colorScheme.colors.base0B} + + Nsxiv.window.background: #${config.colorScheme.colors.base03} + Nsxiv.window.foreground: #${config.colorScheme.colors.base05} + Nsxiv.mark.foreground: #${config.colorScheme.colors.base08} + + Nsxiv.bar.background: #${config.colorScheme.colors.base00} + Nsxiv.bar.foreground: #${config.colorScheme.colors.base05} + Nsxiv.bar.font: monospace:size=12 + + + ''; + }; +} diff --git a/hosts/citadel/default.nix b/hosts/citadel/default.nix new file mode 100644 index 0000000..6c2010e --- /dev/null +++ b/hosts/citadel/default.nix @@ -0,0 +1,60 @@ +{ inputs, lib, pkgs, ... }: +let + # Disko setup + fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence + dev = "/dev/nvme0n1"; # depends on target hardware + encrypted = true; # currrently only applies to btrfs + btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; + user = "sam"; + impermanence = true; +in +{ + imports = + [ + # Create users for this host + ../common/users/${user} + + # Disk configuration + inputs.disko.nixosModules.disko + (import ../common/disks { device = dev; impermanence = impermanence; fsType = fsType; encrypted = encrypted; }) + + # Impermanence + (import ../common/disks/btrfs/impermanence.nix { btrfsMountDevice = btrfsMountDevice; lib = lib; }) + + # Import core options + ./hardware-configuration.nix + ../common/core + + # Import optional options + ../common/optional/persistence.nix + ../common/optional/pipewire.nix + ../common/optional/openssh.nix + ../common/optional/dwm.nix + ../common/optional/nfs-mounts/music.nix + ../common/optional/printing.nix + + ]; + + boot = { + blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ]; + kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest; + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + timeout = 3; + }; + }; + + hardware.firmware = [ + pkgs.sof-firmware + ]; + + networking = { + hostName = "citadel"; + networkmanager.enable = true; + enableIPv6 = false; + nameservers = [ "10.0.10.60" "8.8.8.8" ]; + }; + + services.libinput.enable = true; +} diff --git a/hosts/citadel/hardware-configuration.nix b/hosts/citadel/hardware-configuration.nix new file mode 100644 index 0000000..0a2bb19 --- /dev/null +++ b/hosts/citadel/hardware-configuration.nix @@ -0,0 +1,24 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + # 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.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}