add openusage

Signed-off-by: Christoph Schmatzler <christoph@schmatzler.com>
This commit is contained in:
2026-02-09 17:15:10 +00:00
parent 42873f4d2d
commit d38a348a06
4 changed files with 155 additions and 0 deletions

18
flake.lock generated
View File

@@ -495,6 +495,23 @@
"type": "github" "type": "github"
} }
}, },
"openusage": {
"flake": false,
"locked": {
"lastModified": 1770543295,
"narHash": "sha256-DvgEPZhFm06igalUPgnQ8VLkl0gk/3rm+lbEJ2/s7gM=",
"owner": "robinebers",
"repo": "openusage",
"rev": "22a7bd5f7856397400e60dd787ad82b23c763969",
"type": "github"
},
"original": {
"owner": "robinebers",
"ref": "v0.5.1",
"repo": "openusage",
"type": "github"
}
},
"overseer": { "overseer": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -526,6 +543,7 @@
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixvim": "nixvim", "nixvim": "nixvim",
"nono": "nono", "nono": "nono",
"openusage": "openusage",
"overseer": "overseer", "overseer": "overseer",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"zjstatus": "zjstatus" "zjstatus": "zjstatus"

View File

@@ -48,6 +48,10 @@
url = "github:dmmulroy/overseer"; url = "github:dmmulroy/overseer";
flake = false; flake = false;
}; };
openusage = {
url = "github:robinebers/openusage/v0.5.1";
flake = false;
};
}; };
outputs = inputs @ {flake-parts, ...}: outputs = inputs @ {flake-parts, ...}:

132
overlays/openusage.nix Normal file
View File

@@ -0,0 +1,132 @@
{inputs}: final: prev: let
version = "0.5.1";
in {
openusage =
prev.rustPlatform.buildRustPackage (finalAttrs: {
pname = "openusage";
inherit version;
src = inputs.openusage;
cargoRoot = "src-tauri";
cargoLock = {
lockFile = "${inputs.openusage}/src-tauri/Cargo.lock";
outputHashes = {
"tauri-nspanel-2.1.0" = "sha256-PLACEHOLDER";
"tauri-plugin-aptabase-1.0.0" = "sha256-PLACEHOLDER";
};
};
buildAndTestSubdir = finalAttrs.cargoRoot;
node_modules =
prev.stdenv.mkDerivation {
inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-node_modules";
impureEnvVars =
prev.lib.fetchers.proxyImpureEnvVars
++ [
"GIT_PROXY_COMMAND"
"SOCKS_SERVER"
];
nativeBuildInputs = [
prev.bun
prev.writableTmpDirAsHomeHook
];
dontConfigure = true;
dontFixup = true;
dontPatchShebangs = true;
buildPhase = ''
runHook preBuild
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
bun install \
--no-progress \
--frozen-lockfile \
--ignore-scripts
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -R ./node_modules $out
runHook postInstall
'';
outputHash = "sha256-PLACEHOLDER";
outputHashMode = "recursive";
};
nativeBuildInputs = [
prev.cargo-tauri.hook
prev.rustPlatform.bindgenHook
prev.bun
prev.nodejs
prev.pkg-config
prev.makeBinaryWrapper
];
buildInputs =
prev.lib.optionals prev.stdenv.isDarwin (
with prev.darwin.apple_sdk.frameworks; [
AppKit
CoreFoundation
CoreServices
Security
WebKit
]
);
# Disable updater artifact generation — we don't have signing keys.
tauriConf = builtins.toJSON {bundle.createUpdaterArtifacts = false;};
passAsFile = ["tauriConf"];
preBuild = ''
tauriBuildFlags+=(
"--config"
"$tauriConfPath"
)
'';
configurePhase = ''
runHook preConfigure
# Copy pre-fetched node_modules
cp -R ${finalAttrs.node_modules} node_modules/
chmod -R u+rw node_modules
chmod -R u+x node_modules/.bin
patchShebangs node_modules
export HOME=$TMPDIR
export PATH="$PWD/node_modules/.bin:$PATH"
# Bundle plugins (copy from plugins/ to src-tauri/resources/bundled_plugins/)
${prev.nodejs}/bin/node copy-bundled.cjs
runHook postConfigure
'';
env = {
OPENSSL_NO_VENDOR = true;
};
doCheck = false;
postInstall =
prev.lib.optionalString prev.stdenv.isDarwin ''
makeWrapper $out/Applications/OpenUsage.app/Contents/MacOS/OpenUsage $out/bin/openusage
'';
meta = {
description = "Track all your AI coding subscriptions in one place";
homepage = "https://github.com/robinebers/openusage";
license = prev.lib.licenses.mit;
platforms = prev.lib.platforms.darwin;
mainProgram = "openusage";
};
});
}

View File

@@ -52,6 +52,7 @@ with pkgs;
alcove alcove
dockutil dockutil
mas mas
openusage
raycast raycast
tailscale tailscale
xcodes xcodes