Instantly share code, notes, and snippets.

Embed
What would you like to do?
self: super:
{
# Install overlay:
# $ mkdir -p ~/.config/nixpkgs/overlays
# $ curl https://gist.githubusercontent.com/LnL7/570349866bb69467d0caf5cb175faa74/raw/3f3d53fe8e8713ee321ee894ecf76edbcb0b3711/lnl-overlay.nix -o ~/.config/nixpkgs/overlays/lnl.nix
userPackages = super.userPackages or {} // {
# Example:
hello = self.hello;
# add more packages here...
# Default packages:
# cacert = self.cacert;
# nix = self.nix; # don't enable this on multi-user.
nix-rebuild = super.writeScriptBin "nix-rebuild" ''
#!${super.stdenv.shell}
if ! command -v nix-env &>/dev/null; then
echo "warning: nix-env was not found in PATH, add nix to userPackages" >&2
PATH=${self.nix}/bin:$PATH
fi
exec nix-env -f '<nixpkgs>' -r -iA userPackages "$@"
'';
};
}
@efx

This comment has been minimized.

Copy link

efx commented Oct 13, 2017

on macOS, if you haven't installed overlays before, you need to create the directory:

$ mkdir -p ~/.config/nixpkgs/overlays
@grahamc

This comment has been minimized.

Copy link

grahamc commented May 23, 2018

Aftr adding this overlay, run:

nix-env -f '<nixpkgs>' -r -iA userPackages

and from then on you edit this file and run nix-rebuild.

@jcrben

This comment has been minimized.

Copy link

jcrben commented Jul 23, 2018

UPDATE: looks like userPackages isn't showing up in a search but other overlay packages are - I tried giving it a name but that didn't fix it. Guess it's missing some attributes.

Is it expected that this will show up in a search? Been fiddling around for a while trying to get it (mentioned more at NixOS/nixpkgs#43266 (comment)).

@LnL7

This comment has been minimized.

Copy link
Owner

LnL7 commented Aug 11, 2018

Use super.userPackages or {} // super.recurseIntoAttrs { ... } to expose these when searching packages, etc.

@jabranham

This comment has been minimized.

Copy link

jabranham commented Dec 11, 2018

This doesn't seem to make info manuals of those programs available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment