Skip to content

How to inherit from a snowfall flake? #179

@n0rad

Description

@n0rad

👋 ,
I would like to define some common things in a parent flake using snowfall that then can be used in a downstream flake (also using the lib in my case).

Some parts are working but I cannot get the whole think working for now, especially when it comes to the fact that the namespace, pretty helpful inside a flake, becomes a drawback in a downstream one.

{
  outputs = inputs:
   # inputs.parent.outputs // inputs.parent.inputs.snowfall-lib.mkFlake {
    inputs.parent.inputs.snowfall-lib.mkFlake {
      inputs = inputs.parent.inputs // inputs;
      src = ./.;
      snowfall.namespace = "my";
      systems.modules.nixos = [
        inputs.parent.nixosModules.module1
        inputs.parent.nixosModules.module2
      ];
    } ;

  #################################

  inputs = {
    parent = {
      url = "github:something/something";
    };
  };
}

different problems I found, but I think all are linked to the namespace:

  • modules in the parent are namespaced, but not when going in the output, making them hard to import in the downstream flake
  • modules are referencing each other by the namespace that is unknown to the downstream flake
  • packages in modules are referenced by the namespace, that is unknown when being the downstream flake, since it does not exists in the output

By hacking the output of the downstream flake I was able to import modules and packages from the parent, but the loss of the namespace makes it impossible to use them correctly as soon as there are references between modules.
Did somebody, with more knowledge than me on nix, have an idea on how to have, or rebuilding the namespace in a downstream flake?

Metadata

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