-
Notifications
You must be signed in to change notification settings - Fork 409
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
Compiling website in other folder #800
Comments
Does https://robertwpearce.com/hakyll-pt-1-setup-and-initial-customization.html#configuration-rules help in any way? Using |
I guess it helps a bit, but the problem is that each time we want to compile the website to another directory, we need to rebuild the Haskell code. Of course, we can ask the user to manually parse the command line arguments to fill the configuration, but I'd say it would be better if this could be included directly in the default `hakyll` command (it already parses the arguments to check which function to run).
I can try to do a PR when I've some time if you like.
|
Well, I'm simply passing by and far from being an expert when it comes to both haskell and hakyll so I'll let the maintainers decide if it's worth the effort. Keep in mind that if changing the directory is not a common event it's easier to recompile. Also, parsing the command line myself and building the |
@tobiasBora As a middle ground, you can supply the path via an environment variable, which you read at the start of |
+1 to this issue. And I would rather not rely on the user setting their Configuration correctly |
@Radvendii I never used Nix flakes. Looks like a wrapper over the user's Cabal project? Can you explain why a user would want to build from different directories depending on the context? |
A Nix Flake is a kind of recipe that tells you how to compile a given project and package it for the Nix package manager. It is particularly nice to use: for example you can compile and run a project using a single line:
You don't even need to clone locally the project (of course you can if you plan to develop locally), or install any dependency (except of course the Nix package manager, with Flake support): everything is done automatically. It is also extremely reproducible (Flake pins all dependencies), and it can be particularly useful if you want a common environment between all developpers, or if you want to use it to deploy your website automatically using a CI solution. So if I understand correctly (correct me if I'm wrong), Radvendii is building a kind of library that allows you to automatically compile and package for Nix a Hakyll website in a few lines (and I do think it is useful, I came up with writting the same kind of code myself). Concerning the fact that Radvendii wants to compile from different directories depending on the context, the thing is that Nix can also be used during development (if you don't go into development mode, you will not be able to benefit from caching between builds). Therefore, in development mode, you usually want to compile the current directory normally. However, when you compile an external project (for example using Also, it makes a lot of sense to separate the executable from the website-src, since you could use a single executable to create many different website (a bit like you just have one executable in @Radvendii : do you plan to also put a way to only compile the executable, but let the user use it as he want: either in another flake, or use it directly if the user do not plan to package its website but plans to use the executable of someone else? Also, sorry for answering at your place, feel free to correct me if I did not get your point. |
Okay, I think I understand the use-case now, but I still disagree that these options make sense for Hakyll. The comparison to Hugo is misguided: Hugo follows a "convention over configuration" pattern, i.e. it has a fixed layout which all sites follow. That's what enables Hugo to have a single binary which is configured at runtime (via a file). Hakyll, on the other hand, is first and foremost a library, and each site is a snowflake, with its own layout and configuration. So no, in general it doesn't make that much sense to separate the executable from the website-src. They're intertwined. Specifically, every site has its own deployment command, which obviously will mention the destination directory (the default "_site" or whatever the user specified in |
Hey, sorry for the delay. @tobiasBora has most of it right, but it's actually kind of the opposite. Nix indeed copies the source directory into a
I've realized though, two things:
@tobiasBora as to your question: Yes, the function provides two packages: "builder" (which is just the compiled haskell / hakyll code) and "website", which then also uses the builder to compile the site. It should all be explained in the readme. Also, if you have any suggestions for the project based on your experience, I'm all ears. @Minoru I haven't actually used hakyll deployment command at all personally, so I didn't think about it. I'll have to think about how to integrate that into hakyll-flake-gen. |
Hello,
I'm discovering this great tool, but I've an issue. I'd like to write a script that compiles a website that is not in the current folder (I'd like the current folder to contain the final website, usually in
_site
. Indeed, because I usenix
, the source folder is write-only.Would it be possible to compile with something like:
Or if it's already possible to do that with some workaround, could you describe/document them please?
The text was updated successfully, but these errors were encountered: