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
+84 -44
View File
@@ -1,51 +1,91 @@
{ {
myConfig = { hakase = {
nixos = { myConfig = {
username = "kenji"; nixos = {
hostname = "hakase"; username = "kenji";
timezone = "America/Chicago"; hostname = "hakase";
}; timezone = "America/Chicago";
git = { };
username = "kenji"; git = {
email = "kenji@hakase"; username = "kenji";
defaultBranch = "master"; email = "kenji@hakase";
}; defaultBranch = "master";
terminal = { };
default = "ghostty"; terminal = {
aliases = { default = "ghostty";
update = "sudo nixos-rebuild switch --flake ~/.config/nixos/#hakase"; aliases = {
update = "sudo nixos-rebuild switch --flake ~/.config/nixos/#hakase";
};
};
hyprland = {
monitors = [
"DP-1,highres@180,0x1080,1,bitdepth,10,cm,hdr,sdrbrightness,1.4,sdrsaturation,0.98,vrr,0"
"DP-2, highres@165,760x0,1"
"HDMI-A-1, highres@highrr@120, 3440x1440, 1.6"
];
wallpaper = "firewatch.png";
};
firefox = {
bookmarks = [
{
name = "Home Manager";
url = "https://mynixos.com/home-manager/options/programs";
}
{
name = "YouTube";
url = "https://youtube.com";
}
{
name = "Nur";
url = "https://nur.nix-community.org/repos";
}
];
newtabpage = [
{
title = "Dashboard";
url = "https://dash.sakamoto.dev";
}
];
}; };
}; };
hyprland = { };
monitors = [
"DP-1,highres@180,0x1080,1,bitdepth,10,cm,hdr,sdrbrightness,1.4,sdrsaturation,0.98,vrr,0"
"DP-2, highres@165,760x0,1"
"HDMI-A-1, highres@highrr@120, 3440x1440, 1.6"
];
wallpaper = "firewatch.png"; macbook = {
}; myConfig = {
firefox = { nixos = {
bookmarks = [ username = "kenji";
{ hostname = "macbook";
name = "Home Manager"; timezone = "America/Chicago";
url = "https://mynixos.com/home-manager/options/programs"; };
} git = {
{ username = "kenji";
name = "YouTube"; email = "kenji@macbook";
url = "https://youtube.com"; defaultBranch = "master";
} };
{ terminal = {
name = "Nur"; default = "ghostty";
url = "https://nur.nix-community.org/repos"; aliases = {
} update = "sudo nixos-rebuild switch --flake ~/.config/nixos/#macbook";
]; };
newtabpage = [ };
{ hyprland = {
title = "Dashboard"; # M1 Pro/Max/Air screens are usually built-in eDP-1.
url = "https://dash.sakamoto.dev"; # 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