!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

897 Members
182 Servers

Load older messages


SenderMessageTime
10 Nov 2023
@mib:kanp.aimib 🥐 if you e.g. wanted to get config from some other module, you'd be unable to since you can't see the fully built config (the config variable that modules usually have access to) 13:44:35
@industrial:matrix.orgIndustrialOkay13:46:38
@mib:kanp.aimib 🥐

if you wanna go about it like this, you could e.g. have a bunch of modules (like you do), but define a top-level configuration option for all your stuff, i.e.

nixosConfigratuinon = {
  langhus = lib.nixosSystem {
    modules = [
      /* all your modules */
      # ...
      # and then a host-specific module
      ./hosts/langhus
    ];
  };
};

then ./hosts/langhus/default.nix:

{ ... }: {
  options.config = {
    hostname = "langhus"; /* although tbh you should just set `networking.hostName` and if you need to refer to it elsewhere use `config.networking.hostName` */
    /* etc */
  };
}
13:47:06
@mib:kanp.aimib 🥐 *

if you wanna go about it like this, you could e.g. have a bunch of modules (like you do), but define a top-level configuration option for all your stuff, i.e.

nixosConfigratuinon = {
  langhus = lib.nixosSystem {
    modules = [
      ./hosts/langhus
      /* the rest of your modules */
    ];
  };
};

then ./hosts/langhus/default.nix:

{ ... }: {
  options.config = {
    hostname = "langhus"; /* although tbh you should just set `networking.hostName` and if you need to refer to it elsewhere use `config.networking.hostName` */
    /* etc */
  };
}
13:47:56
@mib:kanp.aimib 🥐 *

if you wanna go about it like this, you could e.g. have a bunch of modules (like you do), but define a top-level configuration option for all your stuff, i.e.

nixosConfigratuinon = {
  langhus = lib.nixosSystem {
    modules = [
      ./hosts/langhus
      /* the rest of your modules */
    ];
  };
};

then ./hosts/langhus/default.nix:

{ ... }: {
  options.custom = {
    hostname = "langhus"; /* although tbh you should just set `networking.hostName` and if you need to refer to it elsewhere use `config.networking.hostName` */
    /* etc */
  };
}

then your networking is imported just like all the other ones, but defined as

{ config, ... }: {
  networking.networkmanager.enable = true;
  networking.hostName = config.custom.hostname;
}
13:49:22
@industrial:matrix.orgIndustrial
In reply to@mib:kanp.ai

if you wanna go about it like this, you could e.g. have a bunch of modules (like you do), but define a top-level configuration option for all your stuff, i.e.

nixosConfigratuinon = {
  langhus = lib.nixosSystem {
    modules = [
      ./hosts/langhus
      /* the rest of your modules */
    ];
  };
};

then ./hosts/langhus/default.nix:

{ ... }: {
  options.custom = {
    hostname = "langhus"; /* although tbh you should just set `networking.hostName` and if you need to refer to it elsewhere use `config.networking.hostName` */
    /* etc */
  };
}

then your networking is imported just like all the other ones, but defined as

{ config, ... }: {
  networking.networkmanager.enable = true;
  networking.hostName = config.custom.hostname;
}
Seems like I can't define options.custom = {} nor custom = {} in the ./hosts/langhus/default.nix.
14:01:46
@industrial:matrix.orgIndustrial Should I use pkgs.lib.mkOption there? 14:03:46
@mib:kanp.aimib 🥐 When you're doing options you're making an option, so use mkOption 14:09:45
@mib:kanp.aimib 🥐 When you're configuring them ie custom = {}, just set them as you'd normally do. 14:10:15
@petrichor:envs.net@petrichor:envs.net If you just want to put a value somewhere to share with other modules, you can do lib.custom = { hostname = "langhus"; }; for example 14:19:56
@mib:kanp.aimib 🥐 * When you're configuring them a'la custom = {}, just set them as you'd normally do. 15:15:12
@industrial:matrix.orgIndustrialOh. okay :D16:27:32
@pfz4:zettoit.eupaul / pfz4 joined the room.16:46:06
11 Nov 2023
@ngn999:matrix.org@ngn999:matrix.org changed their profile picture.07:14:18
@ngn999:matrix.org@ngn999:matrix.org changed their profile picture.07:14:26
@orowith2os:fedora.imOro (any/all) changed their display name from Dallas Strouse (she/her) 🧑‍🏫 to Rika (she/her).14:29:47
@brian:bmcgee.ie@brian:bmcgee.ie joined the room.19:53:06
13 Nov 2023
@greg:matrix.burd.meGreg Burd changed their profile picture.15:41:45
@fractivore:cyberia.club@fractivore:cyberia.clubSo as far as whether flakes are regarded as stable... I mean I know I had to get past multiple warnings that they were unstable / experimental before using them. From that standpoint they're definitely treated as experimental .17:18:07
@marie:marie.cologne@marie:marie.cologne joined the room.17:57:18
15 Nov 2023
@grahamc:nixos.org@grahamc:nixos.orgchanged room power levels.15:54:38
@grahamc:nixos.org@grahamc:nixos.org left the room.15:54:38
@qyliss:fairydust.space@qyliss:fairydust.space joined the room.17:10:20
@qyliss:fairydust.space@qyliss:fairydust.space left the room.17:49:42
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:13:14
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:13:14
@eisfunke:eisfunke.com@eisfunke:eisfunke.com changed their profile picture.22:41:03
16 Nov 2023
@linus:schreibt.jetzt@linus:schreibt.jetzt joined the room.05:53:37
@eva:blahaj.nyceva 10:40:28
@captainpip:matrix.orgcaptainpip joined the room.17:37:09

Show newer messages


Back to Room ListRoom Version: 6