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

Apple silicon #84

Merged
merged 18 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 88 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 33 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
{
description = "Consequence of allowing autistic people on the internet. Stay mad one-proper-config-structure purists :3";

outputs = {nixpkgs, ...} @ inputs: let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
outputs = inputs @ {flake-parts, ...}: let
theme = import ./theme;
user = import ./user {
inherit pkgs theme;
};
in {
nixosConfigurations = import ./hosts inputs;
nixosModules =
{
# This module is not meant to be imported by anyone but me
# it's just so I can easily avoid ../../../../../ mess
system = import ./system;
user = import ./user theme;
in
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {
nixosModules =
{
# This module is not meant to be imported by anyone but me
# it's just so I can easily avoid ../../../../../ mess
system = import ./system;

user = user.module;
user = user.module;

# place for my home brew modules
}
// import ./modules;
# place for my home brew modules
}
// import ./modules;
nixosConfigurations = import ./hosts inputs;
};
systems = [
"x86_64-linux"
"aarch64-linux"
];
perSystem = {pkgs, ...}: {
formatter = pkgs.alejandra;
packages = user.packages pkgs;
devShells.default = user.shell pkgs;
};
};

inherit theme;
packages.x86_64-linux = user.packages;
formatter.x86_64-linux = pkgs.alejandra;
devShells.x86_64-linux.default = user.shell;
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
apple-silicon-support = {
url = "github:tpwrules/nixos-apple-silicon";
inputs.nixpkgs.follows = "nixpkgs";
};
};

inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
}
64 changes: 52 additions & 12 deletions hosts/calypso/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,46 @@
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot.initrd.availableKernelModules =
[
"xhci_pci"
"ahci"
"usbhid"
"sd_mod"
"dm_mod"
"dm_crypt"
"cryptd"
"input_leds"
]
++ config.boot.initrd.luks.cryptoModules;
boot = {
loader = {
systemd-boot = {
enable = true;
memtest86.enable = true;
configurationLimit = 10;
editor = false;
};
# spam space to get to boot menu
timeout = 0;
};
loader.efi.canTouchEfiVariables = true;

kernelPackages = pkgs.linuxPackages_xanmod_latest;
kernelParams = [
# fix for suspend issues
# see: https://www.reddit.com/r/archlinux/comments/e5oe4p/comment/fa8mzft/
"snd_hda_intel.dmic_detect=0"
"acpi_osi=linux"
"nowatchdog"
];
initrd.availableKernelModules =
[
"xhci_pci"
"ahci"
"usbhid"
"sd_mod"
"dm_mod"
"dm_crypt"
"cryptd"
"input_leds"
]
++ config.boot.initrd.luks.cryptoModules;
};

fileSystems."/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = ["noatime" "discard"];
};

# For some reason my mic light indicator refuses to turn off on its own
# it may not be a perfect solution, but it works
Expand All @@ -32,5 +60,17 @@
};

hardware.cpu.intel.updateMicrocode = true;
hardware.graphics.extraPackages = builtins.attrValues {
inherit
(pkgs)
vaapiIntel
libva
libvdpau-va-gl
vaapiVdpau
ocl-icd
intel-compute-runtime
;
};

hardware.laptop.enable = true;
}
7 changes: 5 additions & 2 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
inherit (self) inputs;
mkHost = name: system:
nixpkgs.lib.nixosSystem {
inherit system;
modules =
[
{networking.hostName = name;}
{
networking.hostName = name;
nixpkgs.hostPlatform = system;
}
./${name}
]
++ builtins.attrValues self.nixosModules;
Expand All @@ -24,4 +26,5 @@
};
in {
calypso = mkHost "calypso" "x86_64-linux";
pandora = mkHost "pandora" "aarch64-linux";
}
66 changes: 66 additions & 0 deletions hosts/pandora/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
modulesPath,
lib,
inputs,
...
}: {
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/6A3B-1D00";
fsType = "vfat";
options = ["noatime" "discard"];
};
imports = [
inputs.apple-silicon-support.nixosModules.apple-silicon-support

(modulesPath + "/installer/scan/not-detected.nix")
];

homix.".config/kanshi/config".text = ''
profile {
output eDP-1 enable scale 1.5
}
'';

hardware.asahi = {
enable = true;
extractPeripheralFirmware = true;
peripheralFirmwareDirectory = ./firmware;
withRust = true;
useExperimentalGPUDriver = true;
experimentalGPUInstallMode = "replace";
};

boot = {
binfmt.emulatedSystems = ["x86_64-linux"];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = lib.mkForce false;
};
kernelPatches = [
{
name = "edge-config";
patch = null;
# derived from
# https://github.com/AsahiLinux/PKGBUILDs/blob/stable/linux-asahi/config.edge
extraConfig = ''
DRM_SIMPLEDRM_BACKLIGHT n
BACKLIGHT_GPIO n
DRM_APPLE m
APPLE_SMC m
APPLE_SMC_RTKIT m
APPLE_RTKIT m
APPLE_MBOX m
GPIO_MACSMC m
DRM_VGEM n
DRM_SCHED y
DRM_GEM_SHMEM_HELPER y
DRM_ASAHI m
SUSPEND y
'';
}
];

initrd.availableKernelModules = ["usbhid" "usb_storage" "sd_mod"];
initrd.kernelModules = ["usbhid" "dm-snapshot"];
};
}
Binary file added hosts/pandora/firmware/all_firmware.tar.gz
Binary file not shown.
Binary file added hosts/pandora/firmware/kernelcache.release.mac13g
Binary file not shown.
4 changes: 0 additions & 4 deletions modules/laptop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ in {
};
};
};
hardware.bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
};
# https://github.com/NixOS/nixpkgs/issues/114222
systemd.user.services.telephony_client.enable = false;

Expand Down
11 changes: 9 additions & 2 deletions system/audio/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{...}: {
{pkgs, ...}: {
services.pipewire = {
enable = true;
alsa = {
Expand All @@ -22,5 +22,12 @@
jack.enable = true;
};

hardware.pulseaudio.support32Bit = true;
hardware = {
pulseaudio.support32Bit = true;

bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
};
};
}
Loading
Loading