forked from nico/dots
nix: start darwin configuration
preparation for macOS
This commit is contained in:
parent
b6f830297b
commit
3d70922a85
7 changed files with 213 additions and 1 deletions
21
flake.lock
generated
21
flake.lock
generated
|
|
@ -125,6 +125,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1732420287,
|
||||||
|
"narHash": "sha256-CzvYF4x6jUh/+NEEIFrIY5t1W/N3IA2bNZJiMXu9GTo=",
|
||||||
|
"owner": "LnL7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "3c52583b99666a349a6219dc1f0dd07d75c82d6a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "LnL7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731676054,
|
"lastModified": 1731676054,
|
||||||
|
|
@ -187,6 +207,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"lanzaboote": "lanzaboote",
|
"lanzaboote": "lanzaboote",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
23
flake.nix
23
flake.nix
|
|
@ -6,9 +6,11 @@
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
|
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
|
||||||
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
|
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
nix-darwin.url = "github:LnL7/nix-darwin";
|
||||||
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, lanzaboote, ... }@inputs: {
|
outputs = { self, nixpkgs, lanzaboote, nix-darwin, ... }@inputs: {
|
||||||
nixosConfigurations.pluto = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.pluto = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
|
|
@ -34,5 +36,24 @@
|
||||||
./hosts/pluto/hardware-configuration.nix
|
./hosts/pluto/hardware-configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
darwinConfigurations.faye = nix-darwin.lib.darwinSystem {
|
||||||
|
system = "aarch64-darwin";
|
||||||
|
modules = [
|
||||||
|
./modules/applications.nix
|
||||||
|
./modules/firefox.nix
|
||||||
|
./modules/fonts.nix
|
||||||
|
./modules/games.nix
|
||||||
|
./modules/nix.nix
|
||||||
|
./modules/shell.nix
|
||||||
|
|
||||||
|
./modules/darwin/applications.nix
|
||||||
|
./modules/darwin/desktop.nix
|
||||||
|
./modules/darwin/hardware.nix
|
||||||
|
./modules/darwin/nix.nix
|
||||||
|
|
||||||
|
./hosts/faye/conf.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
hosts/faye/conf.nix
Normal file
6
hosts/faye/conf.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
networking.hostName = "faye";
|
||||||
|
networking.computerName = "faye";
|
||||||
|
}
|
||||||
48
modules/darwin/applications.nix
Normal file
48
modules/darwin/applications.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# dock
|
||||||
|
system.defaults.dock.autohide = true;
|
||||||
|
system.defaults.dock.autohide-delay = 0.2;
|
||||||
|
system.defaults.dock.autohide-time-modifier = 0.2;
|
||||||
|
system.defaults.dock.mineffect = "scale";
|
||||||
|
system.defaults.dock.orientation = "left";
|
||||||
|
system.defaults.dock.show-recents = true;
|
||||||
|
system.defaults.dock.tilesize = 48;
|
||||||
|
system.defaults.dock.persistent-apps = [
|
||||||
|
"${pkgs.firefox}/Applications/Firefox.app"
|
||||||
|
"${pkgs.kitty}/Applications/Kitty.app"
|
||||||
|
"/System/Applications/Finder.app"
|
||||||
|
];
|
||||||
|
|
||||||
|
# finder
|
||||||
|
system.defaults.finder = {
|
||||||
|
AppleShowAllExtensions = true;
|
||||||
|
AppleShowAllFiles = true;
|
||||||
|
FXEnableExtensionChangeWarning = false;
|
||||||
|
FXPreferredViewStyle = "clmv";
|
||||||
|
FXRemoveOldTrashItems = true;
|
||||||
|
NewWindowTarget = "Home";
|
||||||
|
ShowStatusBar = true;
|
||||||
|
_FXShowPosixPathInTitle = true;
|
||||||
|
_FXSortFoldersFirst = true;
|
||||||
|
|
||||||
|
CreateDesktop = true; # desktop icons
|
||||||
|
ShowHardDrivesOnDesktop = true;
|
||||||
|
ShowExternalHardDrivesOnDesktop = true;
|
||||||
|
ShowMountedServersOnDesktop = true;
|
||||||
|
ShowRemovableMediaOnDesktop = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# activity monitor
|
||||||
|
system.defaults.ActivityMonitor = {
|
||||||
|
IconType = 0;
|
||||||
|
OpenMainWindow = true;
|
||||||
|
ShowCategory = 100;
|
||||||
|
SortColumn = "CPUUsage";
|
||||||
|
SortDirection = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
# hotkey daemon
|
||||||
|
services.skhd.enable = true;
|
||||||
|
}
|
||||||
47
modules/darwin/desktop.nix
Normal file
47
modules/darwin/desktop.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
# appearance
|
||||||
|
system.defaults.NSGlobalDomain.AppleInterfaceStyle = "Dark";
|
||||||
|
system.defaults.NSGlobalDomain.AppleShowScrollBars = "WhenScrolling";
|
||||||
|
system.defaults.WindowManager.EnableStandardClickToShowDesktop = true;
|
||||||
|
system.startup.chime = true;
|
||||||
|
|
||||||
|
system.defaults.NSGlobalDomain.NSDisableAutomaticTermination = true;
|
||||||
|
system.defaults.NSGlobalDomain.NSDocumentSaveNewDocumentsToCloud = false;
|
||||||
|
|
||||||
|
# login
|
||||||
|
system.defaults.loginwindow.GuestEnabled = false;
|
||||||
|
system.defaults.screensaver.askForPassword = true;
|
||||||
|
|
||||||
|
# control center
|
||||||
|
# 18 = show in menubar, 24 = put in control center
|
||||||
|
system.defaults.controlcenter = {
|
||||||
|
Display = 18;
|
||||||
|
FocusModes = 18;
|
||||||
|
NowPlaying = 18;
|
||||||
|
Sound = 18;
|
||||||
|
|
||||||
|
Bluetooth = 24;
|
||||||
|
AirDrop = 24;
|
||||||
|
|
||||||
|
BatteryShowPercentage = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# clock
|
||||||
|
system.defaults.menuExtraClock = {
|
||||||
|
Show24Hour = false;
|
||||||
|
ShowAMPM = true;
|
||||||
|
ShowDayOfMonth = true;
|
||||||
|
ShowDayOfWeek = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# mission control
|
||||||
|
system.defaults.dock.expose-animation-duration = 0.2;
|
||||||
|
|
||||||
|
# spaces
|
||||||
|
system.defaults.dock.mru-spaces = false; # dont rearange spaces based on usage
|
||||||
|
system.defaults.spaces.spans-displays = true; # displays have different spaces
|
||||||
|
system.defaults.NSGlobalDomain.AppleSpacesSwitchOnActivate = true;
|
||||||
|
}
|
||||||
35
modules/darwin/hardware.nix
Normal file
35
modules/darwin/hardware.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
power = {
|
||||||
|
sleep.computer = "never";
|
||||||
|
sleep.display = 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
security.pam.enableSudoTouchIdAuth = true;
|
||||||
|
|
||||||
|
networking.dns = [
|
||||||
|
"1.1.1.1"
|
||||||
|
];
|
||||||
|
|
||||||
|
# keyboard
|
||||||
|
system.defaults.NSGlobalDomain = {
|
||||||
|
KeyRepeat = 1;
|
||||||
|
NSAutomaticCapitalizationEnabled = false;
|
||||||
|
NSAutomaticDashSubstitutionEnabled = false;
|
||||||
|
NSAutomaticInlinePredictionEnabled = true;
|
||||||
|
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||||
|
NSAutomaticQuoteSubstitutionEnabled = false;
|
||||||
|
NSAutomaticSpellingCorrectionEnabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
system.keyboard.remapCapsLockToControl = true;
|
||||||
|
system.keyboard.swapLeftCtrlAndFn = true;
|
||||||
|
system.defaults.NSGlobalDomain.ApplePressAndHoldEnabled = false;
|
||||||
|
|
||||||
|
system.defaults.hitoolbox.AppleFnUsageType = "Do Nothing";
|
||||||
|
|
||||||
|
# mouse
|
||||||
|
system.defaults.".GlobalPreferences"."com.apple.mouse.scaling" = -1.0; # mouse acceleration
|
||||||
|
|
||||||
|
}
|
||||||
34
modules/darwin/nix.nix
Normal file
34
modules/darwin/nix.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# auto upgrade nix package and the daemon service.
|
||||||
|
services.nix-daemon.enable = true;
|
||||||
|
|
||||||
|
# nix auto garbage collection
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
interval = { Weekday = 0; Hour = 0; Minute = 0; };
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
|
||||||
|
# make nix applications use alias instead of symlinks for compatability
|
||||||
|
system.activationScripts.applications.text = let
|
||||||
|
env = pkgs.buildEnv {
|
||||||
|
name = "system-applications";
|
||||||
|
paths = config.environment.systemPackages;
|
||||||
|
pathsToLink = "/Applications";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.lib.mkForce ''
|
||||||
|
# Set up applications.
|
||||||
|
echo "setting up /Applications..." >&2
|
||||||
|
rm -rf /Applications/Nix\ Apps
|
||||||
|
mkdir -p /Applications/Nix\ Apps
|
||||||
|
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
|
||||||
|
while read -r src; do
|
||||||
|
app_name=$(basename "$src")
|
||||||
|
echo "copying $src" >&2
|
||||||
|
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue