-
Notifications
You must be signed in to change notification settings - Fork 286
Re-enable “Nix development cache” workflow #5625
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| ## Building with Nix | ||
|
|
||
| __NB__: It is important that the Unison Nix cache is trusted when building, otherwise you will likely end up building hundreds of packages, including GHC itself. | ||
|
|
||
| The recommended way to do this is to add the public key and URL for the cache to your system’s Nix configuration. /etc/nix/nix.conf should have lines similar to | ||
| ```conf | ||
| trusted-public-keys = unison.cachix.org-1:i1DUFkisRPVOyLp/vblDsbsObmyCviq/zs6eRuzth3k= | ||
| trusted-substituters = https://unison.cachix.org | ||
| ``` | ||
| these lines could be prefixed with `extra-` and they may have additional entries besides the ones for our cache. | ||
|
|
||
| This command should work if you don’t want to edit the file manually: | ||
| ```shell | ||
| sudo sh -c 'echo "extra-trusted-public-keys = unison.cachix.org-1:i1DUFkisRPVOyLp/vblDsbsObmyCviq/zs6eRuzth3k= | ||
| extra-trusted-substituters = https://unison.cachix.org" >>/etc/nix/nix.conf' | ||
| ``` | ||
| After updating /etc/nix/nix.conf, you need to restart the Nix daemon. To do this on | ||
| - Ubuntu: `sudo systemctl restart nix-daemon` | ||
| - MacOS: | ||
| ```shell | ||
| sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist | ||
| sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist | ||
| ``` | ||
|
|
||
| If you use NixOS, you may instead add this via your configuration.nix with | ||
| ```nix | ||
| nix.settings.trusted-public-keys = ["unison.cachix.org-1:i1DUFkisRPVOyLp/vblDsbsObmyCviq/zs6eRuzth3k="]; | ||
| nix.settings.trusted-substituters = ["https://unison.cachix.org"]; | ||
| ``` | ||
| and run `sudo nixos-rebuild switch` afterward. | ||
|
|
||
| It is _not_ recommended to add your user to `trusted-users`. This _can_ make enabling flake configurations simpler (like the Unison Nix cache here), but [it is equivalent to giving that user root access (without need for sudo)](https://nix.dev/manual/nix/2.23/command-ref/conf-file.html#conf-trusted-users). | ||
|
|
||
| ## Building package components with nix | ||
|
|
||
| ### Build the unison executable | ||
| ```shell | ||
| nix build | ||
| ``` | ||
|
|
||
| ### Build a specific component | ||
| This is specified with the normal | ||
| `<package>:<component-type>:<component-name>` triple. | ||
|
|
||
| Some examples: | ||
| ```shell | ||
| nix build '.#component-unison-cli:lib:unison-cli' | ||
| nix build '.#component-unison-syntax:test:syntax-tests' | ||
| nix build '.#component-unison-cli:exe:transcripts' | ||
| ``` | ||
|
|
||
| ### Development environments | ||
|
|
||
| #### Get into a development environment for building with stack | ||
| This gets you into a development environment with the preferred | ||
| versions of the compiler and other development tools. These | ||
| include: | ||
|
|
||
| - ghc | ||
| - stack | ||
| - ormolu | ||
| - haskell-language-server | ||
|
|
||
| ```shell | ||
| nix develop | ||
| ``` | ||
|
|
||
| #### Get into a development environment for building with cabal | ||
| This gets you into a development environment with the preferred | ||
| versions of the compiler and other development tools. Additionally, | ||
| all non-local haskell dependencies (including profiling dependencies) | ||
| are provided in the nix shell. | ||
|
|
||
| ```shell | ||
| nix develop '.#cabal-local' | ||
| ``` | ||
|
|
||
| #### Get into a development environment for building a specific package | ||
| This gets you into a development environment with the preferred | ||
| versions of the compiler and other development tools. Additionally, | ||
| all haskell dependencies of this package are provided by the nix shell | ||
| (including profiling dependencies). | ||
|
|
||
| ```shell | ||
| nix develop '.#cabal-<package-name>' | ||
| ``` | ||
|
|
||
| for example: | ||
|
|
||
| ```shell | ||
| nix develop '.#cabal-unison-cli' | ||
| ``` | ||
| or | ||
| ```shell | ||
| nix develop '.#cabal-unison-parser-typechecker' | ||
| ``` | ||
|
|
||
| This is useful if you wanted to profile a package. For example, if you | ||
| want to profile `unison-cli-main:exe:unison` then you could get into one of these | ||
| shells, cd into its directory, then run the program with | ||
| profiling. | ||
|
|
||
| ```shell | ||
| nix develop '.#cabal-unison-parser-typechecker' | ||
| cd unison-cli | ||
| cabal run --enable-profiling unison-cli-main:exe:unison -- +RTS -p | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {lib}: let | ||
| ## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some | ||
| ## configuration from the VS Code settings to avoid duplication. | ||
| vscodeSettings = lib.importJSON ../.vscode/settings.json; | ||
| in | ||
| vscodeSettings."haskell.toolchain" | ||
| ## There are some things we want to pin that the VS Code Haskell extension doesn’t let us control. | ||
| // { | ||
| hpack = "0.35.2"; | ||
| ormolu = "0.7.2.0"; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I have seen some hpack 0.37 slipping in, so we may want to bump this too at some point.
unison/unison-share-api/unison-share-api.cabal
Line 3 in 754805c
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.
Yeah, good call. In #5486, I mention that 0.36 is the minimum supported by our pinned stack version, so it’s even inconsistent within the current Nix environment. I should rebase that, now that this is merged, and see if the cache issue is gone.