haumea icon indicating copy to clipboard operation
haumea copied to clipboard

Confirm paths, and import depth

Open bashfulrobot opened this issue 1 year ago • 0 comments

Hi there, I think I have a misunderstanding on how Haumea works.

I have:

tree src/.
src/.
├── archetype
│   └── workstation.nix
├── modules
│   ├── betterbird.nix
│   └── firefox.nix
└── suites
    └── office.nix

flake.nix:

{
<snipped>

  inputs = {

    haumea = {
      url = "github:nix-community/haumea/v0.2.2";
      inputs.nixpkgs.follows = "nixpkgs";
    };
<snipped>

  };

  outputs = inputs@{ self, nixpkgs, home-manager, nixos-hardware, haumea, ... }:
    with inputs;
    let
      nixpkgsConfig = { overlays = [ ]; };
     
    in {

      lib = haumea.lib.load {
        src = ./src;
        inputs = { inherit (nixpkgs) lib; };
      };

      nixosConfigurations = {
      <snipped>
      };
    };
}

Then for the workstation.nix I have something like:

{ config, pkgs, lib, ... }:
let cfg = config.archetype.workstation;
in {
  config = lib.mkIf cfg.enable {

    suites = {
      office.enable = true;
    };

  };
}

and for office.nix I have:

{ config, pkgs, lib, ... }:
let cfg = config.suites.office;
in {
  config = lib.mkIf cfg.enable {

    programs = {
      firefox.enable = true;
      betterbird.enable = true;
    };

  };
}

and just as an example, for firefox.nix:

{ config, pkgs, lib, ... }:
let
    cfg = config.programs.firefox;
in
 {
  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [ firefox ];
  };
}

So my impression was that all of my files in my src folder would be imported.

And then by enabling the configs I had created using lib.mkIf I would be able to enable the configurations I wanted.

So my flow is essentially:

flake.nix --> imports all files in src --> workstation.nix --> office.nix --> firefox.nix

But when I rebuild I get:

error: The option `archetype' does not exist. Definition values:
       - In `/nix/store/i9czzb50vfnr1l1y7l6jzm89f8xiwnzp-source/systems/rembot/config':
           {
             workstation = true;
           }

Which makes me think the auto importing works different than I thought. Any tips? Is there another way I should be calling the options?

and with regards to the src file, how many folders deep will nix files be imported? Just one layer deep? Thank you for your time.

bashfulrobot avatar May 08 '24 05:05 bashfulrobot