hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
721 stars 41 forks source link

NixOS options not 1:1 available #179

Closed keidrych closed 7 months ago

keidrych commented 1 year ago

I'm on NixOS 23.05, and one of the changes was fonts.fonts became fonts.packages additionally fonts.enableDefaultPackages also triggers an error

There are no errors when using flakes normally with flake-parts, the following error occurs, the same if fonts.packages is used

error: The option `fonts.enableDefaultPackages' does not exist. Definition values:
       - In `/nix/store/fckpbv0vcld0h7j30540zwa8ji6d4gd1-source/flake.nix#nixosModules.default': true

It appears that flake-parts doesn't have access to the new options configuration used in 23.05 & is using the 22.11 or older options?

Below is code to reproduce this issue

{
  description = "LeFailure";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
    flake-parts = {
      url = "github:hercules-ci/flake-parts";
    };
  };

  outputs =
    inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } (top@{ moduleWithSystem, withSystem, ... }: {
      imports = [ ];
      systems = [ "x86_64-linux" ];
      flake = {
        nixosModules.default = moduleWithSystem
          (
            perSystem@{ config }: # NOTE: only explicit params will be in perSystem
            nixos@{ pkgs, ... }:
            {
              fonts = {
                fontDir.enable = true;
                enableDefaultPackages = true;
                packages = with pkgs; [
                  fira-code
                ];
              };
              imports = [
                ./configuration.nix
                ./hardware-configuration.nix
              ];
            }
          );

        nixosConfigurations.default = withSystem "x86_64-linux"
          (ctx@{ config, inputs', ... }:
            inputs.nixpkgs.lib.nixosSystem {
              specialArgs = inputs;
              modules = [
                top.config.flake.nixosModules.default
              ];
            }
          );
      };
    });
roberth commented 1 year ago

fonts.enableDefaultPackages

This seems to have been introduced after 23.05 when I look it up in search.nixos.org.

roberth commented 7 months ago

These releases are not supported anymore, and when you're doing inputs.nixpkgs.lib.nixosSystem in the example above there's really no way you don't get a NixOS from the Nixpkgs you specified in inputs at the top. If it does, it'd be a Nix bug. My earlier comment suggests a more plausible mechanism for the observations. I'll assume this is resolved, but I'll reopen this if you still experience a problem like this.