poscat0x04 / hls-nix

Nix derivations for hasekll-language-server
11 stars 3 forks source link

Binary package #3

Open poscat0x04 opened 4 years ago

poscat0x04 commented 4 years ago

What method should we use to distribute binary packages?

expipiplus1 commented 4 years ago

I think that cachix is the standard solution for this.

poscat0x04 commented 4 years ago

I uploaded the binary cache onto cachix: https://app.cachix.org/cache/hls-nix

expipiplus1 commented 4 years ago

I wonder if it's possible to trigger a github action to run whenever hls is updated, then you could get that to bump the version on cachix: something like https://github.com/expipiplus1/vulkan/blob/master/.github/workflows/ci.yml#L170-L186

analyticd commented 4 years ago

Thanks for the cachix binary. Question: When I came back to babysit the nix-build after quite some time, I see lines like

<<ghc: 9170278952 bytes, 512 GCs, 51844641/156860200 avg/max bytes residency (13 samples), 420M in use, 0.001 INIT (0.002 elapsed), 5.459 MUT (7.732 elapsed), 2.723 GC (2.864 elapsed) :ghc>> "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H32m -O -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -this-unit-id ghc-8.8.3 -hide-all-packages -i -icompiler/backpack -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen [snip]...[/snip]

which seems like it may be doing tests in a doCheck phase or something? Is there a way to build this using the cachix binary and skip any doCheck phase (if that is what is going on) since it takes so long?

expipiplus1 commented 4 years ago

@analyticd That is GHC itself being compiled, so it looks as though you're not hitting the cache.

analyticd commented 4 years ago

Thanks for responding. I had added the cachix binary per the instructions, https://app.cachix.org/cache/hls-nix, and subseqently it is in my ~/.config/nix/nix.conf, but when I do nix-build in the root dir of your project it copies several dependencies successfully including your binary, but when it comes to ghc 8.8.3 it wants to build from source. I am able to build all-hies using cachix for 8.8.3 fine, so I don't know yet what the problem is. Building ghc from source is a no go, takes all day.

poscat0x04 commented 4 years ago

probably because the cache is out-dated. If you have haskell.nix's binary cache (see https://input-output-hk.github.io/haskell.nix/tutorials/getting-started/) set up then you can avoid compiling ghc.

analyticd commented 4 years ago

Thanks for responding. Ok, forgive me if this is me not having my env correct, but after ensuring I had, cachix use iohk, I did a nix-shell --show-trace, having first tried the build command in the readme without success, in this repo's root dir and got the following (just reporting in case something recently broke - appreciate you making this available):

From https://github.com/haskell/haskell-language-server
 * [new branch]      correct-stack-install   -> origin/correct-stack-install
 * [new branch]      ghc-8.10                -> origin/ghc-8.10
 * [new branch]      github-action-builds    -> origin/github-action-builds
 * [new branch]      master                  -> origin/master
 * [new branch]      remove-redundant-import -> origin/remove-redundant-import
 * [new branch]      shake-threads-default-0 -> origin/shake-threads-default-0
 * [new tag]         0.1                     -> 0.1
Switched to a new branch 'fetchgit'
Submodule 'ghcide' (https://github.com/wz1000/ghcide.git) registered for path 'ghcide'
Initialized empty Git repository in /nix/store/5zhk14mdjjc3mbvm1l60b0i7yinxq4qv-source/ghcide/.git/
remote: Enumerating objects: 225, done.
remote: Counting objects: 100% (225/225), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 7534 (delta 131), reused 174 (delta 105), pack-reused 7309
Receiving objects: 100% (7534/7534), 2.26 MiB | 76.00 KiB/s, done.
Resolving deltas: 100% (4289/4289), done.
From https://github.com/wz1000/ghcide
 * [new branch]      async-ide-action       -> origin/async-ide-action
 * [new branch]      cabal-metadata         -> origin/cabal-metadata
 * [new branch]      computersarebad        -> origin/computersarebad
 * [new branch]      daml-bump              -> origin/daml-bump
 * [new branch]      debug                  -> origin/debug
 * [new branch]      debug-modtime          -> origin/debug-modtime
 * [new branch]      debug-spans            -> origin/debug-spans
 * [new branch]      debugging              -> origin/debugging
 * [new branch]      filter-notenabled-warnings -> origin/filter-notenabled-warnings
 * [new branch]      fix-completion-ghc-lib -> origin/fix-completion-ghc-lib
 * [new branch]      fix-doc-hover          -> origin/fix-doc-hover
 * [new branch]      ghc-api-version        -> origin/ghc-api-version
 * [new branch]      hi-file-changes        -> origin/hi-file-changes
 * [new branch]      hiedb                  -> origin/hiedb
 * [new branch]      hiedb-2                -> origin/hiedb-2
 * [new branch]      hiedb-2-pepe-rebased   -> origin/hiedb-2-pepe-rebased
 * [new branch]      hiedb-3                -> origin/hiedb-3
 * [new branch]      hiedb-refs             -> origin/hiedb-refs
 * [new branch]      hiedb-refs-rebased     -> origin/hiedb-refs-rebased
 * [new branch]      hiefile-namecache      -> origin/hiefile-namecache
 * [new branch]      hls                    -> origin/hls
 * [new branch]      hls-2                  -> origin/hls-2
 * [new branch]      hls-2-pepe-rebased     -> origin/hls-2-pepe-rebased
 * [new branch]      hls-3                  -> origin/hls-3
 * [new branch]      hls-persistent-stale   -> origin/hls-persistent-stale
 * [new branch]      hls-simpler-ideaction  -> origin/hls-simpler-ideaction
 * [new branch]      hls-squash-bugs        -> origin/hls-squash-bugs
 * [new branch]      hls-stale-fail         -> origin/hls-stale-fail
 * [new branch]      ifaces                 -> origin/ifaces
 * [new branch]      master                 -> origin/master
 * [new branch]      multi-component        -> origin/multi-component
 * [new branch]      my-completion          -> origin/my-completion
 * [new branch]      no-span-info           -> origin/no-span-info
 * [new branch]      nodeps-compilemodule   -> origin/nodeps-compilemodule
 * [new branch]      package-debug          -> origin/package-debug
 * [new branch]      recompile              -> origin/recompile
 * [new branch]      reinstantiate-fakedynflags -> origin/reinstantiate-fakedynflags
 * [new branch]      remove-bazel           -> origin/remove-bazel
 * [new branch]      symbols                -> origin/symbols
 * [new branch]      tracing                -> origin/tracing
 * [new branch]      wip/shake-queue-2      -> origin/wip/shake-queue-2
 * [new branch]      wip/stale-logic        -> origin/wip/stale-logic
 * [new branch]      wip/zubin-rebase-fix-authors -> origin/wip/zubin-rebase-fix-authors
 * [new tag]         v0.0.4                 -> v0.0.4
 * [new tag]         v0.0.5                 -> v0.0.5
 * [new tag]         v0.0.6                 -> v0.0.6
 * [new tag]         v0.1.0                 -> v0.1.0
fatal: reference is not a tree: 0407fafa7b2d2fb238c383b510fb4b2abc141822
Unable to checkout 0407fafa7b2d2fb238c383b510fb4b2abc141822 from https://github.com/wz1000/ghcide.git.
builder for '/nix/store/psbyc3mjlkq6sglzbkh69ymicnkkaxdg-source.drv' failed with exit code 1
cannot build derivation '/nix/store/57kx0ixn6n5bpqyfvwbixm3xpz01503w-source-stack-to-nix-pkgs.drv': 1 dependencies couldn't be built
error: while evaluating anonymous function at /Users/lriley/.ghq/github.com/poscat0x04/hls-nix/default.nix:1:1, called from undefined position:
while evaluating 'stackProject' at /nix/store/bafg522vklayh5yhipvafncxqb00skaj-source/overlays/haskell.nix:536:24, called from /Users/lriley/.ghq/github.com/poscat0x04/hls-nix/default.nix:9:5:
while evaluating the attribute 'hsPkgs' at /nix/store/bafg522vklayh5yhipvafncxqb00skaj-source/overlays/haskell.nix:490:15:
while evaluating the attribute 'hsPkgs' at /nix/store/bafg522vklayh5yhipvafncxqb00skaj-source/overlays/haskell.nix:531:39:
while evaluating the attribute 'config' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:96:25:
while evaluating 'yieldConfig' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:83:29, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:82:16:
while evaluating 'mergeModules' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:233:26, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:73:17:
while evaluating 'mergeModules'' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:237:36, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:234:5:
while evaluating 'flip' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/trivial.nix:138:16, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:280:6:
while evaluating 'byName' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:260:25, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:268:21:
while evaluating 'reverseList' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/lists.nix:393:17, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:73:38:
while evaluating anonymous function at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:167:37, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:68:19:
while evaluating 'filterModules' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:157:36, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:168:7:
while evaluating 'imap1' at /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/lists.nix:116:14, called from /nix/store/x0vxvwcf9hja4m9x73ajrz3210r04f8y-source/lib/modules.nix:142:73:
while evaluating anonymous function at /nix/store/bafg522vklayh5yhipvafncxqb00skaj-source/lib/import-and-filter-project.nix:5:1, called from /nix/store/bafg522vklayh5yhipvafncxqb00skaj-source/overlays/haskell.nix:524:32:
build of '/nix/store/57kx0ixn6n5bpqyfvwbixm3xpz01503w-source-stack-to-nix-pkgs.drv' failed

essentially the same for nix-build.

As a point of reference, I can still nix-shell an all-hies haskell.nix branch which also uses iohk's haskell.nix from binary cache (as referenced here: https://github.com/Infinisil/all-hies/pull/64).