How to import a part of a set

Hello,
i would like to split up my dconf settings into multiple files so i can organize it easier.
My current setup looks like this:

.
├── configuration.nix
├── hardware-configuration.nix
├── home
│   ├── dconf
│   │   ├── blur-my-shell.nix
│   │   └── default.nix
│   ├── default.nix
│   ├── firefox.nix
│   ├── fish.nix
│   ├── git.nix
│   ├── gnome-shell.nix
│   ├── gtk.nix
│   ├── kitty.nix
│   └── vscodium.nix
└── system
    ├── default.nix
    ├── printing.nix
    └── scanning.nix

home/dconf/default.nix:

{
  "org/gnome/desktop/peripherals/mouse" = {
    speed = 0.5;
    accel-profile = "flat";
  };
  "org/gnome/desktop/interface" = {
    enable-hot-corners = false;
    color-scheme = "prefer-dark";
  };
  "org/gnome/mutter" = {
    center-new-windows = true;
  };
  "org/gnome/desktop/wm/preferences" = {
    button-layout = "appmenu:minimize,maximize,close";
    resize-with-right-button = true;
  };
  "org/gnome/shell" = {
    favorite-apps = [
      "org.gnome.Console.desktop"
      "org.gnome.Nautilus.desktop"
      "firefox.desktop"
      "codium.desktop"
    ];
    welcome-dialog-last-shown-version = "46.2";
  };
}

home/dconf/blur-my-shell.nix:

{
  "org/gnome/shell/extensions/blur-my-shell" = {
    settings-version = 2;
  };

  "org/gnome/shell/extensions/blur-my-shell/dash-to-dock" = {
    pipeline = "pipeline_default_rounded";
  };

  "org/gnome/shell/extensions/blur-my-shell/lockscreen" = {
    pipeline = "pipeline_default";
  };

  "org/gnome/shell/extensions/blur-my-shell/overview" = {
    pipeline = "pipeline_default";
  };

  "org/gnome/shell/extensions/blur-my-shell/panel" = {
    pipeline = "pipeline_default";
  };

  "org/gnome/shell/extensions/blur-my-shell/screenshot" = {
    pipeline = "pipeline_default";
  };
}

I don’t know how i can import the content of the dconf files into the default file.

import ./blur-my-shell.nix needs something to assign to as far as i understand and the imports = [./blur-my-shell]; gives me

    error: A definition for option `home-manager.users.redacted.dconf.settings.imports' is not of type `attribute set of (GVariant value)'. Definition values:
       - In `/etc/nixos/configuration.nix':
           [
             /etc/nixos/home/dconf/blur-my-shell
           ]

Thanks in advance

The nix language has the // operator, which joins attrsets together.

So you could do something like this in your default.nix file:

{
  "foo" = ...;
  "bar" = ...;
} // import ./blur-my-shell.nix

Though if you want to separate the files further, my personal recommendation would be to have default.nix only contain imports and other files would have the actual values.
So you could move the current default.nix to base.nix and create a new default.nix that only has

import ./base.nix // import ./blur-my-shell.nix // import ./some-other-file.nix

You could write a more generic function but I think this should be fine for not too many files.

thanks! yes i wanted to split up the default.nix into multiple files. I was just starting out and noticed i don’t know how :smiley: