sile-typesetter / sile-typesetter.github.io

Github Pages source code for https://sile-typesetter.org
Creative Commons Zero v1.0 Universal
3 stars 4 forks source link

Can't run SILE Flake from CI #30

Closed alerque closed 2 years ago

alerque commented 2 years ago

From the mostly obsolete SILE issue:

Gah! So close and yet....

It works for me locally:

$ nix run github:sile-typesetter/sile -- --version
SILE v0.12.5-72b25f3-flake (Lua 5.3)

But CI bombs out with a cryptic:

error: attribute 'defaultApp.x86_64-linux' should have type 'derivation'

Same version of nix (2.9.1) in both places, same channels (I think) and same config options (seemingly irrelevant experimental flags leftover from previous versions, but tried with and without).

We use both the last stable release and the HEAD to generate examples on the website. The stable version comes out of Nix packages, the HEAD version from the flake.

For some reason while I can run it locally the Flake doesn't work from CI.

Before trying to use it we double check that we can run it:

https://github.com/sile-typesetter/sile-typesetter.github.io/blob/master/.github/workflows/deploy.yml#L40

That's the line that's failing.

Note I've been testing this on my fork.

Any ideas @doronbehar?

alerque commented 2 years ago

In score+=1 for debugging, I can at least reproduce this in NixOS!

$ docker run -it nixos/nix:latest
$ nix run --extra-experimental-features 'nix-command flakes' github:sile-typesetter/sile -- --version
error: attribute 'defaultApp.x86_64-linux' should have type 'derivation'

I don't understand why it works for me locally (Arch Linux w/ nix).

alerque commented 2 years ago

Adding the app name #sile to the command works both for me locally and in NixOS.

$ nix run --extra-experimental-features 'nix-command flakes' github:sile-typesetter/sile#sile -- --version
SILE v0.12.5-72b25f3-flake (Lua 5.3)

I will push that through as a fix to get the website updating, but I don't pretend to understand why.

doronbehar commented 2 years ago

I read this: https://github.com/NixOS/nix/issues/6448 and I think your solution is:

diff --git i/flake.nix w/flake.nix
index dd0da117..b32ba0fc 100644
--- i/flake.nix
+++ w/flake.nix
@@ -139,9 +139,12 @@
       };
       packages.sile = sile;
       defaultPackage = sile;
-      apps.sile = {
-        type = "app";
-        program = "${sile}/bin/sile";
+      apps = rec {
+        default = sile;
+        sile = {
+          type = "app";
+          program = "${sile}/bin/sile";
+        };
       };
       defaultApp = apps.sile;
     }
doronbehar commented 2 years ago

The change done in the newer nix version is the fact that nix run now searches for app.default attribute and not defaultPackage, so it seems.

alerque commented 2 years ago

Thanks! That wasn't quite the right syntax because ${sile} isn't set there and needed to be ${self.defaultPackage.${system}} instead, but it was close enough to get on the right track. I agree with that issue you linked, this error is too cryptic and points completely the wrong direction—at least for this specific cause.