refactor(darwin): moved common stuff into darwin-common + improved apps provision

This commit is contained in:
alina 🌸 2024-05-01 06:32:34 +03:00
parent 6ae50e8cc6
commit 80fc71d327
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
8 changed files with 142 additions and 160 deletions

View file

@ -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;
}

26
hosts/darwin-common.nix Normal file
View file

@ -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;
}

View file

@ -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 = [

View file

@ -1,4 +1,4 @@
{ wget, lib, ... }:
{ wget, lib }:
rec {
download = {

View file

@ -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 {})
let
repo = pkgs.callPackage ./productivity.nix {};
in appsFactory: {
system.activationScripts.postUserActivation.text = ''
set -eau
${builtins.concatStringsSep "\n" (appsFactory repo)}
'';
}

View file

@ -1,4 +1,4 @@
{ callPackage, ... }:
{ callPackage }:
let
common = callPackage ./common.nix {};

View file

@ -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

View file

@ -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;
};
}