Compare commits
7 Commits
d36071134c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| fcbd126288 | |||
| d9b49b7aea | |||
| b403b620f5 | |||
| e75de17f2f | |||
| 55ba34e517 | |||
| 5cb9b1f992 | |||
| 449afdaa36 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,3 +7,5 @@ BrewFile.lock.json
|
||||
/nix-shells/macos-vm/
|
||||
|
||||
logs/
|
||||
|
||||
openclaw/.npm-global/
|
||||
@@ -1,9 +1,11 @@
|
||||
Use idiomatic nix.
|
||||
|
||||
Before making changes, read the appropriate entries of the following manuals:
|
||||
If needed, read the appropriate entries of the following manuals:
|
||||
- man configuration.nix
|
||||
- man home-configuration.nix
|
||||
- ... among other resources
|
||||
|
||||
Do not read the entire manual at once, instead search only for what you need.
|
||||
|
||||
After editing nix configurations, always run `nix flake check nixos/` to check for errors.
|
||||
Do NOT attempt to rebuild the system, let the user handle that.
|
||||
|
||||
@@ -91,11 +91,6 @@
|
||||
];
|
||||
};
|
||||
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
# Packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
@@ -138,7 +133,73 @@
|
||||
};
|
||||
|
||||
# Set up virtualisation
|
||||
virtualisation.libvirtd.enable = true;
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
|
||||
# Enable TPM emulation (for Windows 11)
|
||||
qemu = {
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable USB redirection
|
||||
virtualisation.spiceUSBRedirection.enable = true;
|
||||
|
||||
# Allow VM management
|
||||
users.groups.libvirtd.members = [ "trude" ];
|
||||
users.groups.kvm.members = [ "trude" ];
|
||||
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
# Noise cancellation
|
||||
programs.noisetorch.enable = true;
|
||||
|
||||
# UPS (Green Cell 2000VA)
|
||||
power.ups = {
|
||||
enable = true;
|
||||
mode = "standalone";
|
||||
ups.greencell = {
|
||||
driver = "nutdrv_qx";
|
||||
port = "auto";
|
||||
description = "Green Cell UPS 2000VA";
|
||||
directives = [
|
||||
"vendorid = 0001"
|
||||
"productid = 0000"
|
||||
];
|
||||
};
|
||||
users.upsmon = {
|
||||
passwordFile = "${pkgs.writeText "upsmon-password" "upsmonpass"}";
|
||||
upsmon = "primary";
|
||||
instcmds = [ "ALL" ];
|
||||
};
|
||||
upsmon.monitor.greencell = {
|
||||
user = "upsmon";
|
||||
};
|
||||
};
|
||||
|
||||
# RAM Optimizations (important for AI workloads)
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
algorithm = "zstd";
|
||||
# Total "virtual" swap size. 100% of RAM is safe for zRAM.
|
||||
memoryPercent = 100; # Drop to 50% if 64+GB of RAM
|
||||
};
|
||||
services.earlyoom = {
|
||||
enable = true;
|
||||
# Start killing processes when available RAM drops below 10%
|
||||
freeMemThreshold = 10; # Drop to 5% if 64+GB of RAM, increase if on <16GB RAM.
|
||||
# Start killing processes when available swap drops below 10%
|
||||
freeSwapThreshold = 10;
|
||||
};
|
||||
boot.kernel.sysctl = {
|
||||
"vm.swappiness" = 100;
|
||||
"vm.vfs_cache_pressure" = 50;
|
||||
# Helps prevent the system from "stuttering" when it starts swapping
|
||||
"vm.watermark_boost_factor" = 0;
|
||||
};
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall.enable = true;
|
||||
|
||||
12
nixos/flake.lock
generated
12
nixos/flake.lock
generated
@@ -7,11 +7,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769622371,
|
||||
"narHash": "sha256-Cs1/+P3ntxl9mOIL7/QtItBAzQJ2xjvTMHv7qw0nFV0=",
|
||||
"lastModified": 1772380461,
|
||||
"narHash": "sha256-O3ukj3Bb3V0Tiy/4LUfLlBpWypJ9P0JeUgsKl2nmZZY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "02d763228d8aff317e6e5a319474b6d4d9d826a5",
|
||||
"rev": "f140aa04d7d14f8a50ab27f3691b5766b17ae961",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -22,11 +22,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1769461804,
|
||||
"narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
|
||||
"lastModified": 1772198003,
|
||||
"narHash": "sha256-I45esRSssFtJ8p/gLHUZ1OUaaTaVLluNkABkk6arQwE=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d",
|
||||
"rev": "dd9b079222d43e1943b6ebd802f04fd959dc8e61",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -17,11 +17,19 @@
|
||||
nil
|
||||
bat
|
||||
|
||||
vscode
|
||||
vesktop
|
||||
google-chrome
|
||||
localsend
|
||||
#stremio
|
||||
element-desktop
|
||||
|
||||
# Dev tools / AI
|
||||
vscode
|
||||
codex
|
||||
opencode-desktop
|
||||
nodejs
|
||||
python3
|
||||
lmstudio
|
||||
|
||||
# VR / Games
|
||||
bs-manager
|
||||
@@ -29,6 +37,7 @@
|
||||
prismlauncher
|
||||
protonup-qt
|
||||
wayvr
|
||||
unityhub
|
||||
|
||||
# Gnome Extensions
|
||||
gnomeExtensions.caffeine
|
||||
@@ -48,14 +57,12 @@
|
||||
switcheroo
|
||||
wordbook
|
||||
textpieces
|
||||
gnome-sound-recorder
|
||||
|
||||
# Virtualisation
|
||||
gnome-boxes # VM management
|
||||
dnsmasq # VM networking
|
||||
|
||||
# AI
|
||||
lmstudio
|
||||
nodejs
|
||||
gnome-boxes
|
||||
dnsmasq
|
||||
phodav
|
||||
|
||||
# Scripts
|
||||
(pkgs.writeShellScriptBin "colors" ''
|
||||
@@ -198,6 +205,7 @@
|
||||
raid = "sudo mdadm --detail /dev/md0";
|
||||
unp = "unp -U";
|
||||
cat = "bat";
|
||||
lmcodex = "codex --oss -m qwen3-coder-30b-a3b-instruct";
|
||||
};
|
||||
historySize = 10000;
|
||||
historyFileSize = 100000;
|
||||
@@ -412,6 +420,7 @@
|
||||
"_processor_usage_"
|
||||
"_gpu#1_usage_"
|
||||
"_memory_usage_"
|
||||
"_memory_swap_usage_"
|
||||
"__temperature_max__"
|
||||
];
|
||||
icon-style = 1;
|
||||
@@ -437,10 +446,26 @@
|
||||
};
|
||||
};
|
||||
|
||||
programs.opencode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
autoshare = false; # No telemetry
|
||||
systemd.user.services.noisetorch = {
|
||||
Unit = {
|
||||
Description = "NoiseTorch Noise Cancelling";
|
||||
After = [
|
||||
"graphical-session.target"
|
||||
"pipewire.service"
|
||||
"wireplumber.service"
|
||||
];
|
||||
Wants = [ "graphical-session.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.noisetorch}/bin/noisetorch -i";
|
||||
ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u";
|
||||
RemainAfterExit = true;
|
||||
TimeoutStartSec = "30s";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
1
openclaw/.envrc
Normal file
1
openclaw/.envrc
Normal file
@@ -0,0 +1 @@
|
||||
use flake
|
||||
@@ -1,24 +0,0 @@
|
||||
# Openclaw
|
||||
|
||||
Development shell for [Openclaw](https://github.com/openclaw/openclaw) with Ollama.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nix develop
|
||||
```
|
||||
|
||||
Auto-starts:
|
||||
- **ollama** on http://localhost:11434
|
||||
- **openclaw-gateway** (uses config from `~/.openclaw`)
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
ollama list # List models
|
||||
ollama run llama3.2:3b # Chat with model
|
||||
|
||||
# Stop services
|
||||
pkill ollama
|
||||
pkill openclaw-gateway
|
||||
```
|
||||
86
openclaw/flake.lock
generated
86
openclaw/flake.lock
generated
@@ -18,95 +18,17 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nix-openclaw",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767909183,
|
||||
"narHash": "sha256-u/bcU0xePi5bgNoRsiqSIwaGBwDilKKFTz3g0hqOBAo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "cd6e96d56ed4b2a779ac73a1227e0bb1519b3509",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-openclaw": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"home-manager": "home-manager",
|
||||
"nix-steipete-tools": "nix-steipete-tools",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770307011,
|
||||
"narHash": "sha256-xrLN4YZtd+AOkGnQqLQ7BW7Ln10X3cvbHYFog9DZTwQ=",
|
||||
"owner": "openclaw",
|
||||
"repo": "nix-openclaw",
|
||||
"rev": "4c4a7cb03bc5f32b0e24b1c466d10fda27fd8af2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "openclaw",
|
||||
"repo": "nix-openclaw",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-steipete-tools": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770240566,
|
||||
"narHash": "sha256-fY8t41kMSHu2ovf89mIdvC7vkceroCwKxw/MKVn4rsE=",
|
||||
"owner": "openclaw",
|
||||
"repo": "nix-steipete-tools",
|
||||
"rev": "983210e3b6e9285780e87f48ce9354b51a270e95",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "openclaw",
|
||||
"repo": "nix-steipete-tools",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1767364772,
|
||||
"narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1770197578,
|
||||
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
|
||||
"owner": "NixOS",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
@@ -114,8 +36,8 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nix-openclaw": "nix-openclaw",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
||||
@@ -1,76 +1,56 @@
|
||||
# nix develop
|
||||
{
|
||||
description = "Openclaw development shell";
|
||||
description = "OpenClaw dev shell";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nix-openclaw = {
|
||||
url = "github:openclaw/nix-openclaw";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ nixpkgs, nix-openclaw, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ nix-openclaw.overlays.default ];
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.openclaw-gateway
|
||||
pkgs.openclaw-tools
|
||||
pkgs.trash-cli
|
||||
pkgs.ollama
|
||||
];
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "openclaw-shell";
|
||||
|
||||
shellHook = ''
|
||||
# Start ollama service if not already running
|
||||
if ! pgrep -x "ollama" > /dev/null; then
|
||||
echo "Starting ollama service..."
|
||||
ollama serve &>/dev/null &
|
||||
sleep 2
|
||||
fi
|
||||
buildInputs = with pkgs; [
|
||||
nodejs_22
|
||||
git
|
||||
curl
|
||||
cmake
|
||||
];
|
||||
|
||||
# Pull model if needed (runs in background)
|
||||
if ! ollama list 2>/dev/null | grep -q "llama3.2:3b"; then
|
||||
echo "Pulling llama3.2:3b model (running in background)..."
|
||||
ollama pull llama3.2:3b &
|
||||
fi
|
||||
shellHook = ''
|
||||
echo "🦞 OpenClaw"
|
||||
echo ""
|
||||
|
||||
# Start openclaw-gateway if not already running (uses ~/.openclaw config)
|
||||
if ! pgrep -f "openclaw-gateway" > /dev/null; then
|
||||
echo "Starting openclaw-gateway..."
|
||||
openclaw gateway &>/dev/null &
|
||||
sleep 1
|
||||
fi
|
||||
# Set up local npm prefix to avoid permission issues
|
||||
export NPM_CONFIG_PREFIX="$PWD/.npm-global"
|
||||
export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"
|
||||
|
||||
xdg-open http://127.0.0.1:18789/ &
|
||||
# Ensure the prefix directory exists
|
||||
mkdir -p "$NPM_CONFIG_PREFIX/bin"
|
||||
|
||||
echo ""
|
||||
echo "Openclaw development shell"
|
||||
echo ""
|
||||
echo "Services:"
|
||||
echo " ollama - http://localhost:11434"
|
||||
if pgrep -f "openclaw-gateway" > /dev/null; then
|
||||
echo " openclaw-gateway - Running"
|
||||
fi
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " ollama list - List models"
|
||||
echo " ollama run <model> - Chat with a model"
|
||||
echo ""
|
||||
'';
|
||||
};
|
||||
# Install openclaw if not already installed
|
||||
if ! command -v openclaw &> /dev/null; then
|
||||
echo "📦 Installing OpenClaw..."
|
||||
npm install -g openclaw
|
||||
fi
|
||||
|
||||
# Also expose the packages for direct use
|
||||
packages.${system} = {
|
||||
default = pkgs.openclaw;
|
||||
gateway = pkgs.openclaw-gateway;
|
||||
tools = pkgs.openclaw-tools;
|
||||
};
|
||||
};
|
||||
echo ""
|
||||
echo "Run 'openclaw gateway' to start the gateway"
|
||||
echo ""
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user