-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
100 lines (80 loc) · 3.03 KB
/
flake.nix
File metadata and controls
100 lines (80 loc) · 3.03 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
{
description = "GT Terminal and GF File Browser";
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
pkgs = nixpkgs.legacyPackages.${system};
goVersion = pkgs.go_1_22; # Specify Go version
# Placeholder vendor hash - Needs to be generated after first build attempt
# Run: nix build .#gt (or .#gf)
# Copy the hash from the error message and replace fakeSha256 below.
vendorSha256 = pkgs.lib.fakeSha256;
# Alternatively use: vendorSha256 = null;
in
{
# Packages accessible via `nix build .#<name>`
packages = {
gt = pkgs.buildGoModule {
pname = "gt";
version = "1.2.0"; # Match version in main.go or use git describe
src = self;
subPackages = [ "cmd/gt" ];
inherit vendorSha256;
# System dependencies needed by gt
buildInputs = [
pkgs.sdl2
pkgs.SDL2_ttf
];
# On Darwin, we might need specific frameworks
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Cocoa
pkgs.darwin.apple_sdk.frameworks.Security
];
ldflags = [ "-s" "-w" ]; # Strip debug info and symbols
};
gf = pkgs.buildGoModule {
pname = "gf";
version = "0.1.0"; # Assign a version
src = self;
subPackages = [ "cmd/gf" ];
inherit vendorSha256;
# gf seems to be pure Go TUI, likely no extra system deps needed
buildInputs = [ ];
ldflags = [ "-s" "-w" ]; # Strip debug info and symbols
};
default = self.packages.${system}.gt; # Default package is gt
};
# Apps accessible via `nix run .#<name>`
apps = {
gt = flake-utils.lib.mkApp { drv = self.packages.${system}.gt; };
gf = flake-utils.lib.mkApp { drv = self.packages.${system}.gf; };
default = self.apps.${system}.gt; # Default app is gt
};
# Development shell accessible via `nix develop`
devShells.default = pkgs.mkShell {
name = "gt-dev-shell";
# Tools needed for development
packages = [
goVersion # Go compiler
pkgs.gopls # Go Language Server
pkgs.gotools # Go tools (like goimports)
pkgs.go-outline
pkgs.delve # Go debugger
];
# Dependencies needed to build the project within the shell
inputsFrom = [
self.packages.${system}.gt # Includes SDL deps
self.packages.${system}.gf
];
# Environment variables if needed
# shellHook = ''
# export SOME_VAR="value"
# ''';
};
}
);
}