A NixOS-based system for managing personal data across three tiers: - Tier 1: Configuration (shareable via git) - Tier 2: Syncable data (nb + Syncthing) - Tier 3: Large data (self-hosted services + backup) Includes: - NixOS modules for nb, Syncthing, backup (restic) - Server modules for Forgejo, Immich, Jellyfin - Helper scripts (usync, ustatus) - Comprehensive documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
203 lines
5.6 KiB
Nix
203 lines
5.6 KiB
Nix
# Example Host Configuration
|
|
#
|
|
# This is a template for your machine's configuration.nix.
|
|
# Copy this to hosts/your-hostname/configuration.nix and customize.
|
|
#
|
|
# To use:
|
|
# 1. Copy this file to hosts/<your-hostname>/configuration.nix
|
|
# 2. Generate hardware-configuration.nix: nixos-generate-config --show-hardware-config
|
|
# 3. Customize the settings below
|
|
# 4. Add to flake.nix outputs
|
|
|
|
{ config, pkgs, lib, inputs, ... }:
|
|
|
|
{
|
|
imports = [
|
|
./hardware-configuration.nix # Generate with nixos-generate-config
|
|
];
|
|
|
|
# ============================================================================
|
|
# SYSTEM BASICS
|
|
# ============================================================================
|
|
|
|
networking.hostName = "example"; # Change this!
|
|
|
|
# Bootloader (adjust for your system)
|
|
boot.loader.systemd-boot.enable = true;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
# Networking
|
|
networking.networkmanager.enable = true;
|
|
|
|
# Timezone and locale
|
|
time.timeZone = "America/New_York"; # Change this!
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
# ============================================================================
|
|
# USERS
|
|
# ============================================================================
|
|
|
|
users.users.youruser = { # Change this!
|
|
isNormalUser = true;
|
|
description = "Your Name";
|
|
extraGroups = [ "wheel" "networkmanager" ];
|
|
shell = pkgs.zsh; # Or bash, fish, etc.
|
|
};
|
|
|
|
# ============================================================================
|
|
# TIER 1: CONFIGURATION
|
|
# ============================================================================
|
|
|
|
# Enable Nix flakes
|
|
nix.settings = {
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
auto-optimise-store = true;
|
|
};
|
|
|
|
# Garbage collection
|
|
nix.gc = {
|
|
automatic = true;
|
|
dates = "weekly";
|
|
options = "--delete-older-than 30d";
|
|
};
|
|
|
|
# ============================================================================
|
|
# TIER 2: NOTES (nb)
|
|
# ============================================================================
|
|
|
|
programs.nb = {
|
|
enable = true;
|
|
editor = "nvim";
|
|
defaultExtension = "md";
|
|
|
|
# Configure your notebooks
|
|
notebooks = {
|
|
# personal = {
|
|
# remote = "git@forgejo.yourdomain.com:youruser/personal-notes.git";
|
|
# };
|
|
# work = {
|
|
# remote = "git@forgejo.yourdomain.com:youruser/work-notes.git";
|
|
# };
|
|
};
|
|
};
|
|
|
|
# ============================================================================
|
|
# TIER 2: SYNC (Syncthing)
|
|
# ============================================================================
|
|
|
|
services.syncthing-managed = {
|
|
enable = true;
|
|
user = "youruser"; # Change this!
|
|
|
|
# Add your device IDs here
|
|
devices = {
|
|
# laptop = {
|
|
# id = "XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX";
|
|
# };
|
|
# desktop = {
|
|
# id = "YYYYYYY-YYYYYYY-YYYYYYY-YYYYYYY-YYYYYYY-YYYYYYY-YYYYYYY-YYYYYYY";
|
|
# };
|
|
};
|
|
|
|
# Configure folders to sync
|
|
folders = {
|
|
# documents = {
|
|
# path = "/home/youruser/Documents";
|
|
# devices = [ "laptop" "desktop" ];
|
|
# versioning = { type = "simple"; params.keep = "5"; };
|
|
# };
|
|
};
|
|
};
|
|
|
|
# ============================================================================
|
|
# TIER 3: BACKUP
|
|
# ============================================================================
|
|
|
|
services.backup = {
|
|
enable = true;
|
|
|
|
# Configure your backup repository
|
|
# repository = "b2:your-bucket:backup";
|
|
repository = "/mnt/backup"; # Local example
|
|
|
|
# Paths to back up
|
|
paths = [
|
|
"/home/youruser/Documents"
|
|
"/home/youruser/notes"
|
|
# Add more paths
|
|
];
|
|
|
|
# Password file (create this manually or use sops-nix)
|
|
passwordFile = "/etc/restic-password"; # Create this!
|
|
|
|
# For cloud storage, set environment file
|
|
# environmentFile = "/etc/restic-env";
|
|
|
|
# Schedule: 2 AM daily
|
|
schedule = "*-*-* 02:00:00";
|
|
};
|
|
|
|
# ============================================================================
|
|
# EDITOR
|
|
# ============================================================================
|
|
|
|
programs.neovim = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
};
|
|
|
|
# ============================================================================
|
|
# PACKAGES
|
|
# ============================================================================
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
# Shell essentials
|
|
git
|
|
ripgrep
|
|
fd
|
|
jq
|
|
htop
|
|
tmux
|
|
|
|
# Development
|
|
neovim
|
|
|
|
# Sync & backup (installed by modules, but explicit is fine)
|
|
syncthing
|
|
restic
|
|
rclone
|
|
];
|
|
|
|
# ============================================================================
|
|
# SECRETS (sops-nix)
|
|
# ============================================================================
|
|
|
|
# Uncomment and configure when you set up sops-nix
|
|
#
|
|
# sops = {
|
|
# defaultSopsFile = ../../secrets/secrets.yaml;
|
|
# age.keyFile = "/home/youruser/.config/sops/age/keys.txt";
|
|
#
|
|
# secrets = {
|
|
# "restic-password" = {};
|
|
# "syncthing-key" = {
|
|
# owner = "youruser";
|
|
# };
|
|
# };
|
|
# };
|
|
|
|
# ============================================================================
|
|
# SERVICES
|
|
# ============================================================================
|
|
|
|
services.openssh.enable = true;
|
|
|
|
# ============================================================================
|
|
# SYSTEM
|
|
# ============================================================================
|
|
|
|
system.stateVersion = "24.05"; # Don't change after initial install
|
|
}
|