use callPackageWith to cleanup some logic

This commit is contained in:
John Murray 2023-11-14 22:28:01 -05:00
parent 81cd92f3fe
commit 3179773d90
No known key found for this signature in database
4 changed files with 26 additions and 12 deletions

View file

@ -35,7 +35,7 @@
compile-deps = rocBuild.compile-deps; compile-deps = rocBuild.compile-deps;
inherit (compile-deps) zigPkg llvmPkgs llvmVersion inherit (compile-deps) zigPkg llvmPkgs llvmVersion
llvmMajorMinorStr glibcPath libGccSPath darwinInputs; llvmMajorMinorStr glibcPath libGccSPath darwinInputs;
# DevInputs are not necessary to build roc as a user # DevInputs are not necessary to build roc as a user
linuxDevInputs = with pkgs; linuxDevInputs = with pkgs;
@ -155,6 +155,12 @@
formatter = pkgs.nixpkgs-fmt; formatter = pkgs.nixpkgs-fmt;
# You can build this package (the roc CLI) with the `nix build` command. # You can build this package (the roc CLI) with the `nix build` command.
packages.default = rocBuild.roc-cli; packages = {
default = rocBuild.roc-cli;
cli = rocBuild.roc-cli;
lang-server = rocBuild.roc-lang-server;
};
}); });
} }

View file

@ -5,12 +5,20 @@ let
cargo = rustVersion; cargo = rustVersion;
rustc = rustVersion; rustc = rustVersion;
}; };
compile-deps = pkgs.callPackage ./compile-deps.nix { };
# this will allow our callPackage to reference our own packages defined below
# mainly helps with passing compile-deps and rustPlatform to builder automatically
callPackage = pkgs.lib.callPackageWith (pkgs // packages);
packages = {
inherit rustPlatform;
compile-deps = callPackage ./compile-deps.nix { };
rust-shell =
(rustVersion.override { extensions = [ "rust-src" "rust-analyzer" ]; });
roc-cli = callPackage ./builder.nix { }; # TODO: this builds the language server as `roc_ls`
roc-lang-server = callPackage ./builder.nix { subPackage = "lang_srv"; };
};
in in
{ packages
inherit rustPlatform compile-deps;
rust-shell =
(rustVersion.override { extensions = [ "rust-src" "rust-analyzer" ]; });
roc-cli = pkgs.callPackage ./roc-cli.nix { inherit compile-deps rustPlatform; };
roc-lang-server = {};
}