ark/pkgs
Timothy DeHerrera 4f44e0dd13
nix: patch nix directly for experimental features
The bash wrapper was causing issues with deploy-rs and the
experimental-features option in the config was causing hercules-ci to
spit out a bunch of junk in the logs. Patching nix with the default
values required for flakes fixes both of these issues.
2021-02-17 12:54:41 -07:00
..
tools/package-management/nix nix: patch nix directly for experimental features 2021-02-17 12:54:41 -07:00
default.nix create core branch without any profiles 2021-02-03 18:58:58 -07:00
README.md doc: new mdbook documentation 2021-02-14 02:46:05 -07:00

Packages

Similar to modules, the pkgs directory mirrors the upstream nixpkgs/pkgs, and for the same reason; if you ever want to upstream your package, it's as simple as dropping it into the nixpkgs/pkgs directory.

The only minor difference is that, instead of adding the callPackage call to all-packages.nix, you just add it the the default.nix in this directory, which is defined as a simple overlay.

This overlay is set as the default overlay output attribute for the flake. And all the packages are exported via packages.<system>.<pkg-name>, for all the supported systems listed in the package's meta.platforms attribute.

And, as usual, every package in the overlay is also available to any NixOS host.

Example

pkgs/development/libraries/libinih/default.nix:

{ stdenv, meson, ninja, fetchFromGitHub, ... }:
let version = "r50";
in
stdenv.mkDerivation {
  pname = "libinih";
  inherit version;

  src = fetchFromGitHub {
    owner = "benhoyt";
    repo = "inih";
    rev = "${version}";
    hash = "sha256-GF+TVEysaXJxSBBjMsTr2IQvRKlzdEu3rlPQ88PE3nI=";
  };

  buildInputs = [ meson ninja ];

  mesonFlags = ''
    -Ddefault_library=shared
    -Ddistro_install=true
  '';

  meta = with stdenv.lib; {
    description = "Simple .INI file parser in C";
    homepage = "https://github.com/benhoyt/inih";
    maintainers = [ maintainers.nrdxp ];
    license = licenses.bsd3;
    platforms = platforms.all;
    inherit version;
  };
}

pkgs/default.nix:

final: prev: {
  libinih = prev.callPackage ./development/libraries/libinih { };
}