-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathflake.nix
More file actions
148 lines (129 loc) · 4.83 KB
/
flake.nix
File metadata and controls
148 lines (129 loc) · 4.83 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
description = "Backlog.md - A markdown-based task management CLI tool";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
bun2nix = {
url = "github:baileyluTCD/bun2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, bun2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
# Use baseline Bun for x86_64-linux to support older CPUs without AVX2
# This fixes issue #412 where users with older CPUs (i7-3770, i7-3612QE)
# get "Illegal instruction" errors during the build process.
#
# The baseline build targets Nehalem architecture (2008+) with SSE4.2
# instead of Haswell (2013+) with AVX2, allowing builds on older hardware.
#
# Using an overlay to replace the Bun package maintains full compatibility
# with the standard Bun package structure (thanks to @erdosxx for this solution).
pkgs = import nixpkgs {
inherit system;
overlays = if system == "x86_64-linux" then
let bunVersion = "1.2.23"; in [
(final: prev: {
bun = prev.bun.overrideAttrs (oldAttrs: {
src = prev.fetchurl {
url = "https://github.com/oven-sh/bun/releases/download/bun-v${bunVersion}/bun-linux-x64-baseline.zip";
sha256 = "017f89e19e1b40aa4c11a7cf671d3990cb51cc12288a43473238a019a8cafffc";
};
});
})
]
else
[];
};
# Read version from package.json
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
version = packageJson.version;
ldLibraryPath = ''
LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
]}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
'';
backlog-md = bun2nix.lib.${system}.mkBunDerivation {
pname = "backlog";
inherit version;
src = ./.;
packageJson = ./package.json;
bunNix = ./bun.nix;
nativeBuildInputs = with pkgs; [ bun git rsync ];
preBuild = ''
export HOME=$TMPDIR
export HUSKY=0
export ${ldLibraryPath}
'';
buildPhase = ''
runHook preBuild
# Build the CLI tool with embedded version
# Note: CSS is pre-compiled and committed to git, no need to build here
bun build --compile --minify --define "__EMBEDDED_VERSION__=${version}" --outfile=dist/backlog src/cli.ts
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp dist/backlog $out/bin/backlog
chmod +x $out/bin/backlog
runHook postInstall
'';
meta = with pkgs.lib; {
description = "A markdown-based task management CLI tool with Kanban board";
longDescription = ''
Backlog.md is a command-line tool for managing tasks and projects using markdown files.
It provides Kanban board visualization, task management, and integrates with Git workflows.
'';
homepage = "https://backlog.md";
changelog = "https://github.com/MrLesk/Backlog.md/releases";
license = licenses.mit;
maintainers = let
mrlesk = {
name = "MrLesk";
github = "MrLesk";
githubId = 181345848;
};
in
with maintainers; [ anpryl mrlesk ];
platforms = platforms.all;
mainProgram = "backlog";
};
};
in
{
packages = {
default = backlog-md;
"backlog-md" = backlog-md;
};
apps = {
default = flake-utils.lib.mkApp {
drv = backlog-md;
name = "backlog";
};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bun
bun2nix.packages.${system}.default
];
buildInputs = with pkgs; [
bun
nodejs_24
git
biome
];
shellHook = ''
export ${ldLibraryPath}
echo "Backlog.md development environment"
echo "Available commands:"
echo " bun i - Install dependencies"
echo " bun test - Run tests"
echo " bun run cli - Run CLI in development mode"
echo " bun run build - Build the CLI tool"
echo " bun run check - Run Biome checks"
'';
};
});
}