libnixstore

Crates.iolibnixstore
lib.rslibnixstore
version0.4.0
sourcesrc
created_at2022-06-28 13:28:07.319688
updated_at2022-12-06 10:03:43.911626
descriptionRust friendly bindings to nixos nix-store library
homepagehttps://github.com/helsinki-systems/harmonia
repositoryhttps://github.com/helsinki-systems/harmonia.git
max_upload_size
id614850
size32,030
Rust (github:helsinki-systems:rust)

documentation

README

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());
}
Commit count: 166

cargo fmt