Skip to content

Calling mkFlake iteratively #263

Open
@Alxandr

Description

Hello, I'm trying to refactor my flake into was is effectively subflakes (though with shared lock/inputs). I'm basically just trying not to have to deal wth multiple git repositories if I can avoid it, due to the added maintainance overhead that brings. I planned to effectively make these "stages" such that I have 00-base, and 01-nixos. My plan was to do something like this (pseudocode):

let
  base = mkFlake { inherit inputs; } (import ./01-base);
  nixos = mkFlake { inputs = inputs // { inherit base; }; } (import ./02-nixos);
in
  mkFlake { inputs = inputs // { inherit base nixos; }; } (import ./config)

However, this very quickly leads to infinite recursion. Another thing that's stumped me, is that while I can do { home-manager, ... }: {} as a module in all 3 mkFlake invocations, I can't do { base, ... }: {}.

I've gone through the issues here that deal with dogfooding, and while that's pretty similar, I would really like to be able to produce multiple stages to make the dependencies much more explicit (and hopefully enforced). I'm however unable to get something like this to work, so I need some guidance.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions