Last active
February 7, 2026 17:57
-
-
Save jDmacD/4e5e1c1d7a71667afc520b5b795570d8 to your computer and use it in GitHub Desktop.
Minimal flake with OpenClaw. Its a bit janky. Openclaw will update `~/.openclaw/openclaw.json` then home-manager will complain. Test with `nix build .#nixosConfigurations.hostname.config.system.build.toplevel`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| description = "Complete OpenClaw Example Flake"; | |
| inputs = { | |
| nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | |
| home-manager.url = "github:nix-community/home-manager"; | |
| home-manager.inputs.nixpkgs.follows = "nixpkgs"; | |
| openclaw.url = "github:openclaw/nix-openclaw"; | |
| openclaw.inputs.nixpkgs.follows = "nixpkgs"; | |
| }; | |
| outputs = inputs@{ self, nixpkgs, home-manager, openclaw }: { | |
| nixosConfigurations = { | |
| hostname = nixpkgs.lib.nixosSystem { | |
| system = "x86_64-linux"; | |
| specialArgs = { inherit inputs; }; | |
| modules = [ | |
| # Minimal inline NixOS configuration | |
| { | |
| boot.loader.systemd-boot.enable = true; | |
| boot.loader.efi.canTouchEfiVariables = true; | |
| # Minimal filesystem configuration (adjust for your system) | |
| fileSystems."/" = { | |
| device = "/dev/disk/by-label/nixos"; | |
| fsType = "ext4"; | |
| }; | |
| fileSystems."/boot" = { | |
| device = "/dev/disk/by-label/boot"; | |
| fsType = "vfat"; | |
| }; | |
| networking.hostName = "hostname"; | |
| networking.networkmanager.enable = true; | |
| time.timeZone = "UTC"; | |
| users.users.jdoe = { | |
| isNormalUser = true; | |
| extraGroups = [ "wheel" "networkmanager" ]; | |
| # Set a password with: mkpasswd -m sha-512 | |
| # Or use initialPassword for testing | |
| initialPassword = "changeme"; | |
| }; | |
| system.stateVersion = "26.05"; | |
| } | |
| # Apply OpenClaw overlay at NixOS level | |
| { | |
| nixpkgs.overlays = [ openclaw.overlays.default ]; | |
| } | |
| # Configure home-manager | |
| home-manager.nixosModules.home-manager | |
| { | |
| home-manager.useGlobalPkgs = true; | |
| home-manager.useUserPackages = true; | |
| home-manager.extraSpecialArgs = { inherit inputs; }; | |
| home-manager.users.jdoe = { config, ... }: { | |
| # Import OpenClaw home-manager module | |
| imports = [ openclaw.homeManagerModules.openclaw ]; | |
| home.stateVersion = "26.05"; | |
| # Create .env file with OpenClaw credentials | |
| # Use sops-nix ore age-nix here | |
| home.file.".openclaw/.env".text = '' | |
| ANTHROPIC_API_KEY=sk-ant-api03-big-long-token | |
| OPENCLAW_GATEWAY_TOKEN=any-token-here | |
| TELEGRAM_BOT_TOKEN=your-token-here | |
| ''; | |
| # Configure OpenClaw instance | |
| programs.openclaw = { | |
| instances.default = { | |
| enable = true; | |
| systemd = { | |
| enable = true; | |
| }; | |
| config = { | |
| gateway = { | |
| mode = "local"; | |
| }; | |
| plugins = { | |
| entries = { | |
| telegram = { | |
| enabled = true; | |
| }; | |
| }; | |
| }; | |
| channels.telegram = { | |
| dmPolicy = "pairing"; | |
| allowFrom = [ 0000000000 ]; # Replace with your Telegram user ID | |
| groupPolicy = "allowlist"; | |
| streamMode = "partial"; | |
| }; | |
| }; | |
| }; | |
| }; | |
| }; | |
| } | |
| ]; | |
| }; | |
| }; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment