mirror of https://gitlab.com/famedly/conduit
chore: format nix using alejandra
parent
3ad7675bbf
commit
88b24310b5
@ -1,10 +1,14 @@
|
|||||||
(import
|
(
|
||||||
|
import
|
||||||
(
|
(
|
||||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
let
|
||||||
fetchTarball {
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
in
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
fetchTarball {
|
||||||
}
|
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
)
|
)
|
||||||
{ src = ./.; }
|
{src = ./.;}
|
||||||
).defaultNix
|
)
|
||||||
|
.defaultNix
|
||||||
|
@ -1,100 +1,93 @@
|
|||||||
{ lib
|
{
|
||||||
, pkgsBuildHost
|
lib,
|
||||||
, rust
|
pkgsBuildHost,
|
||||||
, stdenv
|
rust,
|
||||||
|
stdenv,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalAttrs stdenv.hostPlatform.isStatic {
|
lib.optionalAttrs stdenv.hostPlatform.isStatic {
|
||||||
ROCKSDB_STATIC = "";
|
ROCKSDB_STATIC = "";
|
||||||
}
|
}
|
||||||
//
|
// {
|
||||||
{
|
|
||||||
CARGO_BUILD_RUSTFLAGS =
|
CARGO_BUILD_RUSTFLAGS =
|
||||||
lib.concatStringsSep
|
lib.concatStringsSep
|
||||||
" "
|
" "
|
||||||
([]
|
(
|
||||||
# This disables PIE for static builds, which isn't great in terms of
|
[]
|
||||||
# security. Unfortunately, my hand is forced because nixpkgs'
|
# This disables PIE for static builds, which isn't great in terms of
|
||||||
# `libstdc++.a` is built without `-fPIE`, which precludes us from
|
# security. Unfortunately, my hand is forced because nixpkgs'
|
||||||
# leaving PIE enabled.
|
# `libstdc++.a` is built without `-fPIE`, which precludes us from
|
||||||
++ lib.optionals
|
# leaving PIE enabled.
|
||||||
stdenv.hostPlatform.isStatic
|
++ lib.optionals
|
||||||
[ "-C" "relocation-model=static" ]
|
stdenv.hostPlatform.isStatic
|
||||||
++ lib.optionals
|
["-C" "relocation-model=static"]
|
||||||
(stdenv.buildPlatform.config != stdenv.hostPlatform.config)
|
++ lib.optionals
|
||||||
[ "-l" "c" ]
|
(stdenv.buildPlatform.config != stdenv.hostPlatform.config)
|
||||||
++ lib.optionals
|
["-l" "c"]
|
||||||
# This check has to match the one [here][0]. We only need to set
|
++ lib.optionals
|
||||||
# these flags when using a different linker. Don't ask me why, though,
|
# This check has to match the one [here][0]. We only need to set
|
||||||
# because I don't know. All I know is it breaks otherwise.
|
# these flags when using a different linker. Don't ask me why, though,
|
||||||
#
|
# because I don't know. All I know is it breaks otherwise.
|
||||||
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L37-L40
|
#
|
||||||
(
|
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L37-L40
|
||||||
# Nixpkgs doesn't check for x86_64 here but we do, because I
|
(
|
||||||
# observed a failure building statically for x86_64 without
|
# Nixpkgs doesn't check for x86_64 here but we do, because I
|
||||||
# including it here. Linkers are weird.
|
# observed a failure building statically for x86_64 without
|
||||||
(stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64)
|
# including it here. Linkers are weird.
|
||||||
&& stdenv.hostPlatform.isStatic
|
(stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64)
|
||||||
&& !stdenv.isDarwin
|
&& stdenv.hostPlatform.isStatic
|
||||||
&& !stdenv.cc.bintools.isLLVM
|
&& !stdenv.isDarwin
|
||||||
)
|
&& !stdenv.cc.bintools.isLLVM
|
||||||
[
|
)
|
||||||
"-l"
|
[
|
||||||
"stdc++"
|
"-l"
|
||||||
"-L"
|
"stdc++"
|
||||||
"${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 configure
|
# What follows is stolen from [here][0]. Its purpose is to properly configure
|
||||||
# compilers and linkers for various stages of the build, and even covers the
|
# compilers and linkers for various stages of the build, and even covers the
|
||||||
# case of build scripts that need native code compiled and run on the build
|
# case of build scripts that need native code compiled and run on the build
|
||||||
# platform (I think).
|
# platform (I think).
|
||||||
#
|
#
|
||||||
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L57-L80
|
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L57-L80
|
||||||
//
|
// (
|
||||||
(
|
|
||||||
let
|
let
|
||||||
inherit (rust.lib) envVars;
|
inherit (rust.lib) envVars;
|
||||||
in
|
in
|
||||||
lib.optionalAttrs
|
lib.optionalAttrs
|
||||||
(stdenv.targetPlatform.rust.rustcTarget
|
(stdenv.targetPlatform.rust.rustcTarget
|
||||||
!= stdenv.hostPlatform.rust.rustcTarget)
|
!= stdenv.hostPlatform.rust.rustcTarget)
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
|
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
"CC_${cargoEnvVarTarget}" = envVars.ccForTarget;
|
"CC_${cargoEnvVarTarget}" = envVars.ccForTarget;
|
||||||
"CXX_${cargoEnvVarTarget}" = envVars.cxxForTarget;
|
"CXX_${cargoEnvVarTarget}" = envVars.cxxForTarget;
|
||||||
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" =
|
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" =
|
||||||
envVars.linkerForTarget;
|
envVars.linkerForTarget;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
//
|
// (
|
||||||
(
|
let
|
||||||
let
|
inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget;
|
||||||
inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget;
|
in {
|
||||||
in
|
"CC_${cargoEnvVarTarget}" = envVars.ccForHost;
|
||||||
{
|
"CXX_${cargoEnvVarTarget}" = envVars.cxxForHost;
|
||||||
"CC_${cargoEnvVarTarget}" = envVars.ccForHost;
|
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForHost;
|
||||||
"CXX_${cargoEnvVarTarget}" = envVars.cxxForHost;
|
CARGO_BUILD_TARGET = rustcTarget;
|
||||||
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForHost;
|
}
|
||||||
CARGO_BUILD_TARGET = rustcTarget;
|
)
|
||||||
}
|
// (
|
||||||
)
|
let
|
||||||
//
|
inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget;
|
||||||
(
|
in {
|
||||||
let
|
"CC_${cargoEnvVarTarget}" = envVars.ccForBuild;
|
||||||
inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget;
|
"CXX_${cargoEnvVarTarget}" = envVars.cxxForBuild;
|
||||||
in
|
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForBuild;
|
||||||
{
|
HOST_CC = "${pkgsBuildHost.stdenv.cc}/bin/cc";
|
||||||
"CC_${cargoEnvVarTarget}" = envVars.ccForBuild;
|
HOST_CXX = "${pkgsBuildHost.stdenv.cc}/bin/c++";
|
||||||
"CXX_${cargoEnvVarTarget}" = envVars.cxxForBuild;
|
}
|
||||||
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForBuild;
|
)
|
||||||
HOST_CC = "${pkgsBuildHost.stdenv.cc}/bin/cc";
|
|
||||||
HOST_CXX = "${pkgsBuildHost.stdenv.cc}/bin/c++";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
@ -1,61 +1,69 @@
|
|||||||
# Keep sorted
|
# Keep sorted
|
||||||
{ cargo-deb
|
{
|
||||||
, default
|
alejandra,
|
||||||
, engage
|
cargo-deb,
|
||||||
, go
|
default,
|
||||||
, inputs
|
engage,
|
||||||
, jq
|
go,
|
||||||
, lychee
|
inputs,
|
||||||
, mdbook
|
jq,
|
||||||
, mkShell
|
lychee,
|
||||||
, olm
|
mdbook,
|
||||||
, system
|
mkShell,
|
||||||
, taplo
|
olm,
|
||||||
, toolchain
|
system,
|
||||||
|
taplo,
|
||||||
|
toolchain,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
mkShell {
|
mkShell {
|
||||||
env = default.env // {
|
env =
|
||||||
# Rust Analyzer needs to be able to find the path to default crate
|
default.env
|
||||||
# sources, and it can read this environment variable to do so. The
|
// {
|
||||||
# `rust-src` component is required in order for this to work.
|
# Rust Analyzer needs to be able to find the path to default crate
|
||||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
# sources, and it can read this environment variable to do so. The
|
||||||
};
|
# `rust-src` component is required in order for this to work.
|
||||||
|
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||||
|
};
|
||||||
|
|
||||||
# Development tools
|
# Development tools
|
||||||
nativeBuildInputs = default.nativeBuildInputs ++ [
|
nativeBuildInputs =
|
||||||
# Always use nightly rustfmt because most of its options are unstable
|
default.nativeBuildInputs
|
||||||
#
|
++ [
|
||||||
# This needs to come before `toolchain` in this list, otherwise
|
# Always use nightly rustfmt because most of its options are unstable
|
||||||
# `$PATH` will have stable rustfmt instead.
|
#
|
||||||
inputs.fenix.packages.${system}.latest.rustfmt
|
# This needs to come before `toolchain` in this list, otherwise
|
||||||
|
# `$PATH` will have stable rustfmt instead.
|
||||||
|
inputs.fenix.packages.${system}.latest.rustfmt
|
||||||
|
|
||||||
|
# rust itself
|
||||||
|
toolchain
|
||||||
|
|
||||||
# rust itself
|
# CI tests
|
||||||
toolchain
|
engage
|
||||||
|
|
||||||
# CI tests
|
# format toml files
|
||||||
engage
|
taplo
|
||||||
|
|
||||||
# format toml files
|
# Needed for producing Debian packages
|
||||||
taplo
|
cargo-deb
|
||||||
|
|
||||||
# Needed for producing Debian packages
|
# Needed for our script for Complement
|
||||||
cargo-deb
|
jq
|
||||||
|
|
||||||
# Needed for our script for Complement
|
# Needed for Complement
|
||||||
jq
|
go
|
||||||
|
olm
|
||||||
|
|
||||||
# Needed for Complement
|
# Needed for our script for Complement
|
||||||
go
|
jq
|
||||||
olm
|
|
||||||
|
|
||||||
# Needed for our script for Complement
|
# Needed for finding broken markdown links
|
||||||
jq
|
lychee
|
||||||
|
|
||||||
# Needed for finding broken markdown links
|
# Useful for editing the book locally
|
||||||
lychee
|
mdbook
|
||||||
|
|
||||||
# Useful for editing the book locally
|
# nix formatter
|
||||||
mdbook
|
alejandra
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue