qutebrowser: fix escape sequences and disable session restore
- Simplify escape sequences in bind commands (M, Z keys) - Add c.session.default_name = '' and c.session.store_size = 0 - Update AGENTS.md (trimmed to 150 lines) - Update flake.lock with latest dependencies
This commit is contained in:
@@ -4,74 +4,47 @@ This is a NixOS/Nix flake-based configuration repository using home-manager for
|
||||
|
||||
## Build Commands
|
||||
|
||||
### Evaluating Configuration
|
||||
### Evaluating
|
||||
```bash
|
||||
# Evaluate system config (Lauretta laptop)
|
||||
nix eval .#nixosConfigurations.lauretta.config.system.build.toplevel
|
||||
|
||||
# Evaluate flake info
|
||||
nix flake show
|
||||
|
||||
# Evaluate all outputs
|
||||
nix eval . --apply 'x: x'
|
||||
```
|
||||
|
||||
### Building
|
||||
```bash
|
||||
# Build VM
|
||||
nix build .#nixosConfigurations.vm.config.system.build.vm
|
||||
# Or with submodules
|
||||
# VM (with submodules for azos-core)
|
||||
nix build '.?submodules=1#nixosConfigurations.vm.config.system.build.vm'
|
||||
|
||||
# Build formatter (alejandra)
|
||||
# Formatter
|
||||
nix build .#formatter.x86_64-linux
|
||||
```
|
||||
|
||||
### Deploying
|
||||
```bash
|
||||
# Switch to new config (Lauretta)
|
||||
sudo nixos-rebuild switch --flake '.?submodules=1#lauretta'
|
||||
|
||||
# Update flake inputs
|
||||
nix flake update
|
||||
|
||||
# Update specific input
|
||||
nix flake lock --update-input azos-core
|
||||
nix flake update # Update all inputs
|
||||
nix flake lock --update-input X # Update specific input
|
||||
```
|
||||
|
||||
### Nix REPL
|
||||
```bash
|
||||
nix repl
|
||||
:lf .
|
||||
# Then explore with:
|
||||
inputs.nixpkgs.lib
|
||||
```
|
||||
|
||||
### Dev Shell
|
||||
### Dev Shell & REPL
|
||||
```bash
|
||||
nix develop .#shells.x86_64-linux.debugTexShell
|
||||
```
|
||||
|
||||
### Garbage Collection
|
||||
```bash
|
||||
sudo nix-collect-garbage --delete-old
|
||||
nix repl
|
||||
:lf .
|
||||
```
|
||||
|
||||
## Linting/Formatting
|
||||
|
||||
This project uses [alejandra](https://github.comkamadorama/alejandra) as the formatter.
|
||||
|
||||
Uses [alejandra](https://github.com/kamadorama/alejandra):
|
||||
```bash
|
||||
# Format all Nix files
|
||||
nix fmt
|
||||
|
||||
# Or use alejandra directly
|
||||
nix fmt # Format all Nix files
|
||||
alejandra .
|
||||
```
|
||||
|
||||
There are no automated tests in this repository. VM testing is manual:
|
||||
## Testing
|
||||
|
||||
Manual VM testing:
|
||||
```bash
|
||||
# Build and run VM
|
||||
nix build .#nixosConfigurations.vm.config.system.build.vm
|
||||
./result/bin/run-nixos-vm
|
||||
```
|
||||
@@ -79,15 +52,11 @@ nix build .#nixosConfigurations.vm.config.system.build.vm
|
||||
## Code Style Guidelines
|
||||
|
||||
### File Organization
|
||||
|
||||
- **Home-manager modules**: `modules/home-manager/<name>.nix`
|
||||
- **NixOS modules**: `modules/nixos/<name>.nix`
|
||||
- **Imports**: All modules are imported in `modules/home-manager/default.nix` and `modules/nixos/default.nix`
|
||||
- **Import sorting**: Alphabetical order in default.nix files
|
||||
- **Imports**: All modules in `modules/home-manager/default.nix` and `modules/nixos/default.nix` (alphabetical order)
|
||||
|
||||
### Nix Module Structure
|
||||
|
||||
Follow this template for home-manager modules:
|
||||
### Nix Module Template
|
||||
|
||||
```nix
|
||||
{
|
||||
@@ -101,100 +70,65 @@ Follow this template for home-manager modules:
|
||||
in {
|
||||
options.azos.<module-name>.enable = lib.mkOption {
|
||||
default = true;
|
||||
example = true;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
config = lib.mkIf isEnabled {
|
||||
home.packages = with pkgs; [
|
||||
<package1>
|
||||
<package2>
|
||||
];
|
||||
home.packages = with pkgs; [ pkg1 pkg2 ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Naming Conventions
|
||||
- Option paths: `config.azos.<module-name>.<option>`
|
||||
- Enable option: `enable` (bool), default `true`
|
||||
- Module names: kebab-case (`libreoffice.nix`, `git-config.nix`)
|
||||
- Variables: kebab-case (`isEnabled`)
|
||||
|
||||
- **Option paths**: `config.azos.<module-name>.<option>`
|
||||
- **Enable option**: Always `enable` (bool), default `true`
|
||||
- **Module names**: kebab-case (e.g., `libreoffice.nix`, `git-config.nix`)
|
||||
- **Variable names**: kebab-case in let bindings (e.g., `isEnabled`)
|
||||
|
||||
### Formatting Rules
|
||||
|
||||
- **Indentation**: 2 spaces
|
||||
- **Let bindings**: Multi-line format with `isEnabled` on its own line
|
||||
```nix
|
||||
let
|
||||
isEnabled =
|
||||
config.azos.module.enable;
|
||||
in
|
||||
```
|
||||
- **Imports**: Sorted alphabetically in default.nix
|
||||
- **Packages**: Use `with pkgs;` block for package lists
|
||||
### Formatting
|
||||
- Indentation: 2 spaces
|
||||
- Let bindings: multi-line with `isEnabled` on its own line
|
||||
- Packages: Use `with pkgs; [ ... ]` syntax
|
||||
|
||||
### Imports
|
||||
|
||||
- Always include `{...}` for module args even if unused
|
||||
- Standard module args: `lib, config, pkgs, ...`
|
||||
- Always include `{...}` for module args
|
||||
- Standard args: `lib, config, pkgs, ...`
|
||||
- Use `./relative/path.nix` for local imports
|
||||
|
||||
### Adding New Modules
|
||||
|
||||
1. Create file in appropriate directory (`modules/home-manager/` or `modules/nixos/`)
|
||||
2. Add import to `modules/<type>/default.nix` in alphabetical order
|
||||
3. Use the standard module template above
|
||||
4. Run `nix fmt` to format
|
||||
|
||||
### Option Patterns
|
||||
- Boolean enable: `lib.mkOption { default = true; type = lib.types.bool; }`
|
||||
- Conditional config: `lib.mkIf isEnabled { ... }`
|
||||
- User-overridable: `lib.mkDefault`
|
||||
- Force value: `lib.mkForce` (sparingly)
|
||||
|
||||
- **Boolean enable**: Always use `lib.mkOption` with `default = true`, `type = lib.types.bool`
|
||||
- **Conditional config**: Always use `lib.mkIf isEnabled` wrapper
|
||||
- **Package lists**: Use `with pkgs; [ ... ]` syntax
|
||||
### Home-Manager vs NixOS
|
||||
- Home-manager: `home.packages`, `home.file`, `programs.<program>`
|
||||
- NixOS: `config.services`, `environment.systemPackages`
|
||||
|
||||
### Error Handling
|
||||
## Adding New Modules
|
||||
|
||||
- Use `lib.mkIf` for conditional configuration rather than if-then-else
|
||||
- Use `lib.mkDefault` for values that can be overridden by users
|
||||
- Use `lib.mkForce` sparingly for values that must not be overridden
|
||||
|
||||
### Home-Manager Specific
|
||||
|
||||
- Config goes under `home` attribute (e.g., `home.packages`, `home.file`, `home.sessionVariables`)
|
||||
- Use `programs.<program>` for program configurations
|
||||
- Use `services.<service>` for system services
|
||||
|
||||
### NixOS Specific
|
||||
|
||||
- Config goes under `config` directly (e.g., `services`, `environment.systemPackages`)
|
||||
- Use `environment.systemPackages` for system-wide packages
|
||||
- Use `users.users.<name>` for user configuration
|
||||
1. Create file in `modules/home-manager/` or `modules/nixos/`
|
||||
2. Add import to `modules/<type>/default.nix` (alphabetical)
|
||||
3. Use module template above
|
||||
4. Run `nix fmt`
|
||||
|
||||
## Key Files
|
||||
|
||||
- `flake.nix`: Main flake definition, defines systems, overlays, modules
|
||||
- `modules/home-manager/default.nix`: Home-manager module imports
|
||||
- `modules/nixos/default.nix`: NixOS module imports
|
||||
- `nixos/configuration.nix`: Lauretta laptop configuration
|
||||
- `nixos/configuration-vm.nix`: Test VM configuration
|
||||
- `overlays/`: Custom package overlays
|
||||
- `pkgs/`: Custom packages
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `flake.nix` | Main flake, defines systems, overlays |
|
||||
| `modules/home-manager/default.nix` | Home-manager imports |
|
||||
| `modules/nixos/default.nix` | NixOS imports |
|
||||
| `nixos/configuration.nix` | Lauretta laptop config |
|
||||
| `nixos/configuration-vm.nix` | Test VM config |
|
||||
| `overlays/` | Custom package overlays |
|
||||
| `pkgs/` | Custom packages |
|
||||
| `azos-core/` | Shared modules (submodule) |
|
||||
|
||||
## Common Tasks
|
||||
|
||||
### Add new package to system
|
||||
1. Create or edit module in `modules/nixos/`
|
||||
2. Add to `environment.systemPackages = with pkgs; [ pkg ]`
|
||||
**Add system package**: Edit NixOS module, add to `environment.systemPackages = with pkgs; [ pkg ]`
|
||||
|
||||
### Add new home-manager package
|
||||
1. Create or edit module in `modules/home-manager/`
|
||||
2. Add to `home.packages = with pkgs; [ pkg ]`
|
||||
**Add home-manager package**: Edit module, add to `home.packages = with pkgs; [ pkg ]`
|
||||
|
||||
### Add new system service
|
||||
1. Edit appropriate NixOS module
|
||||
2. Add service config under `services.<service>`
|
||||
|
||||
### Test changes locally
|
||||
1. Build VM: `nix build .#nixosConfigurations.vm.config.system.build.vm`
|
||||
2. Run VM: `./result/bin/run-nixos-vm`
|
||||
**Add system service**: Edit NixOS module, add under `services.<service>`
|
||||
Reference in New Issue
Block a user