| 8 Jun 2026 |
accelbread | { outputs, ... }: {
modules = builtins.attrValues outputs.nixosModules ++ [
{
mystuff.test.enable = true;
nixpkgs.hostPlatform = "x86_64-linux";
}
];
}
for your nixos config would work
| 17:02:23 |
accelbread | hmm i can see about how to make that ergonomic | 17:02:41 |
accelbread | though outside of nixpkgs itself, a lot of modules I've seen do not use an enable option and just add their settings | 17:03:19 |
inomena | yeah that works, but it's boilerplate I hoped this lib had auto wiring for :) | 17:03:50 |
inomena | or opt-in atleast | 17:04:12 |
accelbread | potentially could have something that gets added to each nixosConfig | 17:04:20 |
accelbread | and could add it there | 17:04:23 |
inomena | I'm migrating from snowfall-lib, which has this kind of auto wiring out of the box | 17:04:59 |
accelbread | I think adding an opt-in setting to autoimport all modules makes sense | 17:06:20 |
accelbread | im thinking if its possible to detect whether a module is "well-behaved" | 17:08:29 |
accelbread | so it could be automatic | 17:08:52 |
inomena | i.e. if it outputs a config object it would just be imported, but if it doesn't then it won't? | 17:18:14 |
inomena | I would like to auto load "misbehaving" modules too :P | 17:18:30 |
accelbread | makes sense | 17:22:26 |
inomena | * I would like to auto import "misbehaving" modules too :P | 17:23:33 |
accelbread | maybe like flakelight.autoImportModules = ["*"] for everything, and flakelight.autoImportModules = ["nixos/*"] for just nixos ones | 17:23:56 |
inomena | yeah that could work | 17:24:13 |
accelbread | nixos/home-manager will be easy. would need to export some machinery for flakelight-darwin to use | 17:25:06 |
accelbread | flakelightModules may be tricky but imo makes sense too | 17:25:29 |
inomena | was not expecting this to also load modules from external flakes (like flakelightModules), I tend to import them within a module that does something with them (like I have a sops module for sops-nix that'd deal with sops stuff) | 17:27:33 |
inomena | * was not expecting this to also load modules from external flakes (like flakelightModules), I tend to import them within a module that does something with them (like I have a sops module for sops-nix that'd deal with sops stuff, disko module that imports disko's module and does stuff, etc) | 17:28:00 |
inomena | Redacted or Malformed Event | 17:28:48 |
inomena | * like this snippet from a module I have for disko:
{ lib, config, inputs, ... }:
let
cfg = config.flake.disks;
in {
options.flake.disks = {
device = lib.mkOption {
type = lib.types.str;
default = "";
};
};
config = lib.mkIf cfg.device != "" {
imports = [
inputs.disko.nixosModules.disko
];
disko.devices.disk.root = {
device = cfg.device;
type = "disk";
content = {
| 17:28:59 |
inomena | oh neat, matrix code blocks support ligatures | 17:29:27 |
accelbread | yeah i meant flakelightModules in same flake. for exporting extensions to flakelight | 17:29:59 |
| 13 Jun 2026 |
inomena | one problem I found with this is that it's not recursive, i.e. only top-level modules are imported | 15:43:06 |
accelbread | what do you mean by that? like modules stored in subdirs? | 19:00:32 |
inomena | yeah exactly, I've got a pattern where I group/nest modules based on their context, i.e. I have a desktop module, within that module I have a gnome module, etc | 20:39:57 |
inomena | to be explicit; nix/nixosModules/desktop/default.nix, nix/nixosModules/desktop/gnome/default.nix, etc | 20:41:16 |
| 14 Jun 2026 |
accelbread | Ah yeah, since the schema of nixosModules is an attrset, the loading logic is to load nix/nixosModules as attrs; it'll load desktop/default.nix as "desktop" | 21:12:00 |