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