39aldo39 / klfc

Keyboard Layout Files Creator
GNU General Public License v3.0
215 stars 13 forks source link

Add support for working on this project with nix #33

Closed lf- closed 3 years ago

lf- commented 3 years ago

This uses a pinned git commit of nixpkgs-unstable to get GHC 8.10.4. haskell-language-server is supported in the dev shell (nix-shell from the repo root), although a wrapper script is necessary to get the editor to run the version from this project's configuration with all the right dependencies available.

An example of such a script is here:

nix-shell --run "haskell-language-server-wrapper $@"

You can also build the program with nix from any distro.

The upshot of this PR is that you can, if you have nix installed, install from source or work on this software in one command, utilizing binary caching to avoid having to build dependencies.

39aldo39 commented 3 years ago

Thank you for the PR! I don't use nix myself, but it looks fine to me. For the maintenance: am I right that a straightforward update script should be occasionally run? And that you, or someone else interested using nix, need to make an infrequent PR for this?

lf- commented 3 years ago

Thank you for the PR! I don't use nix myself, but it looks fine to me. For the maintenance: am I right that a straightforward update script should be occasionally run? And that you, or someone else interested using nix, need to make an infrequent PR for this?

Yes, although it is not critical: nobody will cry if their klfc dependencies don't get updates super fast. It is also possible to use the system version of nixpkgs, with the unfortunate loss of the guarantee that it will always build properly since our dependency versions wouldn't be known good values regardless of environment anymore.

Another thing we can do with this in the future is CI. See https://github.com/carnap/carnap for an example of a project using nix with a similar setup for CI. :)