Format all nix files with new nixfmt

This commit is contained in:
Vladislav Grechannik
2026-01-30 01:04:33 +01:00
committed by June Strawberry
parent dbc208d5d9
commit f2a15fda34
7 changed files with 819 additions and 728 deletions

View File

@@ -1,38 +1,35 @@
{ lib
, pkgsBuildHost
, rust
, stdenv
{
lib,
pkgsBuildHost,
rust,
stdenv,
}:
lib.optionalAttrs stdenv.hostPlatform.isStatic {
ROCKSDB_STATIC = "";
}
//
{
CARGO_BUILD_RUSTFLAGS =
lib.concatStringsSep
" "
([]
# This disables PIE for static builds, which isn't great in terms
# of security. Unfortunately, my hand is forced because nixpkgs'
# `libstdc++.a` is built without `-fPIE`, which precludes us from
# leaving PIE enabled.
++ lib.optionals
stdenv.hostPlatform.isStatic
[ "-C" "relocation-model=static" ]
++ lib.optionals
(stdenv.buildPlatform.config != stdenv.hostPlatform.config)
[
"-l"
"c"
// {
CARGO_BUILD_RUSTFLAGS = lib.concatStringsSep " " (
[ ]
# This disables PIE for static builds, which isn't great in terms
# of security. Unfortunately, my hand is forced because nixpkgs'
# `libstdc++.a` is built without `-fPIE`, which precludes us from
# leaving PIE enabled.
++ lib.optionals stdenv.hostPlatform.isStatic [
"-C"
"relocation-model=static"
]
++ lib.optionals (stdenv.buildPlatform.config != stdenv.hostPlatform.config) [
"-l"
"c"
"-l"
"stdc++"
"-l"
"stdc++"
"-L"
"${stdenv.cc.cc.lib}/${stdenv.hostPlatform.config}/lib"
]
);
"-L"
"${stdenv.cc.cc.lib}/${stdenv.hostPlatform.config}/lib"
]
);
}
# What follows is stolen from [here][0]. Its purpose is to properly
@@ -41,26 +38,21 @@ lib.optionalAttrs stdenv.hostPlatform.isStatic {
# run on the build platform (I think).
#
# [0]: https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/build-support/rust/lib/default.nix#L48-L68
//
(
// (
let
inherit (rust.lib) envVars;
in
lib.optionalAttrs
(stdenv.targetPlatform.rust.rustcTarget
!= stdenv.hostPlatform.rust.rustcTarget)
(
let
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
in
{
"CC_${cargoEnvVarTarget}" = envVars.ccForTarget;
"CXX_${cargoEnvVarTarget}" = envVars.cxxForTarget;
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.ccForTarget;
}
)
//
(
lib.optionalAttrs (stdenv.targetPlatform.rust.rustcTarget != stdenv.hostPlatform.rust.rustcTarget) (
let
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
in
{
"CC_${cargoEnvVarTarget}" = envVars.ccForTarget;
"CXX_${cargoEnvVarTarget}" = envVars.cxxForTarget;
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.ccForTarget;
}
)
// (
let
inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget;
in
@@ -71,8 +63,7 @@ lib.optionalAttrs stdenv.hostPlatform.isStatic {
CARGO_BUILD_TARGET = rustcTarget;
}
)
//
(
// (
let
inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget;
in