Skip to main content
Install packages, bundlers, and libs from this repository using either direct flake installation or the Nix User Repository (NUR).
Configure the binary cache to avoid building packages from source.

Direct Flake Installation

Add the flake as an input to your flake.nix and use overlays to access packages and libs.
1

Add to flake inputs

Add the repository to your flake inputs with nixpkgs and systems following:
flake.nix
{
  inputs = {
    systems.url = "github:nix-systems/default";
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    trev = {
      url = "github:spotdemo4/nur";
      inputs.systems.follows = "systems";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
}
Using follows ensures you don’t duplicate nixpkgs and systems in your flake lock.
2

Import overlays

Import nixpkgs with the overlays to access packages and libs:
flake.nix
outputs = { nixpkgs, trev, ... }:
  trev.libs.mkFlake (system:
    let
      pkgs = import nixpkgs {
        inherit system;
        overlays = [
          trev.overlays.packages
          trev.overlays.libs
        ];
      };
    in
    rec {
      # Your flake outputs here
    }
  );
  • packages - Adds all packages directly to pkgs namespace
  • libs - Adds utility functions to pkgs.lib
  • images - Adds Docker images to pkgs.image
  • pythonPackages - Adds Python packages to Python package sets
  • default - Adds all packages under pkgs.trev namespace
3

Use packages in dev shells

Access packages through the pkgs namespace:
flake.nix
devShells = {
  default = pkgs.mkShell {
    packages = with pkgs; [
      nixfmt
      prettier
      bobgen        # From trev.overlays.packages
      opengrep      # From trev.overlays.packages
    ];
    shellHook = pkgs.shellhook.ref;
  };
};
4

Add to NixOS system packages

For NixOS configurations, import the overlay module:
flake.nix
nixosConfigurations = {
  laptop = nixpkgs.lib.nixosSystem {
    modules = [
      trev.nixosModules.overlay  # Adds the default overlay

      ({ pkgs, ... }: {
        environment.systemPackages = [
          pkgs.trev.bobgen
          pkgs.trev.renovate
          pkgs.trev.opengrep
        ];
      })
    ];
  };
};

Complete Example

{
  nixConfig = {
    extra-substituters = [ "https://nix.trev.zip" ];
    extra-trusted-public-keys = [ "trev:I39N/EsnHkvfmsbx8RUW+ia5dOzojTQNCTzKYij1chU=" ];
  };

  inputs = {
    systems.url = "github:nix-systems/default";
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    trev = {
      url = "github:spotdemo4/nur";
      inputs.systems.follows = "systems";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, trev, ... }:
    trev.libs.mkFlake (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [
            trev.overlays.packages
            trev.overlays.libs
          ];
        };
      in
      rec {
        devShells = {
          default = pkgs.mkShell {
            packages = with pkgs; [
              nixfmt
              prettier
            ];
            shellHook = pkgs.shellhook.ref;
          };
        };

        checks = pkgs.lib.mkChecks {
          nix = {
            src = ./.;
            deps = with pkgs; [ nixfmt-tree ];
            script = ''
              treefmt --ci
            '';
          };
        };
      }
    );
}

Nix User Repository (NUR)

Install packages through the Nix User Repository as an alternative to direct flake installation.
1

Add NUR to inputs

Add the NUR flake to your inputs:
flake.nix
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nur = {
      url = "github:nix-community/NUR";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
}
2

Import NUR module

Add the NUR module to your NixOS configuration:
flake.nix
outputs = { self, nixpkgs, nur }: {
  nixosConfigurations = {
    laptop = nixpkgs.lib.nixosSystem {
      modules = [
        nur.modules.nixos.default  # Adds NUR overlay

        ({ pkgs, ... }: {
          environment.systemPackages = [
            pkgs.nur.repos.trev.bobgen
            pkgs.nur.repos.trev.renovate
          ];
        })
      ];
    };
  };
};

Complete Example

flake.nix
{
  nixConfig = {
    extra-substituters = [ "https://nix.trev.zip" ];
    extra-trusted-public-keys = [ "trev:I39N/EsnHkvfmsbx8RUW+ia5dOzojTQNCTzKYij1chU=" ];
  };

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nur = {
      url = "github:nix-community/NUR";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, nur }: {
    nixosConfigurations = {
      laptop = nixpkgs.lib.nixosSystem {
        modules = [
          nur.modules.nixos.default

          ({ pkgs, ... }: {
            environment.systemPackages = [
              pkgs.nur.repos.trev.bobgen
            ];
          })
        ];
      };
    };
  };
}
Don’t forget to configure the binary cache to avoid building packages from source.

Quick Start Commands

Run packages directly without installation:
# Run bobgen
nix run github:spotdemo4/nur#bobgen

# Run renovate
nix run github:spotdemo4/nur#renovate

# Run opengrep
nix run github:spotdemo4/nur#opengrep
Bundle packages for distribution:
# Build Docker image
nix bundle --bundler github:spotdemo4/nur#docker

# Cross-compile Go package for Linux
nix bundle --bundler github:spotdemo4/nur#go-x86_64-linux

Build docs developers (and LLMs) love