Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm paths, and import depth #44

Open
bashfulrobot opened this issue May 8, 2024 · 0 comments
Open

Confirm paths, and import depth #44

bashfulrobot opened this issue May 8, 2024 · 0 comments

Comments

@bashfulrobot
Copy link

bashfulrobot commented May 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant