Skip to content

equals03/nix-pax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-pax

wrappackage meets modules — a Nix library for declaratively wrapping packages with environment variables, runtime inputs, and binary-specific configuration.

License: MIT

Usage

Library

{ pkgs, inputs, ... }:
inputs.nix-pax.lib.wrapper.wrap-package pkgs {
  package = pkgs.bat;
  env = { BAT_THEME = "Dracula"; };
  runtimeInputs = [ pkgs.ripgrep ];
  binaries = {
    bat = {
      env = { BAT_CONFIG_PATH = "/etc/bat.conf"; };
      alias = "batcat";
    };
  };
}

Or use the flake as a function (returns wrap-package):

(inputs.nix-pax pkgs) { package = pkgs.bat; env = { DEFAULT_THEME = "Dracula"; }; }

flake-parts

{
  inputs = {
    flake-parts.url = "github:hercules-ci/flake-parts";
    nix-pax.url = "github:equals03/nix-pax";
  };

  outputs = inputs @ { flake-parts, nix-pax, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [ nix-pax.flakeModules.default ];

      perSystem = { pkgs, ... }: {
        pax.packages.bat = { env = { DEFAULT_THEME = "Dracula"; }; };
        pax.profiles.dev = {
          env = { NIX_DEBUG = "1"; };
          packages = { bat = { env = { DEFAULT_THEME = "TwoDark"; }; }; };
        };
      };
    };
}

Options

Option Description
package Derivation to wrap
env Global environment variables (string, list, or { default | force = ... })
runtimeInputs Packages to prepend to PATH
binaries Per-binary config: env, runtimeInputs, alias, args
filesToPatch Glob patterns for path replacement (default: ["share/applications/*.desktop"])
filesToExclude Glob patterns for files to exclude from output

Inputs

License

See LICENSE.

About

wrappackage meets modules

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages