Skip to content
spotdemo4Public

About

extra packages, bundlers and libs for nix

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

trev's nix repository

check vulnerable nix user repository

Extra packages, bundlers, images and libs for nix

Packages

Packages are cached and kept up-to-date automatically. Available here or the Nix User Repository.

Version bumper for projects using git and semantic versioning

nix run github:spotdemo4/trevpkgs#bumper

Wrap your application in a BEAM Burrito; used by mkGleamBurrito

nativeBuildInputs = with pkgs.beamPackages; [
  burrito
];

Catppuccin theme for GTK

gtk = {
  enable = true;
  theme = {
    package = pkgs.trev.catppuccin-gtk.override {
      themeVariants = [ "sky" ];
      colorVariants = [ "dark" ];
    };
    name = "Catppuccin-Sky-Dark";
  };

  # https://raw.githubusercontent.com/nix-community/home-manager/f2d3e04e278422c7379e067e323734f3e8c585a7/modules/misc/news/2025/11/2025-11-26_11-55-28.nix
  gtk4.theme = config.gtk.theme;
};

Catppuccin theme for Zen Browser

Using with 0xc000022070/zen-browser-flake:

programs.zen-browser.profiles.default = {
  userChrome = builtins.readFile "${pkgs.trev.catppuccin-zen-browser}/Mocha/Sky/userChrome.css";
  userContent = builtins.readFile "${pkgs.trev.catppuccin-zen-browser}/Mocha/Sky/userContent.css";
};

Chrome DevTools for coding agents

nix run github:spotdemo4/trevpkgs#chrome-devtools-mcp

Proxy server providing OpenAI-compatible APIs for CLI models

nix run github:spotdemo4/trevpkgs#cliproxyapi

Embeddable SQL OLAP Database Management System

nix run github:spotdemo4/trevpkgs#duckdb

Extensions are built with nix rather than downloaded at runtime with INSTALL. The in-tree autocomplete, icu, json, tpcds and tpch extensions are enabled by default; out-of-tree extensions can be enabled with an override:

pkgs.trev.duckdb.override {
  withHttpfs = true;
  withPostgresScanner = true;
  withSpatial = true;
};
  • out-of-tree: withAvro, withAws, withAzure, withDucklake, withEncodings, withExcel, withFts, withHttpfs, withIceberg, withInet, withMysqlScanner, withOdbcScanner, withPostgresScanner, withQuack, withSpatial, withSqliteScanner, withSqlsmith, withVss
  • drivers: withJdbc, withOdbc

Out-of-tree extensions are built as loadable extensions against the default duckdb, so enabling them does not rebuild duckdb; the duckdb binary finds them through DUCKDB_NIX_EXTENSION_DIRECTORIES, which programs linking libduckdb can set to duckdb.extensionDirectory. spatial, vss and odbc_scanner are not autoloaded and need LOAD. Static builds (pkgsStatic) compile every extension into the binary, except odbc_scanner which is unsupported.

Out-of-tree extensions are pinned to the commits the duckdb release builds (.github/config/extensions in the duckdb source), with the patches it applies from .github/patches/extensions. packages/duckdb/update.sh updates duckdb and the extension pins together.

Fetch the hashes of remote files

nix run github:spotdemo4/trevpkgs#fetch-hash

Nix hash fixer

nix run github:spotdemo4/trevpkgs#fix-hash

Flake package releaser

nix run github:spotdemo4/trevpkgs#flake-release

Bundles your Gleam-on-Erlang project into an escript

nix run github:spotdemo4/trevpkgs#gleescript

A tool to audit Erlang & Elixir dependencies

nix run github:spotdemo4/trevpkgs#go-over

Private, fast, and honest web browser

nix run github:spotdemo4/trevpkgs#helium

Intel graphics system firmware update library

nix run github:spotdemo4/trevpkgs#igsc

Model Context Protocol (MCP) server for Kagi Search

nix run github:spotdemo4/trevpkgs#kagimcp

Kotlin Language Server

nix run github:spotdemo4/trevpkgs#kotlin-lsp

Perceptual video quality assessment based on multi-method fusion (VMAF); latest version

buildInputs = with pkgs.trev; [
  libvmaf-latest
];

C WebTransport over HTTP/3 library built on MsQuic

buildInputs = with pkgs.trev; [
  libwtf
];

Provides convenient, on-demand access to serverless cloud compute from Python scripts on your local computer

buildInputs = with pkgs.python3Packages; [
  modal
];

Nix vulnerability scanner

nix run github:spotdemo4/trevpkgs#nix-scan

Prometheus exporter for nvtop

nix run github:spotdemo4/trevpkgs#nvtop-exporter

Static code analysis engine to find security issues in code

nix run github:spotdemo4/trevpkgs#opengrep

Beautiful monospace font for design and code by Paper

fonts.packages = with pkgs.trev; [
  paper-mono
];

Protobuf plugin for generating OpenAPI specs matching the Connect RPC interface

nix run github:spotdemo4/trevpkgs#protoc-gen-connect-openapi

Scans your Python dependencies for known security vulnerabilities

nix run github:spotdemo4/trevpkgs#pysentry

QSV high-speed encoding performance experiment tool

nix run github:spotdemo4/trevpkgs#qsvenc

Cross-platform dependency update tool, with patches for nix

  • patched with renovate#45258 to support flake input updates
  • patched to update the rev and ref attributes of flake inputs
nix run github:spotdemo4/trevpkgs#renovate

Shell hook for nix development shells

Displays info about the environment and creates a pre-push hook that runs nix flake check

devShells.x86_64-linux.default = pkgs.mkShell {
  shellHook = pkgs.shellhook.ref;
};

Paper Mono, patched for coding

fonts.packages = with pkgs.trev; [
  trev-mono
];

Build backend for uv; latest version

build-system = with pkgs.python3Packages; [
  setuptools
  uv-build-latest
];

xdg-desktop-portal backend for Hyprland, with RemoteDesktop and Clipboard support

programs.hyprland.portalPackage = pkgs.trev.xdg-desktop-portal-hyprland;

xdg-desktop-portal backend for wlroots based compositors, providing screenshot and screencast

xdg.portal.extraPortals = with pkgs.trev; [
  xdg-desktop-portal-luminous
];

A feature-rich command-line audio/video downloader; unstable version

nix run github:spotdemo4/trevpkgs#yt-dlp

A protobuf 3 implementation for zig

nix run github:spotdemo4/trevpkgs#zig-protobuf

Images

Docker container images

nix (nixos/nix)

nix build github:spotdemo4/trevpkgs#images.x86_64-linux.nix &&
docker load -i result
nix build github:spotdemo4/trevpkgs#images.x86_64-linux.ffmpeg &&
docker load -i result

Bundlers

A collection of nix bundlers

image

A better alternative to github:NixOS/bundlers#toDockerImage that also sets org.opencontainers.image labels according to the packages meta attributes

nix bundle --bundler github:spotdemo4/trevpkgs#image

appimage

An alternative to ralismark/nix-appimage that uses bwrap to create compressed AppImages

nix bundle --bundler github:spotdemo4/trevpkgs#appimage

deno-<system>

Compiles a JavaScript package into a standalone binary for the given system with deno compile. Available for x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin and x86_64-windows

nix bundle --bundler github:spotdemo4/trevpkgs#deno-x86_64-linux

Libs

mkFlake

Utility function to simplify creating flakes.

  • Imports nixpkgs and adds all the overlays, including static-pie
  • Inserts system attributes where necessary (like flake-utils.lib.eachDefaultSystem)
  • Creates cross-compiled sub-derivations for packages, images and appimages
  • Adds every package to checks as package_<name>, so nix flake check builds them
outputs = { trev, ... }:
  trev.libs.mkFlake (
    system: pkgs: {
      packages.default = pkgs.rustPlatform.buildRustPackage (
        final: with pkgs.lib; {
          name = "rust-example";
          src = fileset.toSource {
            root = ./.;
            fileset = fileset.unions [
              ./Cargo.lock
              ./Cargo.toml
              (fileset.fileFilter (file: file.hasExt "rs") ./.)
            ];
          };
          cargoLock.lockFile = ./Cargo.lock;
        }
      );
    }
  );

To build rust-example into a statically linked binary:

nix build .#default.x86_64-unknown-linux-musl

To build rust-example into a different architecture:

nix build .#default.aarch64-unknown-linux-gnu

Linux builders also automatically attempt macOS cross-compilation using the Apple SDK packaged by nixpkgs:

nix build .#default.arm64-apple-darwin

Darwin cross-compilation is best-effort per package. Target binaries cannot run on the Linux builder, so builds and checks must inspect them without executing them. For target-specific package logic, use pkgs.stdenv.hostPlatform; the system callback argument remains the build system.

View all possible cross-compilation targets with:

nix flake show

Packages are added to checks with a package_ prefix. A check with the same name in checks takes precedence. Building a package only runs its tests when doCheck is enabled.

To skip one package, set passthru.packageCheck = false. It stays in checks as a stub that nix flake check doesn't build:

