diff --git a/hosts/airi/configuration.nix b/hosts/airi/configuration.nix index 8c729c3..8a5e6f8 100644 --- a/hosts/airi/configuration.nix +++ b/hosts/airi/configuration.nix @@ -1,38 +1,7 @@ -{ pkgs -, lib -, abs -, inputs -, ... -}: +{ abs, pkgs, ... } @ inputs: { - nix = { - settings.experimental-features = [ "nix-command" "flakes" ]; - settings.trusted-users = [ "@admin" ]; - - useDaemon = true; - - registry = { - nixpkgs.to = { - type = "github"; - owner = "NixOS"; - repo = "nixpkgs"; - rev = inputs.nixpkgs.rev; - }; - }; - - settings.nix-path = [ "nixpkgs=flake:nixpkgs" ]; - }; - # nixpkgs.flake.source = lib.mkForce null; - nixpkgs.hostPlatform = "aarch64-darwin"; - services.nix-daemon.enable = true; - - age.identityPaths = [ - "/Users/teidesu/.ssh/agenix-key" - ]; - - security.pam.enableSudoTouchIdAuth = true; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; @@ -40,94 +9,15 @@ programs.zsh.enable = true; imports = [ - (import (abs "users/teidesu/darwin.nix") { - home = let - apps = pkgs.callPackage (abs "lib/darwin/apps") {}; - in with apps; provisionApps [ - # alacritty - # raycast - # karabiner - ]; - }) + ../darwin-common.nix + (import (abs "lib/darwin/apps") inputs (apps: with apps; [ + alacritty + raycast + karabiner + ])) + (import (abs "users/teidesu/darwin.nix") {}) ]; - system.defaults.LaunchServices.LSQuarantine = false; - system.defaults.NSGlobalDomain = { - AppleEnableMouseSwipeNavigateWithScrolls = false; - AppleEnableSwipeNavigateWithScrolls = false; - ApplePressAndHoldEnabled = false; - AppleShowAllFiles = true; - AppleShowAllExtensions = true; - AppleShowScrollBars = "WhenScrolling"; - NSAutomaticCapitalizationEnabled = false; - NSAutomaticDashSubstitutionEnabled = false; - NSAutomaticPeriodSubstitutionEnabled = false; - NSAutomaticQuoteSubstitutionEnabled = false; - NSAutomaticSpellingCorrectionEnabled = false; - NSWindowShouldDragOnGesture = true; - NSDocumentSaveNewDocumentsToCloud = false; - NSNavPanelExpandedStateForSaveMode = true; - NSNavPanelExpandedStateForSaveMode2 = true; - InitialKeyRepeat = 10; - KeyRepeat = 1; - AppleKeyboardUIMode = 3; - NSWindowResizeTime = 0.1; - "com.apple.keyboard.fnState" = true; - }; - system.defaults.alf.allowdownloadsignedenabled = 1; - system.defaults.dock = { - mru-spaces = false; - orientation = "left"; - show-recents = false; - tilesize = 36; - wvous-bl-corner = 1; - wvous-br-corner = 1; - wvous-tl-corner = 1; - wvous-tr-corner = 1; - }; - system.defaults.finder = { - FXDefaultSearchScope = "SCcf"; - FXEnableExtensionChangeWarning = false; - FXPreferredViewStyle = "Nlsv"; - ShowPathbar = true; - ShowStatusBar = true; - }; - system.defaults.CustomUserPreferences = { - NSGlobalDomain = { - TSMLanguageIndicatorEnabled = 0; - QLPanelAnimationDuration = 0; - NSAutomaticWindowAnimationsEnabled = 0; - }; - - "com.apple.screencapture".location = "~/Pictures"; - "com.apple.finder" = { - _FXSortFoldersFirst = true; - CreateDesktop = false; - ShowHardDrivesOnDesktop = false; - ShowExternalHardDrivesOnDesktop = false; - ShowRemovableMediaOnDesktop = false; - ShowMountedServersOnDesktop = false; - }; - - "com.apple.BluetoothAudioAgent" = { - # from https://github.com/joeyhoer/starter/blob/master/system/bluetooth.sh - "Apple Bitpool Max (editable)" = 80; - "Apple Bitpool Min (editable)" = 48; - "Apple Initial Bitpool (editable)" = 40; - "Negotiated Bitpool" = 48; - "Negotiated Bitpool Max" = 53; - "Negotiated Bitpool Min" = 48; - "Stream - Flush Ring on Packet Drop (editable)" = 30; - "Stream - Max Outstanding Packets (editable)" = 15; - "Stream Resume Delay" = "0.75"; - }; - - "com.apple.dock".size-immutable = true; - "com.apple.frameworks.diskimages".skip-verify = true; - "com.apple.CrashReporter".UseUNC = 1; - com.apple.helpviewer.DevMode = true; - }; - system.stateVersion = 4; } diff --git a/hosts/darwin-common.nix b/hosts/darwin-common.nix new file mode 100644 index 0000000..a77ee5e --- /dev/null +++ b/hosts/darwin-common.nix @@ -0,0 +1,26 @@ +{ inputs, ... }: + +{ + nix = { + settings.experimental-features = [ "nix-command" "flakes" ]; + settings.trusted-users = [ "@admin" ]; + + useDaemon = true; + + registry = { + nixpkgs.to = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + rev = inputs.nixpkgs.rev; + }; + }; + + settings.nix-path = [ "nixpkgs=flake:nixpkgs" ]; + }; + + services.nix-daemon.enable = true; + # nixpkgs.flake.source = lib.mkForce null; + + security.pam.enableSudoTouchIdAuth = true; +} \ No newline at end of file diff --git a/hosts/teidesu-osx/configuration.nix b/hosts/teidesu-osx/configuration.nix index 4950eb9..7ead340 100644 --- a/hosts/teidesu-osx/configuration.nix +++ b/hosts/teidesu-osx/configuration.nix @@ -1,39 +1,11 @@ { pkgs , lib , abs -, inputs , ... -}: +}@inputs: { - nix = { - settings.experimental-features = [ "nix-command" "flakes" ]; - settings.trusted-users = [ "@admin" ]; - - useDaemon = true; - - registry = { - nixpkgs.to = { - type = "github"; - owner = "NixOS"; - repo = "nixpkgs"; - rev = inputs.nixpkgs.rev; - }; - }; - - settings.nix-path = [ "nixpkgs=flake:nixpkgs" ]; - }; - # nixpkgs.flake.source = lib.mkForce null; - nixpkgs.hostPlatform = "aarch64-darwin"; - services.nix-daemon.enable = true; - - age.identityPaths = [ - "/Users/teidesu/.ssh/agenix-key" - "/Users/Shared/agenix-key-unsafe" - ]; - - security.pam.enableSudoTouchIdAuth = true; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; @@ -41,6 +13,12 @@ programs.zsh.enable = true; imports = [ + ../darwin-common.nix + (import (abs "lib/darwin/apps") inputs (apps: with apps; [ + alacritty + raycast + karabiner + ])) (import (abs "users/teidesu/darwin.nix") { home = { imports = [ diff --git a/lib/darwin/apps/common.nix b/lib/darwin/apps/common.nix index 851eaca..f224736 100644 --- a/lib/darwin/apps/common.nix +++ b/lib/darwin/apps/common.nix @@ -1,4 +1,4 @@ -{ wget, lib, ... }: +{ wget, lib }: rec { download = { diff --git a/lib/darwin/apps/default.nix b/lib/darwin/apps/default.nix index 277dd42..cdda1f4 100644 --- a/lib/darwin/apps/default.nix +++ b/lib/darwin/apps/default.nix @@ -1,4 +1,4 @@ -{ callPackage, ... }: +{ pkgs, ... }: # i want to be able to declaratively *provision* gui apps on macos, # but have them manage themselves later on, not managed by nix-darwin, @@ -8,11 +8,11 @@ # homebrew sucks and i don't want to give it *any* recognition, so guess # i'll just handle dmg's myself :D -{ - provisionApps = apps: { - home.activation.provisionApps = '' - set -eau - ${builtins.concatStringsSep "\n" apps} - ''; - }; -} // (callPackage ./productivity.nix {}) \ No newline at end of file +let + repo = pkgs.callPackage ./productivity.nix {}; +in appsFactory: { + system.activationScripts.postUserActivation.text = '' + set -eau + ${builtins.concatStringsSep "\n" (appsFactory repo)} + ''; +} \ No newline at end of file diff --git a/lib/darwin/apps/productivity.nix b/lib/darwin/apps/productivity.nix index bff2420..02bec48 100644 --- a/lib/darwin/apps/productivity.nix +++ b/lib/darwin/apps/productivity.nix @@ -1,4 +1,4 @@ -{ callPackage, ... }: +{ callPackage }: let common = callPackage ./common.nix {}; diff --git a/users/teidesu/darwin.nix b/users/teidesu/darwin.nix index bffe17c..392e978 100644 --- a/users/teidesu/darwin.nix +++ b/users/teidesu/darwin.nix @@ -1,15 +1,23 @@ -{ home ? {}, ... }: +{ + home ? {}, + ... +}: { imports = [ ./fonts.nix + ./macos-defaults.nix ]; users.users.teidesu = { home = "/Users/teidesu"; }; - home-manager.users.teidesu = { pkgs, ... }: { + age.identityPaths = [ + "/Users/teidesu/.ssh/agenix-key" + ]; + + home-manager.users.teidesu = { pkgs, abs, ... }: { imports = [ ./common.nix diff --git a/users/teidesu/macos-defaults.nix b/users/teidesu/macos-defaults.nix new file mode 100644 index 0000000..74eb6df --- /dev/null +++ b/users/teidesu/macos-defaults.nix @@ -0,0 +1,80 @@ +{ ... }: + +{ + system.defaults.LaunchServices.LSQuarantine = false; + system.defaults.NSGlobalDomain = { + AppleEnableMouseSwipeNavigateWithScrolls = false; + AppleEnableSwipeNavigateWithScrolls = false; + ApplePressAndHoldEnabled = false; + AppleShowAllFiles = true; + AppleShowAllExtensions = true; + AppleShowScrollBars = "WhenScrolling"; + NSAutomaticCapitalizationEnabled = false; + NSAutomaticDashSubstitutionEnabled = false; + NSAutomaticPeriodSubstitutionEnabled = false; + NSAutomaticQuoteSubstitutionEnabled = false; + NSAutomaticSpellingCorrectionEnabled = false; + NSWindowShouldDragOnGesture = true; + NSDocumentSaveNewDocumentsToCloud = false; + NSNavPanelExpandedStateForSaveMode = true; + NSNavPanelExpandedStateForSaveMode2 = true; + InitialKeyRepeat = 10; + KeyRepeat = 1; + AppleKeyboardUIMode = 3; + NSWindowResizeTime = 0.1; + "com.apple.keyboard.fnState" = true; + }; + system.defaults.alf.allowdownloadsignedenabled = 1; + system.defaults.dock = { + mru-spaces = false; + orientation = "left"; + show-recents = false; + tilesize = 36; + wvous-bl-corner = 1; + wvous-br-corner = 1; + wvous-tl-corner = 1; + wvous-tr-corner = 1; + }; + system.defaults.finder = { + FXDefaultSearchScope = "SCcf"; + FXEnableExtensionChangeWarning = false; + FXPreferredViewStyle = "Nlsv"; + ShowPathbar = true; + ShowStatusBar = true; + }; + system.defaults.CustomUserPreferences = { + NSGlobalDomain = { + TSMLanguageIndicatorEnabled = 0; + QLPanelAnimationDuration = 0; + NSAutomaticWindowAnimationsEnabled = 0; + }; + + "com.apple.screencapture".location = "~/Pictures"; + "com.apple.finder" = { + _FXSortFoldersFirst = true; + CreateDesktop = false; + ShowHardDrivesOnDesktop = false; + ShowExternalHardDrivesOnDesktop = false; + ShowRemovableMediaOnDesktop = false; + ShowMountedServersOnDesktop = false; + }; + + "com.apple.BluetoothAudioAgent" = { + # from https://github.com/joeyhoer/starter/blob/master/system/bluetooth.sh + "Apple Bitpool Max (editable)" = 80; + "Apple Bitpool Min (editable)" = 48; + "Apple Initial Bitpool (editable)" = 40; + "Negotiated Bitpool" = 48; + "Negotiated Bitpool Max" = 53; + "Negotiated Bitpool Min" = 48; + "Stream - Flush Ring on Packet Drop (editable)" = 30; + "Stream - Max Outstanding Packets (editable)" = 15; + "Stream Resume Delay" = "0.75"; + }; + + "com.apple.dock".size-immutable = true; + "com.apple.frameworks.diskimages".skip-verify = true; + "com.apple.CrashReporter".UseUNC = 1; + com.apple.helpviewer.DevMode = true; + }; +} \ No newline at end of file