-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add flake.nix and other files #1231
Conversation
Hm; if $ git submodule update --init --recursive --remote
Submodule 'libtexpdf' (https://github.com/sile-typesetter/libtexpdf.git) registered for path 'libtexpdf'
Cloning into '/home/akavel/prog/sile/libtexpdf'...
Submodule path 'libtexpdf': checked out 'c4ff429664607e1f055d29aeb5dc5d4b6ddb2499'
$ ls -1 libtexpdf/ | wc -l
133
$ nix shell
error: builder for '/nix/store/fy27raxwrfmldax4n0i9rv48gdp8549b-sile-0.11.1-flake.drv' failed with exit code 2;
last 10 log lines:
> config.status: creating sile
> config.status: executing depfiles commands
> config.status: executing libtool commands
> Making all in libtexpdf
> make[2]: Entering directory '/build/s95x4z6kk2vw0nabr92mn7ihb45qp0c5-source/libtexpdf'
> make[2]: *** No rule to make target 'all'. Stop.
> make[2]: Leaving directory '/build/s95x4z6kk2vw0nabr92mn7ihb45qp0c5-source/libtexpdf'
> make[1]: *** [Makefile:772: all-recursive] Error 1
> make[1]: Leaving directory '/build/s95x4z6kk2vw0nabr92mn7ihb45qp0c5-source'
> make: *** [Makefile:501: all] Error 2
For full logs, run 'nix log /nix/store/fy27raxwrfmldax4n0i9rv48gdp8549b-sile-0.11.1-flake.drv'. |
I haven't had time to review this in detail, but thanks for the contribution!
A quick note on fonts, there is already a If anybody is doing development work on SILE itself I would expect them to have the source checked out anyway and be able to do the font downloads on the host system on in a nix shell (with curl). They should not get in the way of running a dev version. |
33ce75f
to
d017448
Compare
@akavel I'm not sure I'm more experienced in Nix then you :) That The current usages of this flake are:
Feature 3 doesn't work, due to the Git Submodule issue, but we can test it once we decide how to tackle it with @akavel |
Some ideas for tackling
|
@doronbehar I'm afraid $ git fetch origin pull/1231/head:pr1231.02
$ git checkout pr1231.02
$ nix build
error: builder for '/nix/store/v96hg6vzn6pd3xnivkv7hr4ivacgpbqp-sile-0.11.1-flake.drv' failed with exit code 2;
last 10 log lines:
> config.status: creating sile
> config.status: executing depfiles commands
> config.status: executing libtool commands
> Making all in libtexpdf
> make[2]: Entering directory '/build/xblbbmm57jdrjb7va26va9ggdblzp19a-source/libtexpdf'
> make[2]: *** No rule to make target 'all'. Stop.
> make[2]: Leaving directory '/build/xblbbmm57jdrjb7va26va9ggdblzp19a-source/libtexpdf'
> make[1]: *** [Makefile:772: all-recursive] Error 1
> make[1]: Leaving directory '/build/xblbbmm57jdrjb7va26va9ggdblzp19a-source'
> make: *** [Makefile:501: all] Error 2
For full logs, run 'nix log /nix/store/v96hg6vzn6pd3xnivkv7hr4ivacgpbqp-sile-0.11.1-flake.drv'.
$ git describe
v0.11.1-141-gd0174488
$ ls -1 libtexpdf/ | wc -l
133 |
Of the 3 options there, ② makes the most sense long term. We're planning on splitting it out with it's own release cycle anyway. I've already setup the Arch Linux packaging getting it ready for a split for that to be it's own library package. Right now we always have it pinned to the master branch HEAD, but as soon as we start tagging releases there it will just be pinned to whatever the latest tag is. Option 3 is also viable. I have a make job to confirm the submodule is up to date, I can have it update the hash in the flake too. |
d017448
to
617b797
Compare
Perhaps it will be convenient to have a libtexpdf as a submodule for now, or perhaps forever, so it'd be easier to test changes in that library while developing? I added a TODO in the code. Now, using
And also the README is updated with a similar command And maintaining this flake.nix only requires making sure that the file @akavel I hope now it will work for you 🙏 . |
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.
One thing that still bothers me @alerque is that when I nix run . -- --version
I get:
SILE vUNKNOWN (Lua 5.2)
In which part of the build would it be correct to write .version
or .tarball-version
so that it'd be picked up by the build?
Does the build environment see the rest of the repository (i.e. the Or if needed I can come up with another mechanism. |
617b797
to
a77a6e3
Compare
No. Putting the version in |
0c37423
to
8935c52
Compare
I'm having trouble testing this locally too. Interestingly I can use nix run .
/nix/store/g786j9lkivd7fida2hbz6gncvl1mk4r7-lua-5.2.4/bin/lua: error loading module 'justenoughicu' from file './core/justenoughicu.so':
libicuio.so.69: cannot open shared object file: No such file or directory
stack traceback:
[C]: in ?
[C]: in function 'require'
./core/utilities.lua:496: in main chunk
[C]: in function 'require'
./core/sile.lua:40: in main chunk
[C]: in function 'require'
...a272cdbvayq834axmlq1439zhkirl-sile-0.11.1-flake/bin/sile:36: in main chunk
[C]: in ? Any idea what's up with that? It seems like they should be the same thing since my local branch is what is in this PR branch right now. |
No idea :/ Did you try perhaps using |
Woohoo @doronbehar @alerque , worked for me now!!! 🎉 ❤️ Both |
@doronbehar oh, sweet, the $ nix run .
warning: Git tree '/home/akavel/prog/sile' is dirty
SILE v0.11.1-dirty-flake (Lua 5.2)
>
$ git stash
Saved working directory and index state WIP on pr1231.04: 789be0b4 fixup! feat(tooling): Enable use as a Nix flake
$ nix run .
SILE v0.11.1-789be0b4-flake (Lua 5.2)
> |
Yes I tried that. Playing with it some more now, it seems that the trouble is the working directory I was in has a built version of SILE — built on my host system, Arch Linux. If I blow that away with ¹ |
- Use flake-compat for shell.nix and default.nix compatibility. - Use builtins.fetchGit to fetch libtexpdf instead of relying on the submodule.
src = builtins.filterSource | ||
(path: type: type != "directory" || baseNameOf path != ".git") | ||
./.; |
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.
git clean -dxff -e node_modules -e .fonts -e .sources -e .husky
Perhaps we should filter these files as well right here?
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 don't think that will help, if $CWD
is still set to the project directory when it is actually run it won't matter what was or wasn't copied into the Nix build, SILE will still prefer local resources to it's distribution ones. This is intentional so that users can override virtually anything in the system, but it does make the assumption that any resources in $CWD
should be usable.
In any case this is a developer only problem and I'm not too worried about it. I've scheduled this for merge so I can test it out on the SILE website before tagging a release. We can issue any adjustments for more developer convenience in a follow-up.
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.
As @ctrlcctrlv noted, this is really the same as #1212. I'm not sure what the solution should even be (maybe nothing), but lets move discussion there.
That is also the root cause of #1212, but just affecting you this time and not me. 😆 |
One thing that bothers me, is that the |
Use
flake-compat
forshell.nix
anddefault.nix
compatibility.Currentlynix build -L
doesn't work, due to the fonts not available in the source, and they can't be downloaded in the sandbox.