mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
setup sub package builds
This commit is contained in:
parent
3179773d90
commit
07e06e60f5
3 changed files with 22 additions and 14 deletions
|
@ -156,10 +156,10 @@
|
|||
|
||||
# You can build this package (the roc CLI) with the `nix build` command.
|
||||
packages = {
|
||||
default = rocBuild.roc-cli;
|
||||
default = rocBuild.roc-full;
|
||||
full = rocBuild.roc-full;
|
||||
|
||||
cli = rocBuild.roc-cli;
|
||||
|
||||
lang-server = rocBuild.roc-lang-server;
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{ pkgs, rustPlatform, compile-deps, subPackage ? null }:
|
||||
{ pkgs, lib, rustPlatform, compile-deps, subPackage ? null }:
|
||||
let
|
||||
inherit (compile-deps) zigPkg llvmPkgs llvmVersion llvmMajorMinorStr glibcPath libGccSPath;
|
||||
|
||||
subPackagePath = if subPackage != null then "crates/${subPackage}" else null;
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "roc";
|
||||
pname = "roc" + lib.optionalString (subPackage != null) "_${subPackage}";
|
||||
version = "0.0.1";
|
||||
|
||||
buildAndTestSubdir = subPackage;
|
||||
buildAndTestSubdir = subPackagePath;
|
||||
|
||||
src = pkgs.nix-gitignore.gitignoreSource [ ] ../.;
|
||||
|
||||
|
@ -68,13 +70,18 @@ rustPlatform.buildRustPackage {
|
|||
# cp: to copy str.zig,list.zig...
|
||||
# wrapProgram pkgs.stdenv.cc: to make ld available for compiler/build/src/link.rs
|
||||
postInstall =
|
||||
if pkgs.stdenv.isLinux then ''
|
||||
wrapProgram $out/bin/roc --set NIX_GLIBC_PATH ${glibcPath} --set NIX_LIBGCC_S_PATH ${libGccSPath} --prefix PATH : ${
|
||||
pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]
|
||||
}
|
||||
'' else ''
|
||||
wrapProgram $out/bin/roc --prefix PATH : ${
|
||||
pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]
|
||||
}
|
||||
let
|
||||
binPath =
|
||||
lib.makeBinPath [ pkgs.stdenv.cc ];
|
||||
linuxArgs = lib.optionalString pkgs.stdenv.isLinux
|
||||
"--set NIX_GLIBC_PATH ${glibcPath} --set NIX_LIBGCC_S_PATH ${libGccSPath}";
|
||||
rocPath = "$out/bin/roc";
|
||||
wrapRoc = "wrapProgram ${rocPath} ${linuxArgs} --prefix PATH : ${binPath}";
|
||||
in
|
||||
# need to check if roc bin exists since it might not if subPackage is set
|
||||
''
|
||||
if test -f ${rocPath}; then
|
||||
${wrapRoc}
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ let
|
|||
rust-shell =
|
||||
(rustVersion.override { extensions = [ "rust-src" "rust-analyzer" ]; });
|
||||
|
||||
roc-cli = callPackage ./builder.nix { }; # TODO: this builds the language server as `roc_ls`
|
||||
roc-full = callPackage ./builder.nix { };
|
||||
roc-lang-server = callPackage ./builder.nix { subPackage = "lang_srv"; };
|
||||
roc-cli = callPackage ./builder.nix { subPackage = "cli"; };
|
||||
};
|
||||
|
||||
in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue