Nix User Repository

Robert Helgesson <robert@rycee.net>

NUR is …

  • Inspired by AUR (Arch User Repository)

  • A centralized collection of user maintained packages

  • Also allows user maintained modules and overlays

Structure

  • Each user gets their own namespace

  • Have complete control over it

    • No external review

    • Watch out for malicious content!

Getting NUR

# nix-channel --add \
  https://github.com/nix-community/NUR/archive/master.tar.gz \
  nur

Accessing packages

Using Nix tools

  • In ~/.config/nixpkgs/config.nix:

    packageOverrides = pkgs: {
      nur = import <nur> { inherit pkgs; };
    };
  • Can now do

    $ nix run nixpkgs.nur.repos.mic92.inxi
    $ inxi --info
    Info:
      Processes: 267 Uptime: 3h 59m
      Memory: 31.08 GiB used: 3.20 GiB (10.3%)
      Shell: bash inxi: 3.0.27

In NixOS config

  • In /etc/nixos/configuration.nix:

    nixpkgs.config.packageOverrides = pkgs: {
      nur = import <nur> { inherit pkgs; };
    };
  • Can now do

    environment.systemPackages = with pkgs; [
      nur.repos.mic92.inxi
    ];

In Home Manager config

  • In ~/.config/nixpkgs/home.nix:

    nixpkgs.config.packageOverrides = pkgs: {
      nur = import <nur> { inherit pkgs; };
    };
  • Can now do

    home.packages = with pkgs; [
      nur.repos.mic92.inxi
    ];

In nix-darwin config*

  • In ~/.nixpkgs/darwin-configuration.nix:

    nixpkgs.config.packageOverrides = pkgs: {
      nur = import <nur> { inherit pkgs; };
    };
  • Can now do

    environment.systemPackages = with pkgs; [
      nur.repos.mic92.inxi
    ];

Accessing modules & overlays

In NixOS

  • In /etc/nixos/configuration.nix:

    { pkgs, ... }:
    
    let
      nurNoPkgs = import <nur> { pkgs = null; };
    in
    {
      imports = [
        nurNoPkgs.repos.rycee.modules.home-manager
      ];
    
      nixpkgs.overlays = [
        nurNoPkgs.repos.john.overlays.bar
      ];
    }

In Home Manager

  • In ~/.config/nixpkgs/home.nix:

    { pkgs, ... }:
    
    let
      nurNoPkgs = import <nur> { pkgs = null; };
    in
    {
      imports = [
        nurNoPkgs.repos.rycee.hmModules.emacs-init
      ];
    
      nixpkgs.overlays = [
        nurNoPkgs.repos.john.overlays.bar
      ];
    }

In nix-darwin*

  • In ~/.nixpkgs/darwin-configuration.nix:

    { pkgs, ... }:
    
    let
      nurNoPkgs = import <nur> { pkgs = null; };
    in
    {
      imports = [
        nurNoPkgs.repos.rycee.ndModules.home-manager
      ];
    
      nixpkgs.overlays = [
        nurNoPkgs.repos.john.overlays.bar
      ];
    }

Make your own

Simplest way is to copy the template repository:

https://github.com/nix-community/nur-packages-template