Files
nixos-config/hosts/buildbox/configuration.nix
T

213 lines
4.9 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
config,
pkgs,
pkgs-unstable,
inputs,
configPath,
hostname,
hostTypes,
lib,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
# Declarative disk layout (consumed by disko + nixos-anywhere).
./disko-config.nix
inputs.home-manager.nixosModules.default
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.graceful = true;
nix.settings.experimental-features = ["nix-command" "flakes"];
# Nix optimizations
nix.optimise.automatic = true;
nix.settings.auto-optimise-store = true;
nix.gc = {
automatic = true;
dates = "weekly";
persistent = true;
options = "--delete-older-than 30d";
};
# Btrfs filesystem
services.btrfs.autoScrub = {
enable = true;
interval = "weekly";
fileSystems = ["/" "/home" "/nix"];
};
# Snapper — automatic btrfs snapshots so you can roll back
services.snapper = {
# Snapshot / every hour, keep 10 hourly and 7 daily
configs.root = {
SUBVOLUME = "/";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_MIN_AGE = "1800";
TIMELINE_LIMIT_HOURLY = "10";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_MONTHLY = "3";
TIMELINE_LIMIT_YEARLY = "0";
};
# Snapshot /home every 4 hours
configs.home = {
SUBVOLUME = "/home";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_MIN_AGE = "14400";
TIMELINE_LIMIT_HOURLY = "6";
TIMELINE_LIMIT_DAILY = "14";
TIMELINE_LIMIT_MONTHLY = "3";
TIMELINE_LIMIT_YEARLY = "0";
};
};
networking.hostName = "buildbox"; # Define your hostname.
# Enable networking
networking.networkmanager.enable = true;
networking.useDHCP = false;
networking.interfaces.ens18.ipv4.addresses = [
{
address = "192.168.8.200";
prefixLength = 24; # Subnet Mask
}
];
networking.defaultGateway = "192.168.8.1";
networking.nameservers = ["192.168.8.1" "1.1.1.1"];
# Virtualisation
virtualisation.docker.enable = true;
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
# zram
zramSwap = {
enable = true;
priority = 100;
memoryPercent = 30;
swapDevices = 1;
algorithm = "zstd";
};
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.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";
};
# Disable X11 for servers
services.xserver.enable = false;
services.tailscale.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = false;
# VSCode-Server
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
stdenv.cc.cc.lib
zlib
glib
libGL
libGLU
openssl
];
# Define a user account. Don't forget to set a password with passwd.
programs.zsh.enable = true;
users.users.rogueking = {
isNormalUser = true;
description = "rogueking";
hashedPassword = "$y$j9T$acC7H6j3hHlc9RBftDGvd.$5irPc2XAuYCwDx3lqtcSPEUBY31SGI/ZmcP/t9SbKq0";
extraGroups = ["networkmanager" "wheel" "docker"];
shell = pkgs.zsh;
packages = with pkgs; [];
};
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
security.polkit.enable = true;
programs._1password.enable = true;
programs._1password-gui = {
enable = true;
polkitPolicyOwners = ["rogueking"];
};
# Enable OpenSSH daemon
services.openssh = {
enable = true;
ports = [22];
settings = {
PasswordAuthentication = true;
AllowUsers = ["rogueking"];
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "no";
MaxAuthTries = 8;
};
};
users.users."rogueking".openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINXqriPZVIuduc/J7GS1mD171LL0gIbgEjlImsxedWVX"
];
nixpkgs.config.permittedInsecurePackages = [
"qtwebengine-5.15.19"
"python3.12-ecdsa-0.19.1"
];
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# System-level only — CLI tools moved to home-manager
btrfs-progs
];
home-manager = {
extraSpecialArgs = {
inherit
configPath
inputs
pkgs-unstable
hostname
hostTypes
;
};
users = {
"rogueking" = import ./../../home-manager/home.nix;
};
backupFileExtension = "backup";
};
system.stateVersion = "26.05";
}