Update flake to unstable, add chromium/opencode modules, update emacs config

This commit is contained in:
2026-03-15 01:27:58 +02:00
parent 68d2c50721
commit 07fb5656f2
12 changed files with 299 additions and 71 deletions
+200
View File
@@ -0,0 +1,200 @@
# AGENTS.md - Guidelines for Agentic Coding in Azos
This is a NixOS/Nix flake-based configuration repository using home-manager for dotfiles and system configuration.
## Build Commands
### Evaluating Configuration
```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
nix build '.?submodules=1#nixosConfigurations.vm.config.system.build.vm'
# Build formatter (alejandra)
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 REPL
```bash
nix repl
:lf .
# Then explore with:
inputs.nixpkgs.lib
```
### Dev Shell
```bash
nix develop .#shells.x86_64-linux.debugTexShell
```
### Garbage Collection
```bash
sudo nix-collect-garbage --delete-old
```
## Linting/Formatting
This project uses [alejandra](https://github.comkamadorama/alejandra) as the formatter.
```bash
# Format all Nix files
nix fmt
# Or use alejandra directly
alejandra .
```
There are no automated tests in this repository. VM testing is manual:
```bash
# Build and run VM
nix build .#nixosConfigurations.vm.config.system.build.vm
./result/bin/run-nixos-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
### Nix Module Structure
Follow this template for home-manager modules:
```nix
{
lib,
config,
pkgs,
...
}: let
isEnabled =
config.azos.<module-name>.enable;
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>
];
};
}
```
### Naming Conventions
- **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
### Imports
- Always include `{...}` for module args even if unused
- Standard module 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**: 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
### Error Handling
- 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
## 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
## Common Tasks
### Add new package to system
1. Create or edit module in `modules/nixos/`
2. 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 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`
Generated
+16 -16
View File
@@ -64,11 +64,11 @@
]
},
"locked": {
"lastModified": 1770260404,
"narHash": "sha256-3iVX1+7YUIt23hBx1WZsUllhbmP2EnXrV8tCRbLxHc8=",
"lastModified": 1772020340,
"narHash": "sha256-aqBl3GNpCadMoJ/hVkWTijM1Aeilc278MjM+LA3jK6g=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0d782ee42c86b196acff08acfbf41bb7d13eed5b",
"rev": "36e38ca0d9afe4c55405fdf22179a5212243eecc",
"type": "github"
},
"original": {
@@ -98,11 +98,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1771423359,
"narHash": "sha256-yRKJ7gpVmXbX2ZcA8nFi6CMPkJXZGjie2unsiMzj3Ig=",
"lastModified": 1771969195,
"narHash": "sha256-qwcDBtrRvJbrrnv1lf/pREQi8t2hWZxVAyeMo7/E9sw=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "740a22363033e9f1bb6270fbfb5a9574067af15b",
"rev": "41c6b421bdc301b2624486e11905c9af7b8ec68e",
"type": "github"
},
"original": {
@@ -128,11 +128,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1771369470,
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
"lastModified": 1771848320,
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0182a361324364ae3f436a63005877674cf45efb",
"rev": "2fc6539b481e1d2569f25f8799236694180c0993",
"type": "github"
},
"original": {
@@ -144,11 +144,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1771207753,
"narHash": "sha256-b9uG8yN50DRQ6A7JdZBfzq718ryYrlmGgqkRm9OOwCE=",
"lastModified": 1771923393,
"narHash": "sha256-Fy0+UXELv9hOE8WjYhJt8fMDLYTU2Dqn3cX4BwoGBos=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d1c15b7d5806069da59e819999d70e1cec0760bf",
"rev": "ea7f1f06811ce7fcc81d6c6fd4213150c23edcf2",
"type": "github"
},
"original": {
@@ -174,16 +174,16 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1771419570,
"narHash": "sha256-bxAlQgre3pcQcaRUm/8A0v/X8d2nhfraWSFqVmMcBcU=",
"lastModified": 1773476965,
"narHash": "sha256-Laaj25PvGeoP5SPhMfMGxvWqM6ZjZ6LdUeEhP6b3czY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6d41bc27aaf7b6a3ba6b169db3bd5d6159cfaa47",
"rev": "f82ce7af0b79ac154b12e27ed800aeb97413723c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.11",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
+3 -2
View File
@@ -5,8 +5,9 @@
self.submodules = true;
# Nixpkgs
#Temporarily
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
#Need unstable for opencode and agent-shell
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# Unused unstable
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
+21
View File
@@ -0,0 +1,21 @@
{
lib,
config,
pkgs,
...
}: let
isEnabled =
config.azos.chromium.enable;
in {
options.azos.chromium.enable = lib.mkOption {
default = true;
example = true;
type = lib.types.bool;
};
config = lib.mkIf isEnabled {
home.packages = with pkgs; [
chromium
];
};
}
+2
View File
@@ -18,7 +18,9 @@
./gimp.nix
# ./printing.nix
./libreoffice.nix
./chromium.nix
./hyprland-suite.nix
# ./gnuradio.nix
./opencode.nix
];
}
+21
View File
@@ -0,0 +1,21 @@
{
lib,
config,
pkgs,
...
}: let
isEnabled =
config.azos.opencode.enable;
in {
options.azos.opencode.enable = lib.mkOption {
default = true;
example = true;
type = lib.types.bool;
};
config = lib.mkIf isEnabled {
home.packages = with pkgs; [
opencode
];
};
}
+1 -1
View File
@@ -17,7 +17,7 @@ in {
home.packages = with pkgs; [
reaper
helm #TODO this synth had better work
surge
# surge
lsp-plugins
vital
];
+2 -2
View File
@@ -113,17 +113,17 @@
git
tmux
killall
brightnessctl
];
fonts.enableDefaultPackages = true;
services.upower.enable = true;
programs.light.enable = true;
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
system.stateVersion = "25.05"; # Did you read the comment?
system.stateVersion = "25.11"; # Did you read the comment?
}
+5 -6
View File
@@ -46,12 +46,11 @@
#Oh my god disable sleep on lid closed
services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore";
systemd.sleep.extraConfig = ''
[Sleep]
AllowSuspend=yes
AllowHibernation=no
AllowSuspendThenHibernate=no
'';
systemd.sleep.settings.Sleep = {
AllowSuspend = true;
AllowHibernation = false;
AllowSuspendThenHibernate = false;
};
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
+6 -39
View File
@@ -2,50 +2,17 @@
orgTrivialBuild,
epkgs,
pkgs,
}: let
ghgptel = (epkgs.callPackage epkgs.trivialBuild {
pname = "gptel";
version = "0.9.9.3";
src = pkgs.fetchFromGitHub {
owner = "karthink";
repo = "gptel";
rev = "273c0f93958c1ffa85e396717b504903eda36bce"; # Use a specific commit hash for reproducibility
sha256 = "sha256-gVgdFLi6RGUCD3ZXzOIo5XpTNmP/9xMAO5nyWu1zVlM=";
};
})
orgTrivialBuild {
} : orgTrivialBuild {
pname = "azos-emacs-lauretta";
version = "0.1.6";
src = ./elisp/azos-emacs-lauretta.org;
packageRequires = with epkgs; [
pkgs.azos-emacs-base
pkgs.azos-emacs-dev
pkgs.azos-emacs-editor
pkgs.azos-emacs-exwm
pkgs.azos-emacs-station
ghgptel
(epkgs.callPackage epkgs.trivialBuild {
pname = "gptel-autocomplete";
version = "2025-06-18";
src = pkgs.fetchFromGitHub {
owner = "JDNdeveloper";
repo = "gptel-autocomplete";
rev = "8ace326a6e7b8a3a4df7a6e80272b472e7fbd167"; # Use a specific commit hash for reproducibility
sha256 = "sha256-gVgdFLi6RGUCD3ZXzOIo5XpTNmP/9lMAO5nyWu1zVlM=";
};
buildInputs = with epkgs; [
ghgptel
];
})
(epkgs.callPackage epkgs.trivialBuild {
pname = "gptel-agent";
version = "0.0.1";
src = pkgs.fetchFromGitHub {
owner = "karthink";
repo = "gptel-agent";
rev = "8ba9056da2341468192e6417d47cb50e26636e97"; # Use a specific commit hash for reproducibility
sha256 = "sha256-M2J/K3UHoAbDWQjYPD8ZdL6uHBggvPh+ZvJ+xnbXJuo=";
};
buildInputs = with epkgs; [
ghgptel
];
})
agent-shell
];
}
+21 -4
View File
@@ -6,6 +6,10 @@
#+begin_src emacs-lisp
(require 'azos-emacs-base)
(require 'azos-emacs-dev)
(require 'azos-emacs-editor)
(require 'azos-emacs-exwm)
(require 'azos-emacs-station)
#+end_src
* Lauretta specific
@@ -14,16 +18,29 @@
#+begin_src emacs-lisp
(setq
gptel-model 'meta/llama-3.1-8b-instant
gptel-model 'openai/gpt-oss-120b
gptel-backend
(gptel-make-openai "Groq"
:host "api.groq.com"
:endpoint "/openai/v1/chat/completions"
:stream t
:key "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"
:models '('meta/llama-3.1-8b-instant)))
(setq gptel-agent-dirs '("/home/aner/.agents"))
(gptel-agent-update)
:models '(openai/gpt-oss-120b)))
;; This is where I would update agents if I had them
;; (setq gptel-agent-dirs '("/home/aner/.agents"))
;; (gptel-agent-update)
(use-package agent-shell
:ensure t
:ensure-system-package
:config
;; Evil state-specific RET behavior: insert mode = newline, normal mode = send
(evil-define-key 'insert agent-shell-mode-map (kbd "RET") #'newline)
(evil-define-key 'normal agent-shell-mode-map (kbd "RET") #'comint-send-input)
(add-hook 'diff-mode-hook
(lambda ()
(when (string-match-p "\\*agent-shell-diff\\*" (buffer-name))
(evil-emacs-state)))))
#+end_src
** Headphones