-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
114 lines (93 loc) · 3.63 KB
/
flake.nix
File metadata and controls
114 lines (93 loc) · 3.63 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
{
description = "bleamd - Markdown Renderer & Search for the terminal";
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};
# Version information
version = "0.1.0";
gitCommit = if (self ? rev) then self.rev else "dirty";
in
{
packages = {
default = self.packages.${system}.bleamd;
bleamd = pkgs.buildGoModule {
pname = "bleamd";
inherit version;
src = ./.;
# Generate vendor hash with: nix run nixpkgs#nix-prefetch-git -- --url . --fetch-submodules
# Or let nix tell you the correct hash on first build
vendorHash = "sha256-s7SEUAt9SJEDm8+1N5cb5+mM9M6H7tAfSzZKczu/60s=";
# Add version information as build flags
ldflags = [
"-s"
"-w"
"-X main.GitCommit=${gitCommit}"
"-X main.GitLastTag=v${version}"
"-X main.GitExactTag=v${version}"
];
# Ensure binary is named bleamd (Go may name it based on directory/module)
# This is a safety check in case the build process creates 'mdr'
postInstall = ''
if [ -f $out/bin/mdr ] && [ ! -f $out/bin/bleamd ]; then
mv $out/bin/mdr $out/bin/bleamd
fi
install -Dm644 ${./bleamd-icon.svg} $out/share/icons/hicolor/scalable/apps/bleamd-icon.svg
install -Dm644 ${./bleamd.desktop} $out/share/applications/bleamd.desktop
'';
# Disable tests that might require network access
doCheck = false;
meta = with pkgs.lib; {
description = "A standalone Markdown renderer for the terminal with search functionality";
homepage = "https://github.com/guttermonk/bleamd";
license = licenses.mit;
maintainers = [];
mainProgram = "bleamd";
};
};
};
apps = {
default = self.apps.${system}.bleamd;
bleamd = {
type = "app";
program = "${self.packages.${system}.bleamd}/bin/bleamd";
};
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
# Go development
go
gopls
go-tools
golangci-lint
# Build tools
gnumake
git
# Optional: for cross-compilation
gox
# Helpful tools
entr # for file watching
ripgrep # for searching
];
shellHook = ''
echo "bleamd development environment"
echo "Available commands:"
echo " go build - Build the project"
echo " go run . FILE - Run bleamd with a markdown file"
echo " make build - Build using Makefile"
echo " nix build - Build with nix"
echo " nix run - Run the built version"
echo ""
echo "Go version: $(go version)"
'';
};
};
# Legacy support for nix-shell
devShell = self.devShells.${system}.default;
});
}