agents
This commit is contained in:
95
AGENTS.md
95
AGENTS.md
@@ -206,3 +206,98 @@ Key inputs:
|
|||||||
- `sops-nix` - Secrets management
|
- `sops-nix` - Secrets management
|
||||||
- `lanzaboote` - Secure boot
|
- `lanzaboote` - Secure boot
|
||||||
- `jovian` - Steam Deck support (allyx)
|
- `jovian` - Steam Deck support (allyx)
|
||||||
|
|
||||||
|
## Lib Module (`lib/`)
|
||||||
|
|
||||||
|
Custom utility library exposed via `lib.mjallen.*` through Snowfall Lib. Used for creating modules and managing versions.
|
||||||
|
|
||||||
|
### Directory Structure
|
||||||
|
```
|
||||||
|
lib/
|
||||||
|
├── default.nix # Entry point: exports module, file, versioning
|
||||||
|
├── README.md # Detailed documentation
|
||||||
|
├── module/ # Module creation helpers
|
||||||
|
│ └── default.nix
|
||||||
|
├── file/ # File/path utilities
|
||||||
|
│ └── default.nix
|
||||||
|
└── versioning/ # Multi-source version pinning
|
||||||
|
└── default.nix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Module Utilities (`lib.mjallen.module`)
|
||||||
|
|
||||||
|
**`mkModule`** - Create NixOS service modules with standardized options:
|
||||||
|
```nix
|
||||||
|
lib.mjallen.module.mkModule {
|
||||||
|
config, name, description, options, moduleConfig, domain ? "services"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Standard options: `enable`, `port`, `reverseProxy`, `firewall`, `createUser`, `configureDb`, `redis`, `puid`, `pgid`, `timeZone`, etc.
|
||||||
|
|
||||||
|
**`mkContainerService`** - For Podman/OCI containers (auto-generates container definition):
|
||||||
|
```nix
|
||||||
|
lib.mjallen.module.mkContainerService {
|
||||||
|
config, name, image, internalPort, description, options, volumes, environment
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**`mkSopsEnvFile`** - Generate SOPS secrets + template env-file:
|
||||||
|
```nix
|
||||||
|
lib.mjallen.module.mkSopsEnvFile {
|
||||||
|
secrets, name, content, restartUnit, owner, group, mode, sopsFile
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Option Helpers:**
|
||||||
|
- `mkOpt type default description` - Standard option
|
||||||
|
- `mkBoolOpt default description` - Boolean option
|
||||||
|
- `mkReverseProxyOpt name` - Caddy reverse proxy sub-options
|
||||||
|
|
||||||
|
**Convenience Shorthands:**
|
||||||
|
- `enabled` = `{ enable = true; }`
|
||||||
|
- `disabled` = `{ enable = false; }`
|
||||||
|
|
||||||
|
### Home Manager Utilities
|
||||||
|
|
||||||
|
**`mkHomeModule`** - Create Home Manager modules:
|
||||||
|
```nix
|
||||||
|
lib.mjallen.module.mkHomeModule {
|
||||||
|
config, domain, name, description, options, moduleConfig
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### File Utilities (`lib.mjallen.file`)
|
||||||
|
|
||||||
|
- `readFile path` - Read file contents
|
||||||
|
- `pathExists path` - Check if path exists
|
||||||
|
- `safeImport path default` - Safe Nix import
|
||||||
|
- `getFile relativePath` - Get path relative to flake root
|
||||||
|
- `importModulesRecursive path` - Recursively discover Nix modules
|
||||||
|
- `scanSystems systemsPath` - Discover system configurations
|
||||||
|
- `filterNixOSSystems systems` - Filter for Linux systems
|
||||||
|
- `filterDarwinSystems systems` - Filter for macOS systems
|
||||||
|
- `scanHomes homesPath` - Parse home-manager configurations
|
||||||
|
|
||||||
|
### Versioning Utilities (`lib.mjallen.versioning`)
|
||||||
|
|
||||||
|
For packages with `version.json` (multi-variant source pinning):
|
||||||
|
|
||||||
|
- `selectVariant spec variantName system` - Select variant from spec
|
||||||
|
- `render value variables` - Template substitution (`${var}`)
|
||||||
|
- `mkSrc pkgs comp variables` - Build single source
|
||||||
|
- `mkAllSources pkgs selected` - Build all sources for selected variant
|
||||||
|
|
||||||
|
See `lib/versioning/default.nix` for full API and `docs/version.schema.json` for schema.
|
||||||
|
|
||||||
|
### Usage in Packages
|
||||||
|
|
||||||
|
Create `packages/<name>/version.json` with variant definitions, then use:
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
versioning = inputs.self.lib.mjallen.versioning;
|
||||||
|
spec = inputs.self.lib.mjallen.file.readFile ./version.json;
|
||||||
|
selected = versioning.selectVariant spec variantName system;
|
||||||
|
sources = versioning.mkAllSources pkgs selected;
|
||||||
|
in
|
||||||
|
# Use sources.componentName for each source
|
||||||
|
```
|
||||||
|
|||||||
@@ -18,5 +18,12 @@ pre-commit-hooks-nix.lib.${pkgs.stdenv.hostPlatform.system}.run {
|
|||||||
lib.snowfall.fs.get-file "treefmt.nix"
|
lib.snowfall.fs.get-file "treefmt.nix"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
nixfmt-rfc-style = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.nixfmt-rfc-style;
|
||||||
|
};
|
||||||
|
statix = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ in
|
|||||||
output = [ "text" ];
|
output = [ "text" ];
|
||||||
};
|
};
|
||||||
limit = {
|
limit = {
|
||||||
context = 262144;
|
context = 131072;
|
||||||
output = 262144;
|
output = 32768;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ let
|
|||||||
"30"
|
"30"
|
||||||
"--jinja"
|
"--jinja"
|
||||||
"--ctx-size"
|
"--ctx-size"
|
||||||
"4096"
|
"131072"
|
||||||
"--threads"
|
"--threads"
|
||||||
"8"
|
"8"
|
||||||
"--batch-size"
|
"--batch-size"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ in
|
|||||||
brightnessctl
|
brightnessctl
|
||||||
dconf
|
dconf
|
||||||
disko
|
disko
|
||||||
|
kdiskmark
|
||||||
nil
|
nil
|
||||||
nix-output-monitor
|
nix-output-monitor
|
||||||
nixos-anywhere
|
nixos-anywhere
|
||||||
|
|||||||
Reference in New Issue
Block a user