diff --git a/extra/git/hooks.nix b/extra/git/hooks.nix index 8196e33..15d0025 100644 --- a/extra/git/hooks.nix +++ b/extra/git/hooks.nix @@ -39,7 +39,7 @@ let mkdir -p $out/bin ${lib.concatMapStringsSep "\n" (k: '' - cat <<'WRAPPER' > $out/bin/${k} + ${pkgs.coreutils}/bin/cat <<'WRAPPER' > $out/bin/${k} #!${pkgs.bash}/bin/bash set -euo pipefail diff --git a/extra/language/c.nix b/extra/language/c.nix index f50bd2e..8b40aed 100644 --- a/extra/language/c.nix +++ b/extra/language/c.nix @@ -34,12 +34,13 @@ in }; config = { - devshell.packages = - [ cfg.compiler ] - ++ (lib.optionals hasLibraries (map lib.getLib cfg.libraries)) - ++ - # Assume we want pkg-config, because it's good - (lib.optionals hasIncludes ([ pkgs.pkg-config ] ++ (map lib.getDev cfg.includes))); + devshell.packages = [ + cfg.compiler + ] + ++ (lib.optionals hasLibraries (map lib.getLib cfg.libraries)) + ++ + # Assume we want pkg-config, because it's good + (lib.optionals hasIncludes ([ pkgs.pkg-config ] ++ (map lib.getDev cfg.includes))); env = (lib.optionals hasLibraries [ diff --git a/extra/language/rust.nix b/extra/language/rust.nix index 6e6472f..2b1f433 100644 --- a/extra/language/rust.nix +++ b/extra/language/rust.nix @@ -37,53 +37,52 @@ in config = { devshell.packages = if cfg.enableDefaultToolchain then (map (tool: cfg.packageSet.${tool}) cfg.tools) else [ ]; - env = - [ - { - # On darwin for example enables finding of libiconv - name = "LIBRARY_PATH"; - # append in case it needs to be modified - eval = "$DEVSHELL_DIR/lib"; - } - { - # some *-sys crates require additional includes - name = "CFLAGS"; - # append in case it needs to be modified - eval = "\"-I $DEVSHELL_DIR/include ${lib.optionalString pkgs.stdenv.isDarwin "-iframework $DEVSHELL_DIR/Library/Frameworks"}\""; - } - ] - ++ lib.optionals pkgs.stdenv.isDarwin [ - { - # On darwin for example required for some *-sys crate compilation - name = "RUSTFLAGS"; - # append in case it needs to be modified - eval = "\"-L framework=$DEVSHELL_DIR/Library/Frameworks\""; - } - { - # rustdoc uses a different set of flags - name = "RUSTDOCFLAGS"; - # append in case it needs to be modified - eval = "\"-L framework=$DEVSHELL_DIR/Library/Frameworks\""; - } - { - name = "PATH"; - prefix = - let - inherit (pkgs) xcbuild; - in - lib.makeBinPath [ - xcbuild - "${xcbuild}/Toolchains/XcodeDefault.xctoolchain" - ]; - } - ] - # fenix provides '.rust-src' in the 'complete' toolchain configuration - ++ lib.optionals (cfg.enableDefaultToolchain && cfg.packageSet ? rust-src) [ - { - # rust-analyzer may use this to quicker find the rust source - name = "RUST_SRC_PATH"; - value = "${cfg.packageSet.rust-src}/lib/rustlib/src/rust/library"; - } - ]; + env = [ + { + # On darwin for example enables finding of libiconv + name = "LIBRARY_PATH"; + # append in case it needs to be modified + eval = "$DEVSHELL_DIR/lib"; + } + { + # some *-sys crates require additional includes + name = "CFLAGS"; + # append in case it needs to be modified + eval = "\"-I $DEVSHELL_DIR/include ${lib.optionalString pkgs.stdenv.isDarwin "-iframework $DEVSHELL_DIR/Library/Frameworks"}\""; + } + ] + ++ lib.optionals pkgs.stdenv.isDarwin [ + { + # On darwin for example required for some *-sys crate compilation + name = "RUSTFLAGS"; + # append in case it needs to be modified + eval = "\"-L framework=$DEVSHELL_DIR/Library/Frameworks\""; + } + { + # rustdoc uses a different set of flags + name = "RUSTDOCFLAGS"; + # append in case it needs to be modified + eval = "\"-L framework=$DEVSHELL_DIR/Library/Frameworks\""; + } + { + name = "PATH"; + prefix = + let + inherit (pkgs) xcbuild; + in + lib.makeBinPath [ + xcbuild + "${xcbuild}/Toolchains/XcodeDefault.xctoolchain" + ]; + } + ] + # fenix provides '.rust-src' in the 'complete' toolchain configuration + ++ lib.optionals (cfg.enableDefaultToolchain && cfg.packageSet ? rust-src) [ + { + # rust-analyzer may use this to quicker find the rust source + name = "RUST_SRC_PATH"; + value = "${cfg.packageSet.rust-src}/lib/rustlib/src/rust/library"; + } + ]; }; } diff --git a/flake.nix b/flake.nix index 7baec94..103a805 100644 --- a/flake.nix +++ b/flake.nix @@ -36,7 +36,7 @@ { docs = pkgs.writeShellApplication { name = "docs"; - meta.description = ''Run mdBook server at http://localhost:3000''; + meta.description = "Run mdBook server at http://localhost:3000"; runtimeInputs = [ pkgs.mdbook ]; text = '' cd docs @@ -46,7 +46,7 @@ }; bench = pkgs.writeShellApplication { name = "benchmark"; - meta.description = ''Run benchmark''; + meta.description = "Run benchmark"; runtimeInputs = [ pkgs.hyperfine ]; text = '' cd benchmark diff --git a/modules/back-compat.nix b/modules/back-compat.nix index 88b1f95..5a71d0a 100644 --- a/modules/back-compat.nix +++ b/modules/back-compat.nix @@ -56,13 +56,12 @@ in }; # Copy the values over to the devshell module - config.devshell = - { - packages = config.packages; - packagesFrom = config.packagesFrom; - startup.bash_extra = noDepEntry config.bash.extra; - interactive.bash_interactive = noDepEntry config.bash.interactive; - } - // (lib.optionalAttrs (config.motd != null) { motd = config.motd; }) - // (lib.optionalAttrs (config.name != null) { name = config.name; }); + config.devshell = { + packages = config.packages; + packagesFrom = config.packagesFrom; + startup.bash_extra = noDepEntry config.bash.extra; + interactive.bash_interactive = noDepEntry config.bash.interactive; + } + // (lib.optionalAttrs (config.motd != null) { motd = config.motd; }) + // (lib.optionalAttrs (config.name != null) { name = config.name; }); } diff --git a/modules/commands.nix b/modules/commands.nix index 36b2e4f..4f5b777 100644 --- a/modules/commands.nix +++ b/modules/commands.nix @@ -179,7 +179,7 @@ in help = "prints this menu"; name = "menu"; command = '' - cat <<'DEVSHELL_MENU' + ${pkgs.coreutils}/bin/cat <<'DEVSHELL_MENU' ${commandsToMenu config.commands} DEVSHELL_MENU ''; diff --git a/modules/devshell.nix b/modules/devshell.nix index 2da36ef..68d6e95 100644 --- a/modules/devshell.nix +++ b/modules/devshell.nix @@ -173,7 +173,7 @@ let done if [[ -n "''${help:-}" ]]; then - cat <