diff --git a/src/modules/languages/rust.nix b/src/modules/languages/rust.nix index 960f81019..fe7920a6b 100644 --- a/src/modules/languages/rust.nix +++ b/src/modules/languages/rust.nix @@ -35,7 +35,7 @@ in defaultText = lib.literalExpression ''[ ]''; description = '' List of extra [targets](https://github.com/nix-community/fenix#supported-platforms-and-targets) - to install. Defaults to only the native target. + to install. Defaults to only the native target. ''; }; @@ -136,8 +136,8 @@ in if cfg.toolchain ? rust-src then "${cfg.toolchain.rust-src}/lib/rustlib/src/rust/library" else pkgs.rustPlatform.rustLibSrc; - RUSTFLAGS = "${moldFlags} ${cfg.rustflags}"; - RUSTDOCFLAGS = "${moldFlags}"; + RUSTFLAGS = lib.mkIf (moldFlags != "" || cfg.rustflags != "") (lib.concatStringsSep " " (lib.filter (x: x != "") [moldFlags cfg.rustflags])); + RUSTDOCFLAGS = lib.mkIf (moldFlags != "") moldFlags; CFLAGS = lib.optionalString pkgs.stdenv.isDarwin "-iframework ${config.devenv.profile}/Library/Frameworks"; };