From dc2f3b6802beaefe2dc1a896bc2435a0c2716def Mon Sep 17 00:00:00 2001 From: m3tm3re Date: Thu, 12 Feb 2026 19:42:11 +0100 Subject: [PATCH] feat: update opencode to v1.1.60 and re-enable opencode-desktop - Update opencode flake input to v1.1.60 - Add nixpkgs-master input for opencode (needs newer bun) - Re-enable opencode-desktop with workaround for upstream issue #11755 - Add specta/tauri outputHashes for git dependencies - Add .todos/ to gitignore - Update AGENTS.md with td task management instructions --- .gitignore | 1 + AGENTS.md | 5 + README.md | 3 +- flake.lock | 23 ++-- flake.nix | 204 ++++++++++++++---------------- pkgs/default.nix | 36 +++--- pkgs/opencode-desktop/default.nix | 123 +++++++++++++++--- 7 files changed, 233 insertions(+), 162 deletions(-) diff --git a/.gitignore b/.gitignore index 9afc6f5..8820513 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ test-result/ # Local configuration (if you want to keep local overrides) local.nix flake.lock.bak +.todos/ diff --git a/AGENTS.md b/AGENTS.md index 76a59e4..8d06e51 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,10 @@ # m3ta-nixpkgs Knowledge Base +## MANDATORY: Use td for Task Management + +You must run td usage --new-session at conversation start (or after /clear) to see current work. +Use td usage -q for subsequent reads. + **Generated:** 2026-01-13 **Commit:** 366af12 **Branch:** master diff --git a/README.md b/README.md index 2605031..4286069 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ nix run git+https://code.m3ta.dev/m3tam3re/nixpkgs#zellij-ps | `msty-studio` | Msty Studio application | | `n8n` | Free and source-available fair-code licensed workflow automation tool | | `opencode` | AI coding agent built for the terminal | +| `opencode-desktop` | OpenCode Desktop App with Wayland support (includes workaround for upstream issue #11755) | | `pomodoro-timer` | Pomodoro timer utility | | `rofi-project-opener` | Rofi-based project launcher | | `stt-ptt` | Push to Talk Speech to Text | @@ -76,8 +77,6 @@ Go to **Actions → Update Nix Packages with nix-update → Run workflow** in Gi 2. Token scopes needed: `user`, `repo`, `write:issue` 3. Add token as secret: Settings → Secrets → New → `NIX_UPDATE_TOKEN` -**Note:** The `opencode-desktop` package is currently disabled due to an upstream issue with missing specta dependency hashes. See [issue #11755](https://github.com/anomalyco/opencode/issues/11755) for details. This is a temporary workaround until the upstream issue is resolved. - For detailed usage, module documentation, package references, and contribution guidelines, see the [full documentation](./docs). ## License diff --git a/flake.lock b/flake.lock index f85f9b7..6bc237c 100644 --- a/flake.lock +++ b/flake.lock @@ -16,37 +16,39 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs-master": { "locked": { - "lastModified": 1770073757, - "narHash": "sha256-Vy+G+F+3E/Tl+GMNgiHl9Pah2DgShmIUBJXmbiQPHbI=", + "lastModified": 1770917518, + "narHash": "sha256-XSwv/tVrNo/L8SPH8Lx9xZH1PrZd/3Z3J/0SH7Xertg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "47472570b1e607482890801aeaf29bfb749884f6", + "rev": "3f4a3c08f2f318ee29fc8a2689f390071a94aaf0", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "master", "repo": "nixpkgs", "type": "github" } }, "opencode": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs-master" + ] }, "locked": { - "lastModified": 1770817534, - "narHash": "sha256-AcLT70Gjt78nDd13ACUDavE+QI+ouEBwyZq8hIDDAf8=", + "lastModified": 1770875904, + "narHash": "sha256-8ZEVlGe1saA/2KtDTKgkwWfpLCbxfwFip+m+3FlQQK0=", "owner": "anomalyco", "repo": "opencode", - "rev": "edcfd562af6ea5fdc1ade9f46259a676d7663801", + "rev": "03de51bd3cf9e05bd92c9f51763b74a3cdfbe61a", "type": "github" }, "original": { "owner": "anomalyco", - "ref": "v1.1.57", + "ref": "v1.1.60", "repo": "opencode", "type": "github" } @@ -54,6 +56,7 @@ "root": { "inputs": { "nixpkgs": "nixpkgs", + "nixpkgs-master": "nixpkgs-master", "opencode": "opencode" } } diff --git a/flake.nix b/flake.nix index e929ace..bcc8e37 100644 --- a/flake.nix +++ b/flake.nix @@ -1,118 +1,102 @@ { - description = "m3ta's personal Nix repository - Custom packages, overlays, and modules"; + description = + "m3ta's personal Nix repository - Custom packages, overlays, and modules"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - opencode.url = "github:anomalyco/opencode/v1.1.59"; + nixpkgs-master.url = "github:NixOS/nixpkgs/master"; - # Optional: Add stable channel if needed - # nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; - }; - - outputs = { - self, - nixpkgs, - ... - } @ inputs: let - # Supported systems - systems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; - - # Helper function to generate an attrset for each of the systems - forAllSystems = nixpkgs.lib.genAttrs systems; - - # Helper to create pkgs for a given system - pkgsFor = system: - import nixpkgs { - inherit system; - config.allowUnfree = true; - }; - in { - # Custom packages - accessible via 'nix build .#package-name' - packages = forAllSystems ( - system: let - pkgs = pkgsFor system; - in - import ./pkgs {inherit pkgs inputs;} - ); - - # Overlays - can be imported in your system configuration - overlays = { - # Default overlay: adds all custom packages - default = final: prev: - import ./pkgs { - pkgs = final; - inputs = inputs; - }; - - # Individual overlays for more granular control - additions = final: prev: - import ./pkgs { - pkgs = final; - inputs = inputs; - }; - - modifications = final: prev: - import ./overlays/mods {inherit prev;}; - }; - - # NixOS modules - for system-level configuration - nixosModules = { - default = ./modules/nixos; - # Individual modules for selective imports - ports = ./modules/nixos/ports.nix; - mem0 = ./modules/nixos/mem0.nix; - }; - - # Home Manager modules - for user-level configuration - homeManagerModules = { - default = import ./modules/home-manager; - ports = import ./modules/home-manager/ports.nix; - zellij-ps = import ./modules/home-manager/zellij-ps.nix; - }; - - # Library functions - helper utilities for your configuration - lib = forAllSystems ( - system: let - pkgs = pkgsFor system; - in - import ./lib {lib = pkgs.lib;} - ); - - # Development shells for various programming environments - # Usage: nix develop .# - # Available shells: default, python, devops - devShells = forAllSystems ( - system: let - pkgs = pkgsFor system; - in - import ./shells {inherit pkgs;} - ); - - # Formatter for 'nix fmt' - formatter = forAllSystems ( - system: - (pkgsFor system).alejandra - ); - - # Templates for creating new packages/modules - templates = { - package = { - path = ./templates/package; - description = "Template for a new package"; - }; - nixos-module = { - path = ./templates/nixos-module; - description = "Template for a new NixOS module"; - }; - home-manager-module = { - path = ./templates/home-manager-module; - description = "Template for a new Home Manager module"; - }; + # opencode needs newer bun from master + opencode = { + url = "github:anomalyco/opencode/v1.1.60"; + inputs.nixpkgs.follows = "nixpkgs-master"; }; }; + + outputs = { self, nixpkgs, ... }@inputs: + let + # Supported systems + systems = + [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + + # Helper function to generate an attrset for each of the systems + forAllSystems = nixpkgs.lib.genAttrs systems; + + # Helper to create pkgs for a given system + pkgsFor = system: + import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + in { + # Custom packages - accessible via 'nix build .#package-name' + packages = forAllSystems (system: + let pkgs = pkgsFor system; + in import ./pkgs { inherit pkgs inputs; }); + + # Overlays - can be imported in your system configuration + overlays = { + # Default overlay: adds all custom packages + default = final: prev: + import ./pkgs { + pkgs = final; + inputs = inputs; + }; + + # Individual overlays for more granular control + additions = final: prev: + import ./pkgs { + pkgs = final; + inputs = inputs; + }; + + modifications = final: prev: import ./overlays/mods { inherit prev; }; + }; + + # NixOS modules - for system-level configuration + nixosModules = { + default = ./modules/nixos; + # Individual modules for selective imports + ports = ./modules/nixos/ports.nix; + mem0 = ./modules/nixos/mem0.nix; + }; + + # Home Manager modules - for user-level configuration + homeManagerModules = { + default = import ./modules/home-manager; + ports = import ./modules/home-manager/ports.nix; + zellij-ps = import ./modules/home-manager/zellij-ps.nix; + }; + + # Library functions - helper utilities for your configuration + lib = forAllSystems (system: + let pkgs = pkgsFor system; + in import ./lib { lib = pkgs.lib; }); + + # Development shells for various programming environments + # Usage: nix develop .# + # Available shells: default, python, devops + devShells = forAllSystems (system: + let pkgs = pkgsFor system; + in import ./shells { inherit pkgs; }); + + # Formatter for 'nix fmt' + formatter = forAllSystems (system: (pkgsFor system).alejandra); + + # Templates for creating new packages/modules + templates = { + package = { + path = ./templates/package; + description = "Template for a new package"; + }; + nixos-module = { + path = ./templates/nixos-module; + description = "Template for a new NixOS module"; + }; + home-manager-module = { + path = ./templates/home-manager-module; + description = "Template for a new Home Manager module"; + }; + }; + }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 5d108c9..0a48227 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,26 +1,22 @@ -{ - pkgs, - inputs ? null, - ... -}: { +{ pkgs, inputs ? null, ... }: { # Custom packages registry # Each package is defined in its own directory under pkgs/ - beads = pkgs.callPackage ./beads {}; - sidecar = pkgs.callPackage ./sidecar {}; - td = pkgs.callPackage ./td {}; - code2prompt = pkgs.callPackage ./code2prompt {}; - hyprpaper-random = pkgs.callPackage ./hyprpaper-random {}; - launch-webapp = pkgs.callPackage ./launch-webapp {}; - mem0 = pkgs.callPackage ./mem0 {}; - msty-studio = pkgs.callPackage ./msty-studio {}; - n8n = pkgs.callPackage ./n8n {}; - pomodoro-timer = pkgs.callPackage ./pomodoro-timer {}; - rofi-project-opener = pkgs.callPackage ./rofi-project-opener {}; - stt-ptt = pkgs.callPackage ./stt-ptt {}; - tuxedo-backlight = pkgs.callPackage ./tuxedo-backlight {}; - zellij-ps = pkgs.callPackage ./zellij-ps {}; + beads = pkgs.callPackage ./beads { }; + sidecar = pkgs.callPackage ./sidecar { }; + td = pkgs.callPackage ./td { }; + code2prompt = pkgs.callPackage ./code2prompt { }; + hyprpaper-random = pkgs.callPackage ./hyprpaper-random { }; + launch-webapp = pkgs.callPackage ./launch-webapp { }; + mem0 = pkgs.callPackage ./mem0 { }; + msty-studio = pkgs.callPackage ./msty-studio { }; + n8n = pkgs.callPackage ./n8n { }; + pomodoro-timer = pkgs.callPackage ./pomodoro-timer { }; + rofi-project-opener = pkgs.callPackage ./rofi-project-opener { }; + stt-ptt = pkgs.callPackage ./stt-ptt { }; + tuxedo-backlight = pkgs.callPackage ./tuxedo-backlight { }; + zellij-ps = pkgs.callPackage ./zellij-ps { }; # Imported from flake inputs opencode = inputs.opencode.packages.${pkgs.system}.opencode; - # opencode-desktop = pkgs.callPackage ./opencode-desktop { inherit inputs; }; + opencode-desktop = pkgs.callPackage ./opencode-desktop { inherit inputs; }; } diff --git a/pkgs/opencode-desktop/default.nix b/pkgs/opencode-desktop/default.nix index 894b224..5d3baf2 100644 --- a/pkgs/opencode-desktop/default.nix +++ b/pkgs/opencode-desktop/default.nix @@ -1,23 +1,106 @@ -{ lib, stdenv, symlinkJoin, makeWrapper, inputs ? null, }: -let - opencode-desktop = - inputs.opencode.packages.${stdenv.hostPlatform.system}.desktop; -in symlinkJoin { - name = "opencode-desktop"; - paths = [ opencode-desktop ]; +{ + lib, + stdenv, + symlinkJoin, + makeWrapper, + rustPlatform, + pkg-config, + cargo-tauri, + bun, + nodejs, + cargo, + rustc, + jq, + wrapGAppsHook4, + dbus, + glib, + gtk4, + libsoup_3, + librsvg, + libappindicator, + glib-networking, + openssl, + webkitgtk_4_1, + gst_all_1, + inputs ? null, +}: let + # Get upstream opencode package for shared attributes + opencode = inputs.opencode.packages.${stdenv.hostPlatform.system}.default; - nativeBuildInputs = [ makeWrapper ]; + # Workaround for https://github.com/anomalyco/opencode/issues/11755 + # Upstream is missing outputHashes for git dependencies + opencode-desktop = rustPlatform.buildRustPackage (finalAttrs: { + pname = "opencode-desktop"; + inherit (opencode) version src node_modules patches; - postBuild = '' - wrapProgram $out/bin/opencode-desktop \ - --run 'if [[ "$NIXOS_OZONE_WL" == "1" ]]; then export OC_ALLOW_WAYLAND=1; fi' - ''; + cargoRoot = "packages/desktop/src-tauri"; + cargoLock = { + lockFile = finalAttrs.src + "/packages/desktop/src-tauri/Cargo.lock"; + outputHashes = { + "specta-2.0.0-rc.22" = "sha256-YsyOAnXELLKzhNlJ35dHA6KGbs0wTAX/nlQoW8wWyJQ="; + "tauri-2.9.5" = "sha256-dv5E/+A49ZBvnUQUkCGGJ21iHrVvrhHKNcpUctivJ8M="; + "tauri-specta-2.0.0-rc.21" = "sha256-n2VJ+B1nVrh6zQoZyfMoctqP+Csh7eVHRXwUQuiQjaQ="; + }; + }; + buildAndTestSubdir = finalAttrs.cargoRoot; - meta = { - description = "OpenCode Desktop App with Wayland support"; - homepage = "https://opencode.ai"; - license = lib.licenses.mit; - platforms = lib.platforms.linux; - mainProgram = "opencode-desktop"; - }; -} + nativeBuildInputs = + [pkg-config cargo-tauri.hook bun nodejs cargo rustc jq makeWrapper] + ++ lib.optionals stdenv.hostPlatform.isLinux [wrapGAppsHook4]; + + buildInputs = lib.optionals stdenv.isLinux [ + dbus + glib + gtk4 + libsoup_3 + librsvg + libappindicator + glib-networking + openssl + webkitgtk_4_1 + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-good + gst_all_1.gst-plugins-bad + ]; + + strictDeps = true; + + preBuild = '' + cp -a ${finalAttrs.node_modules}/{node_modules,packages} . + chmod -R u+w node_modules packages + patchShebangs node_modules + patchShebangs packages/desktop/node_modules + + mkdir -p packages/desktop/src-tauri/sidecars + cp ${opencode}/bin/opencode packages/desktop/src-tauri/sidecars/opencode-cli-${stdenv.hostPlatform.rust.rustcTarget} + ''; + + tauriBuildFlags = ["--config" "tauri.prod.conf.json" "--no-sign"]; + + postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' + mv $out/bin/OpenCode $out/bin/opencode-desktop + sed -i 's|^Exec=OpenCode$|Exec=opencode-desktop|' $out/share/applications/OpenCode.desktop + ''; + }); + # Wrapper for Wayland support +in + symlinkJoin { + name = "opencode-desktop"; + paths = [opencode-desktop]; + + nativeBuildInputs = [makeWrapper]; + + postBuild = '' + wrapProgram $out/bin/opencode-desktop \ + --run 'if [[ "$NIXOS_OZONE_WL" == "1" ]]; then export OC_ALLOW_WAYLAND=1; fi' + ''; + + meta = { + description = "OpenCode Desktop App with Wayland support"; + homepage = "https://opencode.ai"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + mainProgram = "opencode-desktop"; + }; + }