summaryrefslogtreecommitdiff
path: root/Biz/Bild.nix
AgeCommit message (Collapse)Author
2024-04-03Set CODEROOT dynamically in nix buildsBen Sima
This seems to be needed for git test to work, in particular the directory inside the nix sandbox is like '/build/<name-of-checkout-directory>' which, in the case of git test, is the name of the worktree that git-branchless uses to checkout the commit under test. This is something like 'test-worktree-2'. So, I can't hardcode anything there.
2024-04-01Add nixfmt to Lint.hsBen Sima
nixfmt is the soon-to-be official formatter for Nix code, as per the NixOS GitHub group. So I figure I should just adopt it without worrying too much about the specifics of the formatting. I just formatted everything in one go, hence the huge diff, oh well.
2024-04-01Add --jobs and --cpus to bildBen Sima
By default, nix will use the maximum amount of cores available to the machine. On my machine it was maxxing out the CPUs and then actually running out of RAM when compiling JavaScriptCore and literally shutting down my machine. So, I need to be able to control the concurrency and parallelism. The default settings I chose should reserve 4 cores for the user. I also changed --json to --plan because -j makes more sense for --jobs, as its used this way in other tools like make and nix-build.
2023-10-10Add git-branchlessBen Sima
After using this for a while, I've decided that git-branchless will be the default tool for doing trunk-based development in the omnirepo.
2023-10-10Environment fixes on berylliumBen Sima
Getting beryllium setup with the omnirepo showed that a few things needed fixed.
2023-10-10Don't swallow namespace-parsing errorsBen Sima
Previously, if there was a problem with the inputs and bild failed to determine the namespace, 'fromPath' would return 'Nothing' and then 'catMaybes' would drop the error-causing input altogether. In the one time that I had a bad input, this made debugging incredibly difficult. It's always a bad idea to swallow errors silently, so instead lets just kill the program if we have bad inputs.
2023-10-03Add rundeps feature to bildBen Sima
This allows me to specify runtime dependencies, not just system or language deps.
2023-10-03Rename BIZ_ROOT to CODEROOTBen Sima
BIZ_ROOT was too specific. CODEROOT allows for other (non-biz) projects to live in the root of the repo. I didn't want to call it GIT_ROOT because maybe someday I won't want to use git. But I'll never not use code.
2023-09-19Lint faster by grouping files by extensionBen Sima
Previously I would lint every file individually, in serial. This took forever. Now I group the files by extension (by first getting the Namespace) and run each linter on all relevant files at once. This is so much faster its stupid. Also I added formatters back into the dev env because my editor needs them to autoformat.
2023-08-22Replace pylint with ruffBen Sima
Ruff is like a million times faster, and I mostly ignored pylint's suggestions anyway. I also took this opportunity to move lint tools into a runtime dependency on Lint.hs, which meant adding a wrapper to the Haskell builder, which was easy enough. This paves the way for proper rundeps in bild.
2023-08-22Add a commit-msg hook lint and various other cleanupsBen Sima
Turns out that gitlint by default enforces the exact commit-msg format that I like to use. I'm enabling this because even I write poor commit messages sometimes, and looking back on my commits from even a few days ago is sometimes not very helpful. I also made some minor comment and nix changes that I noticed while reviewing my work from the last few days.
2023-08-21Refactor the build system for readabilityBen Sima
Lots of changes here but the code is much improved. The nix code is clearer and structured better. The Haskell code improved in response to the nix changes. I needed to use a qualified path instead of the abspath because the BIZ_ROOT changes based on whether bild runs in nix or runs in the user environment. Rather than passing every argument into Builder.nix, now I just pass the json from bild and deconstruct it in nix. This is obviously a much better design and it only came to be after sleeping on it the other night.
2023-08-17Nixify C buildBen Sima
This is working with libsodium as an example. Its unfortunate that we need the extra ':arg -lsodium' but how else can I get the name of the library for linking? Is that something in the nix attr metadata? Anyway, an optimization for another day.
2023-08-17Nixify rust buildBen Sima
Not getting deps yet but thats okay, I basically need to do a bunch of annoying nix work to get rustPackages into a thing like pythonPackages.
2023-08-16Get python targets buildingBen Sima
I added 'black' to Biz/Lint.hs, but not the others because they rely on dependencies being in the PYTHONPATH to work, so they are only relevant in nix builds and repls. I also made some other tweaks to the python checkPhase and linted all the files. Everything should be building and linting correctly now.
2023-08-16Log and return output to callerBen Sima
The main change here is 'puts' now returns a value, this enables me to collect the value from the conduit source while also doing stuff with it, like printing or logging it as I want. Previously I was running conduit over the source, *and then* kicking off the concurrent processes to wait for the process and collect the output. This would (I think) drain the source before it got to the 'puts' conduit run, and so I wouldn't be able to get the output streamed in real time. It took a lot of refactoring and exploratory programming to get to this relatively-small diff, but now puts works correctly. At least I think it does... it seems to work more reliably from ghci than from the shell. Maybe the shell or TERM is causing nix-store to do some buffering? Maybe I need to use the threaded runtime in GHC? Not sure, but I will look out for this issue and try to identify and fix. Update: yep it was the threaded runtime. I enabled that and now it works in the shell. I squashed that commit into this one.
2023-08-16Update nixpkgs to 23.05Ben Sima
2023-08-07Working nixified python buildBen Sima
This represents quite a few evenings of hacking. It doesn't build all of my Python code, because my Python code is not up to snuff, but it builds the examples and pulls in third party dependencies. Some design points: - I'm using buildPythonApplication in Builder.nix because it was getting way too annoying to wrap the Python script and set PYTHONPATH myself. Easier and more robust to just use the upstream nix builder - Because of this, I had to generate a setup.py. Maybe switch to pyproject.toml in the future, whatever. - Also because of this, Target.wrapper is becoming redundant. I'll just remove it when I get Guile built in nix. - Biz/Bild.nix is getting messy and could use a refactor. - In Builder.nix, I worked around the empty directories bug by just finding and deleting empty directories after unpacking. If its stupid but works it ain't stupid! - I had to touch __init__.py files in all directories before building. Annoying! - `repl` just works, which is awesome - To ensure good Python code, I moved lints and added type checking to the build. So I can't build anything unless it passes those checks. This seems restrictive, but if I want to run some non-passing code, I can still use `repl`, so it's actually not inhibitory.
2023-08-02Fix nix syntax to include pkgsBen Sima
2023-07-31Implement nix builds for HaskellBen Sima
This is prototype quality. For some reason I think it breaks when doing `build **/*.hs`, which isn't good. But also it's working, and the code feels good. Next I'd like to get Python builds working, as hopefully that will force me to improve the existing code to support a second language.
2023-07-31Prototype nix expression generationBen Sima
There are some limitations to this implementation: 1. Using `runCommand` means this will re-run any time anything changes in the repo. The solution is to use the existing import detection to make a list of source files, and put that into a `stdenv.mkDerivation`, which I'll do next. 2. The `NeatInterpolation` usage is ugly. The templated nix code should be extracted into its own file, such as `Biz/Bild/Builder.nix`. 3. I'm not actually calling it yet. The ideal thing would be to call `nix-instantiate`, get the output drv path, and then call `nix-store --realise` on that. To do that I need to refactor my `proc` function to return stdout to the calling function, and I should probably just make helper functions like `nixInstatiate :: Target -> IO DrvPath` and `nixStoreRealise :: DrvPath -> NixStorePath`, or something like that.
2023-07-28Add NIX_CFLAGS_COMPILE and some depsBen Sima
2023-05-03Add C indent linterBen Sima
2023-04-28Default to Guile 3.0 everywhereBen Sima
Without this, Guile libraries like SDL2 will use Guile 2.0 instead.
2023-01-06Expose some packages in the nix libraryBen Sima
At least one namespace (Biz/Dragons/Analysis.nix) needs this.
2023-01-01Add black and pylintBen Sima
2022-12-28Get ava GPT chatbot prototype workingBen Sima
Mostly thid required packaging up some deps, but also had to recompile stuff with cuda support.
2022-12-16Stub ava chatbotBen Sima
2022-12-01Build gnutls with guile bindingsBen Sima
2022-10-26Support building with SDLBen Sima
As a byproduct this also (sorta) generalizes how I pass flags to the C compiler using pkg-config, instead of using the guile-config. Now the 'lib' metadata will be added with 'pkg-config --libs', and the 'sys' metadata will be added with 'pkg-config --cflags'. I'm not *really* sure what the difference is, but if it works it works.
2022-08-03Print bild JSON analysis as a dictionary instead of a streamBen Sima
2022-08-02Make bild dev build work againBen Sima
Unfortunately, until bild can instantiate nix builds, it needs all of its compilers in the dev environment, and I need to pass this environment into the dev nix-shell in order for it to work in the repl or after being built to _/bin.
2022-08-01Add missing runtime dependencies to bildBen Sima
2022-07-29Implement Guile linking for C buildsBen Sima
In order to write Guile code against C, I need to distiguish between libs and bins, so I did that, then I got the flags that gcc needs from `guile-config` and put them in the args for any C lib build. I tested this with Bessel.c and Bessel.scm (not in this patch, because I don't really want that code in my tree, I'll come up with another way to test it later).
2022-07-27Upgrade nixpkgsBen Sima
2022-07-25Run deadnix as a linterBen Sima
2022-07-25Add basic support for building C codeBen Sima
2022-07-25Add tags support for more languagesBen Sima
Rust seems to not be supported in my ctags version :( Also rename some Ide scripts because these are commands, not really scripts.
2022-07-25Remove some unused dev dependenciesBen Sima
2022-07-25Remove GHCJS support completelyBen Sima
I don't care about ghcjs anymore, the most javascript I want to do is jQuery.
2022-07-21Remove rustc and scheme from global environmentBen Sima
2022-07-20Re-enable scheme buildsBen Sima
I had thought that I needed some unmerged commits to nixpkgs that enable Guile 3.0, but turns out I just needed to use a different target name :P
2022-07-19Provision lisp repls with nixBen Sima
asdf seems to always be necessary for any other packages to work, so I just include that in the call to nix-shell, and swank is included because it's just useful to start a repl server.
2022-07-19Upgrade nixpkgs, ghc923Ben Sima
I ended up deleting miso, and consequently all files under Hero/ and Miso/, because I couldn't get miso to build with GHC 9.2. Other things: - Niv has been wrapped by Biz/Bild/Deps.hs, so I can extend it to my liking. - Apply-refact is gone because I couldn't get it to build. - Disabled python stuff.
2022-07-18Move let bindings to 'private'Ben Sima
This way I can still inspect and use them from the nix repl by just doing `:l Biz/Bild.nix`, but its also clear that they aren't part of the normal build rules.
2022-07-18Delete ShellHook.sh in favor of just using direnvBen Sima
2022-07-17Add support for SBCL replBen Sima
2022-07-17Add basic Rust supportBen Sima
Support for packages and third-party imports will need to come later once I figure out how to lookup rust packages by their import statements. Until then, this works to compile "hello world".
2022-05-24Add git and remove custom shell promptBen Sima
2021-12-21Extract repl program from bildBen Sima
This is basically building on top of bild's analysis, which is great becuase it means that bild is becoming a useful tool rather than a monolithic do-everything job runner. The eventual goal is for the bild analysis to be much more useful, maybe even provide data to remote repls or language-server or whatever.