!yUrHuDcxUngfTlDbiy:matrix.org

flakelight

43 Members
https://github.com/nix-community/flakelight12 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
9 Jun 2025
@sigmasquadron:matrix.orgFernando Rodrigues joined the room.13:14:45
11 Jun 2025
@hezhenxing:matrix.orgZhenxing He joined the room.09:41:35
@hezhenxing:matrix.orgZhenxing HeHi, How can I extend flakelight to support a new way of configuring nixos system. For example, I want to add a new directory hosts under nix directory, and also adding some new attributes not current supported. I think I need to add some new options for the host configuration and functions to convert the host configuation to nixos configuration supported by flakelight, but I don't have a clue how to do this. Any help would be greatly appreciated!09:49:20
@hezhenxing:matrix.orgZhenxing HeAlso thank you for the great work, I'm new to nix, flakelight is the best flake module library I found.09:52:52
@accelbread:matrix.orgaccelbreadHi, that should totally be possible. I'll put together a quick example15:18:23
@accelbread:matrix.orgaccelbread

In your flake.nix you can import a module that adds your options (can also just directly add but a module is probably cleaner):

{
  inputs.flakelight.url = "github:nix-community/flakelight";
  outputs = { flakelight, ... }:
    flakelight ./. {
      imports = [ ./nix/flakelightModules/my_module.nix ];
    };
}

Then in your module file, you can add options and config using them (same as for nixos or home-manager modules but setting the flakelight options):

{ config, lib, src, flakelight, ... }:
let
  inherit (lib.types) lazyAttrsOf any;
in
{
  options = {
    hosts = mkOption {
      type = lazyAttrsOf any;
      default = {};
    };
  };

  config = {
    nixosConfigurations = fnThatConvertsHostsToNixosConf config.hosts;
  };
}

17:24:56
@accelbread:matrix.orgaccelbread this adds a hosts option to flakelight. The loading from ./nix/hosts will work automatically. 17:25:54
@accelbread:matrix.orgaccelbread * this adds a hosts option to flakelight. The loading from ./nix/hosts/ will work automatically. 17:26:03
@accelbread:matrix.orgaccelbreadTheres some docs on using the Nix module system here: https://nixos.org/manual/nixos/stable/#sec-writing-modules Also looks like some docs here: https://nix.dev/tutorials/module-system/index.html17:29:15

Show newer messages


Back to Room ListRoom Version: 10