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/
|
/nix-shells/macos-vm/
|
||||||
|
|
||||||
logs/
|
logs/
|
||||||
|
|
||||||
|
openclaw/.npm-global/
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
Use idiomatic nix.
|
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 configuration.nix
|
||||||
- man home-configuration.nix
|
- man home-configuration.nix
|
||||||
|
- ... among other resources
|
||||||
|
|
||||||
Do not read the entire manual at once, instead search only for what you need.
|
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.
|
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
|
# Packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
@@ -138,7 +133,73 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Set up virtualisation
|
# 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.
|
# Open ports in the firewall.
|
||||||
networking.firewall.enable = true;
|
networking.firewall.enable = true;
|
||||||
|
|||||||
12
nixos/flake.lock
generated
12
nixos/flake.lock
generated
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1769622371,
|
"lastModified": 1772380461,
|
||||||
"narHash": "sha256-Cs1/+P3ntxl9mOIL7/QtItBAzQJ2xjvTMHv7qw0nFV0=",
|
"narHash": "sha256-O3ukj3Bb3V0Tiy/4LUfLlBpWypJ9P0JeUgsKl2nmZZY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "02d763228d8aff317e6e5a319474b6d4d9d826a5",
|
"rev": "f140aa04d7d14f8a50ab27f3691b5766b17ae961",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1769461804,
|
"lastModified": 1772198003,
|
||||||
"narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
|
"narHash": "sha256-I45esRSssFtJ8p/gLHUZ1OUaaTaVLluNkABkk6arQwE=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d",
|
"rev": "dd9b079222d43e1943b6ebd802f04fd959dc8e61",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -17,11 +17,19 @@
|
|||||||
nil
|
nil
|
||||||
bat
|
bat
|
||||||
|
|
||||||
vscode
|
|
||||||
vesktop
|
vesktop
|
||||||
google-chrome
|
google-chrome
|
||||||
localsend
|
localsend
|
||||||
#stremio
|
#stremio
|
||||||
|
element-desktop
|
||||||
|
|
||||||
|
# Dev tools / AI
|
||||||
|
vscode
|
||||||
|
codex
|
||||||
|
opencode-desktop
|
||||||
|
nodejs
|
||||||
|
python3
|
||||||
|
lmstudio
|
||||||
|
|
||||||
# VR / Games
|
# VR / Games
|
||||||
bs-manager
|
bs-manager
|
||||||
@@ -29,6 +37,7 @@
|
|||||||
prismlauncher
|
prismlauncher
|
||||||
protonup-qt
|
protonup-qt
|
||||||
wayvr
|
wayvr
|
||||||
|
unityhub
|
||||||
|
|
||||||
# Gnome Extensions
|
# Gnome Extensions
|
||||||
gnomeExtensions.caffeine
|
gnomeExtensions.caffeine
|
||||||
@@ -48,14 +57,12 @@
|
|||||||
switcheroo
|
switcheroo
|
||||||
wordbook
|
wordbook
|
||||||
textpieces
|
textpieces
|
||||||
|
gnome-sound-recorder
|
||||||
|
|
||||||
# Virtualisation
|
# Virtualisation
|
||||||
gnome-boxes # VM management
|
gnome-boxes
|
||||||
dnsmasq # VM networking
|
dnsmasq
|
||||||
|
phodav
|
||||||
# AI
|
|
||||||
lmstudio
|
|
||||||
nodejs
|
|
||||||
|
|
||||||
# Scripts
|
# Scripts
|
||||||
(pkgs.writeShellScriptBin "colors" ''
|
(pkgs.writeShellScriptBin "colors" ''
|
||||||
@@ -198,6 +205,7 @@
|
|||||||
raid = "sudo mdadm --detail /dev/md0";
|
raid = "sudo mdadm --detail /dev/md0";
|
||||||
unp = "unp -U";
|
unp = "unp -U";
|
||||||
cat = "bat";
|
cat = "bat";
|
||||||
|
lmcodex = "codex --oss -m qwen3-coder-30b-a3b-instruct";
|
||||||
};
|
};
|
||||||
historySize = 10000;
|
historySize = 10000;
|
||||||
historyFileSize = 100000;
|
historyFileSize = 100000;
|
||||||
@@ -412,6 +420,7 @@
|
|||||||
"_processor_usage_"
|
"_processor_usage_"
|
||||||
"_gpu#1_usage_"
|
"_gpu#1_usage_"
|
||||||
"_memory_usage_"
|
"_memory_usage_"
|
||||||
|
"_memory_swap_usage_"
|
||||||
"__temperature_max__"
|
"__temperature_max__"
|
||||||
];
|
];
|
||||||
icon-style = 1;
|
icon-style = 1;
|
||||||
@@ -437,10 +446,26 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.opencode = {
|
systemd.user.services.noisetorch = {
|
||||||
enable = true;
|
Unit = {
|
||||||
settings = {
|
Description = "NoiseTorch Noise Cancelling";
|
||||||
autoshare = false; # No telemetry
|
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"
|
"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": {
|
"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": {
|
"locked": {
|
||||||
"lastModified": 1770197578,
|
"lastModified": 1770197578,
|
||||||
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
|
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
|
||||||
"owner": "NixOS",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
|
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "nixos",
|
||||||
"ref": "nixos-unstable",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
@@ -114,8 +36,8 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nix-openclaw": "nix-openclaw",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|||||||
@@ -1,76 +1,56 @@
|
|||||||
|
# nix develop
|
||||||
{
|
{
|
||||||
description = "Openclaw development shell";
|
description = "OpenClaw dev shell";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nix-openclaw = {
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
url = "github:openclaw/nix-openclaw";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{ nixpkgs, nix-openclaw, ... }:
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
overlays = [ nix-openclaw.overlays.default ];
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.${system}.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
buildInputs = [
|
name = "openclaw-shell";
|
||||||
pkgs.openclaw-gateway
|
|
||||||
pkgs.openclaw-tools
|
buildInputs = with pkgs; [
|
||||||
pkgs.trash-cli
|
nodejs_22
|
||||||
pkgs.ollama
|
git
|
||||||
|
curl
|
||||||
|
cmake
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
# Start ollama service if not already running
|
echo "🦞 OpenClaw"
|
||||||
if ! pgrep -x "ollama" > /dev/null; then
|
echo ""
|
||||||
echo "Starting ollama service..."
|
|
||||||
ollama serve &>/dev/null &
|
|
||||||
sleep 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pull model if needed (runs in background)
|
# Set up local npm prefix to avoid permission issues
|
||||||
if ! ollama list 2>/dev/null | grep -q "llama3.2:3b"; then
|
export NPM_CONFIG_PREFIX="$PWD/.npm-global"
|
||||||
echo "Pulling llama3.2:3b model (running in background)..."
|
export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"
|
||||||
ollama pull llama3.2:3b &
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start openclaw-gateway if not already running (uses ~/.openclaw config)
|
# Ensure the prefix directory exists
|
||||||
if ! pgrep -f "openclaw-gateway" > /dev/null; then
|
mkdir -p "$NPM_CONFIG_PREFIX/bin"
|
||||||
echo "Starting openclaw-gateway..."
|
|
||||||
openclaw gateway &>/dev/null &
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
xdg-open http://127.0.0.1:18789/ &
|
# Install openclaw if not already installed
|
||||||
|
if ! command -v openclaw &> /dev/null; then
|
||||||
|
echo "📦 Installing OpenClaw..."
|
||||||
|
npm install -g openclaw
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Openclaw development shell"
|
echo "Run 'openclaw gateway' to start the gateway"
|
||||||
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 ""
|
echo ""
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
}
|
||||||
# Also expose the packages for direct use
|
);
|
||||||
packages.${system} = {
|
|
||||||
default = pkgs.openclaw;
|
|
||||||
gateway = pkgs.openclaw-gateway;
|
|
||||||
tools = pkgs.openclaw-tools;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user