Merge pull request #85 from DeterminateSystems/grahamc/colemickens/axum-0.7
Grahamc/colemickens/axum 0.7
This commit is contained in:
commit
1f386d2aac
1473
Cargo.lock
generated
1473
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
122
crane.nix
122
crane.nix
|
@ -1,122 +0,0 @@
|
||||||
{ stdenv
|
|
||||||
, pkgs
|
|
||||||
, lib
|
|
||||||
, crane
|
|
||||||
, rust
|
|
||||||
, rust-bin
|
|
||||||
, nix-gitignore
|
|
||||||
, supportedSystems
|
|
||||||
, nix-flake
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (stdenv.hostPlatform) system;
|
|
||||||
|
|
||||||
nightlyVersion = "2024-03-28";
|
|
||||||
rustNightly = (pkgs.rust-bin.nightly.${nightlyVersion}.default.override {
|
|
||||||
extensions = [ "rust-src" "rust-analyzer-preview" ];
|
|
||||||
targets = cargoTargets;
|
|
||||||
}).overrideAttrs (old: {
|
|
||||||
# Remove the propagated libiconv since we want to add our static version
|
|
||||||
depsTargetTargetPropagated = lib.filter (d: d.pname != "libiconv")
|
|
||||||
(lib.flatten (old.depsTargetTargetPropagated or [ ]));
|
|
||||||
});
|
|
||||||
|
|
||||||
# For easy cross-compilation in devShells
|
|
||||||
# We are just composing the pkgsCross.*.stdenv.cc together
|
|
||||||
crossPlatforms =
|
|
||||||
let
|
|
||||||
makeCrossPlatform = crossSystem:
|
|
||||||
let
|
|
||||||
pkgsCross =
|
|
||||||
if crossSystem == system then pkgs
|
|
||||||
else
|
|
||||||
import pkgs.path {
|
|
||||||
inherit system crossSystem;
|
|
||||||
overlays = [ nix-flake.overlays.default ];
|
|
||||||
};
|
|
||||||
|
|
||||||
rustTargetSpec = rust.toRustTargetSpec pkgsCross.pkgsStatic.stdenv.hostPlatform;
|
|
||||||
rustTargetSpecUnderscored = builtins.replaceStrings [ "-" ] [ "_" ] rustTargetSpec;
|
|
||||||
|
|
||||||
cargoLinkerEnv = lib.strings.toUpper "CARGO_TARGET_${rustTargetSpecUnderscored}_LINKER";
|
|
||||||
cargoCcEnv = "CC_${rustTargetSpecUnderscored}"; # for ring
|
|
||||||
|
|
||||||
ccbin = "${pkgsCross.stdenv.cc}/bin/${pkgsCross.stdenv.cc.targetPrefix}cc";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
name = crossSystem;
|
|
||||||
value = {
|
|
||||||
inherit rustTargetSpec;
|
|
||||||
cc = pkgsCross.stdenv.cc;
|
|
||||||
pkgs = pkgsCross;
|
|
||||||
buildInputs = makeBuildInputs pkgsCross;
|
|
||||||
env = {
|
|
||||||
"${cargoLinkerEnv}" = ccbin;
|
|
||||||
"${cargoCcEnv}" = ccbin;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
systems = lib.filter (s: s == system || lib.hasInfix "linux" s) supportedSystems
|
|
||||||
# Cross from aarch64-darwin -> x86_64-darwin doesn't work yet
|
|
||||||
# Hopefully the situation will improve with the SDK bumps
|
|
||||||
++ lib.optional (system == "x86_64-darwin") "aarch64-darwin";
|
|
||||||
in
|
|
||||||
builtins.listToAttrs (map makeCrossPlatform systems);
|
|
||||||
|
|
||||||
cargoTargets = lib.mapAttrsToList (_: p: p.rustTargetSpec) crossPlatforms;
|
|
||||||
cargoCrossEnvs = lib.foldl (acc: p: acc // p.env) { } (builtins.attrValues crossPlatforms);
|
|
||||||
|
|
||||||
makeBuildInputs = pkgs:
|
|
||||||
[ pkgs.nix
|
|
||||||
pkgs.boost # needed for clippy
|
|
||||||
]
|
|
||||||
++ lib.optionals pkgs.stdenv.isDarwin [
|
|
||||||
pkgs.darwin.apple_sdk.frameworks.Security
|
|
||||||
(pkgs.libiconv.override { enableStatic = true; enableShared = false; })
|
|
||||||
];
|
|
||||||
|
|
||||||
buildFor = system:
|
|
||||||
let
|
|
||||||
crossPlatform = crossPlatforms.${system};
|
|
||||||
inherit (crossPlatform) pkgs;
|
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain rustNightly;
|
|
||||||
crateName = craneLib.crateNameFromCargoToml {
|
|
||||||
cargoToml = ./magic-nix-cache/Cargo.toml;
|
|
||||||
};
|
|
||||||
|
|
||||||
src = nix-gitignore.gitignoreSource [ ] ./.;
|
|
||||||
|
|
||||||
commonArgs = {
|
|
||||||
inherit (crateName) pname version;
|
|
||||||
inherit src;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
|
||||||
|
|
||||||
buildInputs = makeBuildInputs pkgs;
|
|
||||||
|
|
||||||
cargoExtraArgs = "--target ${crossPlatform.rustTargetSpec}";
|
|
||||||
|
|
||||||
cargoVendorDir = craneLib.vendorMultipleCargoDeps {
|
|
||||||
inherit (craneLib.findCargoFiles src) cargoConfigs;
|
|
||||||
cargoLockList = [
|
|
||||||
./Cargo.lock
|
|
||||||
"${rustNightly.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/Cargo.lock"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
} // crossPlatform.env;
|
|
||||||
|
|
||||||
crate = craneLib.buildPackage (commonArgs // {
|
|
||||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
||||||
|
|
||||||
# The resulting executable must be standalone
|
|
||||||
allowedRequisites = [ ];
|
|
||||||
});
|
|
||||||
in
|
|
||||||
crate;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit crossPlatforms cargoTargets cargoCrossEnvs rustNightly;
|
|
||||||
|
|
||||||
magic-nix-cache = buildFor system;
|
|
||||||
}
|
|
102
flake.lock
102
flake.lock
|
@ -1,22 +1,23 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"fenix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714842444,
|
"lastModified": 1722493751,
|
||||||
"narHash": "sha256-z4HeSYtEdYxKurrbxCMb8v/I1LYDHR/aFrZtGtgUgHw=",
|
"narHash": "sha256-l7/yMehbrL5d4AI8E2hKtNlT50BlUAau4EKTgPg9KcY=",
|
||||||
"rev": "c5ee4371eea1728ef04bb09c79577c84d5e67a48",
|
"rev": "60ab4a085ef6ee40f2ef7921ca4061084dd8cf26",
|
||||||
"revCount": 557,
|
"revCount": 1955,
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.16.6/018f4495-627e-7385-b537-81f1c1d4003b/source.tar.gz"
|
"url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1955%2Brev-60ab4a085ef6ee40f2ef7921ca4061084dd8cf26/01910d03-2462-7e48-b72e-439d1152bd11/source.tar.gz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://flakehub.com/f/ipetkov/crane/0.16.3.tar.gz"
|
"url": "https://flakehub.com/f/nix-community/fenix/0.1.1584.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
|
@ -85,24 +86,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705309234,
|
|
||||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libgit2": {
|
"libgit2": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -119,6 +102,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"naersk": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1721727458,
|
||||||
|
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "naersk",
|
||||||
|
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "naersk",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix": {
|
"nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
|
@ -138,7 +141,7 @@
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://flakehub.com/f/NixOS/nix/2.20.tar.gz"
|
"url": "https://flakehub.com/f/NixOS/nix/~2.22.1.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
@ -221,46 +224,27 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"fenix": "fenix",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
"naersk": "naersk",
|
||||||
"nix": "nix",
|
"nix": "nix",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2"
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-analyzer-src": {
|
||||||
"inputs": {
|
"flake": false,
|
||||||
"flake-utils": "flake-utils_2",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1716862669,
|
"lastModified": 1722449213,
|
||||||
"narHash": "sha256-7oTPM9lcdwiI1cpRC313B+lHawocgpY5F07N+Rbm5Uk=",
|
"narHash": "sha256-1na4m2PNH99syz2g/WQ+Hr3RfY7k4H8NBnmkr5dFDXw=",
|
||||||
"owner": "oxalica",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-analyzer",
|
||||||
"rev": "47b2d15658b37716393b2463a019000dbd6ce4bc",
|
"rev": "c8e41d95061543715b30880932ec3dc24c42d7ae",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "oxalica",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-overlay",
|
"ref": "nightly",
|
||||||
"type": "github"
|
"repo": "rust-analyzer",
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
194
flake.nix
194
flake.nix
|
@ -4,45 +4,81 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.tar.gz";
|
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.tar.gz";
|
||||||
|
|
||||||
rust-overlay = {
|
fenix = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "https://flakehub.com/f/nix-community/fenix/0.1.1584.tar.gz";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
crane = {
|
naersk = {
|
||||||
url = "https://flakehub.com/f/ipetkov/crane/0.16.3.tar.gz";
|
url = "github:nix-community/naersk";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.0.1.tar.gz";
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.0.1.tar.gz";
|
||||||
|
|
||||||
nix.url = "https://flakehub.com/f/NixOS/nix/2.20.tar.gz";
|
nix.url = "https://flakehub.com/f/NixOS/nix/~2.22.1.tar.gz";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nix, ... }@inputs:
|
outputs = { self, nixpkgs, fenix, naersk, nix, ... }@inputs:
|
||||||
let
|
let
|
||||||
overlays = [ inputs.rust-overlay.overlays.default nix.overlays.default ];
|
|
||||||
supportedSystems = [
|
supportedSystems = [
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-darwin"
|
"aarch64-darwin"
|
||||||
"x86_64-darwin"
|
"x86_64-darwin"
|
||||||
];
|
];
|
||||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
|
|
||||||
pkgs = import nixpkgs { inherit overlays system; };
|
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: (forSystem system f));
|
||||||
cranePkgs = pkgs.callPackage ./crane.nix {
|
|
||||||
inherit supportedSystems;
|
forSystem = system: f: f rec {
|
||||||
inherit (inputs) crane;
|
inherit system;
|
||||||
nix-flake = nix;
|
pkgs = import nixpkgs { inherit system; overlays = [ /* self.overlays.default */ nix.overlays.default ]; };
|
||||||
|
lib = pkgs.lib;
|
||||||
};
|
};
|
||||||
inherit (pkgs) lib;
|
|
||||||
});
|
fenixToolchain = system: with fenix.packages.${system};
|
||||||
|
combine ([
|
||||||
|
stable.clippy
|
||||||
|
stable.rustc
|
||||||
|
stable.cargo
|
||||||
|
stable.rustfmt
|
||||||
|
stable.rust-src
|
||||||
|
] ++ nixpkgs.lib.optionals (system == "x86_64-linux") [
|
||||||
|
targets.x86_64-unknown-linux-musl.stable.rust-std
|
||||||
|
] ++ nixpkgs.lib.optionals (system == "aarch64-linux") [
|
||||||
|
targets.aarch64-unknown-linux-musl.stable.rust-std
|
||||||
|
]);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = forEachSupportedSystem ({ pkgs, cranePkgs, ... }: rec {
|
packages = forAllSystems ({ lib, system, pkgs, ... }: let
|
||||||
magic-nix-cache = pkgs.callPackage ./package.nix { };
|
toolchain = fenixToolchain pkgs.stdenv.system;
|
||||||
#inherit (cranePkgs) magic-nix-cache;
|
naerskLib = pkgs.callPackage naersk {
|
||||||
default = magic-nix-cache;
|
cargo = toolchain;
|
||||||
|
rustc = toolchain;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
magic-nix-cache = naerskLib.buildPackage {
|
||||||
|
pname = "magic-nix-cache";
|
||||||
|
version = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package.version;
|
||||||
|
src = builtins.path {
|
||||||
|
name = "magic-nix-cache-source";
|
||||||
|
path = self;
|
||||||
|
filter = (path: type: baseNameOf path != "nix" && baseNameOf path != ".github");
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||||
|
buildInputs = [ pkgs.nix
|
||||||
|
pkgs.boost # needed for clippy
|
||||||
|
]
|
||||||
|
++ lib.optionals pkgs.stdenv.isDarwin [
|
||||||
|
pkgs.darwin.apple_sdk.frameworks.Security
|
||||||
|
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
(pkgs.libiconv.override { enableStatic = true; enableShared = false; })
|
||||||
|
];
|
||||||
|
|
||||||
|
NIX_CFLAGS_LINK = lib.optionalString pkgs.stdenv.isDarwin "-lc++abi";
|
||||||
|
};
|
||||||
|
default = self.packages.${system}.magic-nix-cache;
|
||||||
|
|
||||||
veryLongChain =
|
veryLongChain =
|
||||||
let
|
let
|
||||||
|
@ -74,124 +110,12 @@
|
||||||
# Starting point of the chain
|
# Starting point of the chain
|
||||||
createChain 200 startFile;
|
createChain 200 startFile;
|
||||||
});
|
});
|
||||||
|
devShells = forAllSystems ({ lib, system, pkgs, ... }: let
|
||||||
devShells = forEachSupportedSystem ({ pkgs, cranePkgs, lib }: {
|
pkg = self.packages.${system}.default;
|
||||||
|
in {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
inputsFrom = [ cranePkgs.magic-nix-cache ];
|
inherit (pkg) buildInputs nativeBuildInputs NIX_CFLAGS_LINK;
|
||||||
packages = with pkgs; [
|
|
||||||
bashInteractive
|
|
||||||
cranePkgs.rustNightly
|
|
||||||
pkg-config
|
|
||||||
|
|
||||||
cargo-bloat
|
|
||||||
cargo-edit
|
|
||||||
cargo-udeps
|
|
||||||
cargo-watch
|
|
||||||
bacon
|
|
||||||
|
|
||||||
age
|
|
||||||
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
|
|
||||||
SystemConfiguration
|
|
||||||
]);
|
|
||||||
|
|
||||||
NIX_CFLAGS_LINK = lib.optionalString pkgs.stdenv.isDarwin "-lc++abi";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
cross = pkgs.mkShell ({
|
|
||||||
inputsFrom = [ cranePkgs.magic-nix-cache ];
|
|
||||||
packages = with pkgs; [
|
|
||||||
bashInteractive
|
|
||||||
cranePkgs.rustNightly
|
|
||||||
|
|
||||||
cargo-bloat
|
|
||||||
cargo-edit
|
|
||||||
cargo-udeps
|
|
||||||
cargo-watch
|
|
||||||
|
|
||||||
age
|
|
||||||
];
|
|
||||||
shellHook =
|
|
||||||
let
|
|
||||||
crossSystems = lib.filter (s: s != pkgs.system) (builtins.attrNames cranePkgs.crossPlatforms);
|
|
||||||
in
|
|
||||||
''
|
|
||||||
# Returns compiler environment variables for a platform
|
|
||||||
#
|
|
||||||
# getTargetFlags "suffixSalt" "nativeBuildInputs" "buildInputs"
|
|
||||||
getTargetFlags() {
|
|
||||||
# Here we only call the setup-hooks of nativeBuildInputs.
|
|
||||||
#
|
|
||||||
# What's off-limits for us:
|
|
||||||
#
|
|
||||||
# - findInputs
|
|
||||||
# - activatePackage
|
|
||||||
# - Other functions in stdenv setup that depend on the private accumulator variables
|
|
||||||
(
|
|
||||||
suffixSalt="$1"
|
|
||||||
nativeBuildInputs="$2"
|
|
||||||
buildInputs="$3"
|
|
||||||
|
|
||||||
# Offsets for the nativeBuildInput (e.g., gcc)
|
|
||||||
hostOffset=-1
|
|
||||||
targetOffset=0
|
|
||||||
|
|
||||||
# In stdenv, the hooks are first accumulated before being called.
|
|
||||||
# Here we call them immediately
|
|
||||||
addEnvHooks() {
|
|
||||||
local depHostOffset="$1"
|
|
||||||
# For simplicity, we only call the hook on buildInputs
|
|
||||||
for pkg in $buildInputs; do
|
|
||||||
depTargetOffset=1
|
|
||||||
$2 $pkg
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
unset _PATH
|
|
||||||
unset NIX_CFLAGS_COMPILE
|
|
||||||
unset NIX_LDFLAGS
|
|
||||||
|
|
||||||
# For simplicity, we only call the setup-hooks of nativeBuildInputs
|
|
||||||
for nbi in $nativeBuildInputs; do
|
|
||||||
addToSearchPath _PATH "$nbi/bin"
|
|
||||||
|
|
||||||
if [ -e "$nbi/nix-support/setup-hook" ]; then
|
|
||||||
source "$nbi/nix-support/setup-hook"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "export NIX_CFLAGS_COMPILE_''${suffixSalt}='$NIX_CFLAGS_COMPILE'"
|
|
||||||
echo "export NIX_LDFLAGS_''${suffixSalt}='$NIX_LDFLAGS'"
|
|
||||||
echo "export PATH=$PATH''${_PATH+:$_PATH}"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
target_flags=$(mktemp)
|
|
||||||
${lib.concatMapStrings (system: let
|
|
||||||
crossPlatform = cranePkgs.crossPlatforms.${system};
|
|
||||||
in ''
|
|
||||||
getTargetFlags \
|
|
||||||
"${crossPlatform.cc.suffixSalt}" \
|
|
||||||
"${crossPlatform.cc} ${crossPlatform.cc.bintools}" \
|
|
||||||
"${builtins.concatStringsSep " " (crossPlatform.buildInputs ++ crossPlatform.pkgs.stdenv.defaultBuildInputs)}" >$target_flags
|
|
||||||
. $target_flags
|
|
||||||
'') crossSystems}
|
|
||||||
rm $target_flags
|
|
||||||
|
|
||||||
# Suffix flags for current system as well
|
|
||||||
export NIX_CFLAGS_COMPILE_${pkgs.stdenv.cc.suffixSalt}="$NIX_CFLAGS_COMPILE"
|
|
||||||
export NIX_LDFLAGS_${pkgs.stdenv.cc.suffixSalt}="$NIX_LDFLAGS"
|
|
||||||
unset NIX_CFLAGS_COMPILE
|
|
||||||
unset NIX_LDFLAGS
|
|
||||||
'';
|
|
||||||
} // cranePkgs.cargoCrossEnvs);
|
|
||||||
|
|
||||||
keygen = pkgs.mkShellNoCC {
|
|
||||||
packages = with pkgs; [
|
|
||||||
age
|
|
||||||
];
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue