Hoe do you self host a nix package repo & install nix packages from 3rd party repos? Is this even possible.
Other package managers allow you to install packages from 3rd party repos such as Flatpaks, apt, F-Droid, Scoop, Winget.
And is there any known 3rd party nix package repos?
So, one aspect of this has already been answered by @Klaymore@sh.itjust.works . 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.