Skip to content

BUG (maybe question): static nested includes are ignored in one step after static include but parametric are not #483

@nukdokplex

Description

@nukdokplex

here are portions of my actual nix config

host declaration

{ __findFile, ... }:
{
  den.hosts.x86_64-linux.sleipnir = {
    description = "big desktop";
    isDesktop = true;
    users.nukdokplex = { # <---- user automatically includes den.aspects.nukdokplex
      isPrimaryUser = true;
      agenixGeneratedPassword = false;
    };
  };

  den.aspects.sleipnir = {
    includes = [
      <my/gaming>
      <my/media-tools/desktop>
      <my/office>
    ];
  };
}

user aspect declaration

{ __findFile, ... }:
{
  den.aspects.nukdokplex = {
    includes = [
      <my/parametric-user>
      <my/yazi>
      <my/yazi/default-fm>
      <my/zsh>
      <nukdokplex/xdg-userdirs>
      <nukdokplex/desktop> # <------ this is where problem begins
      <nukdokplex/general>
    ];
  };
}

desktop subaspect declaration

{ __findFile, lib, ... }:
{
  den.aspects.nukdokplex._.desktop =
    { host, ... }: # <----------- as you can see it is parametric aspect
    {
      includes = lib.optionals (host.isDesktop or false) [ # <------------ host is used for conditional includes
        <my/dev-tools>
        <my/foot>
        <my/nixvim>
        <my/ripgrep>
        <my/ssh-agent>
        <my/yazi/desktop> # <------problematic aspect
        <my/obs-studio>
        <nukdokplex/bitwarden>
        <nukdokplex/desktop-apps>
        <nukdokplex/firefox>
      ];
    };
}

here is step one of static include

{ __findFile, ... }:
{
  my.yazi = {
    description = "Provides yazi (filemanager)";

    homeManager = {
      programs.yazi = {
        enable = true;
      };
    };

    nixos =
      { pkgs, ... }:
      {
        environment.systemPackages = with pkgs; [
          yazi
        ];
      };

    includes = [
      <my/yazi/custom-shell>
      <my/yazi/fr>
      <my/yazi/lazygit>
      <my/yazi/office>
      <my/yazi/ouch>
      <my/yazi/spot-audio>
      <my/yazi/spot-cbz>
      <my/yazi/spot-image>
      <my/yazi/spot-video>
      <my/yazi/spot>
      <my/yazi/webp-conversion>
    ];

    provides.desktop = { # <----------- as you can see this is static aspect
      includes = [
        <my/yazi/gvfs> # <-------- for example lets take this aspect
        <my/yazi/wl-clipboard>
        <my/yazi/dragon-drop>
      ];
    };
  };
}

my/yazi/gvfs aspect

{ inputs, ... }:
{
  flake-file.inputs.yazi-gvfs = {
    type = "github";
    flake = false;
    owner = "boydaihungst";
    repo = "gvfs.yazi";
  };

  my.yazi.provides.gvfs = # <----- as you can see it is also a static aspect
    {
      homeManager =
        { lib, ... }:
        {
          programs.yazi = {
            # actual config is very long, it was reduced
            plugins.gvfs = inputs.yazi-gvfs; # <---- there you can see config adds plugin here
          };
        };
    };
}

on evaluating this produces config with programs.yazi.plugins ? gvfs = false. homeManager config is not applied.

BUT, when we make this aspect parametric, it is applied fine:

{ inputs, ... }:
{
  flake-file.inputs.yazi-gvfs = {
    type = "github";
    flake = false;
    owner = "boydaihungst";
    repo = "gvfs.yazi";
  };

  my.yazi.provides.gvfs = { ... }: # <----- make aspect parametric
    {
      homeManager =
        { lib, ... }:
        {
          programs.yazi = {
            # actual config is very long, it was reduced
            plugins.gvfs = inputs.yazi-gvfs; # <---- now programs.yazi.plugins ? gvfs = true, config is applied
          };
        };
    };
}

this is very strange behavior for me. is this intended?

PS: all aspects listed here were declared once in my config

den is 0.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions