NIX-LIB

a reusable nix library for jtrrll's repositories

ABOUT

A reusable Nix library for jtrrll's repositories

Tags

#library#nix#nixos#nixpkgs

Languages

Nix 90.4%
Python 9.6%
View on GitHub

README

nix-lib

CI Status License

A reusable Nix library for jtrrll's repositories.

Usage

This is a plain Nix library, not a flake. Add it as a flake = false
input:

{
  inputs = {
    nix-lib = {
      flake = false;
      url = "github:jtrrll/nix-lib";
    };
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = inputs: {
    ...
  };
}

Then import it with a nixpkgs lib. It returns an attribute set of
lib, modules, and separate library and package overlays:

inputs:
let
  nix-lib = import inputs.nix-lib { lib = inputs.nixpkgs.lib; };
  inherit (nix-lib)
    lib
    modules
    overlays
    ;
in
{
  # Apply the package overlay to access the new packages and extended lib.
  nixpkgs' = import inputs.nixpkgs {
    inherit system;
    overlays = [ overlays.pkgs ];
  };

  # Access reusable modules, grouped by class.
  # Each class exposes its individual modules and a `default` that imports all of them.
  myNixosConfiguration = inputs.nixpkgs.lib.nixosSystem {
    inherit lib; # Use the extended library during NixOS module evaluation.
    modules = [
      modules.nixos.default
      {
        nixpkgs.overlays = [ overlays.pkgs ];
      }
      {
        ...
      }
    ];
  };

  # Use the extended lib directly.
  transformedString = lib.strings.snakeToCamel "foo_bar";
}

Outputs

modules

Show 5
  • devenv

    • default
    • respect-shell
  • flake

    • default
    • flake-metadata
    • github-binary-cache-actions
    • home-configuration-build-checks
    • nixos-configuration-build-checks
    • nixos-configuration-test-checks
    • package-build-checks
    • package-metadata-checks
    • package-passthru-tests-checks
    • packages-by-name
  • homeManager

    • default
    • meta
    • snekcheck
  • nixos

    • default
    • meta
    • opencode
    • tests
  • treefmt

    • default
    • nix

overlays

Show 2
  • lib

    • maintainers
    • modules
    • strings
  • pkgs

    • baseos - Bootable BaseOS image for the Anbernic rgsp
    • cleanyourtv-shell - Shell with ADB, Python, JDK 17 and the Android SDK for following cleanyourtv's PROMPT.md
    • grout - RomM client for Linux retro handhelds
    • nextui-h700 - NextUI frontend card contents for Anbernic H700 handhelds
    • rompatcher-js - Browser and CLI ROM patching tool
    • slk - A blazingly fast Slack TUI
    • snekcheck - An opinionated filename linter that loves snake case
    • terminal-browser - Real browser that runs inside your terminal

License

This repository is licensed under the terms in LICENSE.

That license covers the repository's own code (the library, overlays,
and module definitions). It does not inherently apply to the
packages built by this repository. Some of them package third-party
software with its own licensing. Consult each package's individual
license before use or redistribution.