Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config for GA402X broken? #889

Open
codingCoffee opened this issue Mar 11, 2024 · 1 comment
Open

Config for GA402X broken? #889

codingCoffee opened this issue Mar 11, 2024 · 1 comment

Comments

@codingCoffee
Copy link

codingCoffee commented Mar 11, 2024

I'm trying to configure my Asus Zephyrus G14 GA402X laptop with viz this

Here is my flake.nix

{
  description = "my flake!";

  inputs = {
    nixpkgs = {
      url = "github:NixOS/nixpkgs/nixos-23.11";
    };

    nixos-hardware = {
      url = "github:NixOS/nixos-hardware/master";
    };
  };

  outputs = { self, nixpkgs, ... }@inputs:
    let
      lib = nixpkgs.lib;
    in
    {
      nixosConfigurations = {
        zephyrus = lib.nixosSystem {
          system = "x86_64-linux";
          specialArgs = {inherit inputs;};
          modules = [
            ./configuration.nix
            inputs.nixos-hardware.nixosModules.asus-zephyrus-ga402x
          ];
        };
      };
    };
}

Ref: picked up the config from

asus-zephyrus-ga402x = import ./asus/zephyrus/ga402x;

This is the error I'm facing

$ sudo nixos-rebuild switch --flake .
error:
       … while calling the 'seq' builtin

         at /nix/store/x06xw73q4lpsa83amgnyy1fmaark3pg3-source/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);while calling the 'throw' builtin

         at /nix/store/x06xw73q4lpsa83amgnyy1fmaark3pg3-source/lib/modules.nix:296:18:

          295|                     ''
          296|             else throw baseMsg
             |                  ^
          297|         else null;

       error: The option `amdgpu' does not exist. Definition values:
       - In `/nix/store/x06xw73q4lpsa83amgnyy1fmaark3pg3-source/flake.nix': <function, args: {config, lib, pkgs}>

I'm relatively new to nix, so is this some relative import problem? Or is my method of using nixos-hardware repo incorrect?

@codingCoffee
Copy link
Author

codingCoffee commented Mar 12, 2024

Dug a little deeper, realized the problem was in my config. I need to explicitly mention which GPU config I'd like to use.

# nixos-hardware.nixosModules.asus-zephyrus-ga402x.amdgpu

# nixos-hardware.nixosModules.asus-zephyrus-ga402x.nvidia

So, effectively my config became

{
  description = "my flake!";

  inputs = {
    nixpkgs = {
      url = "github:NixOS/nixpkgs/nixos-23.11";
    };

    nixos-hardware = {
      url = "github:NixOS/nixos-hardware/master";
    };
  };

  outputs = { self, nixpkgs, ... }@inputs:
    let
      lib = nixpkgs.lib;
    in
    {
      nixosConfigurations = {
        zephyrus = lib.nixosSystem {
          system = "x86_64-linux";
          specialArgs = {inherit inputs;};
          modules = [
            ./configuration.nix
            inputs.nixos-hardware.nixosModules.asus-zephyrus-ga402x.nvidia
          ];
        };
      };
    };
}

The issue can be closed. But should this be fixed in flake.nix file by splitting it into 2 lines to make it easier for a newcomer?

asus-zephyrus-ga402 = import ./asus/zephyrus/ga402;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant