!yUrHuDcxUngfTlDbiy:matrix.org

flakelight

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

Load older messages


SenderMessageTime
21 Mar 2024
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:02:53
24 Mar 2024
@psvo:matrix.org@psvo:matrix.org joined the room.23:06:35
@accelbread:matrix.orgaccelbread cmacrae: Not sure about how to make crane not filter deps; might have to open an issue there. Been busy, apologies for late reply
Looking into using nocargo as well, seems better, though may need some work to make it usable
23:10:26
@accelbread:matrix.orgaccelbread Do you have an example of how the file is included? is it include_str! or include_bytes!? or is Cargo.toml somehow importing it? 23:41:43
@accelbread:matrix.orgaccelbreadYeah with include_str/bytes, I'm getting expected behavior of just the fileset applying, so unsure how to reproduce the issue23:56:44
25 Mar 2024
@cmacr.ae:matrix.orgcmacraeno need for apologies! I wasn't expecting anything :) I've had to switch focus to some other stuff for now, so will go spelunking with Nix/Rust stuff then 👍️ definitely curious about nocargo14:29:29
27 Mar 2024
@vicenzogiuseppe:matrix.orgVicenzo Giuseppe joined the room.09:04:01
29 Mar 2024
@sebtm:lodere.esSebTM joined the room.05:40:41
4 Apr 2024
@lunik1:lunik.onelunik1 joined the room.22:02:37
5 Apr 2024
@lunik1:lunik.onelunik1 👋 I've been porting my nixos+home-manager config to flakelight and thought you would like a little feedback from somebody who has been using nix and flakes for a while but is new to flakelight.

Overall, it has been a great experience. Everything works, (well, builds) and flakelight provides a lot of functionality that I had had to half hack together hand half get-around-to-eventually for very little effort.

The biggest surprise for me was that the pkgs for NixOS and home-manager configurations do not automatically contain the overlays specified at the top level with withOverlays and the config in nixpkgs.config. I think it would be useful to have this explicitly documented and an example of how to pass them to nixosConfigurations and homeConfigurations.

I also struggled a little with how to add packages from other flakes which were not exposed as overlays. Ultimately, I added an overlay like
          (self: super: { lunik1-nur = import inputs.lunik1-nur { pkgs = super; }; })
to add an NUR package set and
          (self: super: { nix-wallpaper = super.inputs'.nix-wallpaper.packages.default; })
to add a package from another flake. I think these should be pretty common use-cases, so might be worth giving an example in the documentation?

Excited to try out nixDir next, as it should remove more or less the last remnants of boilerplate from my flake.nix. Thanks for putting flakelight together!
20:12:44
@lunik1:lunik.onelunik1 👋 I've been porting my nixos+home-manager config to flakelight and thought you would like a little feedback from somebody who has been using nix and flakes for a while but is new to flakelight.

Overall, it has been a great experience. Everything works, (well, builds) and flakelight provides a lot of functionality that I had had to half hack together hand half get-around-to-eventually for very little effort.

The biggest surprise for me was that the pkgs for NixOS and home-manager configurations do not automatically contain the overlays specified at the top level with withOverlays and the config in nixpkgs.config. I think it would be useful to have this explicitly documented and an example of how to pass them to nixosConfigurations and homeConfigurations.

I also struggled a little with how to add packages from other flakes which were not exposed as overlays. Ultimately, I added an overlay like
(self: super: { lunik1-nur = import inputs.lunik1-nur { pkgs = super; }; })
to add an NUR package set and
(self: super: { nix-wallpaper = super.inputs'.nix-wallpaper.packages.default; })
to add a package from another flake. I think these should be pretty common use-cases, so might be worth giving an example in the documentation?

Excited to try out nixDir next, as it should remove more or less the last remnants of boilerplate from my flake.nix. Thanks for putting flakelight together!
20:12:56
6 Apr 2024
@lunik1:lunik.onelunik1 Something I'm struggling a bit with now: I would like to use nixDir and have a NixOS configuration in each file, but I have some modules in my inputs I would like to add to each NixOS configuration. Currently, I add those modules by mapping
nixosOptions' // {
                modules = nixosOptions'.modules ++ nixosModules;
              };
(where nixosModules is a lit of the extra nixos modules), but I don't think this can be done with nixDir. Can this be done without just adding those modules to each config individually?
13:20:56
@accelbread:matrix.orgaccelbreadHey, thanks for reaching out! I appreciate hearing back For, withOverlays and NixOS, you'd either have to use the short form (where flakelight calls nixosSystem for you) or pass propagationModule Theres a line here (https://github.com/nix-community/flakelight/blob/a55ef9097613d99f293a532356d67b8ba8aff37f/API_GUIDE.md?plain=1#L959); I'll see about making it clearer. I'll add an example for it too. For packages from other flakes' packages outputs, I'll add some docs/examples as well 22:03:35
@accelbread:matrix.orgaccelbread * Hey, thanks for reaching out! I appreciate hearing back For, withOverlays and NixOS, you'd either have to use the short form (where flakelight calls nixosSystem for you) or pass propagationModule Theres a line here (https://github.com/nix-community/flakelight/blob/a55ef9097613d99f293a532356d67b8ba8aff37f/API_GUIDE.md?plain=1#L959); I'll see about making it clearer. I'll add an example for it too. For packages from other flakes' packages outputs, I'll add some docs/examples as well 22:03:53
@accelbread:matrix.orgaccelbread For sharing module configuration between nixos systems, you could make nixos/default.nix in your nixDir and have that add the config to each system 22:05:59
@accelbread:matrix.orgaccelbreadLet me get an example real quick22:06:06
@accelbread:matrix.orgaccelbread * Hey, thanks for reaching out! I appreciate hearing back For, withOverlays and NixOS/home-manager, you'd either have to use the short form (where flakelight calls nixosSystem/homeManagerConfiguration for you) or pass propagationModule to the function yourself Theres a line here (https://github.com/nix-community/flakelight/blob/a55ef9097613d99f293a532356d67b8ba8aff37f/API_GUIDE.md?plain=1#L959); I'll see about making it clearer. I'll add an example for it too. For packages from other flakes' packages outputs, I'll add some docs/examples as well 22:08:31
@accelbread:matrix.orgaccelbread

Assuming ./nix as nixDIr,

./nix/nixos/default.nix can be:

{ flakelight, lib, inputs, ... }:
let
  addCommonCfg = prev: {
    modules = prev.modules or [ ] ++ [ inputs.some-flake.nixosModules.default ];
  };
in
lib.mapAttrs (_: addCommonCfg) (flakelight.importDir ./.)

and that will add some-flake.nixosModules.default to all you nixos systems, assuming you define your nixos systems something like follows:

./nix/nixos/machineA/default.nix (or ./nix/nixos/machineA.nix):

{
  system = "x86_64-linux";
  modules = [
    ./configuration.nix
    ./mqtt-broker.nix
    { system.stateVersion = "22.11"; }
  ];
}

22:21:01
@accelbread:matrix.orgaccelbread *

Assuming ./nix as nixDIr,

./nix/nixos/default.nix can be:

{ flakelight, lib, inputs, ... }:
let
  addCommonCfg = prev: {
    modules = prev.modules or [ ] ++ [ inputs.some-flake.nixosModules.default ];
  };
in
lib.mapAttrs (_: addCommonCfg) (flakelight.importDir ./.)

and that will add some-flake.nixosModules.default to all you nixos systems, assuming you define your nixos systems something like follows:

./nix/nixos/machineA/default.nix (or ./nix/nixos/machineA.nix):

{
  system = "x86_64-linux";
  modules = [
    ./configuration.nix
    { system.stateVersion = "22.11"; }
  ];
}

22:21:12
@accelbread:matrix.orgaccelbread Or as another option, you can add inputs.self.nixosModules.common to each of your system, and import your common modules there
I do that for my config here:
https://github.com/accelbread/config-flake/blob/ae52725fd660af550d66750707d649082786e332/nix/nixos/solace/configuration.nix#L5
https://github.com/accelbread/config-flake/blob/ae52725fd660af550d66750707d649082786e332/nix/nixosModules/common.nix#L7
22:24:30
@accelbread:matrix.orgaccelbreadIMO the latter is cleaner with importing common config, but if you want to not have common lines, the former works too. Whichever you like the best22:27:49
@accelbread:matrix.orgaccelbread lunik1: LMK if that helps; I might be able to give better advice if you have the code available somewhere as well 22:36:41
@accelbread:matrix.orgaccelbread *

Assuming ./nix as nixDIr,

./nix/nixos/default.nix can be:

{ flakelight, lib, inputs, ... }:
let
  addCommonCfg = prev: prev // {
    modules = prev.modules or [ ] ++ [ inputs.some-flake.nixosModules.default ];
  };
in
lib.mapAttrs (_: addCommonCfg) (flakelight.importDir ./.)

and that will add some-flake.nixosModules.default to all you nixos systems, assuming you define your nixos systems something like follows:

./nix/nixos/machineA/default.nix (or ./nix/nixos/machineA.nix):

{
  system = "x86_64-linux";
  modules = [
    ./configuration.nix
    { system.stateVersion = "22.11"; }
  ];
}

22:42:27
@accelbread:matrix.orgaccelbread * Or as another option, you can add inputs.self.nixosModules.common to each of your system, and import your common modules there
I do that for my config here:
https://github.com/accelbread/config-flake/blob/ae52725fd660af550d66750707d649082786e332/nix/nixosModules/common.nix#L7
https://github.com/accelbread/config-flake/blob/ae52725fd660af550d66750707d649082786e332/nix/nixos/solace/configuration.nix#L5
22:43:47
@lunik1:lunik.onelunik1My code is here https://gitlab.com/lunik1/nix-config/-/tree/flakelight23:29:28
@lunik1:lunik.onelunik1
In reply to@accelbread:matrix.org
Hey, thanks for reaching out! I appreciate hearing back For, withOverlays and NixOS/home-manager, you'd either have to use the short form (where flakelight calls nixosSystem/homeManagerConfiguration for you) or pass propagationModule to the function yourself Theres a line here (https://github.com/nix-community/flakelight/blob/a55ef9097613d99f293a532356d67b8ba8aff37f/API_GUIDE.md?plain=1#L959); I'll see about making it clearer. I'll add an example for it too. For packages from other flakes' packages outputs, I'll add some docs/examples as well
I could have sworn when I did this that the nixos config immediately complained about nonfree packages, indicating the config had not been carried over. I will take another look.
23:31:04
@lunik1:lunik.onelunik1 Those options for the common config look good. Is flakelight.importDir documented anywhere? I don't remember seeing it. 23:32:07
7 Apr 2024
@lunik1:lunik.onelunik1
In reply to@lunik1:lunik.one
I could have sworn when I did this that the nixos config immediately complained about nonfree packages, indicating the config had not been carried over. I will take another look.
Here's a mwe of the issue
{
  inputs = {
    flakelight = {
      url = "github:nix-community/flakelight";
    };
  };

  outputs = { flakelight, ... }:
    flakelight ./. {
      nixpkgs.config.allowUnfree = true;

      nixosConfigurations = {
        host = {
          system = "x86_64-linux";
          modules = [
            {
              boot.loader.grub.device = "/dev/sda";
              fileSystems."/" = {
                device = "/dev/sda";
                fsType = "xfs";
              };
              hardware.enableAllFirmware = true;
            }
          ];
        };
      };
    };
}
This system configuration fails to build with
       Failed assertions:
       - the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files.
         This requires nixpkgs.config.allowUnfree to be true.
         An alternative is to use the hardware.enableRedistributableFirmware option.
00:02:23
@accelbread:matrix.orgaccelbreadYeah importDir is not documented yet; I need to add a section of lib functions. It does the same thing autoimport with nixDir would do00:03:48
@accelbread:matrix.orgaccelbreadAh yeah, the overlays are carried over currently but not config Hmm Propagating config probably makes sense, yeah Can add that00:05:26

Show newer messages


Back to Room ListRoom Version: 10