nix-ld
nix-ld copied to clipboard
Failed to build as part of system flake
I'm attempting to use nix-ld in my system, I have added it to my flake as described in the readme:
flake.nix
inputs = {
...
nixpkgs-for-nix-ld.url = "github:NixOS/nixpkgs/20f77aa09916374aa3141cbc605c955626762c9a";
nix-ld = {
url = "github:Mic92/nix-ld";
inputs.nixpkgs.follows = "nixpkgs-for-nix-ld";
};
};
outputs = { nixpkgs, home-manager, self, nix-ld, ... }@inputs:
...
modules = [
...
nix-ld.nixosModules.nix-ld
{ programs.nix-ld.dev.enable = true; }
];
flake.lock
"nix-ld": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs-for-nix-ld"
]
},
"locked": {
"lastModified": 1721411691,
"narHash": "sha256-fN0NjkYcQrdVSvWlSnvdu8XD34q8tl84SEz5BOJYROA=",
"owner": "Mic92",
"repo": "nix-ld",
"rev": "7a990656e51465a18ba70f49c2cf9c8d0947b4c9",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "nix-ld",
"type": "github"
}
},
but when I run nixos-rebuild switch
the build fails with compile errors in nix-ld
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/gmf0lm6gyarlrgqvl2i9hjgdywlwyj9w-84khmnncb095j174g25zb1cq99i8lfi0-source
source root is 84khmnncb095j174g25zb1cq99i8lfi0-source
Executing cargoSetupPostUnpackHook
Finished cargoSetupPostUnpackHook
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
Executing cargoSetupPostPatchHook
Validating consistency between /build/84khmnncb095j174g25zb1cq99i8lfi0-source/Cargo.lock and /build/cargo-vendor-dir/Cargo.lock
Finished cargoSetupPostPatchHook
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
Executing cargoBuildHook
++ env CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/cc CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/c++ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/cc CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/cc CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/c++ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/cc CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu HOST_CC=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/cc HOST_CXX=/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/c++ cargo build -j 12 --target x86_64-unknown-linux-gnu --frozen --profile release
Compiling proc-macro2 v0.4.30
Compiling unicode-xid v0.1.0
Compiling syn v0.15.44
Compiling heapless v0.8.0
Compiling byteorder v1.5.0
Compiling cc v1.1.6
Compiling stable_deref_trait v1.2.0
Compiling plain v0.2.3
Compiling scroll v0.12.0
Compiling linux-raw-sys v0.6.4
Compiling constcat v0.5.0
Compiling log v0.4.22
Compiling cfg-match v0.2.1
Compiling embedded-io v0.6.1
Compiling hash32 v0.3.1
Compiling goblin v0.8.2
Compiling quote v0.6.13
Compiling nix-ld v2.0.0 (/build/84khmnncb095j174g25zb1cq99i8lfi0-source)
Compiling default-env v0.1.1
error: `MaybeUninit::<T>::zeroed` is not yet stable as a const fn
--> src/arch.rs:54:37
|
54 | pub const NIX_LD_SYSTEM_ENV: &str = concat!("NIX_LD_", NIX_SYSTEM);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_maybe_uninit_zeroed)]` to the crate attributes to enable
= note: this error originates in the macro `$crate::_concat_slices` which comes from the expansion of the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `MaybeUninit::<T>::zeroed` is not yet stable as a const fn
--> src/arch.rs:55:50
|
55 | pub const NIX_LD_LIBRARY_PATH_SYSTEM_ENV: &str = concat!("NIX_LD_LIBRARY_PATH_", NIX_SYSTEM);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_maybe_uninit_zeroed)]` to the crate attributes to enable
= note: this error originates in the macro `$crate::_concat_slices` which comes from the expansion of the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `MaybeUninit::<T>::zeroed` is not yet stable as a const fn
--> src/main.rs:34:41
|
34 | CStr::from_bytes_with_nul_unchecked(concat_slices!([u8]:
| _________________________________________^
35 | | default_env!("DEFAULT_NIX_LD", "/run/current-system/sw/share/nix-ld/lib/ld.so").as_bytes(),
36 | | b"\0"
37 | | ))
| |_____^
|
= help: add `#![feature(const_maybe_uninit_zeroed)]` to the crate attributes to enable
= note: this error originates in the macro `$crate::_concat_slices` which comes from the expansion of the macro `concat_slices` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not evaluate constant pattern
--> src/main.rs:85:13
|
85 | NIX_LD_SYSTEM_ENV_BYTES => {
| ^^^^^^^^^^^^^^^^^^^^^^^
error: could not evaluate constant pattern
--> src/main.rs:91:13
|
91 | NIX_LD_LIBRARY_PATH_SYSTEM_ENV_BYTES => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: unreachable pattern
--> src/main.rs:88:13
|
85 | NIX_LD_SYSTEM_ENV_BYTES => {
| ----------------------- matches any value
...
88 | b"NIX_LD" => {
| ^^^^^^^^^ unreachable pattern
|
= note: `#[warn(unreachable_patterns)]` on by default
warning: unreachable pattern
--> src/main.rs:91:13
|
85 | NIX_LD_SYSTEM_ENV_BYTES => {
| ----------------------- matches any value
...
91 | NIX_LD_LIBRARY_PATH_SYSTEM_ENV_BYTES => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
warning: unreachable pattern
--> src/main.rs:94:13
|
85 | NIX_LD_SYSTEM_ENV_BYTES => {
| ----------------------- matches any value
...
94 | b"NIX_LD_LIBRARY_PATH" => {
| ^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
warning: unreachable pattern
--> src/main.rs:97:13
|
85 | NIX_LD_SYSTEM_ENV_BYTES => {
| ----------------------- matches any value
...
97 | b"LD_LIBRARY_PATH" => {
| ^^^^^^^^^^^^^^^^^^ unreachable pattern
warning: unreachable pattern
--> src/main.rs:100:13
|
85 | NIX_LD_SYSTEM_ENV_BYTES => {
| ----------------------- matches any value
...
100 | _ => {}
| ^ unreachable pattern
warning: `nix-ld` (bin "nix-ld") generated 5 warnings
error: could not compile `nix-ld` (bin "nix-ld") due to 5 previous errors; 5 warnings emitted
Checking out the repository directly to the same commit that is in the flake.lock and compiling there works just fine