diff --git a/default.nix b/default.nix index 71330e4340..f620865d28 100644 --- a/default.nix +++ b/default.nix @@ -7,4 +7,4 @@ } ) { src = ./.; } -).defaultNix \ No newline at end of file +).defaultNix diff --git a/flake.nix b/flake.nix index 9fe1922f28..71a2f09e20 100644 --- a/flake.nix +++ b/flake.nix @@ -34,8 +34,8 @@ rocBuild = import ./nix { inherit pkgs; }; compile-deps = rocBuild.compile-deps; - inherit (compile-deps) zigPkg llvmPkgs llvmVersion - llvmMajorMinorStr glibcPath libGccSPath darwinInputs; + inherit (compile-deps) zigPkg llvmPkgs llvmVersion + llvmMajorMinorStr glibcPath libGccSPath darwinInputs; # DevInputs are not necessary to build roc as a user linuxDevInputs = with pkgs; @@ -155,6 +155,12 @@ formatter = pkgs.nixpkgs-fmt; # 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; + }; }); } diff --git a/nix/roc-cli.nix b/nix/builder.nix similarity index 100% rename from nix/roc-cli.nix rename to nix/builder.nix diff --git a/nix/default.nix b/nix/default.nix index 15dd93e25a..75a8c036b8 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -5,12 +5,20 @@ let cargo = 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 -{ - 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 = {}; -} +packages