glif icon indicating copy to clipboard operation
glif copied to clipboard

Add Nix flake support

Open jakeisnt opened this issue 2 years ago • 8 comments

This helps anyone who uses NixOS or nix get started with a development environment seamlessly. If someone has nix and direnv installed, upon entering this repository they'll have a development environment with the exact versions of rust and all of the system packages necessary to build the repo.

It:

  • Exposes a development shell with all system and rust dependencies configured
  • Adds a glif-test command adhering to the suggested cargo run command in the README for testing the package
  • Enables nix builds of the glif package, which can then be pulled into other packages

I put this together to get glif to run on my end; merge if others would use, OK to close if not.

jakeisnt avatar Dec 24 '22 21:12 jakeisnt

If you do this then probably these files belong in a new repo, MFEK/flake.nix. I can create it for you and leave it empty if you want me to.

ctrlcctrlv avatar Dec 24 '22 21:12 ctrlcctrlv

Oh and last thought. MFEK's IPC uses --version and $PATH only to find its fellow modules so there's nothing special you have to do besides put all those binaries in the NixOS $PATH.

ctrlcctrlv avatar Dec 24 '22 21:12 ctrlcctrlv

I would suggest a flake in each of those other repositories, then depend on them from the flake in this repository. Having a "parking" repository just for a combined flake kind of defeats the purpose and expected usage.

alerque avatar Dec 24 '22 21:12 alerque

Oh, I see. Well, I still think a parking repository makes sense, as even though this is the org's most popular project, it's not the "root" module in any sense. You can use MFEKstroke / MFEKpathops / MFEKmetadata without it just fine.

But perhaps that actually makes this easier for @jakeisnt. If he adds a flake to MFEKmetadata, and makes this rely on that, I'll consider that enough to merge this. (That's the only IPC-checked dependency at current.)

ctrlcctrlv avatar Dec 24 '22 21:12 ctrlcctrlv

Agree that the flake-per-repo approach is more reasonable, as it allows developers to make use of nix shell environments. On it!

jakeisnt avatar Dec 24 '22 21:12 jakeisnt

Thanks! Sorry for my ignorance of NixOS :-)

If there's enough interest I'll make MFEK/flake.nix myself after merging this and the MFEKmetadata PR.

ctrlcctrlv avatar Dec 24 '22 21:12 ctrlcctrlv

Agree that the flake-per-repo approach is more reasonable, as it allows developers to make use of nix shell environments.

Do you think that the idea of having an MFEK/flake.nix with all the binary tools isn't useful then?

The best supported installation method, if you can even call it one, is basically that:

  • https://github.com/MFEK/docs/blob/c792f7cfb61b5c4cb583b14128800cc8f6022a68/blob/pull_all_modules.sh
    • [pull_all_modules.sh] +MFEKpathops https://github.com/MFEK/docs/commit/c792f7cfb61b5c4cb583b14128800cc8f6022a68

ctrlcctrlv avatar Dec 25 '22 02:12 ctrlcctrlv

Marked as draft as blocked on https://github.com/MFEK/metadata/pull/139#issuecomment-1364631789 (see subsequent comment on potential fix).

ctrlcctrlv avatar Dec 26 '22 21:12 ctrlcctrlv