From 4fd56f73360372665dd072adac2a78156d4caf2d Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 12 Jul 2025 04:00:28 +0200 Subject: Setup new M1 MacBook as 'Moissanite' with Asahi Linux Signed-off-by: Mel --- machines/bismuth/devices.nix | 2 + machines/graphite/devices.nix | 2 + machines/moissanite/default.nix | 12 +++++ machines/moissanite/devices.nix | 94 ++++++++++++++++++++++++++++++++++++++++ machines/moissanite/hardware.nix | 49 +++++++++++++++++++++ machines/moissanite/home.nix | 9 ++++ 6 files changed, 168 insertions(+) create mode 100644 machines/moissanite/default.nix create mode 100644 machines/moissanite/devices.nix create mode 100644 machines/moissanite/hardware.nix create mode 100644 machines/moissanite/home.nix (limited to 'machines') diff --git a/machines/bismuth/devices.nix b/machines/bismuth/devices.nix index b5a6e16..6aa4122 100644 --- a/machines/bismuth/devices.nix +++ b/machines/bismuth/devices.nix @@ -3,6 +3,8 @@ { # boot settings boot = { + kernelPackages = pkgs.linuxPackages_latest; + loader.grub = { enable = true; devices = [ "nodev" ]; diff --git a/machines/graphite/devices.nix b/machines/graphite/devices.nix index be777a9..c9851c3 100644 --- a/machines/graphite/devices.nix +++ b/machines/graphite/devices.nix @@ -8,6 +8,8 @@ # boot settings boot = { + kernelPackages = pkgs.linuxPackages_latest; + loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; diff --git a/machines/moissanite/default.nix b/machines/moissanite/default.nix new file mode 100644 index 0000000..8a306d5 --- /dev/null +++ b/machines/moissanite/default.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + imports = [ + ../../modules/common.nix + + ./hardware.nix + ./devices.nix + ]; + + system.stateVersion = "25.05"; +} diff --git a/machines/moissanite/devices.nix b/machines/moissanite/devices.nix new file mode 100644 index 0000000..d6c4d2c --- /dev/null +++ b/machines/moissanite/devices.nix @@ -0,0 +1,94 @@ +{ + config, + lib, + pkgs, + nixos-apple-silicon, + ... +}: + +{ + imports = [ + nixos-apple-silicon.nixosModules.apple-silicon-support + ]; + + # boot settings + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = false; + + plymouth.enable = true; + + initrd.systemd.enable = true; + + # check nixos-apple-silicon documentation on this, + # if keyboard weirdness ever comes up. + # extraModprobeConfig = '' + # options hid_apple iso_layout=0 + # ''; + + # show a nix logo on asahi m1n1 boot! + m1n1CustomLogo = ../../assets/nix-256x256.png; + }; + + # swap + zramSwap = { + enable = true; + algorithm = "zstd"; + swapDevices = 1; + memoryPercent = 50; + }; + + # hardware + hardware = { + enableAllFirmware = true; + enableRedistributableFirmware = true; + + graphics = { + enable = true; + enable32Bit = lib.mkForce false; + }; + bluetooth.enable = true; + + # asahi-specific settings! + asahi = { + enable = true; + + # proprietary apple firmware extracted during installation. + # it can also be found in /boot/asahi, but needs to be + # included here for flake purity. + peripheralFirmwareDirectory = ../../assets/m1-firmware; + + # mesa + useExperimentalGPUDriver = true; + experimentalGPUInstallMode = "replace"; # probably no longer used. + # sound + setupAsahiSound = true; + # kernel + withRust = true; + }; + }; + + # internet/wifi + networking = { + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; + wireless.iwd = { + enable = true; + settings.General.EnableNetworkConfiguration = true; + }; + }; + + # sound + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/machines/moissanite/hardware.nix b/machines/moissanite/hardware.nix new file mode 100644 index 0000000..45661b5 --- /dev/null +++ b/machines/moissanite/hardware.nix @@ -0,0 +1,49 @@ +# 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" + "sdhci_pci" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/3ae7395f-1b2c-407a-9ea5-3baeeabca370"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C6F0-0913"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} diff --git a/machines/moissanite/home.nix b/machines/moissanite/home.nix new file mode 100644 index 0000000..8f27ed2 --- /dev/null +++ b/machines/moissanite/home.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + imports = [ + ../../modules/home/common.nix + ]; + + home.stateVersion = "25.05"; +} -- cgit 1.4.1