diff --git a/config.nix b/config.nix index b19ced4..3bb5fb2 100644 --- a/config.nix +++ b/config.nix @@ -1,51 +1,91 @@ { - myConfig = { - nixos = { - username = "kenji"; - hostname = "hakase"; - timezone = "America/Chicago"; - }; - git = { - username = "kenji"; - email = "kenji@hakase"; - defaultBranch = "master"; - }; - terminal = { - default = "ghostty"; - aliases = { - update = "sudo nixos-rebuild switch --flake ~/.config/nixos/#hakase"; + hakase = { + myConfig = { + nixos = { + username = "kenji"; + hostname = "hakase"; + timezone = "America/Chicago"; + }; + git = { + username = "kenji"; + email = "kenji@hakase"; + defaultBranch = "master"; + }; + terminal = { + default = "ghostty"; + 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"; - }; - 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"; - } - ]; + 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 = []; + }; }; }; } diff --git a/flake.nix b/flake.nix index be14ca3..0a4824b 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,10 @@ url = "github:vicinaehq/vicinae"; inputs.nixpkgs.follows = "nixpkgs"; }; + apple-silicon = { + url = "github:tpwrules/nixos-apple-silicon"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { @@ -62,19 +66,18 @@ chaotic, sops-nix, textfox, + apple-silicon, ... } @ inputs: let - config = import ./config.nix; - system = "x86_64-linux"; - args = - { - inherit inputs system; - } - // config; + allConfig = import ./config.nix; in { nixosConfigurations = { hakase = nixpkgs.lib.nixosSystem { - specialArgs = args; + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + system = "x86_64-linux"; + } // allConfig.hakase; modules = [ home-manager.nixosModules.home-manager sops-nix.nixosModules.sops @@ -82,6 +85,20 @@ ./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 + ]; + }; }; }; } diff --git a/hosts/hakase/configuration.nix b/hosts/hakase/configuration.nix index 84d5d2b..1200ccc 100644 --- a/hosts/hakase/configuration.nix +++ b/hosts/hakase/configuration.nix @@ -8,5 +8,6 @@ ../../modules/nixos/default.nix ../../modules/nixos/hyprland.nix ../../modules/nixos/gaming.nix + ../../modules/nixos/amd.nix ]; } diff --git a/hosts/macbook/configuration.nix b/hosts/macbook/configuration.nix new file mode 100644 index 0000000..c9d7008 --- /dev/null +++ b/hosts/macbook/configuration.nix @@ -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 +} diff --git a/hosts/macbook/hardware-configuration.nix b/hosts/macbook/hardware-configuration.nix new file mode 100644 index 0000000..a14cd91 --- /dev/null +++ b/hosts/macbook/hardware-configuration.nix @@ -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"; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index ac58f1d..25d84c5 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,5 @@ {pkgs, ...}: { imports = [ - ./amd.nix ./backlight.nix ./boot.nix ./fonts.nix