packages.default = pkgs.hello.overrideAttrs (old: {
  passthru = (old.passthru or { }) // {
    packageCheck = false;
  };
});

To skip all packages, override packageChecks:

trev.libs.mkFlake.override { packageChecks = false; } (
  system: pkgs: {
    # ...
  }
);

mkImage

Creates a docker save-formatted image for a given src. Other attributes will be passed to dockerTools.buildLayeredImage

images.default = pkgs.mkImage {
  src = self.packages.${system}.default;
  contents = with pkgs; [ dockerTools.caCertificates ];
};
nix build .#images.x86_64-linux.default
docker load -i result

mkAppImage

Creates an AppImage for a given src. squashfsArgs can be used to modify the compression.

appimages.default = pkgs.mkAppImage {
  src = self.packages.${system}.default;
};
nix build .#appimages.x86_64-linux.default

mkChecks & mkCheck

Utility function to simplify creating flake checks. Can take an src pointing to a derivation, a root pointing to a directory, or neither for checks that do not need a source.

Directories can be filtered with files, filter, ignore and include. The order is: root/files -> filter applied -> ignore'd file(s) removed -> include file(s) added

filter's file attributes are inherited from fileset.fileFilter

checks = pkgs.mkChecks {
  rust = {
    src = self.packages.${system}.default;
    packages = with pkgs; [
      rustfmt
      clippy
    ];
    script = ''
      cargo test --offline
      cargo fmt --check
      cargo clippy --offline -- -D warnings
    '';
  };

  tombi = {
    root = ./.;
    filter = file: file.hasExt "toml";
    packages = with pkgs; [
      tombi
    ];
    forEach = ''
      tombi format --offline --check "$file"
      tombi lint --offline --error-on-warnings "$file"
    '';
  };
};

Checks can be grouped into their own files. A path to a .nix file (or a directory containing checks.nix) adds each check in that file, prefixed with the group's name. Check files are called like callPackage, so they can ask for anything in pkgs (including pkgs itself), and can contain more groups. Use callChecks to pass arguments that aren't in pkgs:

checks = pkgs.mkChecks {
  # node-eslint, node-prettier
  node = ./web/checks.nix;

  # rust-test, ... from ./rust/checks.nix
  rust = pkgs.callChecks ./rust { inherit self; };
};
# ./rust/checks.nix
{
  pkgs,
  self,
}:
{
  test = {
    src = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
    script = "cargo test --offline";
  };
}

mkCheck builds a single check, taking the same attributes as an entry in mkChecks:

pkgs.mkCheck "shellcheck" {
  root = ./.;
  filter = file: file.hasExt "sh";
  packages = [ pkgs.shellcheck ];
  script = ''
    shellcheck "$file"
  '';
}

mkApps

Utility function to simplify creating flake apps. Strings are shorthand for an app script. Structured entries accept script, optional packages, and optional inputsFrom. Like pkgs.mkShell, inputsFrom collects and flattens each derivation's buildInputs, nativeBuildInputs, propagatedBuildInputs, and propagatedNativeBuildInputs into the app's runtime PATH.

let
  devShell = pkgs.mkShell {
    packages = with pkgs; [
      go
      buf
    ];
  };
in
{
  devShells.default = devShell;

  apps = pkgs.mkApps {
    default = "go run .";
    configure = {
      inputsFrom = [ devShell ];
      script = "buf generate";
    };
  };
}
nix run
nix run .#configure

mkRustPackage

Wraps rustPlatform.buildRustPackage, building dependencies in a separate derivation (cargoArtifacts) from a stubbed copy of the workspace. Source changes and version bumps only rebuild the workspace crates. Dependencies are vendored from Cargo.lock, so cargoHash isn't needed. The check phase also runs in the dependency derivation, against the stubs, so the dependencies of custom check commands (e.g. cargo clippy) are built there too. cargoArtifactsArgs can be used to modify the dependency derivation, e.g. overriding checkPhase if it needs other source files.

pkgs.mkRustPackage (finalAttrs: {
  pname = "rust-pkg";
  version = "1.0.0";
  src = ./.;
});

mkGoModule

Wraps buildGoModule, building the vendored dependencies in a separate derivation (goCache) and restoring its build cache. Source changes and version bumps only rebuild the main module's packages. The dependency derivation only uses vendor/modules.txt and the vendor directory, which is named without the version, so it only changes when the dependencies do. proxyVendor isn't supported. goCacheArgs can be used to modify the dependency derivation.

Either vendorHash or modules is required. modules points to a gomod2nix.toml generated by gomod2nix, each module is fetched with its hash and vendorHash is ignored. go.mod and local replacements are read from src during evaluation. Without the main module's sources every package of the modules is listed in vendor/modules.txt, generate it with gomod2nix generate --with-deps so only the imported packages are built in goCache.

Dependencies of tests are cached for the build directory used on Linux, on Darwin they're rebuilt in the check phase.

Go names binaries after their package's directory, so when meta.mainProgram is set and a single binary is installed, it's renamed to meta.mainProgram.

On Linux, binaries are built as position-independent executables (-buildmode=pie) for ASLR when cgo is enabled. On static platforms (pkgsStatic) they're linked as static PIE binaries by the external linker. With CGO_ENABLED = 0 Go's own linker is used, which can't build static PIE binaries, so they're left static. Static 32-bit ARM binaries are also left static, as gcc can't link static PIE binaries for it. Set pie = false to disable it.

pkgs.mkGoModule (finalAttrs: {
  pname = "go-pkg";
  version = "1.0.0";
  src = ./.;
  vendorHash = "sha256-...";
  meta.mainProgram = "go-pkg";
});

pkgs.mkGoModule (finalAttrs: {
  pname = "go-pkg";
  version = "1.0.0";
  src = ./.;
  modules = ./gomod2nix.toml;
});

bufFetchDeps & bufHook

Creates a fixed-output derivation for buf dependencies

pkgs.stdenv.mkDerivation (finalAttrs: {
  pname = "protobuf-pkg";
  version = "1.0.0";
  src = ./.;

  bufDeps = pkgs.bufFetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "...";
  };

  nativeBuildInputs = with pkgs; [
    bufHook
  ];
});

mkGleamPackage

Builds a gleam package with gleamErlangHook or gleamJavascriptHook (gleamTarget, erlang by default), fetching the dependencies from manifest.toml, so a hash isn't needed. The manifest is read from src (in gleamRoot) during evaluation, manifest can point to it elsewhere, e.g. to avoid import from derivation. Hex packages are fetched with their checksums, git packages with builtins.fetchGit. The dependency derivation is named without the version, and only changes with the manifest and the gleam.toml of local packages.

gleamDepsHash fetches the dependencies with gleamFetchDeps instead, so nothing is read from src during evaluation, like cargoHash or vendorHash. Set it to "" to get the hash from the mismatch, and pass --custom-dep=gleamDeps to nix-update (--subpackage looks for the hash in mkGleamPackage).

pkgs.mkGleamPackage (finalAttrs: {
  pname = "gleam-pkg";
  version = "1.0.0";
  src = ./.;
});

pkgs.mkGleamPackage (finalAttrs: {
  pname = "gleam-pkg";
  version = "1.0.0";
  src = fetchFromGitHub { ... };
  gleamDepsHash = "sha256-...";
});

gleamLibrary = true builds a library with gleam build and gleam docs build, and installs its HTML docs to $out instead of an executable. Checks are enabled by default (doCheck), running gleam test when test/<name>_test.gleam exists.

pkgs.mkGleamPackage (finalAttrs: {
  pname = "gleam-lib";
  version = "1.0.0";
  src = ./.;
  gleamLibrary = true;
});

beamPackages sets the erlang and rebar3 used to build with the erlang target, e.g. to use another OTP version.

pkgs.mkGleamPackage (finalAttrs: {
  pname = "gleam-pkg";
  version = "1.0.0";
  src = ./.;
  beamPackages = pkgs.beamMinimal29Packages;
});

gleamFetchDeps, gleamErlangHook & gleamJavascriptHook

  • Creates a fixed-output derivation for gleam dependencies
  • Builds with either erlang (gleamErlangHook) or Javascript (gleamJavascriptHook)
  • gleamConfigHook runs after configure, setting up the dependencies, HOME and REBAR_CACHE_DIR
  • gleamBuildPhase, gleamCheckPhase and gleamInstallPhase are used when buildPhase, checkPhase or installPhase aren't set, and can be disabled with dontUseGleamBuild, dontUseGleamCheck and dontUseGleamInstall
  • Builds an executable, or a library and its docs with gleamLibrary
pkgs.stdenv.mkDerivation (finalAttrs: {
  pname = "gleam-pkg";
  version = "1.0.0";
  src = ./.;

  gleamDeps = pkgs.gleamFetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "...";
  };

  nativeBuildInputs = with pkgs; [
    gleamErlangHook
  ];
});

mkGleamBurrito

Wraps a gleam project into a single self-contained executable with burrito. src can be a source directory or a gleam package built with gleamFetchDeps & gleamErlangHook. target (linux, macos or windows) and targetCpu (x86_64 or aarch64) default to the host system.

