tazjin/nixery

Flakes

lorenzleutgeb opened this issue · 4 comments

Awesome project! I just wanted to create this issue for you so that you don't forget about flakes. At the moment GitHub finds 614 flake.nix files, and that number can be expected to rise over time. It would be interesting to be able to request a package from any flake.

Nixpkgs then would just be one special (and maybe the default) flake. Instead of specifying NIXERY_PKGS_PATH the user could specify a flake.lock file, or a flake, that has all "whitelisted" flakes as inputs.

As an example, applying the following jq filter to flake.lock for a project that has two flakes as inputs:

.nodes | del(.root) | to_entries[] | select(.value.flake != false)
{
  "key": "glittershark",
  "value": {
    "locked": {
      "lastModified": 1601913964,
      "narHash": "sha256-7h0sAx9MRa4EN6DkaaEIh1G/5s834l19hpNhIf1Sx+M=",
      "owner": "glittershark",
      "repo": "nixpkgs",
      "rev": "674c9afb727e4558e3b6162bb164e847606b105c",
      "type": "github"
    },
    "original": {
      "owner": "glittershark",
      "ref": "graalvm-ce",
      "repo": "nixpkgs",
      "type": "github"
    }
  }
}
{
  "key": "nixpkgs",
  "value": {
    "locked": {
      "lastModified": 1602230526,
      "narHash": "sha256-3/ucBPYg42P+1ji5/7q227Ek/Eq2C7zeiB9sZl5UpIY=",
      "owner": "NixOS",
      "repo": "nixpkgs",
      "rev": "0b8799ecaaf0dc6b4c11583a3c96ca5b40fcfdfb",
      "type": "github"
    },
    "original": {
      "id": "nixpkgs",
      "ref": "nixos-20.09",
      "type": "indirect"
    }
  }
}

Thanks for filing this issue. Flakes are currently an experimental feature that has (to my knowledge) no in-progress RFC for becoming stable, since the original RFC was closed.

If this changes I'll look at the topic, but it's also worth noting that for experimental use-cases you should be able to use flake-compat and point Nixery at a git repository with appropriate Nix configuration to use your flakes.

My org is using a heavily flake-driven workflow, with many automation-created flake tags (eg, nightly builds) that it would be great to be able to reference from Nixery, eg:

buildah from nixery.company.com/outerScope.innerScope.packageName:2.26.0-20220912023445-0

It's also now in the process of stabilization (they spoke about it at NixCon)

I've faced the same requirement and put together a prototype which is basically a webserver frontend for dockerTools.streamLayeredImage. It's not as flexible as Nixery but allows to specify container images inside flake.nix files which are then served. See https://github.com/elohmeier/flakehub.
I'm currently using it to provide custom container images to a development Kubernetes (k3s) cluster.