-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathflake.nix
More file actions
55 lines (51 loc) · 1.57 KB
/
Copy pathflake.nix
File metadata and controls
55 lines (51 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
description = "onWatch - Go CLI for AI quota tracking";
inputs = {
# nixos-25.05 ships Go 1.24 (and go_1_25 = 1.25.5); go.mod requires
# >= 1.25.7, so we track nixos-unstable which defaults to Go 1.26.x.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
version = builtins.readFile ./VERSION;
onwatch = pkgs.buildGoModule {
pname = "onwatch";
inherit version;
src = ./.;
subPackages = [ "." ];
vendorHash = "sha256-zagPclPZItTTUaMh+8Ph7k5ESqc3vETPNkhMQ493MoY=";
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
# The Linux tray companion is pure Go (D-Bus StatusNotifierItem), so
# it compiles into the static binary. macOS needs cgo for its menubar
# and is left out of the Nix build.
tags = lib.optionals pkgs.stdenv.isLinux [ "menubar" ];
env.CGO_ENABLED = 0;
};
in
{
packages = {
inherit onwatch;
default = onwatch;
};
apps.default = {
type = "app";
program = "${onwatch}/bin/onwatch";
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
go
gopls
gotools
gofumpt
];
};
});
}