2025-03-13 13:42:25 +01:00

116 lines
2.7 KiB
Nix

{pkgs, ...}: {
imports = [
./hardware-configuration.nix
];
# Enable flakes and nix commands
nix = {
settings = {
experimental-features = ["nix-command" "flakes"];
# Enable automatic garbage collection
auto-optimise-store = true;
};
# Automatic cleanup of old generations
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
};
# Boot configuration
boot.loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
};
# Your base configuration here
system.autoUpgrade = {
enable = true;
allowReboot = true;
dates = "04:00";
flake = "path:/etc/nixos/current-systemconfig";
randomizedDelaySec = "45min";
flags = [
"--update-input nixpkgs"
"--update-input base-config"
];
};
# Other base configurations...
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
MaxAuthTries = 3;
LoginGraceTime = "30s";
};
ports = [2222];
};
# System packages
environment.systemPackages = with pkgs; [
# Docker tools
docker
docker-compose
# System utilities
neovim
git
unstable.gum
just
jq
(pkgs.writeShellScriptBin "shp" ''
exec sudo ${pkgs.just}/bin/just -f /etc/self-host-playbook/justfile "$@"
'')
];
# Enable Docker with recommended settings
virtualisation = {
docker = {
enable = true;
# Enable docker daemon to start on boot
enableOnBoot = true;
# Use overlay2 storage driver
storageDriver = "overlay2";
# Enable live restore
liveRestore = true;
};
oci-containers = {
backend = "docker";
};
};
programs.bash = {
loginShellInit = ''
# Only show the message for interactive login shells
if [[ -t 0 && -t 1 && "$BASH_EXECUTION_STRING" == "" ]]; then
gum style \
--foreground 212 \
--border double \
--margin "1 2" \
--padding "1 2" \
--align center \
--width 70 \
"🌟 Welcome to Your Self-Host Playbook Server! 🌟" \
"" \
"🔧 To manage your server: Run 'shp' (requires sudo)" \
"" \
"💬 Join our community: https://www.m3tam3re.com"
fi
'';
};
environment.etc = {
# Main justfile
"self-host-playbook/justfile".source = ../justfiles/main.just;
# Tier justfiles
"self-host-playbook/tiers".source = ../justfiles/tiers;
"self-host-playbook/scripts".source = ../justfiles/scripts;
};
# System state version (do not change)
system.stateVersion = "24.11";
}