mac updates

This commit is contained in:
mjallen18
2025-07-01 22:14:30 -05:00
parent 9f2b10f47c
commit fbb8cd9054
11 changed files with 481 additions and 186 deletions

33
hosts/mac-nixos/boot.nix Normal file
View File

@@ -0,0 +1,33 @@
{ pkgs, lib, ... }:
{
# Use the systemd-boot EFI boot loader.
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 3;
};
efi.canTouchEfiVariables = lib.mkForce false;
};
kernelParams = [
"apple_dcp.show_notch=1"
];
extraModprobeConfig = ''
options hid_apple iso_layout=0
'';
binfmt.registrations. "x86_64-linux" = {
magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00'';
mask = ''\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'';
openBinary = true;
interpreter = "${pkgs.box64}/bin/box64";
preserveArgvZero = true;
matchCredentials = true;
fixBinary = false;
};
};
zramSwap.enable = true;
}

View File

@@ -8,94 +8,58 @@ let
in
{
imports = [
# Include the results of the hardware scan.
./boot.nix
./hardware-configuration.nix
./networking.nix
./services.nix
];
hardware.asahi = {
enable = true;
useExperimentalGPUDriver = true;
peripheralFirmwareDirectory = ./firmware;
# extractPeripheralFirmware = false;
setupAsahiSound = true;
};
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot = {
enable = true;
configurationLimit = 3;
};
efi.canTouchEfiVariables = lib.mkForce false;
};
hardware.graphics.enable32Bit = lib.mkForce false;
boot.extraModprobeConfig = ''
options hid_apple iso_layout=0
'';
boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
# Networking configs
networking = {
hostName = "macbook-pro-nixos";
# Enable Network Manager
networkmanager = {
enable = lib.mkDefault true;
wifi.powersave = lib.mkDefault false;
settings.connectivity.uri = lib.mkDefault "http://nmcheck.gnome.org/check_network_status.txt";
};
};
services = {
displayManager.sddm.wayland.enable = lib.mkDefault plasma;
displayManager.sddm.enable = lib.mkDefault plasma;
desktopManager.plasma6.enable = lib.mkDefault plasma;
desktopManager.gnome.enable = lib.mkForce true;
displayManager.gdm.enable = lib.mkForce true;
# enable auto discovery of printers
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
# Enable Flatpak
flatpak.enable = lib.mkDefault false;
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnsupportedSystem = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.matt = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
extraGroups = [
"wheel"
"keys"
"networkmanager"
"ratbagd"
"input"
"scanner"
"lp"
"video"
"i2c"
]; # Enable sudo for the user.
shell = pkgs.zsh;
packages = with pkgs; [
firefox
tree
neofetch
gdm
git
box64
#minecraft
prismlauncher
distrobox
podman
];
};
programs.java.enable = true;
virtualisation.containers.enable = true;
virtualisation = {
containers.enable = true;
podman.enable = true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
apple-cursor
gnomeExtensions.dash-to-dock
gnomeExtensions.arcmenu
gnomeExtensions.appindicator
gnomeExtensions.tiling-assistant
micro
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
];
@@ -103,30 +67,4 @@ in
environment.sessionVariables = {
DBX_CONTAINER_MANAGER = "podman";
};
nixpkgs.config.allowUnsupportedSystem = true;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment?
}

View File

@@ -19,39 +19,39 @@
};
fileSystems."/root" =
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
{ device = "/dev/disk/by-uuid/adcc14fa-8bf7-4b4b-a9e4-b038993b96cc";
fsType = "btrfs";
options = [ "subvol=root" ];
options = [ "compress=zstd" "noatime" "subvol=root" ];
};
fileSystems."/etc" =
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
{ device = "/dev/disk/by-uuid/adcc14fa-8bf7-4b4b-a9e4-b038993b96cc";
fsType = "btrfs";
options = [ "subvol=etc" ];
options = [ "compress=zstd" "noatime" "subvol=etc" ];
};
fileSystems."/tmp" =
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
{ device = "/dev/disk/by-uuid/adcc14fa-8bf7-4b4b-a9e4-b038993b96cc";
fsType = "btrfs";
options = [ "subvol=tmp" ];
options = [ "compress=zstd" "noatime" "subvol=tmp" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
{ device = "/dev/disk/by-uuid/adcc14fa-8bf7-4b4b-a9e4-b038993b96cc";
fsType = "btrfs";
options = [ "subvol=nix" ];
options = [ "compress=zstd" "noatime" "subvol=nix" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
{ device = "/dev/disk/by-uuid/adcc14fa-8bf7-4b4b-a9e4-b038993b96cc";
fsType = "btrfs";
options = [ "subvol=log" ];
options = [ "compress=zstd" "noatime" "subvol=log" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
{ device = "/dev/disk/by-uuid/adcc14fa-8bf7-4b4b-a9e4-b038993b96cc";
fsType = "btrfs";
options = [ "subvol=home" ];
options = [ "compress=zstd" "subvol=home" ];
};
fileSystems."/boot" =
@@ -60,7 +60,12 @@
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
swapDevices = [
{
device = "/tmp/swapfile";
randomEncryption.enable = true;
}
];
# 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

View File

@@ -1,69 +0,0 @@
# 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.
{ lib, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
};
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs";
options = [ "subvol=log" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/root" = {
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/F4A1-C77F";
fsType = "vfat";
};
# fileSystems."/boot" =
# { device = "/dev/disk/by-uuid/3aaa1d0e-057d-4b7d-b2fe-ef02db373e9f";
# fsType = "ext4";
# };
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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0f0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}

View File

@@ -4,4 +4,11 @@
home.username = "matt";
home.homeDirectory = "/home/matt";
home.stateVersion = "23.11";
home.packages = with pkgs; [
iw
iwd
orca-slicer
vscodium
];
}

View File

@@ -0,0 +1,37 @@
{ pkgs, lib, ... }:
{
# Networking configs
networking = {
hostName = "macbook-pro-nixos";
wireless.iwd = {
enable = true;
settings = {
General = {
EnableNetworkConfiguration = true;
};
Rank = {
BandModifier2_4GHz = 1.0;
BandModifier5GHz = 5.0;
BandModifier6GHz = 10.0;
};
# DriverQuirks = {
# PowerSaveDisable = "hci_bcm4377,brcmfmac";
# };
Network = {
AutoConnect = true;
};
};
};
# Enable Network Manager
networkmanager = {
enable = lib.mkForce false;
wifi = {
backend = lib.mkForce "iwd";
powersave = lib.mkDefault false;
};
settings.connectivity.uri = lib.mkDefault "http://nmcheck.gnome.org/check_network_status.txt";
};
};
}

123
hosts/mac-nixos/omnissa.nix Normal file
View File

@@ -0,0 +1,123 @@
{ stdenv
, lib
, buildFHSEnv
, fetchurl
, makeWrapper
, gsettings-desktop-schemas
, opensc
, writeTextDir
, configText ? ""
}:
let
version = "2503-8.15.0";
sysArch = "armhf";
mainProgram = "horizon-client";
wrapBinCommands = path: name: ''
makeWrapper "$out/${path}/${name}" "$out/bin/${name}_wrapper" \
--set GTK_THEME Adwaita \
--suffix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \
--suffix LD_LIBRARY_PATH : "$out/lib/omnissa/horizon:$out/lib/omnissa/horizon/vdpService:$out/lib/omnissa"
'';
omnissaHorizonClientFiles = stdenv.mkDerivation {
pname = "omnissa-horizon-armhf-files";
inherit version;
src = fetchurl {
url = "https://download3.omnissa.com/software/CART26FQ1_LIN_2503_TARBALL/Omnissa-Horizon-Client-Linux-2503-8.15.0-14256322247.tar.gz";
sha256 = "sha256-x98ITXF9xwzlPq375anQ2qBpMbZAcCqDVXBfvZPha7Q=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir ext
tar -xzf $src
cd Omnissa-Horizon-Client-Linux-*/${sysArch}
mkdir -p ext
for archive in *.tar.gz; do
tar -C ext --strip-components=1 -xf "$archive"
done
chmod -R u+w ext/usr/lib
mkdir -p $out
mv ext/usr $out
mv ext/${sysArch}/lib $out/
mv ext/${sysArch}/include $out/
mkdir -p $out/lib/omnissa/horizon/pkcs11
ln -s ${opensc}/lib/pkcs11/opensc-pkcs11.so $out/lib/omnissa/horizon/pkcs11/libopenscpkcs11.so
chmod +x "$out/usr/bin/horizon-client"
${wrapBinCommands "usr/bin" "horizon-client"}
'';
};
omnissaFHSUserEnv =
pname:
buildFHSEnv {
inherit pname version;
runScript = "${omnissaHorizonClientFiles}/bin/${pname}_wrapper";
targetPkgs = pkgs: with pkgs; [
atk
cairo
dbus
file
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libjpeg
libpng
libpulseaudio
libtiff
libuuid
libv4l
libxml2
pango
pcsclite
pixman
udev
omnissaHorizonClientFiles
xorg.libX11
xorg.libXau
xorg.libXcursor
xorg.libXext
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXtst
zlib
(writeTextDir "etc/omnissa/config" configText)
];
};
in
stdenv.mkDerivation {
pname = "omnissa-horizon-client";
inherit version;
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
ln -s ${omnissaFHSUserEnv "horizon-client"}/bin/horizon-client $out/bin/
ln -s ${omnissaFHSUserEnv "horizon-eucusbarbitrator"}/bin/horizon-eucusbarbitrator $out/bin/
'';
passthru.unwrapped = omnissaHorizonClientFiles;
meta = {
description = "Omnissa Horizon Client for ARM";
homepage = "https://www.omnissa.com/products/horizon-8/";
license = lib.licenses.unfree;
platforms = [ "aarch64-linux" "armv7l-linux" ];
};
}

View File

@@ -0,0 +1,81 @@
{ lib, ... }:
{
services = {
auto-cpufreq = {
enable = true;
settings = {
# settings for when connected to a power source
charger = {
# see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
# preferred governor
governor = "performance";
# minimum cpu frequency (in kHz)
# example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000
# see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html
# to use this feature, uncomment the following line and set the value accordingly
# scaling_min_freq = 800000
# maximum cpu frequency (in kHz)
# example: for 1GHz = 1000 MHz = 1000000 kHz -> scaling_max_freq = 1000000
# see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html
# to use this feature, uncomment the following line and set the value accordingly
# scaling_max_freq = 1000000
# turbo boost setting. possible values: always, auto, never
turbo = "auto";
};
# settings for when using battery power
battery = {
# see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
# preferred governor
governor = "schedutil";
# minimum cpu frequency (in kHz)
# example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000
# see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html
# to use this feature, uncomment the following line and set the value accordingly
# scaling_min_freq = 800000
# maximum cpu frequency (in kHz)
# see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html
# example: for 1GHz = 1000 MHz = 1000000 kHz -> scaling_max_freq = 1000000
# to use this feature, uncomment the following line and set the value accordingly
# scaling_max_freq = 1000000
# turbo boost setting (always, auto, or never)
turbo = "auto";
# battery charging threshold
# reference: https://github.com/AdnanHodzic/auto-cpufreq/#battery-charging-thresholds
#enable_thresholds = true
#start_threshold = 20
#stop_threshold = 80
};
};
};
displayManager = {
sddm = {
enable = lib.mkForce true;
wayland.enable = lib.mkForce true;
};
gdm.enable = lib.mkForce false;
};
desktopManager = {
plasma6.enable = lib.mkForce false;
gnome.enable = lib.mkForce false;
};
logind = {
lidSwitch = "suspend";
lidSwitchExternalPower = "ignore";
powerKey = "suspend";
powerKeyLongPress = "poweroff";
};
# Enable Flatpak
flatpak.enable = lib.mkDefault false;
};
}