always go through inputs

This commit is contained in:
Charles Hall 2024-04-21 15:33:54 -07:00 committed by June
parent 5476a36a0b
commit 36774322e1

View file

@ -11,18 +11,10 @@
rocksdb = { url = "github:facebook/rocksdb?ref=v9.1.0"; flake = false; }; rocksdb = { url = "github:facebook/rocksdb?ref=v9.1.0"; flake = false; };
}; };
outputs = outputs = inputs:
{ self inputs.flake-utils.lib.eachDefaultSystem (system:
, nixpkgs
, flake-utils
, nix-filter
, fenix
, crane
, ...
}: flake-utils.lib.eachDefaultSystem (system:
let let
pkgsHost = nixpkgs.legacyPackages.${system}; pkgsHost = inputs.nixpkgs.legacyPackages.${system};
rocksdb' = pkgs: (pkgs.rocksdb.overrideAttrs (old: { rocksdb' = pkgs: (pkgs.rocksdb.overrideAttrs (old: {
version = "9.1.0"; version = "9.1.0";
@ -33,7 +25,7 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
# The Rust toolchain to use # The Rust toolchain to use
toolchain = fenix.packages.${system}.fromToolchainFile { toolchain = inputs.fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml; file = ./rust-toolchain.toml;
# See also `rust-toolchain.toml` # See also `rust-toolchain.toml`
@ -41,7 +33,7 @@
}; };
builder = pkgs: builder = pkgs:
((crane.mkLib pkgs).overrideToolchain toolchain).buildPackage; ((inputs.crane.mkLib pkgs).overrideToolchain toolchain).buildPackage;
nativeBuildInputs = pkgs: let nativeBuildInputs = pkgs: let
darwin = if pkgs.stdenv.isDarwin then [ pkgs.libiconv ] else []; darwin = if pkgs.stdenv.isDarwin then [ pkgs.libiconv ] else [];
@ -53,7 +45,7 @@
] ++ darwin; ] ++ darwin;
env = pkgs: { env = pkgs: {
CONDUIT_VERSION_EXTRA = self.shortRev or self.dirtyShortRev; CONDUIT_VERSION_EXTRA = inputs.self.shortRev or inputs.self.dirtyShortRev;
ROCKSDB_INCLUDE_DIR = "${rocksdb' pkgs}/include"; ROCKSDB_INCLUDE_DIR = "${rocksdb' pkgs}/include";
ROCKSDB_LIB_DIR = "${rocksdb' pkgs}/lib"; ROCKSDB_LIB_DIR = "${rocksdb' pkgs}/lib";
} }
@ -147,7 +139,7 @@
); );
mkPackage = pkgs: allocator: cargoArgs: profile: builder pkgs { mkPackage = pkgs: allocator: cargoArgs: profile: builder pkgs {
src = nix-filter { src = inputs.nix-filter {
root = ./.; root = ./.;
include = [ include = [
"src" "src"
@ -179,7 +171,7 @@
name = package.pname; name = package.pname;
tag = "main"; tag = "main";
# Debian makes builds reproducible through using the HEAD commit's date # Debian makes builds reproducible through using the HEAD commit's date
created = "@${toString self.lastModified}"; created = "@${toString inputs.self.lastModified}";
contents = [ contents = [
pkgs.dockerTools.caCertificates pkgs.dockerTools.caCertificates
]; ];
@ -227,7 +219,7 @@
copyToRoot = pkgs.stdenv.mkDerivation { copyToRoot = pkgs.stdenv.mkDerivation {
name = "complement_data"; name = "complement_data";
src = nix-filter { src = inputs.nix-filter {
root = ./.; root = ./.;
include = [ include = [
"tests/complement/conduwuit-complement.toml" "tests/complement/conduwuit-complement.toml"
@ -284,19 +276,21 @@
default = mkPackage pkgsHost null "" "release"; default = mkPackage pkgsHost null "" "release";
jemalloc = mkPackage pkgsHost "jemalloc" "" "release"; jemalloc = mkPackage pkgsHost "jemalloc" "" "release";
hmalloc = mkPackage pkgsHost "hmalloc" "" "release"; hmalloc = mkPackage pkgsHost "hmalloc" "" "release";
oci-image = mkOciImage pkgsHost self.packages.${system}.default; oci-image = mkOciImage pkgsHost inputs.self.packages.${system}.default;
oci-image-jemalloc = mkOciImage pkgsHost self.packages.${system}.jemalloc; oci-image-jemalloc =
oci-image-hmalloc = mkOciImage pkgsHost self.packages.${system}.hmalloc; mkOciImage pkgsHost inputs.self.packages.${system}.jemalloc;
oci-image-hmalloc =
mkOciImage pkgsHost inputs.self.packages.${system}.hmalloc;
book = book =
let let
package = self.packages.${system}.default; package = inputs.self.packages.${system}.default;
in in
pkgsHost.stdenv.mkDerivation { pkgsHost.stdenv.mkDerivation {
pname = "${package.pname}-book"; pname = "${package.pname}-book";
version = package.version; version = package.version;
src = nix-filter { src = inputs.nix-filter {
root = ./.; root = ./.;
include = [ include = [
"book.toml" "book.toml"
@ -317,7 +311,7 @@
''; '';
}; };
complement-image = createComplementImage pkgsHost; complement-image = createComplementImage pkgsHost;
complement-runtime = createComplementRuntime pkgsHost self.outputs.packages.${system}.complement-image; complement-runtime = createComplementRuntime pkgsHost inputs.self.outputs.packages.${system}.complement-image;
} }
// //
builtins.listToAttrs builtins.listToAttrs
@ -327,7 +321,7 @@
let let
binaryName = "static-${crossSystem}"; binaryName = "static-${crossSystem}";
pkgsCrossStatic = pkgsCrossStatic =
(import nixpkgs { (import inputs.nixpkgs {
inherit system; inherit system;
crossSystem = { crossSystem = {
config = crossSystem; config = crossSystem;
@ -358,7 +352,7 @@
name = "oci-image-${crossSystem}"; name = "oci-image-${crossSystem}";
value = mkOciImage value = mkOciImage
pkgsCrossStatic pkgsCrossStatic
self.packages.${system}.${binaryName}; inputs.self.packages.${system}.${binaryName};
} }
# An output for an OCI image based on that binary with jemalloc # An output for an OCI image based on that binary with jemalloc
@ -366,7 +360,7 @@
name = "oci-image-${crossSystem}-jemalloc"; name = "oci-image-${crossSystem}-jemalloc";
value = mkOciImage value = mkOciImage
pkgsCrossStatic pkgsCrossStatic
self.packages.${system}."${binaryName}-jemalloc"; inputs.self.packages.${system}."${binaryName}-jemalloc";
} }
# An output for an OCI image based on that binary with hardened_malloc # An output for an OCI image based on that binary with hardened_malloc
@ -374,7 +368,7 @@
name = "oci-image-${crossSystem}-hmalloc"; name = "oci-image-${crossSystem}-hmalloc";
value = mkOciImage value = mkOciImage
pkgsCrossStatic pkgsCrossStatic
self.packages.${system}."${binaryName}-hmalloc"; inputs.self.packages.${system}."${binaryName}-hmalloc";
} }
] ]
) )
@ -399,7 +393,7 @@
# #
# This needs to come before `toolchain` in this list, otherwise # This needs to come before `toolchain` in this list, otherwise
# `$PATH` will have stable rustfmt instead. # `$PATH` will have stable rustfmt instead.
fenix.packages.${system}.latest.rustfmt inputs.fenix.packages.${system}.latest.rustfmt
toolchain toolchain
] ++ (with pkgsHost; [ ] ++ (with pkgsHost; [