2022-10-15 22:02:13 +02:00
|
|
|
{
|
2023-04-05 01:56:51 +02:00
|
|
|
inputs = {
|
2023-06-18 02:02:10 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
2023-04-05 01:56:51 +02:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2024-01-18 22:05:55 +01:00
|
|
|
nix-filter.url = "github:numtide/nix-filter";
|
2024-02-02 03:50:49 +01:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-04-05 01:56:51 +02:00
|
|
|
|
|
|
|
fenix = {
|
|
|
|
url = "github:nix-community/fenix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-04-05 02:30:30 +02:00
|
|
|
crane = {
|
2024-04-21 21:31:49 +02:00
|
|
|
url = "github:ipetkov/crane?ref=master";
|
2023-04-05 01:56:51 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-01-27 22:10:21 +01:00
|
|
|
};
|
2024-01-25 20:34:46 +01:00
|
|
|
attic.url = "github:zhaofengli/attic?ref=main";
|
2023-04-05 01:56:51 +02:00
|
|
|
};
|
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
outputs = inputs:
|
2023-04-05 01:56:51 +02:00
|
|
|
let
|
2024-05-01 01:00:19 +02:00
|
|
|
# Keep sorted
|
|
|
|
mkScope = pkgs: pkgs.lib.makeScope pkgs.newScope (self: {
|
|
|
|
craneLib =
|
|
|
|
(inputs.crane.mkLib pkgs).overrideToolchain self.toolchain;
|
2023-04-05 01:56:51 +02:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
default = self.callPackage ./nix/pkgs/default {};
|
2023-04-05 01:56:51 +02:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
inherit inputs;
|
2023-04-05 01:56:51 +02:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
oci-image = self.callPackage ./nix/pkgs/oci-image {};
|
2023-04-05 01:56:51 +02:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
book = self.callPackage ./nix/pkgs/book {};
|
2023-07-16 22:38:33 +02:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
rocksdb =
|
2024-01-23 20:22:18 +01:00
|
|
|
let
|
2024-05-01 01:00:19 +02:00
|
|
|
version = "9.1.1";
|
2024-01-23 20:22:18 +01:00
|
|
|
in
|
2024-05-01 01:00:19 +02:00
|
|
|
pkgs.rocksdb.overrideAttrs (old: {
|
|
|
|
inherit version;
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "rocksdb";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-/Xf0bzNJPclH9IP80QNaABfhj4IAR5LycYET18VFCXc=";
|
|
|
|
};
|
|
|
|
});
|
2023-12-24 06:12:42 +01:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
shell = self.callPackage ./nix/shell.nix {};
|
2023-12-24 06:12:42 +01:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
# The Rust toolchain to use
|
|
|
|
toolchain = inputs
|
|
|
|
.fenix
|
|
|
|
.packages
|
|
|
|
.${pkgs.pkgsBuildHost.system}
|
|
|
|
.fromToolchainFile {
|
|
|
|
file = ./rust-toolchain.toml;
|
2024-01-23 08:07:30 +01:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
# See also `rust-toolchain.toml`
|
|
|
|
sha256 = "sha256-SXRtAuO4IqNOQq+nLbrsDFbVk+3aVA8NNpSZsKlVH/8=";
|
2024-01-23 08:07:30 +01:00
|
|
|
};
|
2024-05-01 01:00:19 +02:00
|
|
|
});
|
2024-01-26 04:36:17 +01:00
|
|
|
in
|
2024-05-01 01:00:19 +02: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-30 00:34:16 +01:00
|
|
|
[
|
2024-05-01 01:00:19 +02:00
|
|
|
"x86_64-unknown-linux-musl"
|
|
|
|
"aarch64-unknown-linux-musl"
|
2024-01-30 00:34:16 +01:00
|
|
|
]
|
|
|
|
)
|
2024-05-01 01:00:19 +02:00
|
|
|
);
|
2024-03-21 23:40:10 +01:00
|
|
|
|
2024-05-01 01:00:19 +02:00
|
|
|
devShells.default = (mkScope pkgs).shell;
|
|
|
|
}
|
|
|
|
);
|
2022-10-15 22:02:13 +02:00
|
|
|
}
|