From 297589362fc97bf5325d0892309bcdf8f6571370 Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Tue, 16 Jun 2026 15:54:09 +0200 Subject: [PATCH 1/5] Removed new nginx entry; fixed mautrix discord --- nixos/roles/matrix/discord-bridge.nix | 134 ++++++++++++++------------ nixos/roles/nginx.nix | 20 ++-- 2 files changed, 83 insertions(+), 71 deletions(-) diff --git a/nixos/roles/matrix/discord-bridge.nix b/nixos/roles/matrix/discord-bridge.nix index c603555..295b05a 100644 --- a/nixos/roles/matrix/discord-bridge.nix +++ b/nixos/roles/matrix/discord-bridge.nix @@ -17,78 +17,90 @@ }; }; - systemd.services.mautrix-discord-env = { - before = [ "mautrix-discord-registration.service" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - script = '' - mkdir -p /run/mautrix-discord - echo "DISCORD_BOT_TOKEN=$(cat ${config.sops.secrets.discord_bot_token.path})" > /run/mautrix-discord/env - echo "DISCORD_CLIENT_ID=$(cat ${config.sops.secrets.discord_client_id.path})" >> /run/mautrix-discord/env - echo "DISCORD_PICKLE_KEY=$(cat ${config.sops.secrets.discord_pickle_key.path})" >> /run/mautrix-discord/env - chmod 600 /run/mautrix-discord/env - chown mautrix-discord:mautrix-discord /run/mautrix-discord/env - ''; - }; + systemd = { + services = { + mautrix-discord-env = { + before = [ "mautrix-discord-registration.service" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + mkdir -p /run/mautrix-discord + echo "DISCORD_BOT_TOKEN=$(cat ${config.sops.secrets.discord_bot_token.path})" > /run/mautrix-discord/env + echo "DISCORD_CLIENT_ID=$(cat ${config.sops.secrets.discord_client_id.path})" >> /run/mautrix-discord/env + echo "DISCORD_PICKLE_KEY=$(cat ${config.sops.secrets.discord_pickle_key.path})" >> /run/mautrix-discord/env + chmod 600 /run/mautrix-discord/env + chown mautrix-discord:mautrix-discord /run/mautrix-discord/env + ''; + }; - services.postgresql = { - ensureUsers = [ - { - name = "mautrix-discord"; - ensureDBOwnership = true; - } + mautrix-discord-registration.serviceConfig.UMask = lib.mkForce "0750"; + }; + tmpfiles.rules = [ + "z /var/lib/mautrix-discord/discord-registration.yaml 0640 mautrix-discord mautrix-discord -" ]; - ensureDatabases = [ "mautrix-discord" ]; }; - services.mautrix-discord = { - enable = true; - environmentFile = "/run/mautrix-discord/env"; - settings = { - homeserver = { - address = "http://127.0.0.1:8008"; - domain = "cyperpunk.de"; - }; - appservice.database = { - type = "postgres"; - uri = "postgres:///mautrix-discord?host=/run/postgresql&sslmode=disable"; - }; - bridge = { - permissions = { - "cyperpunk.de" = "user"; - "@dergrumpf:cyperpunk.de" = "admin"; - }; + services = { + postgresql = { + ensureUsers = [ + { + name = "mautrix-discord"; + ensureDBOwnership = true; + } + ]; + ensureDatabases = [ "mautrix-discord" ]; - backfill = { - limits = { - initial = { - channel = 10000; - thread = 500; + mautrix-discord = { + enable = true; + environmentFile = "/run/mautrix-discord/env"; + settings = { + homeserver = { + address = "http://127.0.0.1:8008"; + domain = "cyperpunk.de"; + }; + appservice.database = { + type = "postgres"; + uri = "postgres:///mautrix-discord?host=/run/postgresql&sslmode=disable"; + }; + bridge = { + permissions = { + "cyperpunk.de" = "user"; + "@dergrumpf:cyperpunk.de" = "admin"; }; - missed = { - channel = 500; + + backfill = { + limits = { + initial = { + channel = 10000; + thread = 500; + }; + missed = { + channel = 500; + }; + }; + }; + encryption = { + allow = true; + default = true; + pickle_key = "$DISCORD_PICKLE_KEY"; + verification_levels = { + receive = "unverified"; + send = "unverified"; + share = "cross-signed-tofu"; + }; }; }; - }; - encryption = { - allow = true; - default = true; - pickle_key = "$DISCORD_PICKLE_KEY"; - verification_levels = { - receive = "unverified"; - send = "unverified"; - share = "cross-signed-tofu"; + discord = { + client_id = "$DISCORD_CLIENT_ID"; + bot_token = "$DISCORD_BOT_TOKEN"; }; }; }; - discord = { - client_id = "$DISCORD_CLIENT_ID"; - bot_token = "$DISCORD_BOT_TOKEN"; - }; }; }; - systemd.services.mautrix-discord-registration.serviceConfig.UMask = lib.mkForce "0022"; + + users.users.matrix-synapse.extraGroups = [ "mautrix-discord" ]; } diff --git a/nixos/roles/nginx.nix b/nixos/roles/nginx.nix index 0637d8f..f5eb516 100644 --- a/nixos/roles/nginx.nix +++ b/nixos/roles/nginx.nix @@ -74,16 +74,16 @@ in "calvin.cyperpunk.de" = mkWsProxy 15006; "auth.cyperpunk.de" = mkHttpsProxy 8444; - "home.cyperpunk.de" = { - forceSSL = true; - enableACME = true; - locations."/" = { - root = "/var/www/home.cyperpunk.de"; - extraConfig = '' - try_files $uri $uri/ =404; - ''; - }; - }; + #"home.cyperpunk.de" = { + # forceSSL = true; + # enableACME = true; + # locations."/" = { + # root = "/var/www/home.cyperpunk.de"; + # extraConfig = '' + # try_files $uri $uri/ =404; + # ''; + # }; + #}; "www.cyperpunk.de" = { forceSSL = true; From 9640b433a4c5ff7850ecf1a737ad2e8b1ca0f915 Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Wed, 17 Jun 2026 13:48:00 +0200 Subject: [PATCH 2/5] Fixed Discord Bridge and neovim stupid stuff --- flake.lock | 118 ++++++++++++-------------- flake.nix | 1 + home/neovim/avante.nix | 2 +- home/neovim/diffview.nix | 32 +++++-- nixos/roles/matrix/discord-bridge.nix | 74 ++++++++-------- 5 files changed, 117 insertions(+), 110 deletions(-) diff --git a/flake.lock b/flake.lock index 63fa14d..9079cbf 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1778857089, - "narHash": "sha256-TclWRW2SdFeETLaiTG4BA8C8C4m/LppQEldncqyTzAQ=", + "lastModified": 1780756231, + "narHash": "sha256-tXQxKdG5716uB9/LIkLQqQwHKf5mRSpHoZhz3lyI2Cg=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "ab2b0af63fbc9fb779d684f19149b790978be8a8", + "rev": "6ecde03f47172753fe5a2f334f9d3facfb7e6784", "type": "github" }, "original": { @@ -36,16 +36,16 @@ "brew-src": { "flake": false, "locked": { - "lastModified": 1779646357, - "narHash": "sha256-rnnAaESXxItX4D9xCMGvs3hfDBjbbTYht7OluRcvT8k=", + "lastModified": 1781226006, + "narHash": "sha256-w4ZTuOnhYiDxjaynrMTASzp802QblBWmo3wpB8wVN4Y=", "owner": "Homebrew", "repo": "brew", - "rev": "10a163ac127624caa80cc5cc5a705e97f3615b0e", + "rev": "109191be4988470b51a60a5ef1998520aa24c01b", "type": "github" }, "original": { "owner": "Homebrew", - "ref": "5.1.14", + "ref": "6.0.1", "repo": "brew", "type": "github" } @@ -57,11 +57,11 @@ ] }, "locked": { - "lastModified": 1780755633, - "narHash": "sha256-2NZLaQTroHWrXHOeBJhHD7cb8nM4BnlAMNoxIUqs/Os=", + "lastModified": 1781255309, + "narHash": "sha256-n2P5xkAYGylrJ3feu7L6uaCUw/+jW8rk+HO127gDbFA=", "owner": "catppuccin", "repo": "nix", - "rev": "71770b00f2b97631339026e78b4a045cd9aee6f3", + "rev": "036c78ea4cd8a42c8546c6316a944fd7d59d4341", "type": "github" }, "original": { @@ -77,11 +77,11 @@ ] }, "locked": { - "lastModified": 1779036909, - "narHash": "sha256-zXcwYQGCT6pzinK+1dBB2ekTVtfxGZAapb3Evdcu4fY=", + "lastModified": 1781242433, + "narHash": "sha256-bchLZZ3sRn740zyvD2icZSnNoTaanN0nw7l6fjVXO+E=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "56c666e108467d87d13508936aade6d567f2a501", + "rev": "aabb2037edfc0f210723b72cd5f528aab5dd3f0b", "type": "github" }, "original": { @@ -209,11 +209,11 @@ ] }, "locked": { - "lastModified": 1780679734, - "narHash": "sha256-KmRNvpNOb7QEORa06bVgjW9kITcx0VhsI7w0vhmZyD8=", + "lastModified": 1781667738, + "narHash": "sha256-OxrwHpsWf+QGbos1LMDGAcv7sjBGshcw/43th6waeYI=", "owner": "nix-community", "repo": "home-manager", - "rev": "b2b7db486e06e098711dc291bb25db82850e1d16", + "rev": "7664e05e2413d5e2b8c54a884eb8ea0f8a504fc2", "type": "github" }, "original": { @@ -320,11 +320,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1780768552, - "narHash": "sha256-J2gBzBBE9C6LMMJec8buysLAQl7QmqtP/oMrPfVioYc=", + "lastModified": 1781627558, + "narHash": "sha256-qqFd1ufiH/oBB2RCmt7dg5Kyca7grJguIJrNPsD91zk=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "20ee7553c95dd1fa30a00564561f40f7986ffbc7", + "rev": "5b47c782c9f83539a6c642d83844cdc9130a2873", "type": "github" }, "original": { @@ -396,11 +396,11 @@ ] }, "locked": { - "lastModified": 1779209205, - "narHash": "sha256-asc7NpeB8vD66gvZeYcQkaWOs2X6Jgd29vBtP17vjxo=", + "lastModified": 1781442805, + "narHash": "sha256-Kt56e6Bq2sfqN8yq1RHsS6z+8QKCZelmhaeQQRtZyqU=", "owner": "hyprwm", "repo": "hyprland-plugins", - "rev": "1cb37fad68dff5f5840010c314fed5809b4ee66f", + "rev": "1f90c674d51a1ef83c725cd6d02280b4c969fdf7", "type": "github" }, "original": { @@ -580,11 +580,11 @@ ] }, "locked": { - "lastModified": 1779475241, - "narHash": "sha256-Nw4DN0A5krWNcPBvuWe5Gz2yuxsUUPiDgtu6SVPJQeU=", + "lastModified": 1780251518, + "narHash": "sha256-fG9xbb1SOAAJ+2kJRakp3ch+BmA/3dEg/K3PoAZTKkw=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "3cd3972b2ee658a14d2610d8494e09259e530124", + "rev": "40ede2e7bdec80ba5d4c443160d905e9f841ae5f", "type": "github" }, "original": { @@ -652,11 +652,11 @@ "brew-src": "brew-src" }, "locked": { - "lastModified": 1780492467, - "narHash": "sha256-zMEJwtQPmsPPgPczFkyjWHgd1z0HagOPS2Wt2WDYLJY=", + "lastModified": 1781389246, + "narHash": "sha256-ORqLAo/hoJdsZC7UPAuEHev6S0+XIqKEC7vjo5prz1k=", "owner": "zhaofengli", "repo": "nix-homebrew", - "rev": "562332f97de9f5ba51aa647d70462e88222b2988", + "rev": "de7953a08ed4bb9245be043e468561c17b89130d", "type": "github" }, "original": { @@ -675,11 +675,11 @@ "nixpkgs-nixcord": "nixpkgs-nixcord" }, "locked": { - "lastModified": 1780751320, - "narHash": "sha256-3PlWrZkSwElqYHMnWi4d0A+GxlvCXk0JaMsTGghmQGE=", + "lastModified": 1781659360, + "narHash": "sha256-bwTlMeMALwHREYkYBd9swITfW270tt6GzyY1j+QAqIU=", "owner": "kaylorben", "repo": "nixcord", - "rev": "2b70dbed679d2705696deb36f0778c9ef9f1ded2", + "rev": "9dd239d5f8d651ccd94efcf1e3bd384ad41084ca", "type": "github" }, "original": { @@ -726,11 +726,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1779357205, - "narHash": "sha256-cCO8aTqss5x9Ky8GWkpY0Hy5fyTZEbtifSUV8QjSzic=", + "lastModified": 1780749050, + "narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f83fc3c307e74bc5fd5adb7eb6b8b13ffd2a36e1", + "rev": "a799d3e3886da994fa307f817a6bc705ae538eeb", "type": "github" }, "original": { @@ -773,11 +773,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1780243769, - "narHash": "sha256-x5UQuRsH3MqI0U9afaXSNqzTPSeZlRLvFAav2Ux1pNw=", + "lastModified": 1781577229, + "narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "331800de5053fcebacf6813adb5db9c9dca22a0c", + "rev": "567a49d1913ce81ac6e9582e3553dd90a955875f", "type": "github" }, "original": { @@ -787,34 +787,20 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1780336545, - "narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixvim": { "inputs": { "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_3", + "nixpkgs": [ + "nixpkgs" + ], "systems": "systems_3" }, "locked": { - "lastModified": 1780646548, - "narHash": "sha256-Ckyl/l1XBmEwnaHcHD8PvBZk1uph0NqwbJ//CAvB7iE=", + "lastModified": 1781637822, + "narHash": "sha256-6Fwwt8BBGF5rqwGPhj/9ZMyyjXeJQzeHHJQfPuqJP3I=", "owner": "nix-community", "repo": "nixvim", - "rev": "816a15282e58678dde831477964987d0262d4293", + "rev": "d43c763fd9fae0912bdb4103cd842f26fea5b0ed", "type": "github" }, "original": { @@ -831,11 +817,11 @@ ] }, "locked": { - "lastModified": 1780766476, - "narHash": "sha256-BlI1qrW7wqI+pniqRebMttqN/w0H6XHqITGB9JPSQNQ=", + "lastModified": 1781694117, + "narHash": "sha256-TobjUrIR9hSn3PdjooxvNYjuQuCbZ+HIQzExWatX6Bo=", "owner": "nix-community", "repo": "NUR", - "rev": "050c04c7c01ad5de7e60f32b66ce0599e3c17d8e", + "rev": "fea207887cf1f76cb19452ffd6978b82311d9746", "type": "github" }, "original": { @@ -913,11 +899,11 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1780422259, - "narHash": "sha256-dWGk4SEdI189kQW5cE4Uo1Mc+P+kQEdgMcyMgTtmQOA=", + "lastModified": 1781425310, + "narHash": "sha256-GTBka4Df/ZOacmisI/DI2LICyNChEqn/giah83LucdM=", "owner": "Gerg-L", "repo": "spicetify-nix", - "rev": "8414bbf2fcc7bc0a22c675e498e3c7365c1aec0a", + "rev": "aeaf7c81a45d3761da61cb05bfc370ac6d1b0441", "type": "github" }, "original": { @@ -1015,11 +1001,11 @@ ] }, "locked": { - "lastModified": 1778265244, - "narHash": "sha256-8jlPtGSsv/CQY6tVVyLF4Jjd0gnS+Zbn9yk/V13A9nM=", + "lastModified": 1780133819, + "narHash": "sha256-0YPKIY3dlnR7SPq7Z8ekFVvzFsfeiAtEj+QUI3KHrlI=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "813ea5ca9a1702a9a2d1f5836bc00172ef698968", + "rev": "4a170c0ba96fd37374f93d8f91c9ed91814828ac", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e0c9579..b1196ad 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,7 @@ # declarative Neovim nixvim = { url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; }; # declarative Discord diff --git a/home/neovim/avante.nix b/home/neovim/avante.nix index 65d8694..a881f3a 100644 --- a/home/neovim/avante.nix +++ b/home/neovim/avante.nix @@ -108,7 +108,7 @@ }; }; - extraPackages = with pkgs; [ curl ]; + #extraPackages = with pkgs; [ curl ]; }; }; } diff --git a/home/neovim/diffview.nix b/home/neovim/diffview.nix index 7ad09fb..751d9c3 100644 --- a/home/neovim/diffview.nix +++ b/home/neovim/diffview.nix @@ -2,12 +2,32 @@ _: { programs.nixvim = { plugins.diffview = { enable = true; - keymaps = { - "]x" = "DiffviewConflictNext"; - "[x" = "DiffviewConflictPrev"; - "do" = "DiffviewFocusOurs"; - "dt" = "DiffviewFocusTheirs"; - }; + settings.keymaps.view = [ + { + mode = "n"; + key = "]x"; + action = "DiffviewConflictNext"; + description = "Next conflict"; + } + { + mode = "n"; + key = "[x"; + action = "DiffviewConflictPrev"; + description = "Previous conflict"; + } + { + mode = "n"; + key = "do"; + action = "DiffviewFocusOurs"; + description = "Focus ours"; + } + { + mode = "n"; + key = "dt"; + action = "DiffviewFocusTheirs"; + description = "Focus theirs"; + } + ]; }; }; } diff --git a/nixos/roles/matrix/discord-bridge.nix b/nixos/roles/matrix/discord-bridge.nix index 295b05a..f732931 100644 --- a/nixos/roles/matrix/discord-bridge.nix +++ b/nixos/roles/matrix/discord-bridge.nix @@ -52,52 +52,52 @@ } ]; ensureDatabases = [ "mautrix-discord" ]; + }; - mautrix-discord = { - enable = true; - environmentFile = "/run/mautrix-discord/env"; - settings = { - homeserver = { - address = "http://127.0.0.1:8008"; - domain = "cyperpunk.de"; + mautrix-discord = { + enable = true; + environmentFile = "/run/mautrix-discord/env"; + settings = { + homeserver = { + address = "http://127.0.0.1:8008"; + domain = "cyperpunk.de"; + }; + appservice.database = { + type = "postgres"; + uri = "postgres:///mautrix-discord?host=/run/postgresql&sslmode=disable"; + }; + bridge = { + permissions = { + "cyperpunk.de" = "user"; + "@dergrumpf:cyperpunk.de" = "admin"; }; - appservice.database = { - type = "postgres"; - uri = "postgres:///mautrix-discord?host=/run/postgresql&sslmode=disable"; - }; - bridge = { - permissions = { - "cyperpunk.de" = "user"; - "@dergrumpf:cyperpunk.de" = "admin"; - }; - backfill = { - limits = { - initial = { - channel = 10000; - thread = 500; - }; - missed = { - channel = 500; - }; + backfill = { + limits = { + initial = { + channel = 10000; + thread = 500; }; - }; - encryption = { - allow = true; - default = true; - pickle_key = "$DISCORD_PICKLE_KEY"; - verification_levels = { - receive = "unverified"; - send = "unverified"; - share = "cross-signed-tofu"; + missed = { + channel = 500; }; }; }; - discord = { - client_id = "$DISCORD_CLIENT_ID"; - bot_token = "$DISCORD_BOT_TOKEN"; + encryption = { + allow = true; + default = true; + pickle_key = "$DISCORD_PICKLE_KEY"; + verification_levels = { + receive = "unverified"; + send = "unverified"; + share = "cross-signed-tofu"; + }; }; }; + discord = { + client_id = "$DISCORD_CLIENT_ID"; + bot_token = "$DISCORD_BOT_TOKEN"; + }; }; }; }; From e1cf4f3647b169777c991a77dcbada312200a2cf Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Wed, 17 Jun 2026 18:41:54 +0200 Subject: [PATCH 3/5] Configured Ollama --- hosts/cyper-controller/configuration.nix | 3 ++- nixos/roles/ollama.nix | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 nixos/roles/ollama.nix diff --git a/hosts/cyper-controller/configuration.nix b/hosts/cyper-controller/configuration.nix index bc627b5..d37cdbe 100644 --- a/hosts/cyper-controller/configuration.nix +++ b/hosts/cyper-controller/configuration.nix @@ -11,10 +11,11 @@ ../../nixos/roles/gitea.nix ../../nixos/roles/vaultwarden.nix ../../nixos/roles/frontpage - ../../nixos/roles/paperless-ngx.nix + #../../nixos/roles/paperless-ngx.nix ../../nixos/roles/octoprint.nix ../../nixos/roles/matrix/postgres-backup.nix ../../nixos/roles/kanidm.nix + ../../nixos/roles/ollama.nix ]; networking = { diff --git a/nixos/roles/ollama.nix b/nixos/roles/ollama.nix new file mode 100644 index 0000000..8f103ea --- /dev/null +++ b/nixos/roles/ollama.nix @@ -0,0 +1,18 @@ +_: { + services.ollama = { + enable = true; + + host = "0.0.0.0"; + port = 11434; + + openFirewall = true; + + loadModels = [ + "llama3.2:3b" + "qwen2.5:3b" + "deepseek-r1:1.5b" + ]; + + syncModels = true; + }; +} From 48260c392ba5a13e0242e425256476d63447fa8a Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Wed, 17 Jun 2026 20:22:32 +0200 Subject: [PATCH 4/5] Added OpenCode --- home/default.nix | 1 + home/neovim/avante.nix | 52 ++++++++++++++++++++++++------------------ home/opencode.nix | 32 ++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 home/opencode.nix diff --git a/home/default.nix b/home/default.nix index 9ca3f85..63de984 100644 --- a/home/default.nix +++ b/home/default.nix @@ -18,6 +18,7 @@ ./neovim ./python.nix ./fonts.nix + ./opencode.nix inputs.sops-nix.homeManagerModules.sops ] ++ lib.optionals (!isDarwin && !isServer) [ diff --git a/home/neovim/avante.nix b/home/neovim/avante.nix index a881f3a..2fd7092 100644 --- a/home/neovim/avante.nix +++ b/home/neovim/avante.nix @@ -5,25 +5,41 @@ plugins = { markdown-preview.enable = true; render-markdown.enable = true; - avante = { enable = true; autoLoad = true; settings = { - provider = "groq"; + provider = "ollama"; - providers.groq = { - __inherited_from = "openai"; - api_key_name = "cmd:cat /home/phil/.config/sops-nix/secrets/GROQ_API_KEY"; - endpoint = "https://api.groq.com/openai/v1/"; - model = "qwen/qwen3-32b"; # "llama-3.3-70b-versatile"; - system_promt = "You are a helpful coding assistant. Always respond in plain markdown format without using tool calls or JSON structures."; - disable_tools = true; - extra_request_body = { - temperature = 1; - max_tokens = 2000; - response_format = { - type = "text"; + providers = { + groq = { + __inherited_from = "openai"; + api_key_name = "cmd:cat /home/phil/.config/sops-nix/secrets/GROQ_API_KEY"; + endpoint = "https://api.groq.com/openai/v1/"; + model = "qwen/qwen3-32b"; + system_promt = "You are a helpful coding assistant. Always respond in plain markdown format without using tool calls or JSON structures."; + disable_tools = true; + extra_request_body = { + temperature = 1; + max_tokens = 2000; + response_format = { + type = "text"; + }; + }; + }; + + ollama = { + endpoint = "http://100.109.179.25:11434"; # tailscale IP, no /v1 suffix + model = "qwen2.5:3b"; # swap for "llama3.2:3b" or "deepseek-r1:1.5b" + timeout = 60000; # local + small model can be slow on first load + disable_tools = true; # these small models aren't reliable at tool calling + is_env_set.__raw = ''require("avante.providers.ollama").check_endpoint_alive''; + extra_request_body = { + options = { + temperature = 0.7; + num_ctx = 8192; + keep_alive = "5m"; + }; }; }; }; @@ -35,7 +51,6 @@ code = true; link = true; }; - behaviour = { enable_cursor_planning_mode = false; auto_suggestions = false; @@ -46,7 +61,6 @@ use_selection_as_context = true; max_context_tokens = 2000; }; - mappings = { ask = "aa"; edit = "ae"; @@ -79,11 +93,9 @@ reverse_switch_windows = ""; }; }; - hints = { enabled = true; }; - windows = { position = "right"; wrap = true; @@ -93,22 +105,18 @@ rounded = true; }; }; - highlights = { diff = { current = "DiffText"; incoming = "DiffAdd"; }; }; - diff = { autojump = true; list_opener = "copen"; }; }; }; - - #extraPackages = with pkgs; [ curl ]; }; }; } diff --git a/home/opencode.nix b/home/opencode.nix new file mode 100644 index 0000000..77b8de6 --- /dev/null +++ b/home/opencode.nix @@ -0,0 +1,32 @@ +_: { + programs.opencode = { + enable = true; + + settings = { + enabled_providers = [ "ollama" ]; + + model = "ollama/llama3.2:3b"; + + provider = { + ollama = { + npm = "@ai-sdk/openai-compatible"; + name = "Ollama (tailscale)"; + options = { + baseURL = "http://100.109.179.25:11434/v1"; + }; + models = { + "llama3.2:3b" = { + name = "Llama 3.2 3B"; + }; + "qwen2.5:3b" = { + name = "Qwen 2.5 3B"; + }; + "deepseek-r1:1.5b" = { + name = "DeepSeek-R1 1.5B"; + }; + }; + }; + }; + }; + }; +} From d2ad80da6f087502e5d5baabb935740669fd7ddd Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Wed, 17 Jun 2026 20:22:53 +0200 Subject: [PATCH 5/5] Configured Ollama --- nixos/roles/ollama.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/roles/ollama.nix b/nixos/roles/ollama.nix index 8f103ea..5ac74ac 100644 --- a/nixos/roles/ollama.nix +++ b/nixos/roles/ollama.nix @@ -14,5 +14,9 @@ _: { ]; syncModels = true; + + environmentVariables = { + OLLAMA_CONTEXT_LENGTH = "16384"; + }; }; }