Skip to content

Commit db48a1c

Browse files
authored
nix: add flake (#1)
1 parent a8eae19 commit db48a1c

4 files changed

Lines changed: 357 additions & 0 deletions

File tree

.github/workflows/gomod2nix.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Workflow originally from https://github.com/AvengeMedia/danklinux/blob/4a70b1c7366bddcaf1ce209a5132fad259cb2460/.github/workflows/gomod2nix.yml
2+
# under the MIT license
3+
4+
name: Gomod2nix
5+
6+
on:
7+
push:
8+
paths:
9+
- "go.mod"
10+
- "go.sum"
11+
12+
jobs:
13+
update-gomod2nix_toml:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v5
17+
- uses: cachix/install-nix-action@v31
18+
- name: Update gomod2nix.toml
19+
run: nix run github:nix-community/gomod2nix/v1.7.0 --override-input nixpkgs nixpkgs
20+
- name: Commit and push gomod2nix.toml update
21+
run: |
22+
set -euo pipefail
23+
24+
if ! git diff --quiet; then
25+
git config user.name "github-actions[bot]"
26+
git config user.email "github-actions[bot]@users.noreply.github.com"
27+
28+
git add gomod2nix.toml
29+
git commit -m "nix: update gomod2nix.toml"
30+
31+
for attempt in 1 2 3; do
32+
if git push; then
33+
echo "Successfully pushed gomod2nix.toml update"
34+
exit 0
35+
fi
36+
echo "Push attempt $attempt failed, pulling and retrying..."
37+
git pull --rebase
38+
sleep $((attempt*2))
39+
done
40+
41+
echo "Failed to push after retries" >&2
42+
exit 1
43+
fi

flake.lock

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
description = "Indexed filesystem search in GO";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
gomod2nix = {
7+
url = "github:nix-community/gomod2nix/v1.7.0";
8+
inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
};
11+
12+
outputs =
13+
{ self, nixpkgs, gomod2nix }:
14+
let
15+
supportedSystems = [
16+
"x86_64-linux"
17+
"aarch64-linux"
18+
];
19+
20+
forAllSystems =
21+
f:
22+
builtins.listToAttrs (
23+
map (system: {
24+
name = system;
25+
value = f system;
26+
}) supportedSystems
27+
);
28+
29+
in
30+
{
31+
packages = forAllSystems (
32+
system:
33+
let
34+
pkgs = import nixpkgs { inherit system; };
35+
lib = pkgs.lib;
36+
dsearchVersion = "0.0.7";
37+
in
38+
{
39+
dsearch = gomod2nix.legacyPackages.${system}.buildGoApplication {
40+
pname = "dsearch";
41+
version = dsearchVersion;
42+
src = ./.;
43+
modules = ./gomod2nix.toml;
44+
45+
subPackages = [ "cmd/dsearch" ];
46+
47+
ldflags = [
48+
"-s"
49+
"-w"
50+
"-X main.Version=${dsearchVersion}"
51+
];
52+
53+
postPatch = ''
54+
substituteInPlace assets/dsearch.service \
55+
--replace-fail /usr/local/bin $out/bin
56+
'';
57+
58+
postInstall = ''
59+
install -Dm 644 assets/dsearch.service -t $out/lib/systemd/user
60+
'';
61+
62+
meta = {
63+
description = "Indexed filesystem search in GO";
64+
homepage = "https://github.com/AvengeMedia/danksearch";
65+
mainProgram = "dsearch";
66+
license = lib.licenses.mit;
67+
platforms = lib.platforms.unix;
68+
};
69+
};
70+
71+
default = self.packages.${system}.dsearch;
72+
}
73+
);
74+
};
75+
}

