From c4a9b57cacb57f462c1d10773d4abb43acade3ef Mon Sep 17 00:00:00 2001 From: lrosa007 Date: Wed, 11 Nov 2020 12:55:00 -0500 Subject: [PATCH] feat(shell.nix): group linux only deps --- shell.nix | 113 ++++++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 59 deletions(-) diff --git a/shell.nix b/shell.nix index adc4219105..107065c852 100644 --- a/shell.nix +++ b/shell.nix @@ -16,72 +16,67 @@ with { with (pkgs); let - darwin-frameworks = - if isMacOS then - with pkgs.darwin.apple_sdk.frameworks; [ - AppKit - CoreFoundation - CoreServices - CoreVideo - Foundation - Metal - Security - ] - else - [ ]; + darwin-frameworks = if isMacOS then + with pkgs.darwin.apple_sdk.frameworks; [ + AppKit + CoreFoundation + CoreServices + CoreVideo + Foundation + Metal + Security + ] + else + [ ]; + + linux-only = if !isMacOS then [ + vulkan-headers + vulkan-loader + vulkan-tools + vulkan-validation-layers + xorg.libX11 + xorg.libXcursor + xorg.libXrandr + xorg.libXi + ] else + [ ]; + llvmPkg = pkgs.llvm_10; lldPkg = pkgs.lld_10; # this should match llvm's version clangPkg = pkgs.clang_10; # this should match llvm's version zig = import ./nix/zig.nix { inherit pkgs isMacOS; }; - inputs = - [ - # build libraries - rustc - cargo - clippy - rustfmt - cmake - git - python3 - llvmPkg - clangPkg - valgrind - pkg-config - zig - # llb deps - libffi - libxml2 - xorg.libX11 - zlib - vulkan-headers - vulkan-loader - vulkan-tools - vulkan-validation-layers - # faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker - lldPkg - # dev tools - rust-analyzer - # (import ./nix/zls.nix { inherit pkgs zig; }) - ccls - ]; + inputs = [ + # build libraries + rustc + cargo + clippy + rustfmt + cmake + git + python3 + llvmPkg + clangPkg + valgrind + pkg-config + zig + # llb deps + libffi + libxml2 + zlib + # faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker + lldPkg + # dev tools + rust-analyzer + # (import ./nix/zls.nix { inherit pkgs zig; }) + ccls + ]; + in mkShell { - buildInputs = inputs ++ darwin-frameworks; + buildInputs = inputs ++ darwin-frameworks ++ linux-only; LLVM_SYS_100_PREFIX = "${llvmPkg}"; - APPEND_LIBRARY_PATH = stdenv.lib.makeLibraryPath [ - pkgconfig - vulkan-headers - vulkan-loader - vulkan-tools - vulkan-validation-layers - xorg.libX11 - xorg.libXcursor - xorg.libXrandr - xorg.libXi - libcxx - libcxxabi - libunwind - ]; + APPEND_LIBRARY_PATH = stdenv.lib.makeLibraryPath + ([ pkgconfig libcxx libcxxabi libunwind ] ++ linux-only); # Aliases don't work cross shell, so we do this shellHook = ''