!yUrHuDcxUngfTlDbiy:matrix.org

flakelight

45 Members
https://github.com/nix-community/flakelight13 Servers

Load older messages


SenderMessageTime
9 Apr 2026
@piquu:matrix.orgpiqu
In reply to @accelbread:matrix.org
what do you mean by importing files?
I mean when you use it with import-tree
16:31:30
@accelbread:matrix.orgaccelbreadnot sure what thats doing, but in flakelight you can set all the options by loading files from nixDir17:51:18
27 Apr 2026
@ninja:worldethicaldataforum.orgNinja joined the room.15:04:07
29 Apr 2026
@wibblyfrog:toadstool.onlinewibblyfrog joined the room.00:41:44
1 May 2026
@wibblyfrog:toadstool.onlinewibblyfrog left the room.19:37:46
26 May 2026
@sweatkroket:matrix.org@sweatkroket:matrix.org left the room.14:18:44
6 Jun 2026
@worldsgonemad:matrix.orgWorldsGoneMad joined the room.19:55:13
8 Jun 2026
@inomena:matrix.orginomena joined the room.16:18:19
@inomena:matrix.orginomena

hey, having some trouble getting started with flakelight for my nixos configuration, if someone could point me in the right direction;
my flake.nix:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-26.05";

    flakelight = {
      url = "github:nix-community/flakelight";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = { flakelight, ...} @ inputs: flakelight ./. {
    inherit inputs;
  };
}

nix/nixos/vm/default.nix:

{
  modules = [
    {
      mystuff.test.enable = true;

      nixpkgs.hostPlatform = "x86_64-linux";
    }
  ];
}

nix/nixosModules/test.nix:

{ lib, config, ... }:
let
  cfg = config.mystuff.test;
in {
  options.mystuff.test = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
    };
  };

  config = lib.mkIf cfg.enable {
    boot.loader.grub.enable = true;
  };
}

I assumed this should be enough of a minimal example on how to get a module with options working, but I just get this error (i.e. from nix flake show):

error: The option `mystuff' does not exist. Definition values:
       - In `/nix/store/czgkz14jgyp1inif7gv3jf2rr0znmh3k-source/flake.nix':
           {
             test = {
               enable = true;
             };
           }
16:21:31
@inomena:matrix.orginomena

if I disable the definition of mystuff.test.enable I can see that the module loads just fine, so I'm unsure what's going on:

├───checks                                                                                                                                                                                                                                                                                             
│   ├───aarch64-linux                                                                                                                                                                                                                                                                                  
│   │   └───formatting omitted (use '--all-systems' to show)                                                                                                                                                                                                                                           
│   └───x86_64-linux                                                                                                                                                                                                                                                                                   
│       ├───formatting: derivation 'check-formatting'                                                                                                                                                                                                                                                  
│       └───nixos-vm: derivation 'check-nixos-vm'                                                                                                                                                                                                                                                      
├───formatter                                                                                                                                                                                                                                                                                          
│   ├───aarch64-linux omitted (use '--all-systems' to show)                                                                                                                                                                                                                                            
│   └───x86_64-linux: package 'formatter'                                                                                                                                                                                                                                                              
├───nixosConfigurations                                                                                                                                                                                                                                                                                
│   └───vm: NixOS configuration                                                                                                                                                                                                                                                                        
└───nixosModules                                                                                                                                                                                                                                                                                       
    └───test: NixOS module   
16:25:00
@accelbread:matrix.orgaccelbread if you nix flake show, you should have nixosModules.test 16:46:54
@inomena:matrix.orginomenaI do, see last block :)16:47:15
@accelbread:matrix.orgaccelbreadin your modules you'll want to import it16:47:30
@accelbread:matrix.orgaccelbreadso in the nixos config, you can add self.nixosModules.test16:48:04
@inomena:matrix.orginomenaI thought all modules were auto loaded16:48:24
@accelbread:matrix.orgaccelbreadthey are loaded into flake outputs16:48:43
@inomena:matrix.orginomenai.e. so I wouldn't have to import every single one16:48:44
@inomena:matrix.orginomena* i.e. so I wouldn't have to import every single one, one by one16:49:05
@accelbread:matrix.orgaccelbreadyou can put a line in your nixos config to import all of them16:49:15
@accelbread:matrix.orgaccelbreadbut generally, in flakes with multiple nixos configs, they may use different subsets16:50:17
@accelbread:matrix.orgaccelbread for the single nixos config flake, defs makes sense to do modules = self.nixosModules 16:51:00
@inomena:matrix.orginomenaI want all modules I create to be imported/available, as they will all have options to enable them (like nixpkgs modules do)16:51:01
@inomena:matrix.orginomena I'd want this for all nixos configs 17:00:15
@inomena:matrix.orginomenaand tbh the same thing for all home-manager configs too, for homeModules17:00:47
@accelbread:matrix.orgaccelbread
{ 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:matrix.orgaccelbreadhmm i can see about how to make that ergonomic17:02:41
@accelbread:matrix.orgaccelbreadthough outside of nixpkgs itself, a lot of modules I've seen do not use an enable option and just add their settings17:03:19
@inomena:matrix.orginomenayeah that works, but it's boilerplate I hoped this lib had auto wiring for :)17:03:50
@inomena:matrix.orginomenaor opt-in atleast17:04:12
@accelbread:matrix.orgaccelbreadpotentially could have something that gets added to each nixosConfig17:04:20

Show newer messages


Back to Room ListRoom Version: 10