feat(nixos): scaffold macbook host for apple silicon (aarch64-linux)

This commit is contained in:
kenji
2026-01-05 12:59:33 -06:00
parent 425c429297
commit b8df78e935
6 changed files with 164 additions and 53 deletions
+40
View File
@@ -1,4 +1,5 @@
{ {
hakase = {
myConfig = { myConfig = {
nixos = { nixos = {
username = "kenji"; username = "kenji";
@@ -48,4 +49,43 @@
]; ];
}; };
}; };
};
macbook = {
myConfig = {
nixos = {
username = "kenji";
hostname = "macbook";
timezone = "America/Chicago";
};
git = {
username = "kenji";
email = "kenji@macbook";
defaultBranch = "master";
};
terminal = {
default = "ghostty";
aliases = {
update = "sudo nixos-rebuild switch --flake ~/.config/nixos/#macbook";
};
};
hyprland = {
# M1 Pro/Max/Air screens are usually built-in eDP-1.
# HiDPI scale 2.0 is safe for Retina.
monitors = [
"eDP-1, highres, auto, 2"
];
wallpaper = "firewatch.png";
};
firefox = {
bookmarks = [
{
name = "Asahi Linux";
url = "https://asahilinux.org/";
}
];
newtabpage = [];
};
};
};
} }
+25 -8
View File
@@ -52,6 +52,10 @@
url = "github:vicinaehq/vicinae"; url = "github:vicinaehq/vicinae";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
apple-silicon = {
url = "github:tpwrules/nixos-apple-silicon";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { outputs = {
@@ -62,19 +66,18 @@
chaotic, chaotic,
sops-nix, sops-nix,
textfox, textfox,
apple-silicon,
... ...
} @ inputs: let } @ inputs: let
config = import ./config.nix; allConfig = import ./config.nix;
system = "x86_64-linux";
args =
{
inherit inputs system;
}
// config;
in { in {
nixosConfigurations = { nixosConfigurations = {
hakase = nixpkgs.lib.nixosSystem { hakase = nixpkgs.lib.nixosSystem {
specialArgs = args; system = "x86_64-linux";
specialArgs = {
inherit inputs;
system = "x86_64-linux";
} // allConfig.hakase;
modules = [ modules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
@@ -82,6 +85,20 @@
./hosts/hakase/configuration.nix ./hosts/hakase/configuration.nix
]; ];
}; };
macbook = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = {
inherit inputs;
system = "aarch64-linux";
} // allConfig.macbook;
modules = [
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
apple-silicon.nixosModules.apple-silicon-support
./hosts/macbook/configuration.nix
];
};
}; };
}; };
} }
+1
View File
@@ -8,5 +8,6 @@
../../modules/nixos/default.nix ../../modules/nixos/default.nix
../../modules/nixos/hyprland.nix ../../modules/nixos/hyprland.nix
../../modules/nixos/gaming.nix ../../modules/nixos/gaming.nix
../../modules/nixos/amd.nix
]; ];
} }
+24
View File
@@ -0,0 +1,24 @@
{
pkgs,
myConfig,
...
}: {
imports = [
./hardware-configuration.nix
../../modules/nixos/default.nix
../../modules/nixos/hyprland.nix
# No gaming.nix (Steam is x86 only)
# No amd.nix
];
# Apple Silicon specific hardware tweaks
hardware.asahi = {
# peripheralFirmwareDirectory = ./firmware; # If you have extracted firmware
useExperimentalGPUDriver = true;
experimentalGPUInstallMode = "replace";
};
# Bootloader for Asahi is usually systemd-boot or grub, but asahi-module handles m1n1
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false; # Asahi often prefers this false to avoid bricking nvram
}
+30
View File
@@ -0,0 +1,30 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "usb_storage" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/0000-0000";
fsType = "vfat";
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}
-1
View File
@@ -1,6 +1,5 @@
{pkgs, ...}: { {pkgs, ...}: {
imports = [ imports = [
./amd.nix
./backlight.nix ./backlight.nix
./boot.nix ./boot.nix
./fonts.nix ./fonts.nix