pkgs.mkGleamBurrito {
  src = self.packages.${system}.default;
};

denoCompile

Compiles a JavaScript package into a standalone binary with deno compile. The entrypoint defaults to main in package.json, then build/index.js. Permissions can be denied with allow-read, allow-write, allow-net, allow-env and allow-run.

pkgs.denoCompile {
  package = self.packages.${system}.default;
  target = "aarch64-apple-darwin";
  allow-run = false;
};

getForgejoFlake

Fetches a flake from a Forgejo instance by url, rev and hash

(pkgs.getForgejoFlake {
  url = "https://trev.zip/llc/bumper";
  rev = "...";
  hash = "sha256-...";
}).packages.${system}.default

Overlays

import nixpkgs {
  overlays = [
    trev.overlays.packages
    trev.overlays.images
    trev.overlays.libs
  ];
}

Python packages are added to every python package set (e.g. pkgs.python3Packages.modal), BEAM packages to pkgs.beamPackages and images to pkgs.image.

static-pie

Makes gcc link static executables (e.g. pkgsStatic) as static PIE for ASLR, until NixOS/nixpkgs#515233 lands. This rebuilds the static gcc, so static packages are no longer cached by cache.nixos.org. On musl, static PIE executables don't export symbols (-Wl,--export-dynamic), as musl can't relocate exported thread-local variables. 32-bit ARM, MIPS, SPARC and m68k are left as plain static executables, as gcc's link spec for them doesn't support static PIE.

import nixpkgs {
  overlays = [ trev.overlays.static-pie ];
}

trev

An overlay that adds all of the overlays but with the prefix trev (e.g. pkgs.trev.bumper). Also available as trev.overlays.default.

import nixpkgs {
  overlays = [ trev.overlays.trev ];
}

NixOS Modules

Overlay

Adds the trev overlay to the nixosSystem's pkgs

nixosConfigurations = {
  laptop = nixpkgs.lib.nixosSystem {
    modules = [
      trev.nixosModules.overlay
      ({ pkgs, ... }: {
        environment.systemPackages = with pkgs; [
          trev.bumper
        ];
      })
    ];
  };
};

Examples

Development flake

A flake for developing rust projects

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

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    trevpkgs = {
      url = "github:spotdemo4/trevpkgs";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    {
      self,
      trevpkgs,
      ...
    }:
    trevpkgs.libs.mkFlake (
      system: pkgs: {

        # nix develop [#...]
        devShells = {
          default = pkgs.mkShell {
            shellHook = pkgs.shellhook.ref;
            packages = with pkgs; [
              rustc
              cargo
            ];
          };
        };

        # nix run [#...]
        apps = pkgs.mkApps {
          default = "cargo run";
          test = "cargo test";
        };

        # nix build [#...]
        packages = {
          default = pkgs.rustPlatform.buildRustPackage (
            final: with pkgs.lib; {
              pname = "rust-template";
              version = "0.4.8";

              src = fileset.toSource {
                root = ./.;
                fileset = fileset.unions [
                  ./Cargo.lock
                  ./Cargo.toml
                  (fileset.fileFilter (file: file.hasExt "rs") ./.)
                ];
              };
              cargoLock.lockFile = ./Cargo.lock;
            }
          );
        };

        # nix build #images.[...]
        images = {
          default = pkgs.mkImage {
            src = self.packages.${system}.default;
          };
        };

        # nix flake check
        checks = pkgs.mkChecks {
          rust = {
            src = self.packages.${system}.default;
            packages = with pkgs; [
              rustfmt
              clippy
            ];
            script = ''
              cargo test --offline
              cargo fmt --check
              cargo clippy --offline -- -D warnings
            '';
          };

          tombi = {
            root = ./.;
            filter = file: file.hasExt "toml";
            packages = with pkgs; [
              tombi
            ];
            forEach = ''
              tombi format --offline --check "$file"
              tombi lint --offline --error-on-warnings "$file"
            '';
          };
        };
      }
    );
}

Templates for various languages can be found at spotdemo4/templates

NixOS flake

A flake for NixOS utilizing the Nix User Repository

{
  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 # Add the NUR overlay

          ({ pkgs, ... }: {
            environment.systemPackages = [pkgs.nur.repos.trev.bumper]; # Use the NUR overlay
          })
        ];
      };
    };
  };
}

Cache

Every package in this repo is built and cached each update. To pull from the cache instead of building:

Single flake

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

Entire NixOS system

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

About

extra packages, bundlers and libs for nix

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages