All the instructions I find for creating a local repository of Nix packages involve creating a local clone of the main nixpkgs repository and adding to that.
Is there a way I can create a small repository just containing my local add-on packages?
All the instructions I find for creating a local repository of Nix packages involve creating a local clone of the main nixpkgs repository and adding to that.
Is there a way I can create a small repository just containing my local add-on packages?
Yes, just create an expression for the single package. You can get dependencies from nixpkgs by pkgs = import <nixpkgs> {};.
This blog post have some details: http://sandervanderburg.blogspot.no/2014/07/managing-private-nix-packages-outside.html
For more low-level from-the-ground-up details there's the nix-pill series: http://lethalman.blogspot.no/2014/07/nix-pill-1-why-you-should-give-it-try.html
But I think the basic approach is to create your own version of ~/.nix-defexpr/channels_root/nixos/pkgs/top-level/all-packages.nix, say mypkgs.nix adding dependencies from the default "repo" by importing <nixpkgs>.
Install packages by doing nix-env -f mypkgs.nix -i DERIVATION_NAME
But since nix is based on a full-blown language there's infinity ways you could do it I guess.
I'm by no means a Nix expert so I don't know if this is the best way, but it's what I do. I have a local repo for packages in $HOME/nix-local, which contains a number of package files vault/default.nix, blackbox/default.nix etc and a config.nix file which defines packageOverrides to call them. So something like:
$ cat nix-local/config.nix
{
packageOverrides = pkgs: rec {
vault = pkgs.callPackage ./vault {};
blackbox = pkgs.callPackage ./blackbox {};
# ...
}
$ export NIXPKGS_CONFIG=$HOME/nix-local/config.nix
You can see the full repo at https://github.com/telent/nix-local