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?

  • Klaymore@sh.itjust.works
    link
    fedilink
    arrow-up
    6
    ·
    5 months ago

    Generally you would use flakes to enable third party repos, although there are ways to do it without flakes. With flakes, third party repos work basicallly the same way as the main repo. Chaotic Nyx is one repo, and it also explains how to set it up. There’s also ones like Nixified AI.

  • balsoft@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    3 months ago

    Hoe do you self host a nix package repo & install nix packages from 3rd party repos? Is this even possible.

    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 with let 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.