Skip to content

OscarMarshall/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NixOS/Darwin Configuration with Den

This repository contains my personal system configurations for multiple machines using Nix, managed through the Den aspect-oriented configuration framework.

Systems

  • harmony (x86_64-linux): Home server running media services, Minecraft servers, and infrastructure
  • melaan (x86_64-linux): Framework laptop with GNOME desktop
  • OMARSHAL-M-2FD2 (aarch64-darwin): MacBook with development environment

Quick Start

Prerequisites

  • Nix with flakes enabled
  • Appropriate system (NixOS, macOS, or Linux for home-manager only)

Clone and Build

git clone https://github.com/OscarMarshall/dotfiles.git
cd dotfiles

Apply Configuration

NixOS systems (harmony, melaan):

sudo nixos-rebuild switch --flake .#<hostname>

macOS systems (OMARSHAL-M-2FD2):

darwin-rebuild switch --flake .#OMARSHAL-M-2FD2

Validate Configuration

# nix flake check currently fails due to cross-architecture issues
# Use platform-specific builds instead:
nix build .#nixosConfigurations.harmony.config.system.build.toplevel
nix build .#nixosConfigurations.melaan.config.system.build.toplevel
nix build .#darwinConfigurations.OMARSHAL-M-2FD2.config.system.build.toplevel

# Show available outputs
nix flake show

# Format code
nix fmt

Architecture

This repository uses Den, an aspect-oriented configuration system built on flake-parts. Configuration is organized into composable aspects:

Aspects Structure

  • modules/aspects/hosts/: Host-specific configurations (one aspect per host)
  • modules/aspects/users/: User-specific configurations (one aspect per user)
  • modules/aspects/my/: Reusable service and feature aspects (~43 total)
  • modules/aspects/defaults.nix: Default includes applied to all configurations

Configuration Classes

Each aspect can provide configuration for different targets using these classes:

  • os: Applies to both NixOS and Darwin (avoids duplicating identical config in nixos and darwin)
  • nixos: NixOS-specific configuration only
  • darwin: macOS (nix-darwin) specific configuration only
  • homeManager: Home Manager configuration (cross-platform user environment)

Host Aspects

Each host declares which services and features to enable:

# modules/aspects/hosts/harmony/harmony.nix
den.aspects.harmony = {
  includes = with my; [
    nginx
    (minecraft-servers { administrators = [ "oscar" ]; })
    (qbittorrent { administrators = [ "oscar" ]; })
    plex
    # ... more aspects
  ];
};

User Aspects

Each user declares their environment and applications:

# modules/aspects/users/oscar/oscar.nix
den.aspects.oscar = {
  user.description = "Oscar Marshall";

  includes = with my; [
    emacs
    git
    (host-flag "graphical" {
      includes = [ discord ghostty ];
    })
  ];
};

Key Features

Services

  • Media: Plex, Radarr, Sonarr, Prowlarr, Autobrr, Cross-seed
  • Downloads: qBittorrent (via Gluetun VPN)
  • Gaming: Minecraft servers
  • Infrastructure: Nginx reverse proxy with Let's Encrypt, Samba file sharing, ZFS storage

Desktop

  • GNOME on melaan (Wayland, via NixOS)
  • macOS desktop: Fonts, Homebrew-based applications, and Nix-managed development environment on OMARSHAL-M-2FD2
  • Applications: Emacs, Ghostty terminal, Zen Browser, Discord, Steam, Krita, PrusaSlicer
  • Framework laptop support via nixos-hardware

Development

  • Emacs with doom configuration
  • Git with per-machine configuration
  • GPG and SSH setup
  • Shell: Fish shell via Home Manager

Secrets Management

Secrets are encrypted using ragenix (age-based encryption):

# Edit a secret
nix run github:yaxitech/ragenix -- -e secrets/my-secret.age

# Re-key secrets after adding a new host
nix run github:yaxitech/ragenix -- -r

Public keys are defined in secrets/secrets.nix.

Updating

Update All Dependencies

nix flake update

Update Specific Input

nix flake update <input-name>

Regenerate flake.nix

The flake.nix is auto-generated by flake-file. After modifying inputs in modules/inputs.nix:

nix run .#write-flake

Adding New Configuration

Add a New Service

  1. Create modules/aspects/my/<service>.nix
  2. Define the aspect (with parameters if needed)
  3. Include in host's aspect: modules/aspects/hosts/<hostname>/<hostname>.nix

Add a New Host

NixOS host

  1. Create modules/aspects/hosts/<hostname>/<hostname>.nix
  2. Add a NixOS hardware-configuration.nix for the host
  3. Declare the host in modules/den.nix

Darwin host

  1. Create modules/aspects/hosts/<hostname>/<hostname>.nix
  2. Configure the host-specific nix-darwin options in your aspect
  3. Declare the host in modules/den.nix

Add a New User

  1. Create modules/aspects/users/<username>/<username>.nix
  2. Add user to host declarations in modules/den.nix

Documentation

License

This is a personal configuration repository. Feel free to use it as reference or template for your own configurations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors