# Flake questions

**URL:** https://discourse.nixos.org/t/flake-questions/8741
**Category:** Help
**Created:** [August 24, 2020, 2:42pm UTC](https://discourse.nixos.org/t/flake-questions/8741 "2020-08-24T14:42:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![danieldk](https://discourse.nixos.org/user_avatar/discourse.nixos.org/danieldk/32/31405_2.png) [@danieldk](https://discourse.nixos.org/u/danieldk)
#### Post date: [August 24, 2020, 2:42pm UTC](https://discourse.nixos.org/t/flake-questions/8741/1 "2020-08-24T14:42:04Z")

</div>

I have made my first serious foray into flakes. Converting my system configuration was easy. Converting my home-manager configuration into a flake is almost done (though a bit more work due to use of some external package sets and overlays).

Along the way, I bumped into two questions. The following toy flake

```nix
{
  description = "Test flake";

  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system}; 
      in {
        packages = {
          foo.hello = pkgs.hello;
          bar.hello = pkgs.hello;
        };
      }
    );
}

```

Fails `flake check` with

```auto
flake attribute 'packages.aarch64-linux.foo' is not a derivation
(use '--show-trace' to show detailed location information)

```

I checked the `flake check` source and it seems that the `packages` attrset should always have derivations as the values. I know you can rename the attribute from `packages` to `legacyPackages` and the check passes fine.

On to my first question: does that mean that once we switch to non-legacy packages, flakes can never have derivations nested in another attribute set anymore? I currently have some applications for this, such as bundling Python packages similarly to `nixpkgs` and for bundling machine learning models together (e.g. in one repo the attribute `sticker2_models.nl-ud-20200824` would represent a Dutch sticker2 model from today).

If so, what replaces this? Should such nested derivations become flakes by themselves? Or will `legacyPackages` stick around for such purposes eternally (and if so, why would one use `packages` 😉 )?

* * *

The second question is quite different. I found the valid (according to `flake check`) [output attributes](https://nixos.wiki/wiki/Flakes#Output_schema) on the very helpful Wiki page. Now I am wondering where the home-manager configurations for my various machines should go. I don’t want to overload `nixosConfigurations`, because I would eventually like to merge my NixOS and home-manager repositories into one flake. Seems like something like `homeConfigurations` is missing?

---

<div class="post-metadata">

### Author: ![edolstra](https://discourse.nixos.org/user_avatar/discourse.nixos.org/edolstra/32/84_2.png) [@edolstra](https://discourse.nixos.org/u/edolstra)
#### Post date: [August 24, 2020, 4:23pm UTC](https://discourse.nixos.org/t/flake-questions/8741/2 "2020-08-24T16:23:10Z")

</div>

> does that mean that once we switch to non-legacy packages, flakes can never have derivations nested in another attribute set anymore?

Yes, that’s correct. The reason for banning nested sets is that they make it impossible to efficiently query the set of packages. (E.g. a program like `hydra-eval-jobs` has to evaluate every job in `hydraJobs` just to figure out what jobs exist.)

> If so, what replaces this?

There’s currently no replacement, so if you really need nested sets, you should stick with `legacyPackages`.

---

<div class="post-metadata">

### Author: ![danieldk](https://discourse.nixos.org/user_avatar/discourse.nixos.org/danieldk/32/31405_2.png) [@danieldk](https://discourse.nixos.org/u/danieldk)
#### Post date: [August 24, 2020, 5:19pm UTC](https://discourse.nixos.org/t/flake-questions/8741/3 "2020-08-24T17:19:23Z")

</div>

Thanks! Then I’ll try to stick to `packages` where possible and use `legacyPackages` in exceptional cases.
