1571 lines
48 KiB
Nix
1571 lines
48 KiB
Nix
|
|
# This file was @generated by crate2nix 0.8.0 with the command:
|
|
# "generate"
|
|
# See https://github.com/kolloch/crate2nix for more info.
|
|
|
|
{ nixpkgs ? <nixpkgs>
|
|
, pkgs ? import nixpkgs { config = {}; }
|
|
, lib ? pkgs.lib
|
|
, stdenv ? pkgs.stdenv
|
|
, buildRustCrate ? pkgs.buildRustCrate
|
|
# This is used as the `crateOverrides` argument for `buildRustCrate`.
|
|
, defaultCrateOverrides ? pkgs.defaultCrateOverrides
|
|
# The features to enable for the root_crate or the workspace_members.
|
|
, rootFeatures ? [ "default" ]
|
|
# If true, throw errors instead of issueing deprecation warnings.
|
|
, strictDeprecation ? false
|
|
# Whether to perform release builds: longer compile times, faster binaries.
|
|
, release ? true
|
|
}:
|
|
|
|
rec {
|
|
#
|
|
# "public" attributes that we attempt to keep stable with new versions of crate2nix.
|
|
#
|
|
|
|
|
|
# Refer your crate build derivation by name here.
|
|
# You can override the features with
|
|
# workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }.
|
|
workspaceMembers = {
|
|
"simple-osd-battery" = rec {
|
|
packageId = "simple-osd-battery";
|
|
build = internal.buildRustCrateWithFeatures {
|
|
packageId = "simple-osd-battery";
|
|
};
|
|
|
|
# Debug support which might change between releases.
|
|
# File a bug if you depend on any for non-debug work!
|
|
debug = internal.debugCrate { inherit packageId; };
|
|
};
|
|
"simple-osd-bluetooth" = rec {
|
|
packageId = "simple-osd-bluetooth";
|
|
build = internal.buildRustCrateWithFeatures {
|
|
packageId = "simple-osd-bluetooth";
|
|
};
|
|
|
|
# Debug support which might change between releases.
|
|
# File a bug if you depend on any for non-debug work!
|
|
debug = internal.debugCrate { inherit packageId; };
|
|
};
|
|
"simple-osd-brightness" = rec {
|
|
packageId = "simple-osd-brightness";
|
|
build = internal.buildRustCrateWithFeatures {
|
|
packageId = "simple-osd-brightness";
|
|
};
|
|
|
|
# Debug support which might change between releases.
|
|
# File a bug if you depend on any for non-debug work!
|
|
debug = internal.debugCrate { inherit packageId; };
|
|
};
|
|
"simple-osd-common" = rec {
|
|
packageId = "simple-osd-common";
|
|
build = internal.buildRustCrateWithFeatures {
|
|
packageId = "simple-osd-common";
|
|
};
|
|
|
|
# Debug support which might change between releases.
|
|
# File a bug if you depend on any for non-debug work!
|
|
debug = internal.debugCrate { inherit packageId; };
|
|
};
|
|
"simple-osd-pulseaudio" = rec {
|
|
packageId = "simple-osd-pulseaudio";
|
|
build = internal.buildRustCrateWithFeatures {
|
|
packageId = "simple-osd-pulseaudio";
|
|
};
|
|
|
|
# Debug support which might change between releases.
|
|
# File a bug if you depend on any for non-debug work!
|
|
debug = internal.debugCrate { inherit packageId; };
|
|
};
|
|
};
|
|
workspace_members =
|
|
internal.deprecationWarning
|
|
"workspace_members is deprecated in crate2nix 0.4. Please use workspaceMembers instead."
|
|
lib.mapAttrs (n: v: v.build) workspaceMembers;
|
|
|
|
#
|
|
# "internal" ("private") attributes that may change in every new version of crate2nix.
|
|
#
|
|
|
|
internal = rec {
|
|
# Build and dependency information for crates.
|
|
# Many of the fields are passed one-to-one to buildRustCrate.
|
|
#
|
|
# Noteworthy:
|
|
# * `dependencies`/`buildDependencies`: similar to the corresponding fields for buildRustCrate.
|
|
# but with additional information which is used during dependency/feature resolution.
|
|
# * `resolvedDependencies`: the selected default features reported by cargo - only included for debugging.
|
|
# * `devDependencies` as of now not used by `buildRustCrate` but used to
|
|
# inject test dependencies into the build
|
|
|
|
crates = {
|
|
"autocfg" = rec {
|
|
crateName = "autocfg";
|
|
version = "1.0.1";
|
|
edition = "2015";
|
|
sha256 = "0jj6i9zn4gjl03kjvziqdji6rwx8ykz8zk2ngpc331z2g3fk3c6d";
|
|
authors = [
|
|
"Josh Stone <cuviper@gmail.com>"
|
|
];
|
|
|
|
};
|
|
"backlight" = rec {
|
|
crateName = "backlight";
|
|
version = "0.1.1";
|
|
edition = "2015";
|
|
sha256 = "08czi1s6k0v43dfpfb3f8gl69ihjnixbsdw95wi54h63n87izpd1";
|
|
authors = [
|
|
"Jerko Steiner <jerko.steiner@gmail.com>"
|
|
];
|
|
|
|
};
|
|
"battery" = rec {
|
|
crateName = "battery";
|
|
version = "0.7.6";
|
|
edition = "2018";
|
|
sha256 = "0bx7lc0bm0xcf7dvvnl8lv9kasb36bb87hqwq73rm369ar4vwxc7";
|
|
authors = [
|
|
"svartalf <self@svartalf.info>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "cfg-if";
|
|
packageId = "cfg-if";
|
|
}
|
|
{
|
|
name = "core-foundation";
|
|
packageId = "core-foundation";
|
|
target = { target, features }: ((target."os" == "macos") || (target."os" == "ios"));
|
|
}
|
|
{
|
|
name = "lazycell";
|
|
packageId = "lazycell";
|
|
target = { target, features }: (target."os" == "linux");
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
target = { target, features }: ((target."os" == "dragonfly") || (target."os" == "freebsd"));
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
target = { target, features }: ((target."os" == "macos") || (target."os" == "ios"));
|
|
}
|
|
{
|
|
name = "mach";
|
|
packageId = "mach";
|
|
target = { target, features }: ((target."os" == "macos") || (target."os" == "ios"));
|
|
}
|
|
{
|
|
name = "num-traits";
|
|
packageId = "num-traits";
|
|
usesDefaultFeatures = false;
|
|
}
|
|
{
|
|
name = "uom";
|
|
packageId = "uom";
|
|
features = [ "autoconvert" "f32" "si" ];
|
|
}
|
|
{
|
|
name = "winapi";
|
|
packageId = "winapi";
|
|
target = { target, features }: (target."os" == "windows");
|
|
features = [ "impl-default" "devguid" "winbase" "ioapiset" "ntdef" "setupapi" "handleapi" "errhandlingapi" "winerror" ];
|
|
}
|
|
];
|
|
|
|
};
|
|
"bitflags" = rec {
|
|
crateName = "bitflags";
|
|
version = "1.2.1";
|
|
edition = "2015";
|
|
sha256 = "14qnd5nq8p2almk79m4m8ydqhd413yaxsyjp5xd19g3mikzf47fg";
|
|
authors = [
|
|
"The Rust Project Developers"
|
|
];
|
|
features = {
|
|
};
|
|
resolvedDefaultFeatures = [ "default" ];
|
|
};
|
|
"blurz" = rec {
|
|
crateName = "blurz";
|
|
version = "0.4.0";
|
|
edition = "2015";
|
|
sha256 = "0nga752pfi014kbdm7nn0cgvmxd3mik9jbb74jrp7lzis3s2vg5i";
|
|
authors = [
|
|
"Attila Dusnoki <adusnoki@inf.u-szeged.hu>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "dbus";
|
|
packageId = "dbus";
|
|
}
|
|
{
|
|
name = "hex";
|
|
packageId = "hex";
|
|
}
|
|
];
|
|
|
|
};
|
|
"cfg-if" = rec {
|
|
crateName = "cfg-if";
|
|
version = "0.1.10";
|
|
edition = "2018";
|
|
sha256 = "08h80ihs74jcyp24cd75wwabygbbdgl05k6p5dmq8akbr78vv1a7";
|
|
authors = [
|
|
"Alex Crichton <alex@alexcrichton.com>"
|
|
];
|
|
features = {
|
|
"rustc-dep-of-std" = [ "core" "compiler_builtins" ];
|
|
};
|
|
};
|
|
"configparser" = rec {
|
|
crateName = "configparser";
|
|
version = "1.0.0";
|
|
edition = "2018";
|
|
sha256 = "19s7rcq71rry8zgy2x3pn1c9m11gbx3a3yxx8kj7knnilz6ps7gy";
|
|
authors = [
|
|
"QEDK <qedk.en@gmail.com>"
|
|
];
|
|
|
|
};
|
|
"core-foundation" = rec {
|
|
crateName = "core-foundation";
|
|
version = "0.7.0";
|
|
edition = "2015";
|
|
sha256 = "0wbias8f0m5kyn2pcksi0h58fdslams6nmf16w78fgn42dx4rljp";
|
|
authors = [
|
|
"The Servo Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "core-foundation-sys";
|
|
packageId = "core-foundation-sys";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
features = {
|
|
"mac_os_10_7_support" = [ "core-foundation-sys/mac_os_10_7_support" ];
|
|
"mac_os_10_8_features" = [ "core-foundation-sys/mac_os_10_8_features" ];
|
|
"with-chrono" = [ "chrono" ];
|
|
"with-uuid" = [ "uuid" ];
|
|
};
|
|
};
|
|
"core-foundation-sys" = rec {
|
|
crateName = "core-foundation-sys";
|
|
version = "0.7.0";
|
|
edition = "2015";
|
|
sha256 = "1b5qfnnmg49sawwfsb0c0wbj81bqi7h7lh68pmhbidf0jjs1m9xk";
|
|
authors = [
|
|
"The Servo Project Developers"
|
|
];
|
|
features = {
|
|
};
|
|
};
|
|
"dbus" = rec {
|
|
crateName = "dbus";
|
|
version = "0.6.5";
|
|
edition = "2015";
|
|
sha256 = "068qyxvaam34sjmhjgxz6iikklvylxly7gp6n00yksqydzrz1da8";
|
|
authors = [
|
|
"David Henningsson <diwic@ubuntu.com>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
{
|
|
name = "libdbus-sys";
|
|
packageId = "libdbus-sys";
|
|
}
|
|
];
|
|
features = {
|
|
};
|
|
};
|
|
"gdk-pixbuf" = rec {
|
|
crateName = "gdk-pixbuf";
|
|
version = "0.3.0";
|
|
edition = "2015";
|
|
sha256 = "1lcyaa66ycx3rlamsn33vqnk5fi974izphr46fgvw6p958hhs5hn";
|
|
libName = "gdk_pixbuf";
|
|
authors = [
|
|
"The Gtk-rs Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "gdk-pixbuf-sys";
|
|
packageId = "gdk-pixbuf-sys";
|
|
}
|
|
{
|
|
name = "glib";
|
|
packageId = "glib";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "gobject-sys";
|
|
packageId = "gobject-sys";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
features = {
|
|
"dox" = [ "glib/dox" "gdk-pixbuf-sys/dox" ];
|
|
"embed-lgpl-docs" = [ "gtk-rs-lgpl-docs" ];
|
|
"purge-lgpl-docs" = [ "gtk-rs-lgpl-docs" ];
|
|
"v2_28" = [ "gdk-pixbuf-sys/v2_28" ];
|
|
"v2_30" = [ "v2_28" "gdk-pixbuf-sys/v2_30" ];
|
|
"v2_32" = [ "v2_30" "gdk-pixbuf-sys/v2_32" ];
|
|
"v2_36" = [ "v2_32" "gdk-pixbuf-sys/v2_36" ];
|
|
};
|
|
};
|
|
"gdk-pixbuf-sys" = rec {
|
|
crateName = "gdk-pixbuf-sys";
|
|
version = "0.5.0";
|
|
edition = "2015";
|
|
sha256 = "0ljgifyfa78c23002rih14c6vv67gvh803ix6vd810ga3q89g3vr";
|
|
libName = "gdk_pixbuf_sys";
|
|
authors = [
|
|
"The Gtk-rs Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "bitflags";
|
|
packageId = "bitflags";
|
|
}
|
|
{
|
|
name = "gio-sys";
|
|
packageId = "gio-sys";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "gobject-sys";
|
|
packageId = "gobject-sys";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
features = {
|
|
"v2_30" = [ "v2_28" ];
|
|
"v2_32" = [ "v2_30" ];
|
|
"v2_36" = [ "v2_32" ];
|
|
};
|
|
};
|
|
"gio-sys" = rec {
|
|
crateName = "gio-sys";
|
|
version = "0.5.0";
|
|
edition = "2015";
|
|
sha256 = "1g4i00kzdcf2b8l6d2fnw6brw6sx947g2zqi4yvb6np7lpvvn0x3";
|
|
libName = "gio_sys";
|
|
authors = [
|
|
"The Gtk-rs Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "bitflags";
|
|
packageId = "bitflags";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "gobject-sys";
|
|
packageId = "gobject-sys";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
features = {
|
|
"v2_36" = [ "v2_34" ];
|
|
"v2_38" = [ "v2_36" ];
|
|
"v2_40" = [ "v2_38" ];
|
|
"v2_42" = [ "v2_40" ];
|
|
"v2_44" = [ "v2_42" ];
|
|
"v2_46" = [ "v2_44" ];
|
|
"v2_48" = [ "v2_46" ];
|
|
"v2_50" = [ "v2_48" ];
|
|
"v2_52" = [ "v2_50" ];
|
|
"v2_54" = [ "v2_52" ];
|
|
};
|
|
};
|
|
"glib" = rec {
|
|
crateName = "glib";
|
|
version = "0.4.1";
|
|
edition = "2015";
|
|
sha256 = "0jkdy63hpc3pp7x3rfndfq5rz48431rdq6ph81lhcqyc4hl4bc5r";
|
|
authors = [
|
|
"The Gtk-rs Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "bitflags";
|
|
packageId = "bitflags";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "gobject-sys";
|
|
packageId = "gobject-sys";
|
|
}
|
|
{
|
|
name = "lazy_static";
|
|
packageId = "lazy_static";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
features = {
|
|
"dox" = [ "glib-sys/dox" "gobject-sys/dox" ];
|
|
"v2_34" = [ "glib-sys/v2_34" "gobject-sys/v2_34" ];
|
|
"v2_38" = [ "v2_34" "glib-sys/v2_38" "gobject-sys/v2_38" ];
|
|
"v2_40" = [ "v2_38" "glib-sys/v2_40" ];
|
|
"v2_44" = [ "v2_40" "glib-sys/v2_44" "gobject-sys/v2_44" ];
|
|
"v2_46" = [ "v2_44" "glib-sys/v2_46" "gobject-sys/v2_46" ];
|
|
"v2_48" = [ "v2_46" "glib-sys/v2_48" ];
|
|
"v2_50" = [ "v2_48" "glib-sys/v2_50" ];
|
|
"v2_52" = [ "v2_50" "glib-sys/v2_52" ];
|
|
"v2_54" = [ "v2_52" "glib-sys/v2_54" "gobject-sys/v2_54" ];
|
|
};
|
|
};
|
|
"glib-sys" = rec {
|
|
crateName = "glib-sys";
|
|
version = "0.5.0";
|
|
edition = "2015";
|
|
sha256 = "1s2bvk3zcwsbf8w88a3d6qqfbn360dcx5hrw069jpx9zc54k0sfr";
|
|
libName = "glib_sys";
|
|
authors = [
|
|
"The Gtk-rs Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "bitflags";
|
|
packageId = "bitflags";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
features = {
|
|
"v2_36" = [ "v2_34" ];
|
|
"v2_38" = [ "v2_36" ];
|
|
"v2_40" = [ "v2_38" ];
|
|
"v2_44" = [ "v2_40" ];
|
|
"v2_46" = [ "v2_44" ];
|
|
"v2_48" = [ "v2_46" ];
|
|
"v2_50" = [ "v2_48" ];
|
|
"v2_52" = [ "v2_50" ];
|
|
"v2_54" = [ "v2_52" ];
|
|
};
|
|
};
|
|
"gobject-sys" = rec {
|
|
crateName = "gobject-sys";
|
|
version = "0.5.0";
|
|
edition = "2015";
|
|
sha256 = "1hnpqz4yd1z76gbl5crly9nsg6cvprlsj8gdcqy19cbigb40gmb0";
|
|
libName = "gobject_sys";
|
|
authors = [
|
|
"The Gtk-rs Project Developers"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "bitflags";
|
|
packageId = "bitflags";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
features = {
|
|
"v2_36" = [ "v2_34" ];
|
|
"v2_38" = [ "v2_36" ];
|
|
"v2_42" = [ "v2_38" ];
|
|
"v2_44" = [ "v2_42" ];
|
|
"v2_46" = [ "v2_44" ];
|
|
"v2_54" = [ "v2_46" ];
|
|
};
|
|
};
|
|
"hex" = rec {
|
|
crateName = "hex";
|
|
version = "0.3.2";
|
|
edition = "2015";
|
|
sha256 = "0xsdcjiik5j750j67zk42qdnmm4ahirk3gmkmcqgq7qls2jjcl40";
|
|
authors = [
|
|
"KokaKiwi <kokakiwi@kokakiwi.net>"
|
|
];
|
|
features = {
|
|
};
|
|
};
|
|
"lazy_static" = rec {
|
|
crateName = "lazy_static";
|
|
version = "1.4.0";
|
|
edition = "2015";
|
|
sha256 = "0in6ikhw8mgl33wjv6q6xfrb5b9jr16q8ygjy803fay4zcisvaz2";
|
|
authors = [
|
|
"Marvin Löbel <loebel.marvin@gmail.com>"
|
|
];
|
|
features = {
|
|
"spin_no_std" = [ "spin" ];
|
|
};
|
|
};
|
|
"lazycell" = rec {
|
|
crateName = "lazycell";
|
|
version = "1.3.0";
|
|
edition = "2015";
|
|
sha256 = "0m8gw7dn30i0zjjpjdyf6pc16c34nl71lpv461mix50x3p70h3c3";
|
|
authors = [
|
|
"Alex Crichton <alex@alexcrichton.com>"
|
|
"Nikita Pekin <contact@nikitapek.in>"
|
|
];
|
|
features = {
|
|
"nightly-testing" = [ "clippy" "nightly" ];
|
|
};
|
|
};
|
|
"libc" = rec {
|
|
crateName = "libc";
|
|
version = "0.2.77";
|
|
edition = "2015";
|
|
sha256 = "0dc2z75prvi9vgg7djzy4nkb61vish01p5knis50hq15xh86pygj";
|
|
authors = [
|
|
"The Rust Project Developers"
|
|
];
|
|
features = {
|
|
"default" = [ "std" ];
|
|
"rustc-dep-of-std" = [ "align" "rustc-std-workspace-core" ];
|
|
"use_std" = [ "std" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "default" "std" ];
|
|
};
|
|
"libdbus-sys" = rec {
|
|
crateName = "libdbus-sys";
|
|
version = "0.2.1";
|
|
edition = "2015";
|
|
sha256 = "1w06ycq2mw8zfp9j73macgdl8d2881bnxbzdyyxys90ljyya64nw";
|
|
authors = [
|
|
"David Henningsson <diwic@ubuntu.com>"
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
|
|
};
|
|
"libnotify" = rec {
|
|
crateName = "libnotify";
|
|
version = "1.0.3";
|
|
edition = "2015";
|
|
sha256 = "0bfc83hzzqkkd9hclvd2s79sxmvq0clsiqzxqv6ggy66id7nll0h";
|
|
authors = [
|
|
"Mika Attila <radiantstatue@gmail.com>"
|
|
"Julian Ospald <hasufell@posteo.de>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "gdk-pixbuf";
|
|
packageId = "gdk-pixbuf";
|
|
}
|
|
{
|
|
name = "gdk-pixbuf-sys";
|
|
packageId = "gdk-pixbuf-sys";
|
|
}
|
|
{
|
|
name = "glib";
|
|
packageId = "glib";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "gobject-sys";
|
|
packageId = "gobject-sys";
|
|
}
|
|
{
|
|
name = "libnotify-sys";
|
|
packageId = "libnotify-sys";
|
|
}
|
|
];
|
|
|
|
};
|
|
"libnotify-sys" = rec {
|
|
crateName = "libnotify-sys";
|
|
version = "1.0.2";
|
|
edition = "2015";
|
|
sha256 = "0g1q8w3ivnjl7sxniynly95rlg51gx9f2cdl3q7x2knjnywid9x0";
|
|
libName = "libnotify_sys";
|
|
authors = [
|
|
"Mika Attila <radiantstatue@gmail.com>"
|
|
"Julian Ospald <hasufell@posteo.de>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "bitflags";
|
|
packageId = "bitflags";
|
|
}
|
|
{
|
|
name = "gdk-pixbuf-sys";
|
|
packageId = "gdk-pixbuf-sys";
|
|
}
|
|
{
|
|
name = "glib-sys";
|
|
packageId = "glib-sys";
|
|
}
|
|
{
|
|
name = "gobject-sys";
|
|
packageId = "gobject-sys";
|
|
}
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
|
|
};
|
|
"libpulse-binding" = rec {
|
|
crateName = "libpulse-binding";
|
|
version = "2.16.2";
|
|
edition = "2018";
|
|
sha256 = "0f2mdcqrg3lmfn6hixmhmq67nw3f6hy2xmny81byjjpkcynyz58p";
|
|
authors = [
|
|
"Lyndon Brown <jnqnfe@gmail.com>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
{
|
|
name = "libpulse-sys";
|
|
packageId = "libpulse-sys";
|
|
usesDefaultFeatures = false;
|
|
}
|
|
{
|
|
name = "winapi";
|
|
packageId = "winapi";
|
|
usesDefaultFeatures = false;
|
|
target = { target, features }: target."windows";
|
|
features = [ "winsock2" ];
|
|
}
|
|
];
|
|
features = {
|
|
"default" = [ "pa_latest_common" ];
|
|
"dox" = [ "libpulse-sys/dox" ];
|
|
"pa_latest" = [ "pa_v13" ];
|
|
"pa_latest_common" = [ "pa_v13" ];
|
|
"pa_v12" = [ "pa_v8" "libpulse-sys/pa_v12" ];
|
|
"pa_v13" = [ "pa_v12" "libpulse-sys/pa_v13" ];
|
|
"pa_v5" = [ "libpulse-sys/pa_v5" ];
|
|
"pa_v6" = [ "pa_v5" "libpulse-sys/pa_v6" ];
|
|
"pa_v8" = [ "pa_v6" "libpulse-sys/pa_v8" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "default" "pa_latest_common" "pa_v12" "pa_v13" "pa_v5" "pa_v6" "pa_v8" ];
|
|
};
|
|
"libpulse-sys" = rec {
|
|
crateName = "libpulse-sys";
|
|
version = "1.13.2";
|
|
edition = "2018";
|
|
sha256 = "11hp2ii6pay8651bs87d6qnfd3yc2v9lasasfmjghr6mf5q8alsz";
|
|
authors = [
|
|
"Lyndon Brown <jnqnfe@gmail.com>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
}
|
|
{
|
|
name = "winapi";
|
|
packageId = "winapi";
|
|
usesDefaultFeatures = false;
|
|
target = { target, features }: target."windows";
|
|
features = [ "winsock2" ];
|
|
}
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "pkg-config";
|
|
packageId = "pkg-config";
|
|
}
|
|
];
|
|
features = {
|
|
"default" = [ "pa_latest_common" ];
|
|
"pa_latest" = [ "pa_v13" ];
|
|
"pa_latest_common" = [ "pa_v13" ];
|
|
"pa_v12" = [ "pa_v8" ];
|
|
"pa_v13" = [ "pa_v12" ];
|
|
"pa_v6" = [ "pa_v5" ];
|
|
"pa_v8" = [ "pa_v6" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "pa_v12" "pa_v13" "pa_v5" "pa_v6" "pa_v8" ];
|
|
};
|
|
"mach" = rec {
|
|
crateName = "mach";
|
|
version = "0.3.2";
|
|
edition = "2015";
|
|
sha256 = "1yksa8lwzqh150gr4417rls1wk20asy9vhp8kq5g9n7z58xyh8xq";
|
|
authors = [
|
|
"Nick Fitzgerald <fitzgen@gmail.com>"
|
|
"David Cuddeback <david.cuddeback@gmail.com>"
|
|
"Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "libc";
|
|
packageId = "libc";
|
|
usesDefaultFeatures = false;
|
|
target = { target, features }: ((target."os" == "macos") || (target."os" == "ios"));
|
|
}
|
|
];
|
|
features = {
|
|
"rustc-dep-of-std" = [ "rustc-std-workspace-core" "libc/rustc-dep-of-std" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "default" ];
|
|
};
|
|
"num-traits" = rec {
|
|
crateName = "num-traits";
|
|
version = "0.2.12";
|
|
edition = "2015";
|
|
sha256 = "04fnzwlnn6fcy09jjbi9l7bj5dvg657x5c2sjgwfb3pl0z67n9mc";
|
|
authors = [
|
|
"The Rust Project Developers"
|
|
];
|
|
buildDependencies = [
|
|
{
|
|
name = "autocfg";
|
|
packageId = "autocfg";
|
|
}
|
|
];
|
|
features = {
|
|
"default" = [ "std" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "std" ];
|
|
};
|
|
"pkg-config" = rec {
|
|
crateName = "pkg-config";
|
|
version = "0.3.18";
|
|
edition = "2015";
|
|
sha256 = "0cxc4yd9qb40944a2svgci41bws68f1hqvyljhrldwbadda94r6k";
|
|
authors = [
|
|
"Alex Crichton <alex@alexcrichton.com>"
|
|
];
|
|
|
|
};
|
|
"simple-osd-battery" = rec {
|
|
crateName = "simple-osd-battery";
|
|
version = "0.1.0";
|
|
edition = "2018";
|
|
crateBin = [
|
|
{ name = "simple-osd-battery"; path = "src/main.rs"; }
|
|
];
|
|
src = (builtins.filterSource sourceFilter ./battery);
|
|
authors = [
|
|
"Alexander Bantyev <balsoft@balsoft.ru>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "battery";
|
|
packageId = "battery";
|
|
}
|
|
{
|
|
name = "simple-osd-common";
|
|
packageId = "simple-osd-common";
|
|
}
|
|
];
|
|
|
|
};
|
|
"simple-osd-bluetooth" = rec {
|
|
crateName = "simple-osd-bluetooth";
|
|
version = "0.1.0";
|
|
edition = "2018";
|
|
crateBin = [
|
|
{ name = "simple-osd-bluetooth"; path = "src/main.rs"; }
|
|
];
|
|
src = (builtins.filterSource sourceFilter ./bluetooth);
|
|
authors = [
|
|
"Alexander Bantyev <balsoft@balsoft.ru>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "blurz";
|
|
packageId = "blurz";
|
|
}
|
|
{
|
|
name = "simple-osd-common";
|
|
packageId = "simple-osd-common";
|
|
}
|
|
];
|
|
|
|
};
|
|
"simple-osd-brightness" = rec {
|
|
crateName = "simple-osd-brightness";
|
|
version = "0.1.0";
|
|
edition = "2018";
|
|
crateBin = [
|
|
{ name = "simple-osd-brightness"; path = "src/main.rs"; }
|
|
];
|
|
src = (builtins.filterSource sourceFilter ./brightness);
|
|
authors = [
|
|
"Alexander Bantyev <balsoft@balsoft.ru>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "backlight";
|
|
packageId = "backlight";
|
|
}
|
|
{
|
|
name = "simple-osd-common";
|
|
packageId = "simple-osd-common";
|
|
}
|
|
];
|
|
|
|
};
|
|
"simple-osd-common" = rec {
|
|
crateName = "simple-osd-common";
|
|
version = "0.1.0";
|
|
edition = "2018";
|
|
src = (builtins.filterSource sourceFilter ./common);
|
|
authors = [
|
|
"Alexander Bantyev <balsoft@balsoft.ru>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "configparser";
|
|
packageId = "configparser";
|
|
}
|
|
{
|
|
name = "libnotify";
|
|
packageId = "libnotify";
|
|
}
|
|
{
|
|
name = "xdg";
|
|
packageId = "xdg";
|
|
}
|
|
];
|
|
|
|
};
|
|
"simple-osd-pulseaudio" = rec {
|
|
crateName = "simple-osd-pulseaudio";
|
|
version = "0.1.0";
|
|
edition = "2018";
|
|
crateBin = [
|
|
{ name = "simple-osd-pulseaudio"; path = "src/main.rs"; }
|
|
];
|
|
src = (builtins.filterSource sourceFilter ./pulseaudio);
|
|
authors = [
|
|
"Alexander Bantyev <balsoft@balsoft.ru>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "libpulse-binding";
|
|
packageId = "libpulse-binding";
|
|
}
|
|
{
|
|
name = "simple-osd-common";
|
|
packageId = "simple-osd-common";
|
|
}
|
|
];
|
|
|
|
};
|
|
"typenum" = rec {
|
|
crateName = "typenum";
|
|
version = "1.12.0";
|
|
edition = "2015";
|
|
sha256 = "0cvbksljz61ian21fnn0h51kphl0pwpzb932bv4s0rwy1wh8lg1p";
|
|
build = "build/main.rs";
|
|
authors = [
|
|
"Paho Lurie-Gregg <paho@paholg.com>"
|
|
"Andre Bogus <bogusandre@gmail.com>"
|
|
];
|
|
features = {
|
|
};
|
|
};
|
|
"uom" = rec {
|
|
crateName = "uom";
|
|
version = "0.29.0";
|
|
edition = "2015";
|
|
sha256 = "1fls9ky0sfsmj9dbpmnji22x90h95p58ybqi56wbymi34psr7dcb";
|
|
authors = [
|
|
"Mike Boutin <mike.boutin@gmail.com>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "num-traits";
|
|
packageId = "num-traits";
|
|
usesDefaultFeatures = false;
|
|
}
|
|
{
|
|
name = "typenum";
|
|
packageId = "typenum";
|
|
}
|
|
];
|
|
features = {
|
|
"bigint" = [ "bigint-support" ];
|
|
"bigint-support" = [ "num-bigint" "num-rational/bigint" ];
|
|
"bigrational" = [ "bigint-support" ];
|
|
"biguint" = [ "bigint-support" ];
|
|
"default" = [ "autoconvert" "f32" "f64" "si" "std" ];
|
|
"i128" = [ "rational-support" ];
|
|
"i16" = [ "rational-support" ];
|
|
"i32" = [ "rational-support" ];
|
|
"i64" = [ "rational-support" ];
|
|
"i8" = [ "rational-support" ];
|
|
"isize" = [ "rational-support" ];
|
|
"rational" = [ "rational-support" ];
|
|
"rational-support" = [ "num-rational" ];
|
|
"rational32" = [ "rational-support" ];
|
|
"rational64" = [ "rational-support" ];
|
|
"std" = [ "num-traits/std" ];
|
|
"u128" = [ "rational-support" ];
|
|
"u16" = [ "rational-support" ];
|
|
"u32" = [ "rational-support" ];
|
|
"u64" = [ "rational-support" ];
|
|
"u8" = [ "rational-support" ];
|
|
"use_serde" = [ "serde" ];
|
|
"usize" = [ "rational-support" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "autoconvert" "default" "f32" "f64" "si" "std" ];
|
|
};
|
|
"winapi" = rec {
|
|
crateName = "winapi";
|
|
version = "0.3.9";
|
|
edition = "2015";
|
|
sha256 = "06gl025x418lchw1wxj64ycr7gha83m44cjr5sarhynd9xkrm0sw";
|
|
authors = [
|
|
"Peter Atashian <retep998@gmail.com>"
|
|
];
|
|
dependencies = [
|
|
{
|
|
name = "winapi-i686-pc-windows-gnu";
|
|
packageId = "winapi-i686-pc-windows-gnu";
|
|
target = { target, features }: (stdenv.hostPlatform.config == "i686-pc-windows-gnu");
|
|
}
|
|
{
|
|
name = "winapi-x86_64-pc-windows-gnu";
|
|
packageId = "winapi-x86_64-pc-windows-gnu";
|
|
target = { target, features }: (stdenv.hostPlatform.config == "x86_64-pc-windows-gnu");
|
|
}
|
|
];
|
|
features = {
|
|
"debug" = [ "impl-debug" ];
|
|
};
|
|
resolvedDefaultFeatures = [ "devguid" "errhandlingapi" "handleapi" "impl-default" "ioapiset" "ntdef" "setupapi" "winbase" "winerror" "winsock2" ];
|
|
};
|
|
"winapi-i686-pc-windows-gnu" = rec {
|
|
crateName = "winapi-i686-pc-windows-gnu";
|
|
version = "0.4.0";
|
|
edition = "2015";
|
|
sha256 = "1dmpa6mvcvzz16zg6d5vrfy4bxgg541wxrcip7cnshi06v38ffxc";
|
|
authors = [
|
|
"Peter Atashian <retep998@gmail.com>"
|
|
];
|
|
|
|
};
|
|
"winapi-x86_64-pc-windows-gnu" = rec {
|
|
crateName = "winapi-x86_64-pc-windows-gnu";
|
|
version = "0.4.0";
|
|
edition = "2015";
|
|
sha256 = "0gqq64czqb64kskjryj8isp62m2sgvx25yyj3kpc2myh85w24bki";
|
|
authors = [
|
|
"Peter Atashian <retep998@gmail.com>"
|
|
];
|
|
|
|
};
|
|
"xdg" = rec {
|
|
crateName = "xdg";
|
|
version = "2.2.0";
|
|
edition = "2015";
|
|
sha256 = "0mws8a0fr3cqk5nh7aq9lmkmhzghvasqy4mhw6nnza06l4d6i2fh";
|
|
authors = [
|
|
"Ben Longbons <b.r.longbons@gmail.com>"
|
|
"whitequark <whitequark@whitequark.org>"
|
|
];
|
|
|
|
};
|
|
};
|
|
|
|
#
|
|
# crate2nix/default.nix (excerpt start)
|
|
#
|
|
|
|
/* Target (platform) data for conditional dependencies.
|
|
This corresponds roughly to what buildRustCrate is setting.
|
|
*/
|
|
defaultTarget = {
|
|
unix = true;
|
|
windows = false;
|
|
fuchsia = true;
|
|
test = false;
|
|
|
|
# This doesn't appear to be officially documented anywhere yet.
|
|
# See https://github.com/rust-lang-nursery/rust-forge/issues/101.
|
|
os = if stdenv.hostPlatform.isDarwin
|
|
then "macos"
|
|
else stdenv.hostPlatform.parsed.kernel.name;
|
|
arch = stdenv.hostPlatform.parsed.cpu.name;
|
|
family = "unix";
|
|
env = "gnu";
|
|
endian =
|
|
if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian"
|
|
then "little" else "big";
|
|
pointer_width = toString stdenv.hostPlatform.parsed.cpu.bits;
|
|
vendor = stdenv.hostPlatform.parsed.vendor.name;
|
|
debug_assertions = false;
|
|
};
|
|
|
|
/* Filters common temp files and build files. */
|
|
# TODO(pkolloch): Substitute with gitignore filter
|
|
sourceFilter = name: type:
|
|
let
|
|
baseName = builtins.baseNameOf (builtins.toString name);
|
|
in
|
|
! (
|
|
# Filter out git
|
|
baseName == ".gitignore"
|
|
|| (type == "directory" && baseName == ".git")
|
|
|
|
# Filter out build results
|
|
|| (
|
|
type == "directory" && (
|
|
baseName == "target"
|
|
|| baseName == "_site"
|
|
|| baseName == ".sass-cache"
|
|
|| baseName == ".jekyll-metadata"
|
|
|| baseName == "build-artifacts"
|
|
)
|
|
)
|
|
|
|
# Filter out nix-build result symlinks
|
|
|| (
|
|
type == "symlink" && lib.hasPrefix "result" baseName
|
|
)
|
|
|
|
# Filter out IDE config
|
|
|| (
|
|
type == "directory" && (
|
|
baseName == ".idea" || baseName == ".vscode"
|
|
)
|
|
) || lib.hasSuffix ".iml" baseName
|
|
|
|
# Filter out nix build files
|
|
|| baseName == "Cargo.nix"
|
|
|
|
# Filter out editor backup / swap files.
|
|
|| lib.hasSuffix "~" baseName
|
|
|| builtins.match "^\\.sw[a-z]$$" baseName != null
|
|
|| builtins.match "^\\..*\\.sw[a-z]$$" baseName != null
|
|
|| lib.hasSuffix ".tmp" baseName
|
|
|| lib.hasSuffix ".bak" baseName
|
|
|| baseName == "tests.nix"
|
|
);
|
|
|
|
/* Returns a crate which depends on successful test execution
|
|
of crate given as the second argument.
|
|
|
|
testCrateFlags: list of flags to pass to the test exectuable
|
|
testInputs: list of packages that should be available during test execution
|
|
*/
|
|
crateWithTest = { crate, testCrate, testCrateFlags, testInputs }:
|
|
assert builtins.typeOf testCrateFlags == "list";
|
|
assert builtins.typeOf testInputs == "list";
|
|
let
|
|
# override the `crate` so that it will build and execute tests instead of
|
|
# building the actual lib and bin targets We just have to pass `--test`
|
|
# to rustc and it will do the right thing. We execute the tests and copy
|
|
# their log and the test executables to $out for later inspection.
|
|
test = let
|
|
drv = testCrate.override (
|
|
_: {
|
|
buildTests = true;
|
|
}
|
|
);
|
|
in
|
|
pkgs.runCommand "run-tests-${testCrate.name}" {
|
|
inherit testCrateFlags;
|
|
buildInputs = testInputs;
|
|
} ''
|
|
set -ex
|
|
cd ${crate.src}
|
|
for file in ${drv}/tests/*; do
|
|
$file $testCrateFlags 2>&1 | tee -a $out
|
|
done
|
|
'';
|
|
in
|
|
crate.overrideAttrs (
|
|
old: {
|
|
checkPhase = ''
|
|
test -e ${test}
|
|
'';
|
|
passthru = (old.passthru or {}) // {
|
|
inherit test;
|
|
};
|
|
}
|
|
);
|
|
|
|
/* A restricted overridable version of builtRustCratesWithFeatures. */
|
|
buildRustCrateWithFeatures =
|
|
{ packageId
|
|
, features ? rootFeatures
|
|
, crateOverrides ? defaultCrateOverrides
|
|
, buildRustCrateFunc ? (
|
|
if crateOverrides == pkgs.defaultCrateOverrides
|
|
then buildRustCrate
|
|
else buildRustCrate.override {
|
|
defaultCrateOverrides = crateOverrides;
|
|
}
|
|
)
|
|
, runTests ? false
|
|
, testCrateFlags ? []
|
|
, testInputs ? []
|
|
}:
|
|
lib.makeOverridable
|
|
(
|
|
{ features, crateOverrides, runTests, testCrateFlags, testInputs }:
|
|
let
|
|
builtRustCrates = builtRustCratesWithFeatures {
|
|
inherit packageId features buildRustCrateFunc;
|
|
runTests = false;
|
|
};
|
|
builtTestRustCrates = builtRustCratesWithFeatures {
|
|
inherit packageId features buildRustCrateFunc;
|
|
runTests = true;
|
|
};
|
|
drv = builtRustCrates.${packageId};
|
|
testDrv = builtTestRustCrates.${packageId};
|
|
in
|
|
if runTests then
|
|
crateWithTest {
|
|
crate = drv;
|
|
testCrate = testDrv;
|
|
inherit testCrateFlags testInputs;
|
|
}
|
|
else drv
|
|
)
|
|
{ inherit features crateOverrides runTests testCrateFlags testInputs; };
|
|
|
|
/* Returns an attr set with packageId mapped to the result of buildRustCrateFunc
|
|
for the corresponding crate.
|
|
*/
|
|
builtRustCratesWithFeatures =
|
|
{ packageId
|
|
, features
|
|
, crateConfigs ? crates
|
|
, buildRustCrateFunc
|
|
, runTests
|
|
, target ? defaultTarget
|
|
} @ args:
|
|
assert (builtins.isAttrs crateConfigs);
|
|
assert (builtins.isString packageId);
|
|
assert (builtins.isList features);
|
|
assert (builtins.isAttrs target);
|
|
assert (builtins.isBool runTests);
|
|
let
|
|
rootPackageId = packageId;
|
|
mergedFeatures = mergePackageFeatures (
|
|
args // {
|
|
inherit rootPackageId;
|
|
target = target // { test = runTests; };
|
|
}
|
|
);
|
|
|
|
buildByPackageId = packageId: buildByPackageIdImpl packageId;
|
|
|
|
# Memoize built packages so that reappearing packages are only built once.
|
|
builtByPackageId =
|
|
lib.mapAttrs (packageId: value: buildByPackageId packageId) crateConfigs;
|
|
|
|
buildByPackageIdImpl = packageId:
|
|
let
|
|
features = mergedFeatures."${packageId}" or [];
|
|
crateConfig' = crateConfigs."${packageId}";
|
|
crateConfig =
|
|
builtins.removeAttrs crateConfig' [ "resolvedDefaultFeatures" "devDependencies" ];
|
|
devDependencies =
|
|
lib.optionals
|
|
(runTests && packageId == rootPackageId)
|
|
(crateConfig'.devDependencies or []);
|
|
dependencies =
|
|
dependencyDerivations {
|
|
inherit builtByPackageId features target;
|
|
dependencies =
|
|
(crateConfig.dependencies or [])
|
|
++ devDependencies;
|
|
};
|
|
buildDependencies =
|
|
dependencyDerivations {
|
|
inherit builtByPackageId features target;
|
|
dependencies = crateConfig.buildDependencies or [];
|
|
};
|
|
|
|
filterEnabledDependenciesForThis = dependencies: filterEnabledDependencies {
|
|
inherit dependencies features target;
|
|
};
|
|
|
|
dependenciesWithRenames =
|
|
lib.filter (d: d ? "rename") (
|
|
filterEnabledDependenciesForThis
|
|
(
|
|
(crateConfig.buildDependencies or [])
|
|
++ (crateConfig.dependencies or [])
|
|
++ devDependencies
|
|
)
|
|
);
|
|
|
|
crateRenames =
|
|
builtins.listToAttrs
|
|
(map (d: { name = d.name; value = d.rename; }) dependenciesWithRenames);
|
|
in
|
|
buildRustCrateFunc (
|
|
crateConfig // {
|
|
src = crateConfig.src or (
|
|
pkgs.fetchurl {
|
|
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
|
|
url = "https://crates.io/api/v1/crates/${crateConfig.crateName}/${crateConfig.version}/download";
|
|
sha256 = crateConfig.sha256;
|
|
}
|
|
);
|
|
inherit features dependencies buildDependencies crateRenames release;
|
|
}
|
|
);
|
|
in
|
|
builtByPackageId;
|
|
|
|
/* Returns the actual derivations for the given dependencies. */
|
|
dependencyDerivations =
|
|
{ builtByPackageId
|
|
, features
|
|
, dependencies
|
|
, target
|
|
}:
|
|
assert (builtins.isAttrs builtByPackageId);
|
|
assert (builtins.isList features);
|
|
assert (builtins.isList dependencies);
|
|
assert (builtins.isAttrs target);
|
|
let
|
|
enabledDependencies = filterEnabledDependencies {
|
|
inherit dependencies features target;
|
|
};
|
|
depDerivation = dependency: builtByPackageId.${dependency.packageId};
|
|
in
|
|
map depDerivation enabledDependencies;
|
|
|
|
/* Returns a sanitized version of val with all values substituted that cannot
|
|
be serialized as JSON.
|
|
*/
|
|
sanitizeForJson = val:
|
|
if builtins.isAttrs val
|
|
then lib.mapAttrs (n: v: sanitizeForJson v) val
|
|
else if builtins.isList val
|
|
then builtins.map sanitizeForJson val
|
|
else if builtins.isFunction val
|
|
then "function"
|
|
else val;
|
|
|
|
/* Returns various tools to debug a crate. */
|
|
debugCrate = { packageId, target ? defaultTarget }:
|
|
assert (builtins.isString packageId);
|
|
let
|
|
debug = rec {
|
|
# The built tree as passed to buildRustCrate.
|
|
buildTree = buildRustCrateWithFeatures {
|
|
buildRustCrateFunc = lib.id;
|
|
inherit packageId;
|
|
};
|
|
sanitizedBuildTree = sanitizeForJson buildTree;
|
|
dependencyTree = sanitizeForJson (
|
|
buildRustCrateWithFeatures {
|
|
buildRustCrateFunc = crate: {
|
|
"01_crateName" = crate.crateName or false;
|
|
"02_features" = crate.features or [];
|
|
"03_dependencies" = crate.dependencies or [];
|
|
};
|
|
inherit packageId;
|
|
}
|
|
);
|
|
mergedPackageFeatures = mergePackageFeatures {
|
|
features = rootFeatures;
|
|
inherit packageId target;
|
|
};
|
|
diffedDefaultPackageFeatures = diffDefaultPackageFeatures {
|
|
inherit packageId target;
|
|
};
|
|
};
|
|
in
|
|
{ internal = debug; };
|
|
|
|
/* Returns differences between cargo default features and crate2nix default
|
|
features.
|
|
|
|
This is useful for verifying the feature resolution in crate2nix.
|
|
*/
|
|
diffDefaultPackageFeatures =
|
|
{ crateConfigs ? crates
|
|
, packageId
|
|
, target
|
|
}:
|
|
assert (builtins.isAttrs crateConfigs);
|
|
let
|
|
prefixValues = prefix: lib.mapAttrs (n: v: { "${prefix}" = v; });
|
|
mergedFeatures =
|
|
prefixValues
|
|
"crate2nix"
|
|
(mergePackageFeatures { inherit crateConfigs packageId target; features = [ "default" ]; });
|
|
configs = prefixValues "cargo" crateConfigs;
|
|
combined = lib.foldAttrs (a: b: a // b) {} [ mergedFeatures configs ];
|
|
onlyInCargo =
|
|
builtins.attrNames
|
|
(lib.filterAttrs (n: v: !(v ? "crate2nix") && (v ? "cargo")) combined);
|
|
onlyInCrate2Nix =
|
|
builtins.attrNames
|
|
(lib.filterAttrs (n: v: (v ? "crate2nix") && !(v ? "cargo")) combined);
|
|
differentFeatures = lib.filterAttrs
|
|
(
|
|
n: v:
|
|
(v ? "crate2nix")
|
|
&& (v ? "cargo")
|
|
&& (v.crate2nix.features or []) != (v."cargo".resolved_default_features or [])
|
|
)
|
|
combined;
|
|
in
|
|
builtins.toJSON {
|
|
inherit onlyInCargo onlyInCrate2Nix differentFeatures;
|
|
};
|
|
|
|
/* Returns an attrset mapping packageId to the list of enabled features.
|
|
|
|
If multiple paths to a dependency enable different features, the
|
|
corresponding feature sets are merged. Features in rust are additive.
|
|
*/
|
|
mergePackageFeatures =
|
|
{ crateConfigs ? crates
|
|
, packageId
|
|
, rootPackageId ? packageId
|
|
, features ? rootFeatures
|
|
, dependencyPath ? [ crates.${packageId}.crateName ]
|
|
, featuresByPackageId ? {}
|
|
, target
|
|
# Adds devDependencies to the crate with rootPackageId.
|
|
, runTests ? false
|
|
, ...
|
|
} @ args:
|
|
assert (builtins.isAttrs crateConfigs);
|
|
assert (builtins.isString packageId);
|
|
assert (builtins.isString rootPackageId);
|
|
assert (builtins.isList features);
|
|
assert (builtins.isList dependencyPath);
|
|
assert (builtins.isAttrs featuresByPackageId);
|
|
assert (builtins.isAttrs target);
|
|
assert (builtins.isBool runTests);
|
|
let
|
|
crateConfig = crateConfigs."${packageId}" or (builtins.throw "Package not found: ${packageId}");
|
|
expandedFeatures = expandFeatures (crateConfig.features or {}) features;
|
|
|
|
depWithResolvedFeatures = dependency:
|
|
let
|
|
packageId = dependency.packageId;
|
|
features = dependencyFeatures expandedFeatures dependency;
|
|
in
|
|
{ inherit packageId features; };
|
|
|
|
resolveDependencies = cache: path: dependencies:
|
|
assert (builtins.isAttrs cache);
|
|
assert (builtins.isList dependencies);
|
|
let
|
|
enabledDependencies = filterEnabledDependencies {
|
|
inherit dependencies target;
|
|
features = expandedFeatures;
|
|
};
|
|
directDependencies = map depWithResolvedFeatures enabledDependencies;
|
|
foldOverCache = op: lib.foldl op cache directDependencies;
|
|
in
|
|
foldOverCache
|
|
(
|
|
cache: { packageId, features }:
|
|
let
|
|
cacheFeatures = cache.${packageId} or [];
|
|
combinedFeatures = sortedUnique (cacheFeatures ++ features);
|
|
in
|
|
if cache ? ${packageId} && cache.${packageId} == combinedFeatures
|
|
then cache
|
|
else mergePackageFeatures {
|
|
features = combinedFeatures;
|
|
featuresByPackageId = cache;
|
|
inherit crateConfigs packageId target runTests rootPackageId;
|
|
}
|
|
);
|
|
|
|
cacheWithSelf =
|
|
let
|
|
cacheFeatures = featuresByPackageId.${packageId} or [];
|
|
combinedFeatures = sortedUnique (cacheFeatures ++ expandedFeatures);
|
|
in
|
|
featuresByPackageId // {
|
|
"${packageId}" = combinedFeatures;
|
|
};
|
|
|
|
cacheWithDependencies =
|
|
resolveDependencies cacheWithSelf "dep" (
|
|
crateConfig.dependencies or []
|
|
++ lib.optionals
|
|
(runTests && packageId == rootPackageId)
|
|
(crateConfig.devDependencies or [])
|
|
);
|
|
|
|
cacheWithAll =
|
|
resolveDependencies
|
|
cacheWithDependencies "build"
|
|
(crateConfig.buildDependencies or []);
|
|
in
|
|
cacheWithAll;
|
|
|
|
/* Returns the enabled dependencies given the enabled features. */
|
|
filterEnabledDependencies = { dependencies, features, target }:
|
|
assert (builtins.isList dependencies);
|
|
assert (builtins.isList features);
|
|
assert (builtins.isAttrs target);
|
|
|
|
lib.filter
|
|
(
|
|
dep:
|
|
let
|
|
targetFunc = dep.target or (features: true);
|
|
in
|
|
targetFunc { inherit features target; }
|
|
&& (
|
|
!(dep.optional or false)
|
|
|| builtins.any (doesFeatureEnableDependency dep) features
|
|
)
|
|
)
|
|
dependencies;
|
|
|
|
/* Returns whether the given feature should enable the given dependency. */
|
|
doesFeatureEnableDependency = { name, rename ? null, ... }: feature:
|
|
let
|
|
prefix = "${name}/";
|
|
len = builtins.stringLength prefix;
|
|
startsWithPrefix = builtins.substring 0 len feature == prefix;
|
|
in
|
|
(rename == null && feature == name)
|
|
|| (rename != null && rename == feature)
|
|
|| startsWithPrefix;
|
|
|
|
/* Returns the expanded features for the given inputFeatures by applying the
|
|
rules in featureMap.
|
|
|
|
featureMap is an attribute set which maps feature names to lists of further
|
|
feature names to enable in case this feature is selected.
|
|
*/
|
|
expandFeatures = featureMap: inputFeatures:
|
|
assert (builtins.isAttrs featureMap);
|
|
assert (builtins.isList inputFeatures);
|
|
let
|
|
expandFeature = feature:
|
|
assert (builtins.isString feature);
|
|
[ feature ] ++ (expandFeatures featureMap (featureMap."${feature}" or []));
|
|
outFeatures = builtins.concatMap expandFeature inputFeatures;
|
|
in
|
|
sortedUnique outFeatures;
|
|
|
|
/*
|
|
Returns the actual features for the given dependency.
|
|
|
|
features: The features of the crate that refers this dependency.
|
|
*/
|
|
dependencyFeatures = features: dependency:
|
|
assert (builtins.isList features);
|
|
assert (builtins.isAttrs dependency);
|
|
let
|
|
defaultOrNil = if dependency.usesDefaultFeatures or true
|
|
then [ "default" ]
|
|
else [];
|
|
explicitFeatures = dependency.features or [];
|
|
additionalDependencyFeatures =
|
|
let
|
|
dependencyPrefix = (dependency.rename or dependency.name) + "/";
|
|
dependencyFeatures =
|
|
builtins.filter (f: lib.hasPrefix dependencyPrefix f) features;
|
|
in
|
|
builtins.map (lib.removePrefix dependencyPrefix) dependencyFeatures;
|
|
in
|
|
defaultOrNil ++ explicitFeatures ++ additionalDependencyFeatures;
|
|
|
|
/* Sorts and removes duplicates from a list of strings. */
|
|
sortedUnique = features:
|
|
assert (builtins.isList features);
|
|
assert (builtins.all builtins.isString features);
|
|
let
|
|
outFeaturesSet = lib.foldl (set: feature: set // { "${feature}" = 1; }) {} features;
|
|
outFeaturesUnique = builtins.attrNames outFeaturesSet;
|
|
in
|
|
builtins.sort (a: b: a < b) outFeaturesUnique;
|
|
|
|
deprecationWarning = message: value:
|
|
if strictDeprecation
|
|
then builtins.throw "strictDeprecation enabled, aborting: ${message}"
|
|
else builtins.trace message value;
|
|
|
|
#
|
|
# crate2nix/default.nix (excerpt end)
|
|
#
|
|
|
|
};
|
|
}
|