Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6f4bb7955 | |||
| 74d65a0d75 | |||
| 85bd12778a | |||
| d9565448b9 | |||
| af2655f9e2 | |||
| 6d0684610e | |||
| 17c3a3189f | |||
| 18d1ce711d | |||
| cbdb42f333 | |||
| b44775e3e5 | |||
| 1444912326 |
@@ -0,0 +1,92 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
# Apply configuration (switch/boot/test)
|
||||
sudo nixos-rebuild switch --flake '.#jupiter'
|
||||
sudo nixos-rebuild switch --flake '.#mibook'
|
||||
|
||||
# Build without switching (CI-style check)
|
||||
nix build '.#nixosConfigurations.jupiter.config.system.build.toplevel'
|
||||
|
||||
# Update all flake inputs
|
||||
nix flake update
|
||||
|
||||
# Format Nix files
|
||||
nixfmt-rfc-style <file> # or: find . -name '*.nix' | xargs nixfmt-rfc-style
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
This is a flake-parts NixOS configuration for two machines:
|
||||
|
||||
- **jupiter** — home server running media/automation services
|
||||
- **mibook** — laptop running KDE desktop + development tools
|
||||
|
||||
### Module Loading Chain
|
||||
|
||||
```
|
||||
flake.nix
|
||||
└── machines/configuration.nix # flake-parts module; defines nixosConfigurations
|
||||
├── machines/core/ # base modules applied to every machine
|
||||
│ ├── core.nix # system packages, locale, timezone
|
||||
│ ├── network.nix
|
||||
│ ├── nix.nix
|
||||
│ └── users.nix
|
||||
├── modules/ # custom NixOS option modules (my.profiles.*, my.hardware.*, my.services.*)
|
||||
│ ├── environments/ # per-service/app profiles
|
||||
│ ├── hardware/ # hardware profiles (nvidia, bluetooth, sound, wifi)
|
||||
│ └── services/ # infrastructure services (vpn, webserver)
|
||||
└── machines/<name>/
|
||||
├── configuration.nix # machine-specific NixOS settings
|
||||
├── environments.nix # enables profiles via my.profiles.* / my.hardware.* options
|
||||
├── disks.nix
|
||||
└── hardware-configuration.nix
|
||||
```
|
||||
|
||||
### Profile / Module Pattern
|
||||
|
||||
Every module under `modules/` follows the same structure:
|
||||
|
||||
```nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
let cfg = config.my.profiles.<name>; in
|
||||
{
|
||||
options.my.profiles.<name>.enable = lib.mkEnableOption "...";
|
||||
config = lib.mkIf cfg.enable { ... };
|
||||
}
|
||||
```
|
||||
|
||||
Namespaces in use:
|
||||
- `my.profiles.*` — application/service profiles
|
||||
- `my.hardware.*` — hardware profiles
|
||||
- `my.services.*` — infrastructure services
|
||||
|
||||
Profiles are enabled per-machine in `machines/<name>/environments.nix`.
|
||||
|
||||
### Unstable Packages
|
||||
|
||||
`pkgs.unstable` is available everywhere via an overlay defined in `machines/configuration.nix`. Use it when a package isn't in the pinned stable channel (`nixpkgs/nixos-25.11`).
|
||||
|
||||
### Homepage Dashboard Integration
|
||||
|
||||
Modules that expose a web UI can self-register with the homepage dashboard by adding to `my.homepage.services`:
|
||||
|
||||
```nix
|
||||
my.homepage.services = [{
|
||||
group = "Services";
|
||||
name = "My Service";
|
||||
description = "...";
|
||||
href = "http://${hostName}:PORT";
|
||||
icon = "si-iconname"; # optional
|
||||
}];
|
||||
```
|
||||
|
||||
### Adding a New Service Module
|
||||
|
||||
1. Create `modules/environments/<name>/default.nix` following the profile pattern above.
|
||||
2. Add `./environments/<name>` to `modules/environments/default.nix` (or the relevant `default.nix`).
|
||||
3. Enable it in the target machine's `machines/<name>/environments.nix`.
|
||||
Generated
+44
-28
@@ -21,11 +21,11 @@
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1777988971,
|
||||
"narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
|
||||
"lastModified": 1778716662,
|
||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
|
||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -42,11 +42,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1775087534,
|
||||
"narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
|
||||
"lastModified": 1778716662,
|
||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
|
||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -69,11 +69,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1776796298,
|
||||
"narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=",
|
||||
"lastModified": 1781733627,
|
||||
"narHash": "sha256-U3yTuGBnmXvXoQI3qkpfEDsn9RovQPAjN7ndRco+3u0=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad",
|
||||
"rev": "3bbec39bc90eadfa031e6f3b77272f3f60803e39",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -92,11 +92,11 @@
|
||||
"nixpkgs-regression": "nixpkgs-regression"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778249748,
|
||||
"narHash": "sha256-D+3kaW4NUUaiFTsEpmregtGZVniljBThg/O0JIjRL8k=",
|
||||
"lastModified": 1782211048,
|
||||
"narHash": "sha256-WKITtytZtfU6m24eK/WVI0QHZpHv4VtTpDCR3414Q70=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nix",
|
||||
"rev": "616df97974fd29b79f83502f63854d6d471ee055",
|
||||
"rev": "cdf3b417b272ce2c1de41445378c17f4bebf6fb6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -142,12 +142,15 @@
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778143761,
|
||||
"narHash": "sha256-lkesY6x2X2qxlqLM7CT2iM/0rP2JB7fruPN3h8POXmI=",
|
||||
"lastModified": 1782166108,
|
||||
"narHash": "sha256-/EtnQBcKbsaCAGQ5VRcplrHRkR4ryqyLMpBfkVuG9Xw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "3bcaa367d4c550d687a17ac792fd5cda214ee871",
|
||||
"rev": "875776f0252fcb8618bb948640a0d1f7a5b362be",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -158,15 +161,15 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1771903837,
|
||||
"narHash": "sha256-jEA8WggGKtMFeNeCKq3NK8cLEjJmG6/RLUElYYbBZ0E=",
|
||||
"rev": "e764fc9a405871f1f6ca3d1394fb422e0a0c3951",
|
||||
"lastModified": 1780902259,
|
||||
"narHash": "sha256-YMnBf9lk/LYgvqfmSSJuOGigtRs5Lsy26pJHVlR9yMY=",
|
||||
"rev": "bd0ff2d3eac24699c3664d5966b9ef36f388e2ca",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/25.11/nixos-25.11.6495.e764fc9a4058/nixexprs.tar.xz"
|
||||
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.1550.bd0ff2d3eac2/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://channels.nixos.org/nixos-25.11/nixexprs.tar.xz"
|
||||
"url": "https://channels.nixos.org/nixos-26.05/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"nixpkgs-23-11": {
|
||||
@@ -218,11 +221,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1777954456,
|
||||
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
|
||||
"lastModified": 1781577229,
|
||||
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
|
||||
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -233,16 +236,29 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1778003029,
|
||||
"narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=",
|
||||
"lastModified": 1767892417,
|
||||
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
|
||||
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1782116945,
|
||||
"narHash": "sha256-G3tw/IXmaH6IQ2upZvhuN9sG8CkuX+BLuJDpE8hz0Ds=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5",
|
||||
"rev": "34268251cf5547d39063f2c5ea9a196246f7f3a6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-25.11",
|
||||
"ref": "nixos-26.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
@@ -252,7 +268,7 @@
|
||||
"nix": "nix",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
inputs = {
|
||||
nix.url = "github:NixOS/nix";
|
||||
nixpkgs.url = "nixpkgs/nixos-25.11";
|
||||
nixpkgs.url = "nixpkgs/nixos-26.05";
|
||||
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
@@ -11,7 +11,6 @@
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# hyprland.url = "github:hyprwm/Hyprland";
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
sync.enable = true;
|
||||
sync.enable = false;
|
||||
|
||||
nvidiaBusId = "PCI:01:00:0";
|
||||
intelBusId = "PCI:00:2:0";
|
||||
|
||||
@@ -19,7 +19,7 @@ in
|
||||
my.hardware = {
|
||||
bluetooth.enable = true;
|
||||
sound.enable = false;
|
||||
nvidia.enable = true;
|
||||
nvidia.enable = false;
|
||||
};
|
||||
my.services = {
|
||||
vpn.enable = true;
|
||||
|
||||
@@ -11,11 +11,6 @@ let
|
||||
hostName = config.networking.hostName;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# services.openthread-border-router isn't in nixos-25.11; pull from
|
||||
# nixpkgs-unstable. Package comes from the existing unstable overlay.
|
||||
"${self.inputs.nixpkgs-unstable}/nixos/modules/services/home-automation/openthread-border-router.nix"
|
||||
];
|
||||
|
||||
options.my.profiles.home-assistant = with lib; {
|
||||
enable = mkEnableOption "Home Automation";
|
||||
|
||||
Reference in New Issue
Block a user