Skip to content

Question: Is it possible to share inputs through a pulic blueprint flake #120

@gaerfield

Description

@gaerfield

I have problems sharing a flake publicly and I'm not sure if I misunderstood the concept or if it's a bug.
I have a public flake like nixos-and-darwin-shared-homes that defines in the flake nix an additional input:

nix-index-database = {
  url = "github:nix-community/nix-index-database";
  inputs.nixpkgs.follows = "nixpkgs";
};

And a module that sets it up my-nix-index:

{ inputs, ... }: {
  imports = [
    inputs.nix-index-database.hmModules.nix-index
  ];
  # more config here
}

When pulling this public flake into my private flake:

my-public-flake = {
  url = "git+file:///home/user/my-public-flake";
  inputs.nixpkgs.follows = "nixpkgs";
};

and pulling it into one of my configurations:

{ inputs, ... }: {
  import = [
    inputs.my-public-flake.homeModules.my-nix-index
  ]
}

a nix flake check on this private repo will fail with:

       error: attribute 'nix-index-database' missing
       at /nix/store/yxndvw7rnr3l7vbchrvlv0fblch05b42-source/modules/home/my-nix-index/default.nix:5:15:
            4| {
            5|   imports = [  inputs.nix-index-database.hmModules.nix-index ];

How do I import a flake in my public flake so that is usable in a private one?

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