1 00:00:00,500 --> 00:00:01,680 Okay, great. 2 00:00:01,680 --> 00:00:02,120 Cool. 3 00:00:02,120 --> 00:00:03,260 Thanks for coming, everyone. 4 00:00:03,900 --> 00:00:05,200 This is my talk. 5 00:00:05,200 --> 00:00:06,800 I want to talk about auto formatting. 6 00:00:07,520 --> 00:00:09,520 And I'm excited to see everyone here. 7 00:00:09,720 --> 00:00:11,720 So a little bit about me. 8 00:00:11,720 --> 00:00:13,260 My name is Jeremy Fleischman. 9 00:00:13,260 --> 00:00:15,340 You'll see me on GitHub as JFly. 10 00:00:15,400 --> 00:00:18,040 On the left there is my profile picture. 11 00:00:18,100 --> 00:00:20,540 The reason I have so much hair is because it's from 2010. 12 00:00:21,200 --> 00:00:22,900 I was very into Rubik's cubes. 13 00:00:22,900 --> 00:00:27,060 This is right after I won US Nationals forever ago. 14 00:00:27,460 --> 00:00:30,220 And I've been using Nix since 2021. 15 00:00:30,840 --> 00:00:36,440 And I quit my job last year to learn more about Nix and try to give back to the community. 16 00:00:36,520 --> 00:00:41,120 So I've become a maintainer of TreeFMT, which I want to talk about today. 17 00:00:41,200 --> 00:00:43,140 I'm also on the infra team. 18 00:00:43,260 --> 00:00:46,980 And I recently became the leader of the Nix formatting team. 19 00:00:47,360 --> 00:00:56,580 So my goals for this talk are if you don't already use TreeFMT, I'd love to convince you that it's a useful tool and for have you check it out. 20 00:00:56,880 --> 00:01:02,220 If you're a NeoVim user, I'd love for you to check out this built in that I added to NunLS. 21 00:01:02,400 --> 00:01:04,900 It's called Nix Flake FMT . 22 00:01:05,100 --> 00:01:10,560 And if you use something other than NeoVim, I'd like to persuade you to build something like that for your own editor. 23 00:01:11,000 --> 00:01:12,980 And lastly, contribute to Nix. 24 00:01:12,980 --> 00:01:15,260 It's fun and not scary. 25 00:01:16,060 --> 00:01:19,460 So I'm going to get on my TreeFMT soapbox first. 26 00:01:19,560 --> 00:01:23,340 I realized while prepping for this talk, I didn't actually know how to pronounce the name of this tool. 27 00:01:23,340 --> 00:01:24,700 I'd been saying TreeFmt. 28 00:01:24,860 --> 00:01:27,360 So here's my little mnemonic to help you remember. 29 00:01:27,360 --> 00:01:28,000 Tree. 30 00:01:28,100 --> 00:01:28,820 FM. 31 00:01:29,060 --> 00:01:29,560 T. 32 00:01:30,880 --> 00:01:33,160 Okay, so why would you want to use this? 33 00:01:33,160 --> 00:01:34,260 Why does this exist? 34 00:01:34,400 --> 00:01:37,700 So here's some real code I ran across in Image. 35 00:01:37,700 --> 00:01:40,320 I was contributing to their mobile app the other day. 36 00:01:40,320 --> 00:01:41,780 And they've got this make file. 37 00:01:41,780 --> 00:01:46,540 And I think this is like a perfect example of the sort of thing you see in make files around the world. 38 00:01:46,540 --> 00:01:48,920 Which is, I want to start formatting. 39 00:01:48,920 --> 00:01:50,660 I add a make format target. 40 00:01:51,160 --> 00:01:53,200 And then I like invoke my formatter. 41 00:01:53,320 --> 00:01:55,920 And this one's a great example of like Dart format. 42 00:01:56,120 --> 00:01:59,080 Tries to recurse through your file system and find all your Dart files. 43 00:01:59,080 --> 00:02:03,780 But there's this like bug where it can't ignore, you can't tell it to ignore some files . 44 00:02:03,780 --> 00:02:07,600 And the image has some auto-generated files that they don't want to auto-format. 45 00:02:07,600 --> 00:02:15,720 So they have to like do this shell hackery with find to like find all the Dart files except for these auto -generated Dart files. 46 00:02:15,880 --> 00:02:16,800 And this works for them. 47 00:02:16,800 --> 00:02:24,800 But you can imagine if you were going to add another formatter, then you've got to write another incantation like this and you're going to be recursing through the file system multiple times. 48 00:02:25,140 --> 00:02:29,160 Maybe it doesn't matter in small projects, but that's why TreeFMD exists. 49 00:02:29,160 --> 00:02:31,020 So let me show you what it looks like. 50 00:02:31,420 --> 00:02:34,840 Uh, so it basically defines this thing called the formatter specification. 51 00:02:34,840 --> 00:02:36,240 It's very simple. 52 00:02:36,460 --> 00:02:41,780 The very short version of it is, if you implement a formatter, try to make it follow this CLI. 53 00:02:41,780 --> 00:02:48,000 So it's like command, some options, and then a list of one or more files to format. 54 00:02:48,000 --> 00:02:55,760 So NixFMT, which is a Haskell tool that the Nix formatting team maintains, it obeys the specification. 55 00:02:55,760 --> 00:03:02,200 If you want to format a Nix file, you say NixFMT, you feed it a list of Nix files and it formats them. 56 00:03:02,960 --> 00:03:10,900 Uh, so what TreeFMD will do is if your formatter implements this specification, we will walk the file system for you. 57 00:03:10,900 --> 00:03:16,660 And we'll do it fast, and we'll understand Go, we'll under, er, understand Git, we'll understand JJ, whatever. 58 00:03:16,800 --> 00:03:23,100 You don't need to worry about those nuances in your formatter, so make it simpler for you and for anybody who wants to format a codebase . 59 00:03:23,440 --> 00:03:26,020 We'll walk the file system consistently. 60 00:03:27,200 --> 00:03:31,200 Uh, so to take a look at that earlier example, we have this code. 61 00:03:31,560 --> 00:03:33,480 In TreeFMD, you'd write something like this. 62 00:03:33,480 --> 00:03:34,880 It's a simple TOML file. 63 00:03:35,040 --> 00:03:37,440 You specify all your formatters for all your files. 64 00:03:37,440 --> 00:03:45,600 You say, this is the command, these are the options, format these files, and if you want to exclude some files for whatever reason, you can. 65 00:03:46,240 --> 00:03:47,560 Uh, and here you go. 66 00:03:47,560 --> 00:03:53,100 So this is TreeFMD, we use it in Nix packages to enforce formatting across the entire codebase. 67 00:03:53,140 --> 00:03:57,760 Uh, and you can see, this is me running TreeFMD in a Nix packages checkout. 68 00:03:57,760 --> 00:04:07,400 It took 40 seconds to chug through 49,000 files, and then if I run it again without making any changes, it chugs through everything in 400 milliseconds. 69 00:04:07,400 --> 00:04:08,420 So we also do caching. 70 00:04:08,420 --> 00:04:14,860 We, we understand if a file hasn't changed, there's no reason to invoke the formatter again, it's, it doesn't need to be formatted. 71 00:04:16,160 --> 00:04:20,500 Okay, but we're Nixers, we, we see a config file like this and we ask some questions. 72 00:04:20,500 --> 00:04:22,580 We're like, where does Dart come from? 73 00:04:22,580 --> 00:04:24,720 Which version of TreeFMD are you going to use? 74 00:04:24,760 --> 00:04:25,520 Etcetera. 75 00:04:25,520 --> 00:04:32,220 So, for basically any tool out there, some, somebody has written a Nix abstraction on top of it to let you configure it. 76 00:04:32,220 --> 00:04:40,140 So, there's a tool called TreeFMD Nix, and if you're a Nixer attending this talk, I'd suggest that this be your gateway into TreeFMD. 77 00:04:40,260 --> 00:04:45,000 So, this is just some flake boilerplate because I wanted to show people a complete example. 78 00:04:45,000 --> 00:04:48,580 The interesting part is on the right here, this formatting.nix file. 79 00:04:48,580 --> 00:04:50,920 So, I'll just throw away the boilerplate. 80 00:04:50,920 --> 00:04:53,380 So, this is the, the TreeFMD Nix stuff. 81 00:04:53,380 --> 00:04:57,420 You basically say, okay, I want to enable some TreeFMD programs. 82 00:04:57,820 --> 00:04:59,520 There's one called Dart format. 83 00:04:59,520 --> 00:05:08,780 This is all configured with the Nix module system, so this is strongly typed, like, if you type in the name of some program that doesn't exist, you're going to get a clear error. 84 00:05:08,860 --> 00:05:11,080 And you'll notice there's some stuff missing here. 85 00:05:11,080 --> 00:05:17,620 I've, I've specified the excludes, I've turned on the Dart format program, but I haven't said where the Dart package is. 86 00:05:17,620 --> 00:05:25,580 It is packaged in Nix packages, but somebody else wrote that code, figured out which exact attribute in Nix packages provides the formatter. 87 00:05:25,680 --> 00:05:34,640 And also the, the list of the, of the Dart, that's not here, because that's just intrinsic to the formatter, is what files it tries to format. 88 00:05:34,640 --> 00:05:36,960 So, you know, you get to delete a little bit of stuff. 89 00:05:36,960 --> 00:05:38,260 So, okay. 90 00:05:38,420 --> 00:05:41,520 And then if you do this, you get a couple of flake outputs. 91 00:05:41,540 --> 00:05:50,720 So, you get it enforced automatically in CI, we've got this check right here, that'll fail if you have files that are not correctly formatted. 92 00:05:50,720 --> 00:05:52,960 And then you also have a formatter output. 93 00:05:53,480 --> 00:06:00,240 And so there are a couple of CLI utilities that the, the Nix CLI provides that understands these flake outputs. 94 00:06:00,240 --> 00:06:03,560 So, this is the Nix flake check command, which you could use in CI. 95 00:06:03,840 --> 00:06:09,300 Uh, and then Nix space FMT, which will just go and, uh oh. 96 00:06:09,500 --> 00:06:10,500 Was that me? 97 00:06:12,680 --> 00:06:14,140 Uh oh. 98 00:06:16,160 --> 00:06:17,500 That's not me Morgan? 99 00:06:18,000 --> 00:06:19,120 Okay. 100 00:06:19,140 --> 00:06:20,240 It overheated? 101 00:06:21,040 --> 00:06:21,840 Okay. 102 00:06:21,840 --> 00:06:22,620 Wow. 103 00:06:22,620 --> 00:06:24,700 I didn't know projectors could crash. 104 00:06:26,840 --> 00:06:27,720 Okay. 105 00:06:30,700 --> 00:06:31,580 Hello. 106 00:06:31,740 --> 00:06:32,240 Okay. 107 00:06:32,240 --> 00:06:34,400 So, anyways, I'll just keep talking until it comes back. 108 00:06:34,400 --> 00:06:35,600 Oh, and we're back. 109 00:06:35,600 --> 00:06:36,040 Great. 110 00:06:36,040 --> 00:06:41,320 So, these are the two commands that you just get support for if you use TreeFMT Nix. 111 00:06:41,320 --> 00:06:41,940 Okay. 112 00:06:42,300 --> 00:06:45,620 So, to summarize, we started here and we ended here. 113 00:06:45,620 --> 00:06:49,340 So, and this isn't like really an apples to apples comparison. 114 00:06:49,340 --> 00:06:52,460 We benefit from all the, the power of Nix. 115 00:06:52,960 --> 00:06:58,000 We're, we're being very specific about the version of TreeFMT and the version of Dart that we're using here. 116 00:06:58,460 --> 00:07:00,520 And you get the benefits of TreeFMT too. 117 00:07:00,520 --> 00:07:01,920 We're walking the file system. 118 00:07:01,940 --> 00:07:02,820 We're doing it quickly. 119 00:07:02,820 --> 00:07:04,400 We understand your git ignores. 120 00:07:04,400 --> 00:07:09,020 If you use git submodules or something else wonky, we'll do something same. 121 00:07:09,880 --> 00:07:10,320 Okay. 122 00:07:10,320 --> 00:07:13,200 But, you know, it's nice to have it enforced in CI. 123 00:07:13,200 --> 00:07:16,220 It's nice to have a command you can run to format all the code. 124 00:07:16,420 --> 00:07:22,320 But when you're writing code, you're not thinking to run, like I'm going to drop into the shell and I'm going to like go format all the code. 125 00:07:22,320 --> 00:07:23,320 You're just writing code. 126 00:07:23,320 --> 00:07:25,740 So people try to push this further left. 127 00:07:25,760 --> 00:07:29,980 And so as a TreeFMT maintainer, people usually ask for features that we haven't implemented. 128 00:07:30,060 --> 00:07:32,260 One of which is pre-commit hooks. 129 00:07:32,320 --> 00:07:33,280 People build them. 130 00:07:33,280 --> 00:07:35,240 We don't have support for it in TreeFMT. 131 00:07:36,140 --> 00:07:44,160 Some people try to run things in the background that just watch the file system for changes and automatically invoke the formatters on the files that changed. 132 00:07:44,160 --> 00:07:46,760 That's like a little better because it's even further left. 133 00:07:46,760 --> 00:07:49,340 But then it starts to fight with your IDE a bit. 134 00:07:49,340 --> 00:07:57,320 Like if you save a change in your IDE and then some other tool goes and edits the file, your IDE will probably say, hey, whoa, somebody changed that file. 135 00:07:57,620 --> 00:07:58,820 What's going on here? 136 00:07:59,220 --> 00:08:02,380 So I think editor integration is the right way to go. 137 00:08:02,380 --> 00:08:04,240 That's what I want to talk about in the rest of the talk. 138 00:08:04,240 --> 00:08:07,080 And hopefully I don't need to convince you that that's the way to do it. 139 00:08:07,520 --> 00:08:15,080 So again, couldn't talk about NeoVim here, but if you're following along, I, you know, I really want people to build similar integrations for their own editors. 140 00:08:15,080 --> 00:08:18,700 So hopefully you can, you know, take inspiration from this. 141 00:08:19,680 --> 00:08:20,040 Okay. 142 00:08:20,040 --> 00:08:27,940 So what I wanted to do is I wanted to have a tool in NeoVim that would automatically run Nix space FMT on whatever files I changed. 143 00:08:27,940 --> 00:08:29,080 Super straightforward . 144 00:08:30,020 --> 00:08:34,740 But performance matters and Nix FMT, it turns out, is quite slow. 145 00:08:34,740 --> 00:08:41,880 So for example , in Nix packages, it takes 14 and a half seconds on my laptop to just figure out what the formatter is and build it. 146 00:08:42,320 --> 00:08:45,100 So you only need to do that once. 147 00:08:45,100 --> 00:08:46,160 I want to cache it. 148 00:08:46,240 --> 00:08:53,300 Uh, and so that's, uh, what I opted to do basically is like, let's figure out what the formatter is and let's cache it. 149 00:08:53,300 --> 00:08:55,040 And that ended up being a little tricky. 150 00:08:55,040 --> 00:08:56,860 So I'm going to breeze through the next slide. 151 00:08:56,960 --> 00:09:02,380 Cause a lot of this is just like NeoVim details that nobody cares about, except for me when I was building this. 152 00:09:02,880 --> 00:09:08,200 But I'm just going to like explain some of the stuff I did, which is like none LS is a natural place to put this. 153 00:09:08,200 --> 00:09:18,020 If you haven't heard of it, it's a plugin in the NeoVim ecosystem that basically lets you wrap existing shell commands and just hook them into NeoVim's LSP infrastructure. 154 00:09:18,800 --> 00:09:26,680 Unfortunately, it had this dynamic command thing, which was great, but it assumed that the command, discovering the command was quick. 155 00:09:26,680 --> 00:09:34,680 It was basically like used for finding binaries and node modules, which is like just search the file system to see if you've got something in the node modules directory. 156 00:09:34,740 --> 00:09:38,600 But this is like, oh wait, we've got to like spend 14 seconds figuring something out. 157 00:09:38,960 --> 00:09:45,380 I would like to be able to cache that and I needed to make some changes to dynamic command to make that possible. 158 00:09:45,380 --> 00:09:46,720 So whatever, doesn't matter. 159 00:09:46,720 --> 00:09:53,340 Um, there was another detail with TreeFMT where it wouldn't actually format the files because it like understands Git. 160 00:09:53,340 --> 00:09:55,640 It didn't want to format the temp files that none LS created. 161 00:09:55,640 --> 00:09:56,680 I fixed that. 162 00:09:56,680 --> 00:09:58,640 I ran into a bunch of other TreeFMT bugs. 163 00:09:58,640 --> 00:10:00,600 That's how I ended up becoming a maintainer. 164 00:10:00,880 --> 00:10:09,360 Uh, because Nix space FMT can run arbitrary code, I didn't want to just do that when you open a random project and hit save. 165 00:10:09,500 --> 00:10:12,420 So I hooked into NeoVim's trust infrastructure. 166 00:10:12,520 --> 00:10:15,480 Turned out the support for trusting directories was buggy. 167 00:10:15,480 --> 00:10:17,540 So that was another, that was a PR to NeoVim. 168 00:10:17,840 --> 00:10:24,160 And then this is the one I want to talk about, which is previously it was very hard in Nix to actually discover the formatter. 169 00:10:24,160 --> 00:10:30,740 You could invoke the formatter, you could even build it, but the actual like path to the formatter was not exposed by the Nix CLI. 170 00:10:31,020 --> 00:10:36,300 So at first I opted to just like work around this by writing a bunch of code in Lua. 171 00:10:37,160 --> 00:10:38,420 That was a mistake. 172 00:10:38,420 --> 00:10:39,660 I ended up writing a lot of code. 173 00:10:39,660 --> 00:10:41,180 I didn't get it right the first time. 174 00:10:41,200 --> 00:10:47,120 So I want to talk about what I should have done instead and you guys can benefit from the work I did. 175 00:10:47,120 --> 00:10:50,020 So anyways, it turned into a bunch of PRs to a bunch of places. 176 00:10:50,220 --> 00:10:51,440 Details don't really matter. 177 00:10:51,620 --> 00:10:52,020 Okay. 178 00:10:52,020 --> 00:10:54,120 So it landed in none LS. 179 00:10:54,120 --> 00:10:55,460 Somebody actually accepted my PR. 180 00:10:55,460 --> 00:10:56,200 So that's great. 181 00:10:56,200 --> 00:10:57,000 It's there. 182 00:10:57,820 --> 00:11:02,060 Uh, one of my fellow maintainers on none LS noticed that it was like 300 lines of Lua. 183 00:11:02,060 --> 00:11:03,980 It was like, this probably doesn't belong here. 184 00:11:03,980 --> 00:11:05,360 I totally agreed with him. 185 00:11:05,360 --> 00:11:09,240 So then I was like, can I, can I make this easier to do? 186 00:11:09,240 --> 00:11:15,220 So this is the implementation of Nix space FMT in CPP Nix. 187 00:11:15,220 --> 00:11:19,100 The, the, the thing we call Nix, Nixlang. 188 00:11:19,100 --> 00:11:28,580 Uh, and I wanted to show this to people cause I'm like not a C++ guy, but I found this code like not that intimidating, which was just like a wonderful surprise. 189 00:11:28,580 --> 00:11:30,020 I was really afraid to look at this stuff. 190 00:11:30,020 --> 00:11:32,160 It's like, I don't totally understand everything here. 191 00:11:32,160 --> 00:11:34,440 Like I don't know what an installable is. 192 00:11:34,600 --> 00:11:42,520 I, I kind of had heard the word app before in like the context of flakes, but like this, okay, yeah, we're exacting something and oh, app dot program. 193 00:11:42,520 --> 00:11:43,440 That's the thing I need. 194 00:11:43,440 --> 00:11:45,000 How can I get my hands on that? 195 00:11:45,000 --> 00:11:55,200 So that was like pretty straightforward to like, I, I put together a proof of concept PR to, to CPP Nix and said like, Hey, I'd really like to get, get this path. 196 00:11:55,400 --> 00:12:04,140 Um, so I put together a PR and then I got a little bit of feedback, but people didn't totally understand why I was trying to do this or whatever. 197 00:12:04,380 --> 00:12:07,540 Uh, and I really like real-time communication with people. 198 00:12:07,540 --> 00:12:10,060 And this is something I just want to encourage everyone here to do. 199 00:12:10,140 --> 00:12:19,040 If you're involved in the Nix community, so many of the Nix teams have these like weekly meetings or bi, bi-monthly meetings where you can just like show up and chat with people. 200 00:12:19,040 --> 00:12:25,600 And it's just like a great way to like figure out if the thing you're trying to do is in scope for the team and they'll like tell you what to do. 201 00:12:25,600 --> 00:12:26,560 They want to help you out. 202 00:12:26,560 --> 00:12:29,800 I found it to be like so unintimidating. 203 00:12:29,800 --> 00:12:31,680 I was like so afraid to attend. 204 00:12:31,740 --> 00:12:42,460 Uh, so I encourage you if there's something you want to do, there's a lot of like low hanging sort of, uh, cosmetic fruit like that you can pick in, in Nix itself or whatever project. 205 00:12:42,460 --> 00:12:44,620 So it was very helpful. 206 00:12:44,920 --> 00:12:46,440 Uh, feedback on my PR. 207 00:12:46,440 --> 00:12:53,540 I learned a little bit about C++ and now we have Nix, uh, 2.29, uh, which has this new Nix formatter subcommand. 208 00:12:53,580 --> 00:12:55,280 So I'll show you what that does. 209 00:12:55,440 --> 00:12:57,500 You've got this Nix formatter build command. 210 00:12:57,500 --> 00:13:03,220 So what this will do is evaluate and build the formatter and prints out the absolute path to the formatter. 211 00:13:03,220 --> 00:13:08,000 So this is a thing that your editor can run once and hold on to it. 212 00:13:08,000 --> 00:13:11,880 And then every time you'd make a change to a file after that, it'll just exact this thing. 213 00:13:11,880 --> 00:13:14,800 It'll be super fast and it does exactly what you want. 214 00:13:15,560 --> 00:13:22,420 Uh, and then for completeness, we added this Nix formatter run command, which is just equivalent to the Nix space FMT command. 215 00:13:22,420 --> 00:13:28,580 We're not going to get, I don't think we're going to get rid of Nix space FMT, but this is just sort of here for parallelism, I guess. 216 00:13:28,920 --> 00:13:31,520 So, uh, yeah, that's it. 217 00:13:31,520 --> 00:13:34,600 Um, if you use NaveM, check out the thing I built. 218 00:13:34,680 --> 00:13:35,940 Uh, you can try it out. 219 00:13:36,420 --> 00:13:39,760 I seem to be doing fine on time, so I'll give a brief demo of it, I guess. 220 00:13:39,760 --> 00:13:42,960 Um, so, yeah. 221 00:13:43,080 --> 00:13:44,120 Folks can see stuff? 222 00:13:44,120 --> 00:13:44,720 Okay, great. 223 00:13:44,720 --> 00:13:46,940 So, uh, you can run this demo yourself. 224 00:13:46,940 --> 00:13:49,960 It's fully self-contained output of my, my Flake here. 225 00:13:50,200 --> 00:13:54,720 Uh, and if I open it, if I run it, you know, this is some Nix code right here. 226 00:13:55,040 --> 00:14:10,340 Uh, you know, say, uh, this is not plugins or something, and then I hit save, and I learn about, like, a quirk of our Nix formatter, which is, like, these things get moved to the next line, and I'm like, oh, okay, actually, probably that should, like, 227 00:14:10,340 --> 00:14:11,480 go up here. 228 00:14:11,740 --> 00:14:18,860 And, you know, I think this is why having it hooked into the editor is the right way to do it, because auto-formatters sometimes do surprising things. 229 00:14:18,860 --> 00:14:22,000 So, anyways, uh, yeah. 230 00:14:22,000 --> 00:14:25,720 So, if you want to build something like this for your own IDE, do it. 231 00:14:25,720 --> 00:14:26,600 Feel free to reach out. 232 00:14:26,600 --> 00:14:27,400 Here's my email. 233 00:14:27,400 --> 00:14:28,500 Here's my matrix. 234 00:14:28,700 --> 00:14:30,640 Uh, and that's all I had. 235 00:14:30,640 --> 00:14:33,300 If folks have questions, I'm happy to answer. 236 00:14:39,210 --> 00:14:40,010 Harit? 237 00:14:56,520 --> 00:14:57,300 Yeah, okay. 238 00:14:57,300 --> 00:15:00,480 So, for Harit's asking, wait, why was this so hard? 239 00:15:00,480 --> 00:15:04,540 I ran this Nixie val command here, and it printed out the derivation. 240 00:15:04,540 --> 00:15:05,580 And the answer is yeah. 241 00:15:05,580 --> 00:15:14,600 So, that's what the original implementation I built did, is it took advantage of this to evaluate and build the formatter. 242 00:15:14,600 --> 00:15:27,640 But all that gives you when you build something in Nix is you get a store path, which has a bin directory inside of it, and then some executable underneath it, but you don't know what the, like, program, which, which script in the bin directory to execute. 243 00:15:27,760 --> 00:15:32,040 So, if you were going to assume, oh, yeah, it's treefmt, you could, like, hard code that string. 244 00:15:32,120 --> 00:15:40,140 But what you really need to do is the equivalent of, like, lib dot get exe from Nix packages, the thing that looks at meta dot main program. 245 00:15:41,140 --> 00:15:52,620 And I wrote all that code, and then I got it wrong, because, like, it turns out Nix packages also provides a formatter package, like a package called formatter, and it screws up this thing that I'm showing here . 246 00:15:52,620 --> 00:15:55,620 So, it was a lot I was able to delete. 247 00:15:55,620 --> 00:15:59,300 It, it turned into, like, 200 or so lines of Lua to get it, to get it right. 248 00:15:59,300 --> 00:16:03,940 And I figured, I want to convince other people to build this for their IDs. 249 00:16:03,940 --> 00:16:08,100 I didn't want them to, like, port all that Lua code to whatever. 250 00:16:08,460 --> 00:16:10,300 So, yeah. 251 00:16:14,200 --> 00:16:18,460 Uh, so the question is, are there any other subcommands for the formatter that would make sense? 252 00:16:19,000 --> 00:16:22,400 I don't have any ideas, but let me know if you do. 253 00:16:28,090 --> 00:16:28,890 Alright. 254 00:16:29,370 --> 00:16:30,570 Thanks a lot, everyone.