this post was submitted on 13 Jul 2024
8 points (100.0% liked)
nixos
1262 readers
1 users here now
All about NixOS - https://nixos.org/
founded 4 years ago
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So, one aspect of this has already been answered by @[email protected] . If you just want to package some stuff yourself, then do it (look at various NUR repositories for inspiration), put it in some git repo (or even a
.tar.gz
somewhere), and then fetch it from your NixOS config, either with flakes or þe olde way withlet myPkgs = import (builtins.fetchGit { url = "https://..."; rev = ""; }) {}; in ...
.Another aspect would be providing a substituter/"binary cache" for your repository, so that its users wouldn't need to build everything from source. This is a tad more complicated, as you have to set up some form of CI+CD, a place to host the cache, and your users would have to configure their systems to trust your build infrastructure.
It's all quite doable, and if you have some CI system&s3 bucket ready, boils down to
nix copy $(nix build --print-out-paths) --to s3://your.hosting/your-cache
with some authorization and error handling. There are also some readily available services that do it for you, like https://nixbuild.net, https://garnix.io, and https://cachix.io; however, be prepared to pay for the convenience.Then, on the user end, you'd have to add
extra-substituters = https://your.hosting/your-cache; extra-trusted-public-keys = <...>
to~/.config/nix/nix.conf
, and it should all mostly work.Examples of complex 3rd party repositories with a binary cache would be both aforementioned Chaotic and Nixified AI, and a more unusual haskell.nix.