!yUrHuDcxUngfTlDbiy:matrix.org

flakelight

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

Load older messages


SenderMessageTime
12 Jun 2025
@accelbread:matrix.orgaccelbreadyeah, for that you'd need to grab the other module from outside the module definition. Are these in your nix.nixosModules directory?02:07:57
@accelbread:matrix.orgaccelbread* yeah, for that you'd need to grab the other modules from outside the module definition. Are these in your nix.nixosModules directory?02:08:07
@accelbread:matrix.orgaccelbreadyou could also use relative paths for the modules02:08:19
@hezhenxing:matrix.orgZhenxing He Yes, they are in the nix/nixosModules directory of the first flake, but I want to use then in the second flake02:12:10
@accelbread:matrix.orgaccelbread ahh, then instead of imports = [ inputs.self.nixosModules.other-module ], imports = [ ./other-module.nix ] probably works. 02:13:44
@accelbread:matrix.orgaccelbread * ahh, then instead of imports = [ inputs.self.nixosModules.other-module ], imports = [ ./other-module.nix ] should work. 02:14:38
@hezhenxing:matrix.orgZhenxing HeJust tried, relative path seems to work, thanks! How to solve the reference problem with extra inputs used in the first flake?02:17:24
@hezhenxing:matrix.orgZhenxing Hefor example, I added home-manager inputs in the first flake and used in some of the modules, but they will cause error when used in the second flake, which only added my first flake as inputs.02:18:27
@hezhenxing:matrix.orgZhenxing HeHmm, found a solution, use inherit (myfirstflake) inputs; instead of inherit inputs; seems solve the problem, but I don't know if this is the right solution.02:21:29
@accelbread:matrix.orgaccelbreadfor that you want the first flake to export a flakelightModule. that modules can add its inputs as default values for inputs02:26:45
@accelbread:matrix.orgaccelbreadhttps://github.com/accelbread/flakelight-rust/blob/2e3d11f991c235eb7d499da301245bff1c323610/flake.nix#L1802:27:45
@accelbread:matrix.orgaccelbreadlike this02:27:53
@accelbread:matrix.orgaccelbreadthis lets the consumer flake's input be used if set, and fall back to the imported flake's input02:29:04
@hezhenxing:matrix.orgZhenxing HeThat's cool! thank you!02:30:02
@hezhenxing:matrix.orgZhenxing He It seems when add imports = [flakelight.flakelightModules.flakelightModule], the auto imports will stop working, no nixos/home modules be automatically loaded, how can I turn auto import on in this case? 09:11:39
@accelbread:matrix.orgaccelbread Ah, that module sets nixDir to .. You shouldn't need that module though 14:18:00
@hezhenxing:matrix.orgZhenxing HeOh, yes, change nixDir back works, could you please explain why set nixDir to . in that module?21:34:30
@accelbread:matrix.orgaccelbreadthat specific module is intended for repos that just export a flakelight module, like flakelight-rust, so it sets that since not much point in the folder in a nix-only repo22:52:12
@hezhenxing:matrix.orgZhenxing HeI am not quite sure if my understanding is correct, but I think it should be reasonable and convenient to support both, as in my case, I'd like to use the flakelightModule feature so that the user of my flake will only need to add one input, no need to also add flakelight or home-manager, etc. and at the same time, I can add hosts and test in my flake directly, without the need of another flake.23:31:18
@accelbread:matrix.orgaccelbreadi think theres some confusion here; those are two different things23:39:35
@accelbread:matrix.orgaccelbread you dont need the flakelight.flakelightModules.flakelightModule module for that 23:40:49
@accelbread:matrix.orgaccelbread

lets say a flake named flakeA wants to set a default input named aaa and flakeB wants to use it.

flakeA sets:

flakelightModule = { lib, ... }: {
    inputs.aaa = lib.mkDefault aaa;
}

flakeB sets imports = [ flakeA.flakelightModules.default ];

23:45:58
@accelbread:matrix.orgaccelbread* lets say a flake named flakeA wants to set a default input named aaa and flakeB wants to use it. flakeA sets: ``` flakelightModule = { lib, ... }: { inputs.aaa = lib.mkDefault aaa; } ``` flakeB sets: ``` imports = [ flakeA.flakelightModules.default ]; ``` 23:47:16
@accelbread:matrix.orgaccelbreadthat should be all that is needed23:48:13
@hezhenxing:matrix.orgZhenxing He

What if I wont to be able to do something like this in flakeB:

{
  inputs.flakeA.url = "/path/to/flakeA";
 outputs = inputs: inputs.flakeA ./. {};
}
23:51:31
@hezhenxing:matrix.orgZhenxing He *

What if I want to be able to do something like this in flakeB:

{
  inputs.flakeA.url = "/path/to/flakeA";
 outputs = inputs: inputs.flakeA ./. {};
}
23:51:52
@hezhenxing:matrix.orgZhenxing Heand in flakeB, it will get default for inputs.aaa and others.23:53:20
@hezhenxing:matrix.orgZhenxing He *

What if I want to be able to do something like this in flakeB:

{
  inputs.flakeA.url = "/path/to/flakeA";
  outputs = inputs: inputs.flakeA ./. { inherit inputs; };
}
23:54:40
13 Jun 2025
@hezhenxing:matrix.orgZhenxing He

in flakeA, I did something like this:

{
  inputs = {...};
  outputs = inputs:
    flakelight ./. {
      imports = [
        flakelight.flakelightModules.flakelightModule
        ./myfeature.nix
      ];
      flakelightModule = {lib, ...}: {
        imports = [./myfeature.nix];
        inputs.flakelight = lib.mkDefault flakelight;
        inputs.home-manager = lib.mkDefault home-manager;
     };
   };
}
00:42:36
@hezhenxing:matrix.orgZhenxing HeAnd it seems work as expected, but I am not sure if this is the right way to go.00:44:38

Show newer messages


Back to Room ListRoom Version: 10