Skip to content
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

Publishing this template to Overleaf #61

Closed
PalmaAnd opened this issue Jan 29, 2024 · 21 comments · Fixed by #90
Closed

Publishing this template to Overleaf #61

PalmaAnd opened this issue Jan 29, 2024 · 21 comments · Fixed by #90
Assignees

Comments

@PalmaAnd
Copy link

Hello!
I was wondering if you ever thought of publishing this project/template to Overleaf so people can use it there as a template?

Thanks for the answer in advance!

@matsavage
Copy link
Owner

I had it working on overleaf a couple of years ago, but for whatever reason it doesn't seem to work any more.

It's certainly possible to get it up and running there, but I've never really been able to keep it in sync, as £17/month for the git integration feels a bit much, so I have no way of testing that it currently works.

There has been a lot of work put into the Nix build system by @soispha, and it's really quite painless to run locally now, once you have Nix installed, or if you fork the repository and allow GitHub actions to run, there is an action which will build the latex files for you result.zip at the bottom here will show an example.

@PalmaAnd
Copy link
Author

Oh okay I understand. I get the problem with the sync, £17/month is a lot.
I will try either Nix or GitHub actions, thank you very much for the fast and helpful answer! :)

@matsavage
Copy link
Owner

Let me know how it goes. It would be great to have some feedback/a more genuine set up guide.

Also this is quite a complex document and compilation on overleaf was very slow, so it’s never really real-time, but I do get the allure of just being able to edit on a webpage.

@PalmaAnd
Copy link
Author

PalmaAnd commented Jan 29, 2024

Sure, I can give it a try and add it to my to-do list! 👍🏻
Yeah, it's really convenient, but as soon as I have some free time, I'll attempt to set this up locally.
Do you have any recommendations for the setup? I was thinking about using WSL2 to run everything as it works with that too according to the NIX documentation.
Also, if I encounter any problems or complications during the installation, may I open a pull request with some additional to-dos?

May you assign this issue to me so I have it on my list? :)

@matsavage
Copy link
Owner

I use WSL when I'm on a windows machine, and it's very good, but is obviously a huge hurdle for most people.

I just use the standard Ubuntu image then install Nix with the script on their site.

Feel free to ask for more help/raise issues as they come up etc.

@PalmaAnd
Copy link
Author

Alright gotcha! Thanks, then I will try to install it in my WSL (I have some experience with it)

I will come back to that offer thanks!

@PalmaAnd
Copy link
Author

Sorry for the long pause, I kinda get stuck when executing nix build --experimental-features 'nix-command flakes'
I keep getting the following error in my WSL:

warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled
error: builder for '/nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv' failed with exit code 127;
       last 5 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/r3mc3ja4w4j9v1w3q3jazlw9krp0dcdz-gg9xin9f2wk7w6412jprabawzn9rysa0-source
       > source root is gg9xin9f2wk7w6412jprabawzn9rysa0-source
       > Running phase: patchPhase
       > /nix/store/bknngadwym46j65qs14ic2w79rpav888-stdenv-linux/setup: line 1582: $'\r': command not found
       For full logs, run 'nix log /nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv'.
error: 1 dependencies of derivation '/nix/store/z5bkfa5j2xvlb56y57llsp3vidjvbj4r-characters-all.drv' failed to build

Could be a stupid question but I don't really know what to do as I am fairly new with custom LateX stuff and never used NIX too.

Can anyone help me with this?
Using Ubuntu 22.04

@matsavage
Copy link
Owner

matsavage commented Feb 27, 2024

Can you run the log command and paste the output please

nix log /nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv

Also can you confirm this also happens when running make build

@PalmaAnd
Copy link
Author

PalmaAnd commented Feb 27, 2024

Thanks for the quick reply!

Log output:

nix log /nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv  --experimental-features 'nix-command flakes'
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv^*'
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/r3mc3ja4w4j9v1w3q3jazlw9krp0dcdz-gg9xin9f2wk7w6412jprabawzn9rysa0-source
source root is gg9xin9f2wk7w6412jprabawzn9rysa0-source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
/nix/store/bknngadwym46j65qs14ic2w79rpav888-stdenv-linux/setup: line 1582: $'\r': command not found

When running make build I get the following:

error: builder for '/nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv' failed with exit code 127;
       last 5 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/r3mc3ja4w4j9v1w3q3jazlw9krp0dcdz-gg9xin9f2wk7w6412jprabawzn9rysa0-source
       > source root is gg9xin9f2wk7w6412jprabawzn9rysa0-source
       > Running phase: patchPhase
       > /nix/store/bknngadwym46j65qs14ic2w79rpav888-stdenv-linux/setup: line 1582: $'\r': command not found
       For full logs, run 'nix log /nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv'.
error: 1 dependencies of derivation '/nix/store/z5bkfa5j2xvlb56y57llsp3vidjvbj4r-characters-all.drv' failed to build
make: *** [Makefile:6: build] Error 1

@matsavage
Copy link
Owner

So the same as with make build and the other way, so at least that's consistent.

May I ask how you cloned the repo? in WSL or windows based git client? I haven't seen this issue before, but I wonder if it's something to do with the encoding of linux vs. mac

@PalmaAnd
Copy link
Author

I'm not really sure neither. I will try a complete clean install of nix, followed by git cloning the repo and then trying it again 👍🏻

@matsavage
Copy link
Owner

matsavage commented Feb 28, 2024 via email

@PalmaAnd
Copy link
Author

PalmaAnd commented Feb 29, 2024

Alright so I completely deleted the existing project, uninstalled nix via sudo rm -rf /nix/ inside WSL, and then reinstalled it as described on their page with sh <(curl -L https://nixos.org/nix/install) --no-daemon for single user installation.
Then I cloned my fork via https://github.com/PalmaAnd/DND-5e-LaTeX-Character-Sheet-Template.git and now after I cd into the project and run make I get the following error again:

nix --extra-experimental-features nix-command --extra-experimental-features flakes build
error: builder for '/nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv' failed with exit code 127;
       last 5 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/r3mc3ja4w4j9v1w3q3jazlw9krp0dcdz-gg9xin9f2wk7w6412jprabawzn9rysa0-source
       > source root is gg9xin9f2wk7w6412jprabawzn9rysa0-source
       > Running phase: patchPhase
       > /nix/store/bknngadwym46j65qs14ic2w79rpav888-stdenv-linux/setup: line 1582: $'\r': command not found
       For full logs, run 'nix log /nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv'.
error: 1 dependencies of derivation '/nix/store/z5bkfa5j2xvlb56y57llsp3vidjvbj4r-characters-all.drv' failed to build
make: *** [Makefile:6: build] Error 1

When running nix log /nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv --extra-experimental-features nix-command I get the same log as before...

warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/fz8zpd6ipc807w1yrn1xn86ibyczkw4l-characters-example_2-dnd-char-sheet-1.0.drv^*'
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/r3mc3ja4w4j9v1w3q3jazlw9krp0dcdz-gg9xin9f2wk7w6412jprabawzn9rysa0-source
source root is gg9xin9f2wk7w6412jprabawzn9rysa0-source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
/nix/store/bknngadwym46j65qs14ic2w79rpav888-stdenv-linux/setup: line 1582: $'\r': command not found

I can't find anything, maybe it is some small configuration I made at some point in time in WSL?

Sorry for the spam and these long logs and all that 😅

Ohh I think I found it... looks like a issue with bash and the \r command. I will look into it further and send an update ASAP

@soispha
Copy link
Contributor

soispha commented Mar 1, 2024

Ohh I think I found it... looks like a issue with bash and the \r command.

This seems really weird to me (as your fork builds fine for me). Would you like to show me the line from the setup script that fails (in your example line 1582)?

@matsavage
Copy link
Owner

matsavage commented Mar 1, 2024 via email

@PalmaAnd
Copy link
Author

PalmaAnd commented Mar 4, 2024

Sure, this is the code snippet:

if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then return; fi
    if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then return; fi
    if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then return; fi
    if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then return; fi
    if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then return; fi
    if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then return; fi
    if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then return; fi

    if [[ -n $NIX_LOG_FD ]]; then
        echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&"$NIX_LOG_FD"
    fi

    showPhaseHeader "$curPhase"
    dumpVars

    local startTime=$(date +"%s")

    # Evaluate the variable named $curPhase if it exists, otherwise the
    # function named $curPhase.
    eval "${!curPhase:-$curPhase}"

    local endTime=$(date +"%s")

    showPhaseFooter "$curPhase" "$startTime" "$endTime"

    if [ "$curPhase" = unpackPhase ]; then
        # make sure we can cd into the directory
        [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}"

        cd "${sourceRoot:-.}"
    fi

The eval "${!curPhase:-$curPhase}" is the problem here
Thank you both very much for all the time and help 😅

@soispha
Copy link
Contributor

soispha commented Mar 5, 2024

Could it be that the $curPhase variable contains a \n\r line ending? Because that could mean that bash tries to evaluate the command after the \n, which being a \r doesn't work.
But the flake.nix file does not contain any carriage returns on my local checkout of your fork, and you haven't changed it locally, have you?

@PalmaAnd
Copy link
Author

Okay, sorry for the long pause dos2unix ./* fixed the problem, or at least I got into the building phase I finally was able to execute the following without an error:

nix --extra-experimental-features nix-command --extra-experimental-features flakes build
warning: Git tree '/home/andre/projects/DND-5e-LaTeX-Character-Sheet-Template' is dirty
[1/1/3 built, 0.0 MiB DL] building characters-unnamed-dnd-char-sheet-1.0 (buildPhase): unnamed.xdv -> unnamed.pdf

I will post an update soon, just got a lot to do with university atm sorry

@matsavage
Copy link
Owner

matsavage commented Mar 11, 2024 via email

@matsavage
Copy link
Owner

Also, that shouldn’t be an issue, you should have files at results/ nix just likes you to have your changes committed when you run.

@matsavage
Copy link
Owner

matsavage commented Jun 1, 2024

I did manage to get Overleaf compilation working, but there is more to do if that's also going to use the DND template: #90

@matsavage matsavage linked a pull request Jun 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants