2022-10-15 20:02:13 +00:00
|
|
|
{
|
2023-04-04 23:56:51 +00:00
|
|
|
inputs = {
|
2023-06-18 00:02:10 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
2023-04-04 23:56:51 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2024-01-18 21:05:55 +00:00
|
|
|
nix-filter.url = "github:numtide/nix-filter";
|
2024-02-02 02:50:49 +00:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-04-04 23:56:51 +00:00
|
|
|
|
|
|
|
fenix = {
|
|
|
|
url = "github:nix-community/fenix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-04-05 00:30:30 +00:00
|
|
|
crane = {
|
2024-04-21 19:31:49 +00:00
|
|
|
url = "github:ipetkov/crane?ref=master";
|
2023-04-04 23:56:51 +00:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-01-27 21:10:21 +00:00
|
|
|
};
|
2024-01-25 19:34:46 +00:00
|
|
|
attic.url = "github:zhaofengli/attic?ref=main";
|
2023-04-04 23:56:51 +00:00
|
|
|
};
|
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
outputs = inputs:
|
2023-04-04 23:56:51 +00:00
|
|
|
let
|
2024-04-30 23:00:19 +00:00
|
|
|
# Keep sorted
|
|
|
|
mkScope = pkgs: pkgs.lib.makeScope pkgs.newScope (self: {
|
|
|
|
craneLib =
|
|
|
|
(inputs.crane.mkLib pkgs).overrideToolchain self.toolchain;
|
2023-04-04 23:56:51 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
default = self.callPackage ./nix/pkgs/default {};
|
2023-04-04 23:56:51 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
inherit inputs;
|
2023-04-04 23:56:51 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
oci-image = self.callPackage ./nix/pkgs/oci-image {};
|
2023-04-04 23:56:51 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
book = self.callPackage ./nix/pkgs/book {};
|
2023-07-16 20:38:33 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
rocksdb =
|
2024-01-23 19:22:18 +00:00
|
|
|
let
|
2024-04-30 23:00:19 +00:00
|
|
|
version = "9.1.1";
|
2024-01-23 19:22:18 +00:00
|
|
|
in
|
2024-04-30 23:00:19 +00:00
|
|
|
pkgs.rocksdb.overrideAttrs (old: {
|
|
|
|
inherit version;
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "rocksdb";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-/Xf0bzNJPclH9IP80QNaABfhj4IAR5LycYET18VFCXc=";
|
|
|
|
};
|
|
|
|
});
|
2023-12-24 05:12:42 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
shell = self.callPackage ./nix/shell.nix {};
|
2023-12-24 05:12:42 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
# The Rust toolchain to use
|
|
|
|
toolchain = inputs
|
|
|
|
.fenix
|
|
|
|
.packages
|
|
|
|
.${pkgs.pkgsBuildHost.system}
|
|
|
|
.fromToolchainFile {
|
|
|
|
file = ./rust-toolchain.toml;
|
2024-01-23 07:07:30 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
# See also `rust-toolchain.toml`
|
2024-06-21 07:29:33 +00:00
|
|
|
sha256 = "sha256-Ngiz76YP4HTY75GGdH2P+APE/DEIx2R/Dn+BwwOyzZU=";
|
2024-01-23 07:07:30 +00:00
|
|
|
};
|
2024-04-30 23:00:19 +00:00
|
|
|
});
|
2024-01-26 03:36:17 +00:00
|
|
|
in
|
2024-04-30 23:00:19 +00:00
|
|
|
inputs.flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
packages = {
|
|
|
|
default = (mkScope pkgs).default;
|
|
|
|
oci-image = (mkScope pkgs).oci-image;
|
|
|
|
book = (mkScope pkgs).book;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
builtins.listToAttrs
|
|
|
|
(builtins.concatLists
|
|
|
|
(builtins.map
|
|
|
|
(crossSystem:
|
|
|
|
let
|
|
|
|
binaryName = "static-${crossSystem}";
|
|
|
|
pkgsCrossStatic =
|
|
|
|
(import inputs.nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
crossSystem = {
|
|
|
|
config = crossSystem;
|
|
|
|
};
|
|
|
|
}).pkgsStatic;
|
|
|
|
in
|
|
|
|
[
|
|
|
|
# An output for a statically-linked binary
|
|
|
|
{
|
|
|
|
name = binaryName;
|
|
|
|
value = (mkScope pkgsCrossStatic).default;
|
|
|
|
}
|
|
|
|
|
|
|
|
# An output for an OCI image based on that binary
|
|
|
|
{
|
|
|
|
name = "oci-image-${crossSystem}";
|
|
|
|
value = (mkScope pkgsCrossStatic).oci-image;
|
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
2024-01-29 23:34:16 +00:00
|
|
|
[
|
2024-04-30 23:00:19 +00:00
|
|
|
"x86_64-unknown-linux-musl"
|
|
|
|
"aarch64-unknown-linux-musl"
|
2024-01-29 23:34:16 +00:00
|
|
|
]
|
|
|
|
)
|
2024-04-30 23:00:19 +00:00
|
|
|
);
|
2024-03-21 22:40:10 +00:00
|
|
|
|
2024-04-30 23:00:19 +00:00
|
|
|
devShells.default = (mkScope pkgs).shell;
|
|
|
|
}
|
|
|
|
);
|
2022-10-15 20:02:13 +00:00
|
|
|
}
|