gomod2nix.toml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
schema = 3
2+
3+
[mod]
4+
[mod."github.com/BurntSushi/toml"]
5+
version = "v1.5.0"
6+
hash = "sha256-wX8bEVo7swuuAlm0awTIiV1KNCAXnm7Epzwl+wzyqhw="
7+
[mod."github.com/RoaringBitmap/roaring/v2"]
8+
version = "v2.4.5"
9+
hash = "sha256-igWY0S1PTolQkfctYcmVJioJyV1pk2V81X6o6BA1XQA="
10+
[mod."github.com/aymanbagabas/go-osc52/v2"]
11+
version = "v2.0.1"
12+
hash = "sha256-6Bp0jBZ6npvsYcKZGHHIUSVSTAMEyieweAX2YAKDjjg="
13+
[mod."github.com/bits-and-blooms/bitset"]
14+
version = "v1.22.0"
15+
hash = "sha256-lY1K29h4vlAmJVvwKgbTG8BTACYGjFaginCszN+ST6w="
16+
[mod."github.com/blevesearch/bleve/v2"]
17+
version = "v2.5.4"
18+
hash = "sha256-SvlPvZ3H0xY3KwW/7XKJFTM7MsgWVL4nkrfd3le5Xh8="
19+
[mod."github.com/blevesearch/bleve_index_api"]
20+
version = "v1.2.10"
21+
hash = "sha256-1lC62MFXNuZ9NvvsAC18zGM+IXaPHXqyF2vmSTzJLJ8="
22+
[mod."github.com/blevesearch/geo"]
23+
version = "v0.2.4"
24+
hash = "sha256-W1OV/pvqzJC28VJomGnIU/HeBZ689+p54vWdZ1z/bxc="
25+
[mod."github.com/blevesearch/go-faiss"]
26+
version = "v1.0.25"
27+
hash = "sha256-bcm976UX22aNIuSjBxFaYMKTltO9lbqyeG4Z3KVG3/Y="
28+
[mod."github.com/blevesearch/go-porterstemmer"]
29+
version = "v1.0.3"
30+
hash = "sha256-hUjo6g1ehUD1awBmta0ji/xoooD2qG7O22HIeSQiRFo="
31+
[mod."github.com/blevesearch/gtreap"]
32+
version = "v0.1.1"
33+
hash = "sha256-B4p/5RnECRfV4yOiSQDLMHb23uI7lsQDePhNK+zjbF4="
34+
[mod."github.com/blevesearch/mmap-go"]
35+
version = "v1.0.4"
36+
hash = "sha256-8y0nMAE9goKjYhR/FFEvtbP7cvM46xneE461L1Jn2Pg="
37+
[mod."github.com/blevesearch/scorch_segment_api/v2"]
38+
version = "v2.3.12"
39+
hash = "sha256-C9yB9jK37Wc9pjWOmZjcEnnhYn1wVDvWiOfw4sbFCrg="
40+
[mod."github.com/blevesearch/segment"]
41+
version = "v0.9.1"
42+
hash = "sha256-0EAT737kNxl8IJFGl2SD9mOzxolONGgpfaYEGr7JXkQ="
43+
[mod."github.com/blevesearch/snowballstem"]
44+
version = "v0.9.0"
45+
hash = "sha256-NQsXrhXcYXn4jQcvwjwLc96SGMRcqVlrR6hYKWGk7/s="
46+
[mod."github.com/blevesearch/upsidedown_store_api"]
47+
version = "v1.0.2"
48+
hash = "sha256-P69Mnh6YR5RI73bD6L7BYDxkVmaqPMNUrjbfSJoKWuo="
49+
[mod."github.com/blevesearch/vellum"]
50+
version = "v1.1.0"
51+
hash = "sha256-GJ1wslEJEZhPbMiANw0W4Dgb1ZouiILbWEaIUfxZTkw="
52+
[mod."github.com/blevesearch/zapx/v11"]
53+
version = "v11.4.2"
54+
hash = "sha256-YzRcc2GwV4VL2Bc+tXOOUL6xNi8LWS76DXEcTkFPTaQ="
55+
[mod."github.com/blevesearch/zapx/v12"]
56+
version = "v12.4.2"
57+
hash = "sha256-yqyzkMWpyXZSF9KLjtiuOmnRUfhaZImk27mU8lsMyJY="
58+
[mod."github.com/blevesearch/zapx/v13"]
59+
version = "v13.4.2"
60+
hash = "sha256-VSS2fI7YUkeGMBH89TB9yW5qG8MWjM6zKbl8DboHsB4="
61+
[mod."github.com/blevesearch/zapx/v14"]
62+
version = "v14.4.2"
63+
hash = "sha256-mAWr+vK0uZWMUaJfGfchzQo4dzMdBbD3Z7F84Jn/ktg="
64+
[mod."github.com/blevesearch/zapx/v15"]
65+
version = "v15.4.2"
66+
hash = "sha256-R8Eh3N4e8CDXiW47J8ZBnfMY1TTnX1SJPwQc4gYChi8="
67+
[mod."github.com/blevesearch/zapx/v16"]
68+
version = "v16.2.6"
69+
hash = "sha256-8b3jMCCKOz8Biven8VTe9wxPVxbdnvGfZ3ccvK/0WA0="
70+
[mod."github.com/charmbracelet/colorprofile"]
71+
version = "v0.2.3-0.20250311203215-f60798e515dc"
72+
hash = "sha256-D9E/bMOyLXAUVOHA1/6o3i+vVmLfwIMOWib6sU7A6+Q="
73+
[mod."github.com/charmbracelet/lipgloss"]
74+
version = "v1.1.0"
75+
hash = "sha256-RHsRT2EZ1nDOElxAK+6/DC9XAaGVjDTgPvRh3pyCfY4="
76+
[mod."github.com/charmbracelet/log"]
77+
version = "v0.4.2"
78+
hash = "sha256-3w1PCM/c4JvVEh2d0sMfv4C77Xs1bPa1Ea84zdynC7I="
79+
[mod."github.com/charmbracelet/x/ansi"]
80+
version = "v0.8.0"
81+
hash = "sha256-/YyDkGrULV2BtnNk3ojeSl0nUWQwIfIdW7WJuGbAZas="
82+
[mod."github.com/charmbracelet/x/cellbuf"]
83+
version = "v0.0.13-0.20250311204145-2c3ea96c31dd"
84+
hash = "sha256-XAhCOt8qJ2vR77lH1ez0IVU1/2CaLTq9jSmrHVg5HHU="
85+
[mod."github.com/charmbracelet/x/term"]
86+
version = "v0.2.1"
87+
hash = "sha256-VBkCZLI90PhMasftGw3403IqoV7d3E5WEGAIVrN5xQM="
88+
[mod."github.com/danielgtaylor/huma/v2"]
89+
version = "v2.34.1"
90+
hash = "sha256-GU9ksEvtLppUYUISOWcxh4oD3JcmFgyyQnaPJ+L3cM4="
91+
[mod."github.com/fsnotify/fsnotify"]
92+
version = "v1.9.0"
93+
hash = "sha256-WtpE1N6dpHwEvIub7Xp/CrWm0fd6PX7MKA4PV44rp2g="
94+
[mod."github.com/go-chi/chi/v5"]
95+
version = "v5.2.3"
96+
hash = "sha256-fB8KidqJgWrPnnS+0uIKVOO1VRclD6nG1Lt1IeSq2M0="
97+
[mod."github.com/go-logfmt/logfmt"]
98+
version = "v0.6.0"
99+
hash = "sha256-RtIG2qARd5sT10WQ7F3LR8YJhS8exs+KiuUiVf75bWg="
100+
[mod."github.com/golang/snappy"]
101+
version = "v0.0.4"
102+
hash = "sha256-Umx+5xHAQCN/Gi4HbtMhnDCSPFAXSsjVbXd8n5LhjAA="
103+
[mod."github.com/inconshreveable/mousetrap"]
104+
version = "v1.1.0"
105+
hash = "sha256-XWlYH0c8IcxAwQTnIi6WYqq44nOKUylSWxWO/vi+8pE="
106+
[mod."github.com/json-iterator/go"]
107+
version = "v1.1.12"
108+
hash = "sha256-To8A0h+lbfZ/6zM+2PpRpY3+L6725OPC66lffq6fUoM="
109+
[mod."github.com/lucasb-eyer/go-colorful"]
110+
version = "v1.2.0"
111+
hash = "sha256-Gg9dDJFCTaHrKHRR1SrJgZ8fWieJkybljybkI9x0gyE="
112+
[mod."github.com/mattn/go-isatty"]
113+
version = "v0.0.20"
114+
hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ="
115+
[mod."github.com/mattn/go-runewidth"]
116+
version = "v0.0.16"
117+
hash = "sha256-NC+ntvwIpqDNmXb7aixcg09il80ygq6JAnW0Gb5b/DQ="
118+
[mod."github.com/modern-go/concurrent"]
119+
version = "v0.0.0-20180306012644-bacd9c7ef1dd"
120+
hash = "sha256-OTySieAgPWR4oJnlohaFTeK1tRaVp/b0d1rYY8xKMzo="
121+
[mod."github.com/modern-go/reflect2"]
122+
version = "v1.0.2"
123+
hash = "sha256-+W9EIW7okXIXjWEgOaMh58eLvBZ7OshW2EhaIpNLSBU="
124+
[mod."github.com/mschoch/smat"]
125+
version = "v0.2.0"
126+
hash = "sha256-DZvUJXjIcta3U+zxzgU3wpoGn/V4lpBY7Xme8aQUi+E="
127+
[mod."github.com/muesli/termenv"]
128+
version = "v0.16.0"
129+
hash = "sha256-hGo275DJlyLtcifSLpWnk8jardOksdeX9lH4lBeE3gI="
130+
[mod."github.com/rivo/uniseg"]
131+
version = "v0.4.7"
132+
hash = "sha256-rDcdNYH6ZD8KouyyiZCUEy8JrjOQoAkxHBhugrfHjFo="
133+
[mod."github.com/rwcarlsen/goexif"]
134+
version = "v0.0.0-20190401172101-9e8deecbddbd"
135+
hash = "sha256-AiY2T9hXj6jnfldYDoe4WNr3FldpVTxc3lScR++HOLc="
136+
[mod."github.com/spf13/cobra"]
137+
version = "v1.10.1"
138+
hash = "sha256-OP6wdqk4dvBD8U5aicTkySHZ2s0LWnBo2TST2SmgcpM="
139+
[mod."github.com/spf13/pflag"]
140+
version = "v1.0.9"
141+
hash = "sha256-YAjyYpq5BXCosVJtvYLWFG1t4gma2ylzc7ILLoj/hD8="
142+
[mod."github.com/xo/terminfo"]
143+
version = "v0.0.0-20220910002029-abceb7e1c41e"
144+
hash = "sha256-GyCDxxMQhXA3Pi/TsWXpA8cX5akEoZV7CFx4RO3rARU="
145+
[mod."go.etcd.io/bbolt"]
146+
version = "v1.4.0"
147+
hash = "sha256-nR/YGQjwz6ue99IFbgw/01Pl8PhoOjpKiwVy5sJxlps="
148+
[mod."golang.org/x/exp"]
149+
version = "v0.0.0-20231006140011-7918f672742d"
150+
hash = "sha256-2SO1etTQ6UCUhADR5sgvDEDLHcj77pJKCIa/8mGDbAo="
151+
[mod."golang.org/x/sys"]
152+
version = "v0.33.0"
153+
hash = "sha256-wlOzIOUgAiGAtdzhW/KPl/yUVSH/lvFZfs5XOuJ9LOQ="
154+
[mod."google.golang.org/protobuf"]
155+
version = "v1.36.6"
156+
hash = "sha256-lT5qnefI5FDJnowz9PEkAGylH3+fE+A3DJDkAyy9RMc="

0 commit comments

Comments
 (0)