diff --git a/flake.lock b/flake.lock index 2a4d7c1..bbe364d 100644 --- a/flake.lock +++ b/flake.lock @@ -229,6 +229,26 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736085891, + "narHash": "sha256-bTl9fcUo767VaSx4Q5kFhwiDpFQhBKna7lNbGsqCQiA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "ba9b3173b0f642ada42b78fb9dfc37ca82266f6c", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nix-flatpak": { "locked": { "lastModified": 1734128415, @@ -282,11 +302,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "lastModified": 1736012469, + "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", "type": "github" }, "original": { @@ -353,6 +373,7 @@ "apple-fonts": "apple-fonts", "catppuccin": "catppuccin", "home-manager": "home-manager", + "nix-darwin": "nix-darwin", "nix-flatpak": "nix-flatpak", "nix-index-database": "nix-index-database", "nixos-facter-modules": "nixos-facter-modules", diff --git a/flake.nix b/flake.nix index a5e5325..136a3ff 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,9 @@ nix-index-database.url = "github:nix-community/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; + + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs @ { self, @@ -32,6 +35,7 @@ alejandra, nix-flatpak, nix-index-database, + nix-darwin, ... }: let modules = { @@ -45,6 +49,9 @@ wahnix = [ ./hardware/devices/wahnix.nix ]; + m1mbp = [ + ./hardware/devices/m1mbp.nix + ]; }; drivers = { controllers = { @@ -74,6 +81,9 @@ base = [ ./system/nix.nix ]; + linux = [ + ./system/linux.nix + ]; desktops = { apps = [ ./system/desktop/apps.nix @@ -163,15 +173,18 @@ }; in { packages.x86_64-linux.nerd-fonts-sf-mono-ligatures = nixpkgs.legacyPackages.x86_64-linux.callPackage ./pkgs/fonts/nerd-fonts-sf-mono-ligatures.nix {}; + packages.aarch64-darwin.nerd-fonts-sf-mono-ligatures = nixpkgs.legacyPackages.aarch64-darwin.callPackage ./pkgs/fonts/nerd-fonts-sf-mono-ligatures.nix {}; nixosConfigurations = { wahnix = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; + inherit self; }; modules = modules.nixos.base + ++ modules.nixos.linux ++ modules.nixos.desktops.apps ++ modules.nixos.desktops.displaymanagers.tuigreet ++ modules.nixos.desktops.environments.hyprland @@ -223,7 +236,40 @@ }; }; - formatter.aarch64-linux = alejandra.defaultPackage.aarch64-linux; + darwinConfigurations."Daryls-MacBook-Pro" = nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { + inherit inputs; + inherit self; + }; + modules = + modules.nixos.base + ++ modules.nixos.users.relms + ++ modules.hardware.devices.m1mbp + ++ [ + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + inherit self; + inherit inputs; + }; + home-manager.users.relms = { + imports = + modules.home.users.relms + ++ modules.home.cli.development + ++ modules.home.cli.shell + ++ [ + nix-index-database.hmModules.nix-index + catppuccin.homeManagerModules.catppuccin + ]; + }; + } + ]; + }; + + formatter.aarch64-darwin = alejandra.defaultPackage.aarch64-darwin; formatter.x86_64-linux = alejandra.defaultPackage.x86_64-linux; }; } diff --git a/hardware/devices/m1mbp.nix b/hardware/devices/m1mbp.nix new file mode 100644 index 0000000..35b6661 --- /dev/null +++ b/hardware/devices/m1mbp.nix @@ -0,0 +1,27 @@ +{ + self, + pkgs, + ... +}: { + services.nix-daemon.enable = true; + programs.gnupg.agent.enable = true; + programs.gnupg.agent.enableSSHSupport = true; + + fonts.packages = [self.packages.${pkgs.system}.nerd-fonts-sf-mono-ligatures]; + + system.defaults = { + finder = { + AppleShowAllExtensions = true; + ShowPathbar = true; + FXEnableExtensionChangeWarning = false; + AppleShowAllFiles = true; + FXPreferredViewStyle = "Nlsv"; + _FXSortFoldersFirst = true; + _FXSortFoldersFirstOnDesktop = true; + ShowStatusBar = true; + NewWindowTarget = "Home"; + }; + }; + + nixpkgs.hostPlatform = "aarch64-darwin"; +} diff --git a/hardware/devices/wahnix.nix b/hardware/devices/wahnix.nix index 9248b92..a1b01dd 100644 --- a/hardware/devices/wahnix.nix +++ b/hardware/devices/wahnix.nix @@ -12,5 +12,7 @@ options = ["fmask=0022" "dmask=0022"]; }; + hardware.enableRedistributableFirmware = true; + nixpkgs.hostPlatform = "x86_64-linux"; } diff --git a/home/modules/cli/development.nix b/home/modules/cli/development.nix index 2c4c17b..483fc9e 100644 --- a/home/modules/cli/development.nix +++ b/home/modules/cli/development.nix @@ -1,7 +1,14 @@ -{pkgs, ...}: { +{ + self, + pkgs, + ... +}: { programs.git = { enable = true; - package = pkgs.gitAndTools.gitFull; + package = + if pkgs.stdenv.hostPlatform.system == "x86_64-linux" + then pkgs.gitAndTools.gitFull + else pkgs.git; userEmail = "relms@relms.dev"; userName = "Daryl Ronningen"; delta = { @@ -65,7 +72,10 @@ enableFishIntegration = true; enableScDaemon = true; enableSshSupport = true; - pinentryPackage = pkgs.pinentry-rofi; + pinentryPackage = + if pkgs.stdenv.hostPlatform.system == "x86_64-linux" + then pkgs.pinentry-rofi + else pkgs.pinentry_mac; }; catppuccin = { diff --git a/home/modules/cli/shell.nix b/home/modules/cli/shell.nix index 8515377..679a8f8 100644 --- a/home/modules/cli/shell.nix +++ b/home/modules/cli/shell.nix @@ -23,8 +23,11 @@ shellAliases = { ls = "eza -laghHUum@ --sort name --group-directories-first --git --icons"; tree = "eza -laghHUumRT@ --sort name --group-directories-first --git --icons"; - nixos-rebuild = "sudo nixos-rebuild --flake ~/git/flake#wahnix"; + cat = "bat"; }; + interactiveShellInit = '' + source /Users/relms/.iterm2_shell_integration.fish + ''; }; programs.starship = { diff --git a/home/users/relms.nix b/home/users/relms.nix index 63137a0..a672460 100644 --- a/home/users/relms.nix +++ b/home/users/relms.nix @@ -1,6 +1,9 @@ -{ +{pkgs, ...}: { home.username = "relms"; - home.homeDirectory = "/home/relms"; + home.homeDirectory = + if pkgs.stdenv.hostPlatform.system == "x86_64-linux" + then "/home/relms" + else "/Users/relms"; home.stateVersion = "24.11"; diff --git a/pkgs/fonts/nerd-fonts-sf-mono-ligatures.nix b/pkgs/fonts/nerd-fonts-sf-mono-ligatures.nix index 442804e..b2d7bb6 100644 --- a/pkgs/fonts/nerd-fonts-sf-mono-ligatures.nix +++ b/pkgs/fonts/nerd-fonts-sf-mono-ligatures.nix @@ -92,6 +92,6 @@ in description = "Monospaced variant of San Francisco patched with Nerd Fonts and Fira Code ligatures"; license = "proprietary"; maintainers = ["relms"]; - platforms = ["x86_64-linux" "aarch64-linux"]; + platforms = ["x86_64-linux" "aarch64-darwin"]; }; } diff --git a/system/linux.nix b/system/linux.nix new file mode 100644 index 0000000..08e9aab --- /dev/null +++ b/system/linux.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: { + system.replaceDependencies = { + replacements = [ + { + oldDependency = pkgs.gtk4; + newDependency = pkgs.callPackage ../pkgs/libraries/gtk4.nix {}; + } + ]; + }; + + programs.command-not-found.enable = false; +} diff --git a/system/nix.nix b/system/nix.nix index 431e87a..5378cff 100644 --- a/system/nix.nix +++ b/system/nix.nix @@ -4,8 +4,15 @@ }; nix = { + optimise.automatic = + if pkgs.stdenv.hostPlatform.system == "aarch64-darwin" + then true + else false; settings = { - auto-optimise-store = true; + auto-optimise-store = + if pkgs.stdenv.hostPlatform.system == "x86_64-linux" + then true + else false; trusted-users = ["root" "relms"]; }; extraOptions = '' @@ -13,16 +20,8 @@ ''; }; - hardware.enableRedistributableFirmware = true; - - system.replaceDependencies = { - replacements = [ - { - oldDependency = pkgs.gtk4; - newDependency = pkgs.callPackage ../pkgs/libraries/gtk4.nix {}; - } - ]; - }; - - system.stateVersion = "24.11"; + system.stateVersion = + if pkgs.stdenv.isLinux + then "24.11" + else 5; } diff --git a/system/users/relms.nix b/system/users/relms.nix index 1051729..c9032d3 100644 --- a/system/users/relms.nix +++ b/system/users/relms.nix @@ -1,15 +1,26 @@ {pkgs, ...}: { - users.users.relms = { - isNormalUser = true; - description = "Daryl Ronningen"; - extraGroups = ["networkmanager" "wheel"]; - shell = pkgs.fish; - hashedPassword = "$y$j9T$fiNCczxfgXQRoDCYlRlgy.$8GVAPknKhtp0kq6g9YnJCaAU1GxE9W9puogCXLLYD2/"; - }; + users.users.relms = + if pkgs.stdenv.isLinux + then { + isNormalUser = true; + description = "Daryl Ronningen"; + extraGroups = ["networkmanager" "wheel"]; + shell = pkgs.fish; + hashedPassword = "$y$j9T$fiNCczxfgXQRoDCYlRlgy.$8GVAPknKhtp0kq6g9YnJCaAU1GxE9W9puogCXLLYD2/"; + } + else { + description = "Daryl Ronningen"; + shell = pkgs.fish; + home = "/Users/relms"; + }; programs.fish.enable = true; + programs.zsh.enable = true; - programs.command-not-found.enable = false; + environment.shells = + if pkgs.stdenv.hostPlatform.system == "aarch64-darwin" + then [pkgs.fish] + else []; time.timeZone = "America/Los_Angeles"; }