.%*. .-. .%@@@+. .--=%@@@- =@@@@@@- :--+@@@@@@@@@* *@%@@@@@%: :--=#@@@@@@@@@@@@#@@+ @@::%@@@@@@-: :::-=%@@@@@@@@@@@@@@%#*- :@* .@@ =@@@@@@@@@+-:::::::-=*@@@@@@@@@@@@@@@@@@@%##- @@: #@# +%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%#*: -@@ #@- *%@@@@@@@@@@@@@@@@@%%%#= %@= @@: -=+++== .. @@: @@ . -@@@ +@@ #@% =@@@@- +@@@@# *+ %@# #@- -@@@@@@@. +@@@@@% .%@@@@= @@: @@: +@@@@@@@@@ +@+ +@@@ %@@@@@@@@@ -@@ @@ *@%@* :@@@ *@+ -@@@ %@@@@@@@@@@@# @@@ #@% %@ @% %@@ *@* .@@@ =@@@*@@ :@@@@ @@: %@:## *@+ :@@ :@@ @@@ %@@: @# .@@@ .@@ @@:. @@: .@@ @@ @@@ %@: @@ @@% @@% @@ -@@. =@@ @@. @@@ %@. #@- @@# @@. %@% +@@. @@. %@- @@@ #@ @@. :@@ -@@ %@: +@@+ .@% #@= @@@.@ *@@ +@+ @@* @@: +@@%. .%% *@+ @@@ %@@ -@# @@ @@ :@@@@@@% :@@ @@% %@@ @# *@@ %@@ #@@@@* @@ @@% %@@. %@. @@: @@: ===: @@. @@% %@@: =@%. .@@ @@. #@= @@% %@@%+%@#. @@% @@ +@* @@# -@@@@@* .@@ %@@ :@@ @@# %@@#: =@@ @@: .@@ @@# : @@= @@. @@. @@# :@@ @@ #@= @@% %@% #@@ +@+ #@% .@@ @@: =@# +@% =@% @@ :@% -@@ @@+ @@ .@@ -@: -@@ -@@ @% .: *@# @@* # @@. @@ =@@ .@@ @@* .@@ .@@ *@@ =@# @@* @@* @@ -@@ .@@ +@* .@@ @@- -@@ =@@ %@% #@* @@ @@: @@ +@@ .@@ %@+ :@% @@. :@% *@% -@. %@= %@ @@. @@ *@% @@ %@= @% @@: :@% +@@ :@* =+- #@+ :@: .%@@@. @@- -@ =@@@@@# :@@ =@ *@#.=@@% #@% *@ #@- -@@% %@- @@ #@: :@@% @@: @@ #% .@@% .#@@* -@@ @% #% .@@% +@@@@@- %@% @# %@ :@@% .@@@@@@@@ %@: @# %@ :@@% +@@% .@@@@ @@: @# %@ :@@% #@@: :@@@ -@@ @# @@. .@@@ .@@% .@@@= %@% @# @@. .@@@: %@@- @@@% %@: @# @@ @@@@ %@@@ *@@@ @@: @# .@@ @@@@@@@@@@= :@@@ @@ * @@@ :@@@@@@@@. :@@@ *@@ .@@@@@% -@@@@@. .@@@ @@= @@@@@: .. @@@ @@. -@%: @@@ @@. @@@ @@ -@@ =@@ .@@ @@+ .@@:@@. @@#@- @@@. +@- -mediocregopher's lil web corner
These days any development I do for myself will use nix to, at the very least, define the development environment, if not the entire build process. I also always pin the nixpkgs
version on a per-projecct basis, so that when I come back to the project 2 years later I don't have to deal with compatibility issues which have been sprung up in the meantime.
Pinning nixpkgs involves going to the nixpkgs GitHub page, finding the latest tagged release (or choosing tip of master, if I'm feeling frisky), finding the commit of that tag, and then writing up a default.nix
file which pulls this commit down and imports it. Usually at that point I remember that builtins.fetchGit
isn't good for this, because it will do a full clone and nixpkgs is massive, so I have to go back and switch it to builtins.fetchURL
. But then builtins.fetchURL
needs a sha256, so it takes an extra step to grab that.
In short, it's a chore.
I could use nix flakes, which would simplify this process a bit, but then I'd have to remember the format of nix flakes' magical URL which lets you skip all this. And the structure of a nix flake in general. I don't really like nix flakes for other reasons, so rather than learning these things I've developed a simple bash script to solve the problem.
init-project: A simple script for initializing a project with a default.nix
At present the script does only a couple things:
default.nix
file based on all of the abovedefault.nix
Besides nix
the only dependency is git
. The generated default.nix
includes a basic mkShell
which can be used via nix-shell -A shell
.
Future additions could be to include a LICENSE file, though I don't have a favorite which I could default to, and perhaps to create a Makefile
which can serve as an entrypoint for starting a dev shell, running build commands, etc...
Published 2024-06-08
This site can also be accessed via the gemini protocol: gemini://mediocregopher.com/