-
Notifications
You must be signed in to change notification settings - Fork 247
Add cross compilation and devShell to project.flake #1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The default shell `devShell` works by adding a default `shell` to all projects. You can pass the shell arguments to the project function using the new `shell` argument: ``` let myProject = haskell-nix.project { src = ./.; shell.tools = { cabal = {}; }; shell.crossPlatforms = p: [ p.cross ]; }; ``` This will include js-unknown-ghcjs-cabal in the `devShell`. To add cross compiled outputs to the flake pass `crossPlatforms` to the `flake` function. ``` myProject.flake { crossPlatforms = p: [ p.cross ]; } ``` To cross compile a component include the platforms `config` string to the output name like this ``` nix build .#js-unknown-ghcjs:pkg-name:lib:pkg-name ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks cool!
About the cross-compiling Cabals such as js-unknown-ghcjs-cabal
- could we make them use a different --builddir=DIR
by default? So that they won't clobber an existing build.
# Default shell arguments | ||
shell = mkOption { | ||
# TODO make this a submodule | ||
type = unspecified; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have module option docs here, to help users know how to use it.
Newer cabal versions should include
|
There are now 4 project modules used to check the arguments passed to the various project functions: * `project-common.nix` - Arguments used by all the project functions * `stack-project.nix` - Used by the `stackProject` and `stackProject'` functions * `cabal-project.nix` - Used by the `cabalProject` and `cabalProject'` functions * `project.nix` - Just the `projectFileName` argument that is used by `project` and `project'` functions to determine whether to call `stackProject` or `cabalProject` function. This also includes the `rawProject.args` that was mistakenly left out of #1141 causing #1142 and improvements for the docs for the use of the `shell` argument in `flake.nix` files.
…1141) The default shell `devShell` works by adding a default `shell` to all projects. You can pass the shell arguments to the project function using the new `shell` argument: ``` let myProject = haskell-nix.project { src = ./.; shell.tools = { cabal = {}; }; shell.crossPlatforms = p: [ p.cross ]; }; ``` This will include js-unknown-ghcjs-cabal in the `devShell`. To add cross compiled outputs to the flake pass `crossPlatforms` to the `flake` function. ``` myProject.flake { crossPlatforms = p: [ p.cross ]; } ``` To cross compile a component include the platforms `config` string to the output name like this ``` nix build .#js-unknown-ghcjs:pkg-name:lib:pkg-name ```
…k#1144) There are now 4 project modules used to check the arguments passed to the various project functions: * `project-common.nix` - Arguments used by all the project functions * `stack-project.nix` - Used by the `stackProject` and `stackProject'` functions * `cabal-project.nix` - Used by the `cabalProject` and `cabalProject'` functions * `project.nix` - Just the `projectFileName` argument that is used by `project` and `project'` functions to determine whether to call `stackProject` or `cabalProject` function. This also includes the `rawProject.args` that was mistakenly left out of input-output-hk#1141 causing input-output-hk#1142 and improvements for the docs for the use of the `shell` argument in `flake.nix` files.
The default shell
devShell
works by adding a defaultshell
to all projects. You can pass the shell arguments to the project function using the newshell
argument:This will include js-unknown-ghcjs-cabal in the
devShell
.To add cross compiled outputs to the flake pass
crossPlatforms
to theflake
function.To cross compile a component include the platforms
config
string to the output name like this