mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
always go through inputs
This way we don't have to modify the destructuring of `outputs`' argument when adding or removing inputs.
This commit is contained in:
parent
238bc85b1d
commit
8d8d4425f3
1 changed files with 11 additions and 19 deletions
30
flake.nix
30
flake.nix
|
|
@ -10,24 +10,15 @@
|
|||
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, flake-utils
|
||||
, nix-filter
|
||||
|
||||
, fenix
|
||||
, crane
|
||||
, ...
|
||||
}: flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgsHost = nixpkgs.legacyPackages.${system};
|
||||
pkgsHost = inputs.nixpkgs.legacyPackages.${system};
|
||||
|
||||
# Nix-accessible `Cargo.toml`
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||
|
||||
# The Rust toolchain to use
|
||||
toolchain = fenix.packages.${system}.fromToolchainFile {
|
||||
toolchain = inputs.fenix.packages.${system}.fromToolchainFile {
|
||||
file = ./rust-toolchain.toml;
|
||||
|
||||
# See also `rust-toolchain.toml`
|
||||
|
|
@ -35,7 +26,7 @@
|
|||
};
|
||||
|
||||
builder = pkgs:
|
||||
((crane.mkLib pkgs).overrideToolchain toolchain).buildPackage;
|
||||
((inputs.crane.mkLib pkgs).overrideToolchain toolchain).buildPackage;
|
||||
|
||||
nativeBuildInputs = pkgs: [
|
||||
# bindgen needs the build platform's libclang. Apparently due to
|
||||
|
|
@ -59,7 +50,8 @@
|
|||
});
|
||||
|
||||
env = pkgs: {
|
||||
GRAPEVINE_VERSION_EXTRA = self.shortRev or self.dirtyShortRev;
|
||||
GRAPEVINE_VERSION_EXTRA =
|
||||
inputs.self.shortRev or inputs.self.dirtyShortRev;
|
||||
ROCKSDB_INCLUDE_DIR = "${rocksdb' pkgs}/include";
|
||||
ROCKSDB_LIB_DIR = "${rocksdb' pkgs}/lib";
|
||||
}
|
||||
|
|
@ -152,7 +144,7 @@
|
|||
));
|
||||
|
||||
package = pkgs: builder pkgs {
|
||||
src = nix-filter {
|
||||
src = inputs.nix-filter {
|
||||
root = ./.;
|
||||
include = [
|
||||
"src"
|
||||
|
|
@ -193,7 +185,7 @@
|
|||
{
|
||||
packages = {
|
||||
default = package pkgsHost;
|
||||
oci-image = mkOciImage pkgsHost self.packages.${system}.default;
|
||||
oci-image = mkOciImage pkgsHost inputs.self.packages.${system}.default;
|
||||
}
|
||||
//
|
||||
builtins.listToAttrs
|
||||
|
|
@ -203,7 +195,7 @@
|
|||
let
|
||||
binaryName = "static-${crossSystem}";
|
||||
pkgsCrossStatic =
|
||||
(import nixpkgs {
|
||||
(import inputs.nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = {
|
||||
config = crossSystem;
|
||||
|
|
@ -222,7 +214,7 @@
|
|||
name = "oci-image-${crossSystem}";
|
||||
value = mkOciImage
|
||||
pkgsCrossStatic
|
||||
self.packages.${system}.${binaryName};
|
||||
inputs.self.packages.${system}.${binaryName};
|
||||
}
|
||||
]
|
||||
)
|
||||
|
|
@ -247,7 +239,7 @@
|
|||
#
|
||||
# This needs to come before `toolchain` in this list, otherwise
|
||||
# `$PATH` will have stable rustfmt instead.
|
||||
fenix.packages.${system}.latest.rustfmt
|
||||
inputs.fenix.packages.${system}.latest.rustfmt
|
||||
|
||||
toolchain
|
||||
] ++ (with pkgsHost; [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue