-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
116 lines (99 loc) · 3.34 KB
/
flake.nix
File metadata and controls
116 lines (99 loc) · 3.34 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
description = "Credit Card Statement Analyzer TUI";
inputs = {
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
# Allow unfree packages (required for claude-code)
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
# Package definition
statements = pkgs.buildGoModule {
pname = "statements";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-XijV+d9f4TagHGC2z0zaoZ1Mk1Ax9J2BC6WT/jNZgOA=";
# Build flags
ldflags = [
"-s"
"-w"
];
meta = with pkgs.lib; {
description = "Terminal UI for analyzing credit card statements";
homepage = "https://github.com/BirkhoffLee/credit-card-statement-tui";
license = licenses.mit;
maintainers = [ ];
mainProgram = "statements";
};
};
# Helper function to build the package with specific GOOS and GOARCH
buildForTarget = goos: goarch:
pkgs.buildGoModule {
pname = "statements";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-XijV+d9f4TagHGC2z0zaoZ1Mk1Ax9J2BC6WT/jNZgOA=";
ldflags = [ "-s" "-w" ];
# Set Go cross-compilation environment variables
env = {
GOOS = goos;
GOARCH = goarch;
};
};
in
{
# Default package
packages = {
default = statements;
statements = statements;
# Cross-platform builds using Go's built-in cross-compilation
statements-linux-amd64 = buildForTarget "linux" "amd64";
statements-linux-arm64 = buildForTarget "linux" "arm64";
statements-darwin-amd64 = buildForTarget "darwin" "amd64";
statements-darwin-arm64 = buildForTarget "darwin" "arm64";
statements-windows-amd64 = buildForTarget "windows" "amd64";
};
# Development shell
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Go development
go_1_25
gopls
gotools
go-tools
# Claude Code
claude-code
# Utilities
git
jq
];
shellHook = ''
echo "🚀 Welcome to statements development environment"
echo ""
echo "Available commands:"
echo " go build -o statements - Build the application"
echo " go run . - Run the application directly"
echo " nix build - Build with Nix"
echo " nix run - Run with Nix"
echo ""
echo "📦 Go version: $(go version)"
echo "🤖 Claude Code: $(claude --version)"
echo ""
# Set up Go environment
export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"
'';
};
# App for easy running
apps.default = {
type = "app";
program = "${statements}/bin/statements";
};
}
);
}