nickel-lang/organist

Document what does and does not work?

Opened this issue · 4 comments

leeola commented

I'm trying to understand how much of Nix can currently be replaced Nickel and any blockers that would prevent me from integrating at least some of Nickel into my actual Nix configurations. Notably, this comment:

It is currently missing several basic features.

Is a bit difficult to understand. I suspect there's two important key points:

  1. What features of Nix becomes impossible when using Nickel-Nix, if any?
  2. What features of Nix can i write fully in Nickel-Nix?

I imagine documenting this is best done through examples, maybe paired with a readme to guide from one example to the next. Happy to help if i can, but given that i'm currently exploring this as a user with no knowledge of how it works, i'm more on the receiving side. At least until this makes sense to me, if at all heh.

Any thoughts? Better ways to achieve new user documentation, etc?

leeola commented

Related, documenting the requirements on the Nix side. For example, both the example and the How to use section do not work for me. Probably warrant their own dedicated issue(s), but for explanation:

The example just starts with nix build --impure, running that fails with:

user ~/n/e/c-hello-world (main)> nix build --impure
warning: Using saved setting for 'extra-substituters = https://nickel-nix.cachix.org' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = nickel-nix.cachix.org-1:/Ziozgt3g0CfGwGS795wyjRa9ArE89s3tbz31S6xxFM=' from ~/.local/share/nix/trusted-settings.json.
warning: ignoring untrusted substituter 'https://nickel-nix.cachix.org'
error: attribute 'flake' missing

       at /nix/store/w3yq728isc1m8wxp2rqczk35ipr9ix8z-source/examples/c-hello-world/flake.nix:13:5:

           12|   outputs = {nickel-nix, ...} @ inputs:
           13|     nickel-nix.flake.outputsFromNickel ./. inputs {};
             |     ^
           14| }

Likewise, trying to list the dev shells which is the first command to run in the root Readme, results in:

user ~/n/e/c-hello-world (main)> nix flake show github:nickel-lang/nickel-nix
github:nickel-lang/nickel-nix/75c65b2909567252ab347cc0fec839d5dce5d472
├───apps
│   ├───aarch64-darwin
error: not an app definition

This is on NixOS using Flakes. Nix CLI version nix (Nix) 2.11.1. I imagine this is due to some mismatch of version from the expected, but the lack of documentation indicating a required version makes this difficult to implement.

leeola commented

Updated to NixOS 23.05 and nix cli nix (Nix) 2.15.1, still approximately the same errors.

About the example: it contains flake.lock file that must point to old version of nickel-nix itself. Please try to update nickel-nix input in it.

About features: I don't think nickel-nix is ready for full blown packaging in Nickel, unless you're ready to reimplement all nixpkgs frameworks in it. We pass Nix objects into Nickel world and back, and we're very limited in what we can pass. For example, we cannot pass closures (functions, callbacks) that are wildly used in nixpkgs.

There's an effort to document a vision for the project in #82 that could give you some insight into what will be possible in the future.

leeola commented

About the example: it contains flake.lock file that must point to old version of nickel-nix itself. Please try to update nickel-nix input in it.

That worked! For googlers, i ran nix flake lock --update-input nickel-nix and nix run .#regenerate-lockfile.

About features: I don't think nickel-nix is ready for full blown packaging in Nickel, unless you're ready to reimplement all nixpkgs frameworks in it. We pass Nix objects into Nickel world and back, and we're very limited in what we can pass. For example, we cannot pass closures (functions, callbacks) that are wildly used in nixpkgs.

Yea this (with examples) is exactly what is missing from documentation, imo. Though with this i'm still a bit unclear on what NickelNix can do. Shame that Nix can't run from some intermediate static config format (JSON/etc) that Nickel could then just compile to.

For context i'd be looking to replace my Nix system configuration with Nickel. I'm very unclear on where the interop occurs, but at the very least i imagine Home Manager would pose issues. I am not currently trying to distribute Nickel as a package for Nix users. Not that it makes much of a distinction when compared to system configuration, probably.

What are some use cases for Nickel Nix as it is usable today? I see devShells and i have them working locally, though i'm unsure how big the gulf is between devshell flakes and system flakes (nixosConfiguration/home manager/etc). Thoughts?