Hi,
I'm sorry that I missed the point that flakes are not so prevalent as it
looks in some communities. 😔 To be brief, a /flake
<https://nix.dev/manual/nix/2.22/command-ref/new-cli/nix3-flake>/ is a
directory or a (sub-dir of some) git repository that contains a
`flake.nix`, whose content is then an /attribute set/(similar to JSON
/object/) consisting of
1. An `inputs` attribute that specifies whatever the evaluation of the
flake might need, loosely or strictly, git repo or not, flake or not.
And the most typical cases are like
```
|inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";|
|```
|
|where `nixpkgs-unstable` is the branch to use.|
|2. An `outputs` attribute that gives whatever the user might need from
this flake. Typically some packages (/derivations/), but could also
contain some shell or system environments.
|
|3. An optional `||nixConfig||` attribute that specifies some behaviors
of Nix itself during the evaluation.|
|4. And an optional flake description.|
|During evaluation, Nix will generate a JSON file named `flake.lock`,
which stores the exact revisions of the dependencies, just like the
output of `guix describe -f channels`. The lock file is not mandatory.
You can delete it whenever you want an update, and the next invoking of
`nix build` or something on the flake directory will just generate a new
one that conforms what's written in `inputs` while being as up-to-date
as possible to the upstream. This mechanism allows imperative updating a
program set while not breaking the "rough" specification of
dependencies, and is especially useful in system management (for that
/Nix channels <https://nix.dev/manual/nix/2.22/command-ref/nix-channel>
/and /lookup paths
<https://nix.dev/manual/nix/2.22/language/constructs/lookup-path> /are
not needed anymore, and both the reproducibility and the flexibility get
increased).|
|In comparison to this, Guix rely on `use-modules` of Guile, which
specifies nothing but some symbols and searches the corresponding
modules either directly from the environment or from the /time machine/,
which refer to exact revisions of the channels. Another choice is the
inferiors. Again, they refer directly to the revisions, not branches,
let alone arbitrary source urls. Reproducible as they are, the UX is not
so smooth and simple. So I wonder if there's some approaches that can
deal with this.|
|rczb/
/|
on 2024/6/5 2:03, Simon Tournier wrote:
Hi,
On Tue, 28 May 2024 at 00:37, ‪肖 海帆‬<rc...@outlook.com> wrote:
So, is there any mechanism of Guix analog to, or trick in Guile to
imitate the functionalities of flakes? Or is there a possibility for
this?
It’s hard to tell – at least from my understanding – because each time
people ask for Flakes, they assume we know what it is or they explain
using the vocabulary of Nix which, for what it is worth, I am not
familiar. That’s said, then…
The best step is to describe – using Guix terminology – the Flake
feature, IMHO. :-)
Cheers,
simon