5 releases (3 breaking)

0.4.0 Dec 6, 2022
0.3.0 Sep 18, 2022
0.2.0 Aug 4, 2022
0.1.1 Jun 28, 2022
0.1.0 Jun 28, 2022

#14 in #nixos

Download history 1/week @ 2024-02-19 6/week @ 2024-02-26 82/week @ 2024-04-01

82 downloads per month

MIT license

29KB
634 lines

libnixstore

Is a library that provides simple access to your local nix store, based on c++ bindings. It mimics the already available perl bindings but also adds bindings on top, that might be useful.

Note: This project provides bindings, this makes the project automatically unsafe.

Supported nix version:

  • nix 2.8
  • nix 2.9
  • nix 2.10
  • nix 2.11

Requirements

It is only available for systems that have the nix package manager installed. To achieve this you should setup a simple shell.nix

with import <nixpkgs> { };
stdenv.mkDerivation {
  name = "xyz";
  nativeBuildInputs = [ rustc cargo gcc pkg-config ];
  buildInputs = [
    # required
    nix
    nlohmann_json
    libsodium
    boost

    # additional packages you might need
    rustfmt
    clippy
    # ...
  ];

  RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}

Example

fn main() {
    libnixstore::init();
    println!("{}", libnixstore::get_store_dir());
}

Dependencies

~0.6–1.4MB
~28K SLoC