tangled
alpha
login
or
join now
karitham.dev
/
dotfiles
0
fork
atom
nix all the things
0
fork
atom
overview
issues
pulls
pipelines
better packaging for topiary-nu
karitham.dev
4 months ago
ab6bc18a
af70d0a7
verified
This commit was signed with the committer's
known signature
.
karitham.dev
SSH Key Fingerprint:
SHA256:ODeRMGYuG7M/0G+fRF6IfwUk7r5AgG5MYdFTN+uvimc=
+86
-103
5 changed files
expand all
collapse all
unified
split
flake.lock
flake.nix
modules
home
helix.nix
overlays
default.nix
pkgs
topiary-nu.nix
+1
-93
flake.lock
···
196
196
"type": "github"
197
197
}
198
198
},
199
199
-
"flake-utils_4": {
200
200
-
"inputs": {
201
201
-
"systems": "systems_5"
202
202
-
},
203
203
-
"locked": {
204
204
-
"lastModified": 1731533236,
205
205
-
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
206
206
-
"owner": "numtide",
207
207
-
"repo": "flake-utils",
208
208
-
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
209
209
-
"type": "github"
210
210
-
},
211
211
-
"original": {
212
212
-
"owner": "numtide",
213
213
-
"repo": "flake-utils",
214
214
-
"type": "github"
215
215
-
}
216
216
-
},
217
199
"ghostty": {
218
200
"inputs": {
219
201
"flake-compat": "flake-compat",
···
614
596
"stable": "stable",
615
597
"starship-jj": "starship-jj",
616
598
"systems": "systems_3",
617
617
-
"topiary-nu": "topiary-nu",
618
599
"zjstatus": "zjstatus"
619
600
}
620
601
},
···
807
788
"type": "github"
808
789
}
809
790
},
810
810
-
"systems_5": {
811
811
-
"locked": {
812
812
-
"lastModified": 1681028828,
813
813
-
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
814
814
-
"owner": "nix-systems",
815
815
-
"repo": "default",
816
816
-
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
817
817
-
"type": "github"
818
818
-
},
819
819
-
"original": {
820
820
-
"owner": "nix-systems",
821
821
-
"repo": "default",
822
822
-
"type": "github"
823
823
-
}
824
824
-
},
825
825
-
"topiary-nu": {
826
826
-
"inputs": {
827
827
-
"flake-utils": "flake-utils_3",
828
828
-
"nixpkgs": [
829
829
-
"nixpkgs"
830
830
-
],
831
831
-
"topiary-nushell": "topiary-nushell",
832
832
-
"tree-sitter-nu": "tree-sitter-nu"
833
833
-
},
834
834
-
"locked": {
835
835
-
"dir": "topiary-nu",
836
836
-
"lastModified": 1750272458,
837
837
-
"narHash": "sha256-LqwCgzdBVh0Yz4fm/hJXDDGK1jPVkXhkxgoklPz5HLY=",
838
838
-
"owner": "ck3mp3r",
839
839
-
"repo": "flakes",
840
840
-
"rev": "cd30d7afc9457c650ef719f9cf11a11dedefaf0d",
841
841
-
"type": "github"
842
842
-
},
843
843
-
"original": {
844
844
-
"dir": "topiary-nu",
845
845
-
"owner": "ck3mp3r",
846
846
-
"ref": "cd30d7afc9457c650ef719f9cf11a11dedefaf0d",
847
847
-
"repo": "flakes",
848
848
-
"type": "github"
849
849
-
}
850
850
-
},
851
851
-
"topiary-nushell": {
852
852
-
"flake": false,
853
853
-
"locked": {
854
854
-
"lastModified": 1748947526,
855
855
-
"narHash": "sha256-mLcJR6tZclbRKbnPObqrO57AM1vjWfG13VpJCB7m5Vk=",
856
856
-
"owner": "blindFS",
857
857
-
"repo": "topiary-nushell",
858
858
-
"rev": "9c770f22e54609e17cacfaf02e4943936b3f4119",
859
859
-
"type": "github"
860
860
-
},
861
861
-
"original": {
862
862
-
"owner": "blindFS",
863
863
-
"repo": "topiary-nushell",
864
864
-
"type": "github"
865
865
-
}
866
866
-
},
867
867
-
"tree-sitter-nu": {
868
868
-
"flake": false,
869
869
-
"locked": {
870
870
-
"lastModified": 1750158656,
871
871
-
"narHash": "sha256-v4Nr+dN7VT4AMuejvDWJZK0+wH9/Q3h29vvAKYABaXE=",
872
872
-
"owner": "nushell",
873
873
-
"repo": "tree-sitter-nu",
874
874
-
"rev": "7983592fe54750b750f2ee9dc8e89449257855d4",
875
875
-
"type": "github"
876
876
-
},
877
877
-
"original": {
878
878
-
"owner": "nushell",
879
879
-
"repo": "tree-sitter-nu",
880
880
-
"type": "github"
881
881
-
}
882
882
-
},
883
791
"xwayland-satellite-stable": {
884
792
"flake": false,
885
793
"locked": {
···
945
853
"zjstatus": {
946
854
"inputs": {
947
855
"crane": "crane_2",
948
948
-
"flake-utils": "flake-utils_4",
856
856
+
"flake-utils": "flake-utils_3",
949
857
"nixpkgs": "nixpkgs_9",
950
858
"rust-overlay": "rust-overlay_3"
951
859
},
+2
-4
flake.nix
···
2
2
inputs = {
3
3
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4
4
stable.url = "github:NixOS/nixpkgs/nixos-25.05";
5
5
-
topiary-nu = {
6
6
-
url = "github:ck3mp3r/flakes?dir=topiary-nu&ref=cd30d7afc9457c650ef719f9cf11a11dedefaf0d";
7
7
-
inputs.nixpkgs.follows = "nixpkgs";
8
8
-
};
5
5
+
9
6
home-manager = {
10
7
url = "github:nix-community/home-manager";
11
8
inputs.nixpkgs.follows = "nixpkgs";
···
121
118
packages = forAllSystems (pkgs: {
122
119
pokego = pkgs.callPackage ./pkgs/pokego.nix {};
123
120
http-nu = pkgs.callPackage ./pkgs/http-nu.nix {};
121
121
+
topiary-nu = pkgs.callPackage ./pkgs/topiary-nu.nix {};
124
122
});
125
123
126
124
overlays.default = import ./overlays;
+1
-6
modules/home/helix.nix
···
473
473
name = "nu";
474
474
language-servers = ["nu-lsp"];
475
475
formatter = {
476
476
-
command = "${pkgs.writers.writeBashBin "topiary" ''
477
477
-
export TOPIARY_LANGUAGE_DIR="${inputs'.topiary-nu.packages.default}/languages";
478
478
-
export TOPIARY_CONFIG_FILE="${inputs'.topiary-nu.packages.default}/languages.ncl";
479
479
-
480
480
-
${lib.getExe pkgs.topiary} "$@"
481
481
-
''}/bin/topiary";
476
476
+
command = "${lib.getExe pkgs.topiary-nu}";
482
477
args = [
483
478
"format"
484
479
"--language"
+1
overlays/default.nix
···
1
1
_: prev: {
2
2
pokego = prev.callPackage ../pkgs/pokego.nix {};
3
3
+
topiary-nu = prev.callPackage ../pkgs/topiary-nu.nix {};
3
4
golangci-lint-langserver = prev.golangci-lint-langserver.overrideAttrs (_: {
4
5
patches = prev.fetchurl {
5
6
url = "https://github.com/karitham/golangci-lint-langserver/commit/31e6806187d431a8865261b5441ef5a65b589ae5.patch";
+81
pkgs/topiary-nu.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
stdenv,
4
4
+
fetchFromGitHub,
5
5
+
tree-sitter,
6
6
+
nodejs,
7
7
+
topiary,
8
8
+
makeWrapper,
9
9
+
runCommand,
10
10
+
}:
11
11
+
12
12
+
let
13
13
+
treeSitterNu = stdenv.mkDerivation {
14
14
+
name = "tree-sitter-nu";
15
15
+
src = fetchFromGitHub {
16
16
+
owner = "nushell";
17
17
+
repo = "tree-sitter-nu";
18
18
+
rev = "18b7f951e0c511f854685dfcc9f6a34981101dd6";
19
19
+
hash = "sha256-OSazwPrUD7kWz/oVeStnnXEJiDDmI7itiDPmg062Kl8=";
20
20
+
};
21
21
+
22
22
+
buildInputs = [
23
23
+
tree-sitter
24
24
+
nodejs
25
25
+
];
26
26
+
27
27
+
buildPhase = ''
28
28
+
tree-sitter generate --abi=14
29
29
+
'';
30
30
+
31
31
+
installPhase = ''
32
32
+
mkdir -p $out/lib
33
33
+
if [[ -e src/scanner.c ]]; then
34
34
+
$CC -fPIC -c src/scanner.c -o scanner.o -Isrc -O2
35
35
+
fi
36
36
+
$CC -fPIC -c src/parser.c -o parser.o -Isrc -O2
37
37
+
$CC -shared -o $out/lib/tree_sitter_nu.so *.o
38
38
+
'';
39
39
+
};
40
40
+
41
41
+
topiaryNushell = fetchFromGitHub {
42
42
+
owner = "blindFS";
43
43
+
repo = "topiary-nushell";
44
44
+
rev = "fd78be393af5a64e56b493f52e4a9ad1482c07f4";
45
45
+
hash = "sha256-5gmLFnbHbQHnE+s1uAhFkUrhEvUWB/hg3/8HSYC9L14=";
46
46
+
};
47
47
+
48
48
+
configDir = stdenv.mkDerivation {
49
49
+
name = "topiary-nu-config";
50
50
+
src = topiaryNushell;
51
51
+
52
52
+
buildPhase = ''
53
53
+
mkdir -p $out
54
54
+
cat <<EOF > $out/languages.ncl
55
55
+
{
56
56
+
languages = {
57
57
+
nu = {
58
58
+
extensions = ["nu"],
59
59
+
grammar.source.path = "${treeSitterNu}/lib/tree_sitter_nu.so"
60
60
+
},
61
61
+
},
62
62
+
}
63
63
+
EOF
64
64
+
'';
65
65
+
66
66
+
installPhase = ''
67
67
+
cp -r $src/languages $out
68
68
+
'';
69
69
+
};
70
70
+
in
71
71
+
runCommand "topiary-nu" {
72
72
+
buildInputs = [ makeWrapper ];
73
73
+
meta = {
74
74
+
mainProgram = "topiary-nu";
75
75
+
};
76
76
+
} ''
77
77
+
mkdir -p $out/bin
78
78
+
makeWrapper ${lib.getExe topiary} $out/bin/topiary-nu \
79
79
+
--set TOPIARY_LANGUAGE_DIR "${configDir}/languages" \
80
80
+
--set TOPIARY_CONFIG_FILE "${configDir}/languages.ncl"
81
81
+
''