From 009e1b68b9a3fb99e564c6c55193966c14535dd7 Mon Sep 17 00:00:00 2001 From: Frank LoTurco Date: Sun, 16 Aug 2026 12:54:40 -0400 Subject: [PATCH] hosts: added vergil host and nixos-server shared configuration --- flake.nix | 12 ++ hosts/shared/nixos-server.nix | 245 +++++++++++++++++++++++++++++++++ hosts/vergil/configuration.nix | 15 ++ hosts/vergil/hardware.nix | 63 +++++++++ 4 files changed, 335 insertions(+) create mode 100644 hosts/vergil/configuration.nix create mode 100644 hosts/vergil/hardware.nix diff --git a/flake.nix b/flake.nix index c06cd45..75b3dd4 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,18 @@ ]; }; + vergil = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + + modules = [ + home-manager.nixosModules.home-manager + home-manager-configuration + + ./hosts/vergil/hardware.nix + ./hosts/vergil/configuration.nix + ]; + }; + pdw-frankiel = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; diff --git a/hosts/shared/nixos-server.nix b/hosts/shared/nixos-server.nix index e69de29..781f0cf 100644 --- a/hosts/shared/nixos-server.nix +++ b/hosts/shared/nixos-server.nix @@ -0,0 +1,245 @@ +{ + config, + pkgs, + lib, + inputs, + ... +}: +let + unstable = inputs.nixpkgs-unstable.legacyPacksages.${pkgs.stdenv.hostPlatform.system}; +in +{ + boot.loader = { + systemd-boot.enable = true; + systemd-boot.configurationLimit = 10; + efi.canTouchEfiVariables = true; + timeout = 0; + }; + + services = { + snapper = { + snapshotInterval = "hourly"; + cleanupInterval = "1d"; + configs = { + home = { + SUBVOLUME = "/home"; + TIMELINE_CREATE = true; + TIMELINE_CLEANUP = true; + TIMELINE_LIMIT_HOURLY = "10"; + TIMELINE_LIMIT_DAILY = "7"; + TIMELINE_LIMIT_WEEKLY = "2"; + TIMELINE_LIMIT_MONTHLY = "0"; + TIMELINE_LIMIT_YEARLY = "0"; + BACKGROUND_COMPARISON = "yes"; + NUMBER_CLEANUP = "no"; + NUMBER_MIN_AGE = "1800"; + NUMBER_LIMIT = "50"; + NUMBER_LIMIT_IMPORTANT = "10"; + EMPTY_PRE_POST_CLEANUP = "yes"; + EMPTY_PRE_POST_MIN_AGE = "1800"; + }; + }; + }; + + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + openssh.enable = true; + }; + + networking = { + firewall = { + trustedInterfaces = [ "br0" ]; + allowedTCPPorts = [ 22 ]; + }; + + bridges.br0.interfaces = [ "eno1" ]; + interfaces.br0.useDHCP = true; + }; + + time.timeZone = "America/New_York"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + + extraLocales = [ + "ja_JP.UTF-8/UTF-8" + ]; + + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; + + programs = { + bash = { + enable = true; + + interactiveShellInit = '' + eval "$(jump shell)" + bind -x '"\eOQ": clear;fastfetch' + ''; + }; + + starship = { + enable = true; + + settings = { + character = { + success_symbol = "[λ](bold green)"; + error_symbol = "[λ](bold red)"; + }; + }; + }; + + neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + + configure = { + customRC = '' + set nocompatible + set backspace=indent,eol,start + set tabstop=2 + set shiftwidth=2 + set expandtab + ''; + + packages.myPlugins = with pkgs.vimPlugins; { + start = [ + vim-lastplace + vim-nix + ]; + + opt = [ ]; + }; + }; + }; + + ssh.startAgent = true; + }; + + virtualisation = { + docker.enable = true; + spiceUSBRedirection.enable = true; + + libvirtd = { + enable = true; + + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + }; + }; + }; + + users.users.frank = { + isNormalUser = true; + description = "Frank LoTurco"; + + extraGroups = [ + "wheel" + "libvirtd" + "docker" + ]; + }; + + environment = { + systemPackages = with pkgs; [ + wget + dnsmasq + guestfs-tools + unrar + nil + bash-language-server + devenv + jump + weather + openjdk + openjdk17 + openjdk25 + tmux + + unstable.fastfetch + + (python3.withPackages ( + python-pkgs: with python-pkgs; [ + requests + pandas + ] + )) + ]; + + shellAliases = { + l = "ls -alh"; + ll = "ls -l"; + ls = "ls --color=tty"; + ff = "clear;fastfetch --logo nixos2"; + ffw = "clear;fastfetch --logo nixos2;printf '\n';weather kmco"; + wget = "wget --hsts-file=$XDG_DATA_HOME/wget-hsts"; + nb = "nix-build"; + nix-rebuild = "sudo nixos-rebuild switch"; + }; + + sessionVariables = rec { + XDG_CACHE_HOME = "$HOME/.cache"; + XDG_CONFIG_HOME = "$HOME/.config"; + XDG_DATA_HOME = "$HOME/.local/share"; + XDG_STATE_HOME = "$HOME/.local/state"; + + XDG_DATA_DIRS = [ + "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}" + "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" + ]; + + AZURE_CONFIG_DIR = "$XDG_DATA_HOME/azure"; + NPM_CONFIG_INIT_MODULE = "$XDG_CONFIG_HOME/npm/config/npm-init.js"; + NPM_CONFIG_CACHE = "$XDG_CACHE_HOME/npm"; + NPM_CONFIG_TMP = "$XDG_RUNTIME_DIR/npm"; + _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java"; + PYTHON_HISTORY = "$XDG_STATE_HOME/python_history"; + HISTFILE = "$XDG_STATE_HOME/bash/history"; + DOTNET_ROOT = "${pkgs.dotnet-sdk}/share/dotnet"; + DOTNET_CLI_HOME = "$XDG_DATA_HOME/dotnet"; + GTK2_RC_FILES = "$XDG_CONFIG_HOME/gtk-2.0/gtkrc"; + }; + }; + + nix = { + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + optimise = { + automatic = true; + dates = "weekly"; + }; + + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + + use-xdg-base-directories = true; + }; + }; + + nixpkgs.config.allowUnfree = true; + system.StateVersion = "26.05"; +} diff --git a/hosts/vergil/configuration.nix b/hosts/vergil/configuration.nix new file mode 100644 index 0000000..918db13 --- /dev/null +++ b/hosts/vergil/configuration.nix @@ -0,0 +1,15 @@ +{ + pkgs, + inputs, + ... +}: +let + unstable = inputs.nixpkgs-unstable.legacyPackages.${pkgs.stdenv.hostPlatform.system}; +in +{ + imports = [ + ../shared/nixos-server.nix + ]; + + networking.hostName = "vergil"; +} diff --git a/hosts/vergil/hardware.nix b/hosts/vergil/hardware.nix new file mode 100644 index 0000000..38b448b --- /dev/null +++ b/hosts/vergil/hardware.nix @@ -0,0 +1,63 @@ +{ + config, + lib, + modulesPath, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot = { + initrd = { + availableKernelModules = [ + "uhci_hcd" + "ehci_pci" + "ata_piix" + "megaraid_sas" + "usb_storage" + "usbhid" + "sd_mod" + "sr_mod" + ]; + kernelModules = [ ]; + }; + + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/bd90d419-2a40-4794-9bcb-2fc9adb92435"; + fsType = "btrfs"; + }; + + "/home" = { + device = "/dev/disk/by-uuid/bd90d419-2a40-4794-9bcb-2fc9adb92435"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + "/nix" = { + device = "/dev/disk/by-uuid/bd90d419-2a40-4794-9bcb-2fc9adb92435"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/EB35-0126"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + }; + + swapDevices = [ ]; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}