Compare commits
6 Commits
f8d145b495
...
kodi-add-k
| Author | SHA1 | Date | |
|---|---|---|---|
| f757ea7271 | |||
| 64149713d2 | |||
| 88b413e0af | |||
| c5070eb4bf | |||
| 6b4dc1e6b7 | |||
| aadd8c7b6c |
110
CLAUDE.md
Normal file
110
CLAUDE.md
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Repository Overview
|
||||||
|
|
||||||
|
This is a NixOS configuration repository using flakes, managing multiple machines and home-manager configurations. The repository follows a modular architecture with reusable "roles" that can be composed for different machines.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
### Flake Structure
|
||||||
|
- **flake.nix**: Main entry point defining inputs (nixpkgs, home-manager, plasma-manager, etc.) and outputs for multiple NixOS configurations
|
||||||
|
- **Machines**: `nix-book`, `boxy`, `wixos` (WSL configuration)
|
||||||
|
- **Home configurations**: Standalone home-manager configuration for user `johno`
|
||||||
|
|
||||||
|
### Directory Structure
|
||||||
|
- `machines/`: Machine-specific configurations with hardware-configuration.nix
|
||||||
|
- `roles/`: Modular system configurations (audio, bluetooth, desktop, users, etc.)
|
||||||
|
- `home/`: Home Manager configurations and user-specific modules
|
||||||
|
- `home/modules/`: User environment modules (emacs, i3+sway, plasma-manager, tmux)
|
||||||
|
- `packages/`: Custom package definitions
|
||||||
|
|
||||||
|
### Role-Based Configuration System
|
||||||
|
The repository uses a custom "roles" system where each role is a NixOS module with enable options:
|
||||||
|
- `roles.desktop`: Desktop environment with sub-options for X11, Wayland, KDE, gaming, SDDM
|
||||||
|
- `roles.audio`: Audio configuration
|
||||||
|
- `roles.bluetooth`: Bluetooth support
|
||||||
|
- `roles.users`: User account management
|
||||||
|
- `roles.virtualisation`: Virtualization setup
|
||||||
|
- `roles.kodi`: Kodi media center
|
||||||
|
|
||||||
|
Example role usage in machine configuration:
|
||||||
|
```nix
|
||||||
|
roles = {
|
||||||
|
audio.enable = true;
|
||||||
|
desktop = {
|
||||||
|
enable = true;
|
||||||
|
gaming = true;
|
||||||
|
kde = true;
|
||||||
|
wayland = true;
|
||||||
|
};
|
||||||
|
users.enable = true;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Commands
|
||||||
|
|
||||||
|
### Building and Switching Configurations
|
||||||
|
```bash
|
||||||
|
# Build and switch to a specific machine configuration
|
||||||
|
sudo nixos-rebuild switch --flake .#<hostname>
|
||||||
|
|
||||||
|
# Build without switching
|
||||||
|
nixos-rebuild build --flake .#<hostname>
|
||||||
|
|
||||||
|
# Build home-manager configuration only
|
||||||
|
home-manager switch --flake .#johno
|
||||||
|
```
|
||||||
|
|
||||||
|
### Available Machine Configurations
|
||||||
|
- `nix-book`: Uses `home/home-nix-book.nix`
|
||||||
|
- `boxy`: Gaming desktop with AMD GPU, uses `home/home.nix`
|
||||||
|
- `wixos`: WSL configuration, uses `home/home.nix`
|
||||||
|
|
||||||
|
### Flake Operations
|
||||||
|
```bash
|
||||||
|
# Update flake inputs
|
||||||
|
nix flake update
|
||||||
|
|
||||||
|
# Check flake
|
||||||
|
nix flake check
|
||||||
|
|
||||||
|
# Show flake info
|
||||||
|
nix flake show
|
||||||
|
```
|
||||||
|
|
||||||
|
### Bootstrap New Machine
|
||||||
|
Use the provided bootstrap script:
|
||||||
|
```bash
|
||||||
|
sudo ./bootstrap.sh <hostname>
|
||||||
|
```
|
||||||
|
This script pulls from the remote git repository and applies the configuration.
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
### Adding New Machines
|
||||||
|
1. Create new directory in `machines/<hostname>/`
|
||||||
|
2. Add `configuration.nix` with role assignments
|
||||||
|
3. Include hardware-configuration.nix (generated by nixos-generate-config)
|
||||||
|
4. Add nixosConfiguration to flake.nix outputs
|
||||||
|
|
||||||
|
### Adding New Roles
|
||||||
|
1. Create directory in `roles/<role-name>/`
|
||||||
|
2. Create `default.nix` with module definition using mkEnableOption
|
||||||
|
3. Add role import to `roles/default.nix`
|
||||||
|
4. Configure role options in machine configurations
|
||||||
|
|
||||||
|
### Home Manager Modules
|
||||||
|
- Located in `home/modules/`
|
||||||
|
- Each module has its own `default.nix`
|
||||||
|
- Imported in main home configuration files
|
||||||
|
|
||||||
|
## Key Configuration Details
|
||||||
|
|
||||||
|
- **Experimental features**: nix-command and flakes are enabled
|
||||||
|
- **User**: Primary user is `johno` with trusted-user privileges
|
||||||
|
- **Locale**: en_US.UTF-8, America/Los_Angeles timezone
|
||||||
|
- **SSH**: OpenSSH enabled on all configurations
|
||||||
|
- **Garbage collection**: Automatic, deletes older than 10 days
|
||||||
|
- **Unfree packages**: Allowed globally
|
||||||
@@ -39,6 +39,7 @@ in
|
|||||||
# '')
|
# '')
|
||||||
|
|
||||||
pkgs.bitwarden
|
pkgs.bitwarden
|
||||||
|
pkgs.claude-code
|
||||||
pkgs.codex
|
pkgs.codex
|
||||||
pkgs.dunst
|
pkgs.dunst
|
||||||
pkgs.element-desktop
|
pkgs.element-desktop
|
||||||
@@ -55,7 +56,7 @@ in
|
|||||||
pkgs.moonlight-qt
|
pkgs.moonlight-qt
|
||||||
pkgs.ncdu
|
pkgs.ncdu
|
||||||
pkgs.nextcloud-talk-desktop
|
pkgs.nextcloud-talk-desktop
|
||||||
#pkgs.openscad-unstable
|
pkgs.openscad-unstable
|
||||||
pkgs.pandoc
|
pkgs.pandoc
|
||||||
#pkgs.pinentry-qt
|
#pkgs.pinentry-qt
|
||||||
#pkgs.pytest
|
#pkgs.pytest
|
||||||
@@ -67,6 +68,10 @@ in
|
|||||||
pkgs.wofi
|
pkgs.wofi
|
||||||
pkgs.vlc
|
pkgs.vlc
|
||||||
|
|
||||||
|
## Kubernetes cluster management
|
||||||
|
pkgs.kubectl
|
||||||
|
pkgs.kubernetes-helm
|
||||||
|
|
||||||
globalInputs.google-cookie-retrieval.packages.${system}.default
|
globalInputs.google-cookie-retrieval.packages.${system}.default
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
desktop = {
|
desktop = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wayland = true;
|
wayland = true;
|
||||||
gaming = true;
|
gaming = false;
|
||||||
kde = true;
|
kde = true;
|
||||||
sddm = true;
|
sddm = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ in
|
|||||||
{
|
{
|
||||||
users.extraUsers.kodi = {
|
users.extraUsers.kodi = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "wheel" "networkmanager" "audio" "video" ];
|
extraGroups = [ "wheel" "networkmanager" "audio" "video" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
@@ -38,10 +38,12 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
kodiPkg
|
kodiPkg
|
||||||
wget
|
wget
|
||||||
];
|
];
|
||||||
|
|
||||||
|
programs.kdeconnect.enable = true;
|
||||||
|
|
||||||
services = if cfg.autologin then {
|
services = if cfg.autologin then {
|
||||||
displayManager = {
|
displayManager = {
|
||||||
autoLogin.enable = true;
|
autoLogin.enable = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user