It feels like I’ve tried every possible combination of code. It’s either and infinite recursion or ‘apple-silicon’ is not found, not properly imported.
{ config, pkgs, lib, apple-silicon, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
apple-silicon.nixosModules.apple-silicon-support
];
nixpkgs.overlays = [ apple-silicon.overlays.default ];
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = false;
};
hardware.asahi = {
peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true;
withRust = true;
experimentalGPUInstallMode = "replace";
};
# and the rest
}
nixos-rebuild switch
building the system configuration...
error:
… while calling the 'seq' builtin
at /nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/lib/modules.nix:334:18:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
… while evaluating a branch condition
at /nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/lib/modules.nix:273:9:
272| checkUnmatched =
273| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
274| let
(stack trace truncated; use '--show-trace' to show the full trace)
error: infinite recursion encountered
at /nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/lib/modules.nix:520:28:
519| addErrorContext (context name)
520| (args.${name} or config._module.args.${name})
| ^
521| ) (functionArgs f);
from what your trying to do, you could pass apple-silicon via specialArgs to make it available as a module parameter.
it would look something like this:
building the system configuration...
error:
… while calling the 'head' builtin
at /nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: 'builtins.storePath' is not allowed in pure evaluation mode
at «none»:0: (source not available)
That’s the error. You need to stop using builtins.storePath, or whatever you use that uses it. Hard to say what that is without seeing your full config.
ls nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/ might give a hint.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, pkgs, lib, apple-silicon, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
apple-silicon.nixosModules.apple-silicon-support
];
nixpkgs.overlays = [ apple-silicon.overlays.default ];
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = false;
};
hardware.asahi = {
peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true;
withRust = true;
experimentalGPUInstallMode = "replace";
};
zramSwap = {
enable = true;
memoryPercent = 200;
writebackDevice = "/dev/nvme0n1p6";
};
boot.kernel.sysctl = {
"vm.swappiness" = 180;
"vm.watermark_boost_factor" = 0;
"vm.watermark_scale_factor" = 125;
"vm.page-cluster" = 0;
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/Vilnius";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
environment.sessionVariables = {
HYPRCURSOR_THEME = "macOS";
HYPRCURSOR_SIZE = "20";
WLR_DRM_DEVICES = "/dev/dri/card0";
AQ_DRM_DEVICES = "/dev/dri/card0";
};
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# hardware.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.dxwil = {
isNormalUser = true;
home = "/home/dxwil";
extraGroups = [ "wheel" "video" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim
htop
firefox
kitty
signal-desktop
waybar
hyprpaper
tofi
home-manager
hyprshot
git
];
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services = {
openssh.enable = true;
hypridle.enable = true;
};
networking.wireless.iwd.enable = true;
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.181.10.10/32" "fd42:42:42::10/128" ];
dns = [ "1.1.1.1" "8.8.8.8" ];
listenPort = #####;
autostart = false;
privateKeyFile = "/etc/tevelio-vpn-private.key";
peers = [{
publicKey = "######";
presharedKeyFile = "/etc/tevelio-vpn-preshared.key";
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "#####";
persistentKeepalive = 25;
}];
};
};
security.sudo.enable = true;
programs.hyprland = {
enable = true;
xwayland.enable = true;
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.11"; # Did you read the comment?
}
also
[dxwil@nixos:~]$ ls /nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source/
ci COPYING doc lib nixos README.md
CONTRIBUTING.md default.nix flake.nix maintainers pkgs shell.nix
This release also adds an option `hardware.asahi.experimentalGPUInstallMode` to select the way in which the experimental GPU driver is installed. There are three choices:
* `driver`: install only as a driver, do not replace system Mesa. Causes issues with certain programs like Plasma Wayland.
* `replace` (the default): use `system.replaceRuntimeDependencies` to replace system Mesa with Asahi Mesa. Does not work in pure evaluation context (i.e. in flakes by default).
* `overlay`: overlay system Mesa with Asahi Mesa. Requires rebuilding the world.
Yeah building with --impure doesnt throw me an error, but what does this option even do?
specialArgs passes variables to the module system, making them available via module parameters.
if you want to learn more about it i would suggest reading this: Preface - Nix Pills
EDIT: see functions and imports specifically, as it explains imports without the module-system magic above it, it made things a bit more clear to me. for specialArgs specifically the configuration.nix man page contains some info about it
AKA module args - modules are functions, and you’re asking for the apple-silicon argument:
apple-silicon is however not normally passed to modules, because it’s not part of the default NixOS module arguments. So we add it as a special argument.
This is pretty common in flakes and how you pass in most of your inputs.
Modules specifically can also be directly imported with the appropriately named modules attribute in lib.nixosSystem, but that’s really business logic that should happen with imports inside configuration.nix, so I prefer projects that also pass those via specialArgs (like you do now). It’s also easier to explain and overall simpler to just know one thing that works, so maybe forget I said anything about modules.
@zimward is completely correct of course, I just think it helps to explain with names that make sense in context.