feat: initial macos setup
This commit is contained in:
@@ -3,3 +3,5 @@ result
|
|||||||
result-*
|
result-*
|
||||||
|
|
||||||
secrets.d/
|
secrets.d/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
|||||||
Generated
+22
@@ -102,6 +102,27 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1783744694,
|
||||||
|
"narHash": "sha256-2cp6N3rrwnGYLTx9l6N+NI+kwrCWxvJUbj5WJhvB29A=",
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "c3e90c89649b07d1a96e4b9dd6cd0d6e44b91a74",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"ref": "nix-darwin-26.05",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix4vscode": {
|
"nix4vscode": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -230,6 +251,7 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"globalprotect-openconnect": "globalprotect-openconnect",
|
"globalprotect-openconnect": "globalprotect-openconnect",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
"nix4vscode": "nix4vscode",
|
"nix4vscode": "nix4vscode",
|
||||||
"nixpkgs": "nixpkgs_4",
|
"nixpkgs": "nixpkgs_4",
|
||||||
"onedark-yazi": "onedark-yazi",
|
"onedark-yazi": "onedark-yazi",
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# macOS system management (paired with nixpkgs 26.05).
|
||||||
|
nix-darwin = {
|
||||||
|
url = "github:nix-darwin/nix-darwin/nix-darwin-26.05";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
globalprotect-openconnect.url = "github:yuezk/GlobalProtect-openconnect";
|
globalprotect-openconnect.url = "github:yuezk/GlobalProtect-openconnect";
|
||||||
|
|
||||||
plasma-manager = {
|
plasma-manager = {
|
||||||
@@ -28,44 +34,62 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, home-manager, globalprotect-openconnect, ... }@inputs:
|
outputs = { self, nixpkgs, home-manager, nix-darwin, globalprotect-openconnect, ... }@inputs:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
linuxSystem = "x86_64-linux";
|
||||||
|
|
||||||
|
# Home Manager wiring shared by the NixOS (Linux) hosts.
|
||||||
|
# plasma-manager is Linux-only, so it lives here rather than in the
|
||||||
|
# darwin block below.
|
||||||
|
nixosHome = {
|
||||||
|
home-manager = {
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
backupFileExtension = "backup";
|
||||||
|
users.alex = import ./home/alex;
|
||||||
|
extraSpecialArgs = { inherit inputs; isDarwin = false; };
|
||||||
|
sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ];
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
|
||||||
# To add a new machine, duplicate this block and change the name
|
# To add a new Linux machine, duplicate this block and change the name.
|
||||||
whitegrizzly = nixpkgs.lib.nixosSystem {
|
whitegrizzly = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
system = linuxSystem;
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/whitegrizzly
|
./hosts/whitegrizzly
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
nixosHome
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
users.alex = import ./home/alex;
|
|
||||||
extraSpecialArgs = { inherit inputs; };
|
|
||||||
sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
oreo = nixpkgs.lib.nixosSystem {
|
oreo = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
system = linuxSystem;
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/oreo
|
./hosts/oreo
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
nixosHome
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
darwinConfigurations = {
|
||||||
|
|
||||||
|
seasoned = nix-darwin.lib.darwinSystem {
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
./hosts/seasoned
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
|
backupFileExtension = "backup";
|
||||||
users.alex = import ./home/alex;
|
users.alex = import ./home/alex;
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; isDarwin = true; };
|
||||||
sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
+23
-13
@@ -1,24 +1,34 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, lib, isDarwin, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Modules that only make sense on Linux, either because they use systemd,
|
||||||
|
# KDE/Plasma, or a package that nixpkgs only builds for Linux. On macOS the
|
||||||
|
# equivalents are installed as Homebrew casks (see modules/darwin.nix).
|
||||||
|
linuxOnly = lib.optionals (!isDarwin) [
|
||||||
|
../modules/plasma.nix
|
||||||
|
../modules/dropbox.nix
|
||||||
|
../modules/globalprotect.nix
|
||||||
|
../modules/gimp.nix
|
||||||
|
../modules/libreoffice.nix
|
||||||
|
../modules/masterpdfeditor.nix
|
||||||
|
../modules/pymol.nix
|
||||||
|
../modules/zoom.nix
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
home.username = "alex";
|
home.username = "alex";
|
||||||
home.homeDirectory = "/home/alex";
|
home.homeDirectory = if isDarwin then "/Users/alex" else "/home/alex";
|
||||||
home.stateVersion = "25.11";
|
home.stateVersion = "25.11";
|
||||||
home.sessionPath = [ "$HOME/.local/bin" ];
|
home.sessionPath = [ "$HOME/.local/bin" ];
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../modules/datalad.nix
|
../modules/datalad.nix
|
||||||
../modules/docker.nix
|
../modules/docker.nix
|
||||||
../modules/dropbox.nix
|
|
||||||
../modules/fonts.nix
|
../modules/fonts.nix
|
||||||
../modules/ghostty.nix
|
../modules/ghostty.nix
|
||||||
../modules/gimp.nix
|
|
||||||
../modules/globalprotect.nix
|
|
||||||
../modules/helix.nix
|
../modules/helix.nix
|
||||||
../modules/hyperfine.nix
|
../modules/hyperfine.nix
|
||||||
../modules/libreoffice.nix
|
|
||||||
../modules/masterpdfeditor.nix
|
|
||||||
../modules/pixi.nix
|
../modules/pixi.nix
|
||||||
../modules/plasma.nix
|
|
||||||
../modules/pymol.nix
|
|
||||||
../modules/python.nix
|
../modules/python.nix
|
||||||
../modules/rust.nix
|
../modules/rust.nix
|
||||||
../modules/ssh.nix
|
../modules/ssh.nix
|
||||||
@@ -28,21 +38,21 @@
|
|||||||
../modules/yazi.nix
|
../modules/yazi.nix
|
||||||
../modules/zellij.nix
|
../modules/zellij.nix
|
||||||
../modules/zig.nix
|
../modules/zig.nix
|
||||||
../modules/zoom.nix
|
|
||||||
../modules/zsh.nix
|
../modules/zsh.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
./gh.nix
|
./gh.nix
|
||||||
];
|
] ++ linuxOnly;
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
atool
|
atool
|
||||||
httpie
|
httpie
|
||||||
just
|
just
|
||||||
spotify
|
|
||||||
brave
|
|
||||||
git-lfs
|
git-lfs
|
||||||
typst
|
typst
|
||||||
unzip
|
unzip
|
||||||
glow
|
glow
|
||||||
|
] ++ lib.optionals (!isDarwin) [
|
||||||
|
spotify
|
||||||
|
brave
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, isDarwin, ... }:
|
||||||
let
|
let
|
||||||
baseKeybinds = [
|
baseKeybinds = [
|
||||||
"ctrl+t=new_tab"
|
"ctrl+t=new_tab"
|
||||||
@@ -16,7 +16,10 @@ in
|
|||||||
{
|
{
|
||||||
programs.ghostty = {
|
programs.ghostty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# nixpkgs `ghostty` is the Linux/GTK build (Linux-only meta.platforms).
|
||||||
|
# On macOS use `ghostty-bin`, the repackaged official .dmg.
|
||||||
|
package = if isDarwin then pkgs.ghostty-bin else pkgs.ghostty;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
# Font Settings
|
# Font Settings
|
||||||
"font-family" = "Roboto Mono";
|
"font-family" = "Roboto Mono";
|
||||||
@@ -93,8 +96,8 @@ in
|
|||||||
|
|
||||||
# Keybindings (Tabs & Splits)
|
# Keybindings (Tabs & Splits)
|
||||||
"keybind" = baseKeybinds
|
"keybind" = baseKeybinds
|
||||||
++ lib.optionals pkgs.stdenv.isDarwin [ "super+d=unbind" ];
|
++ lib.optionals isDarwin [ "super+d=unbind" ];
|
||||||
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
} // lib.optionalAttrs isDarwin {
|
||||||
"macos-titlebar-style" = "transparent";
|
"macos-titlebar-style" = "transparent";
|
||||||
"macos-icon" = "official";
|
"macos-icon" = "official";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, lib, isDarwin, ... }: {
|
||||||
programs.vscodium = {
|
programs.vscodium = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.vscodium;
|
package = pkgs.vscodium;
|
||||||
@@ -18,12 +18,16 @@
|
|||||||
rust-lang.rust-analyzer
|
rust-lang.rust-analyzer
|
||||||
timonwong.shellcheck
|
timonwong.shellcheck
|
||||||
unifiedjs.vscode-mdx
|
unifiedjs.vscode-mdx
|
||||||
yzane.markdown-pdf
|
|
||||||
]) ++ pkgs.nix4vscode.forOpenVsx [
|
]) ++ pkgs.nix4vscode.forOpenVsx [
|
||||||
"akamud.vscode-theme-onedark"
|
"akamud.vscode-theme-onedark"
|
||||||
"astral-sh.ty"
|
"astral-sh.ty"
|
||||||
"modular-mojotools.vscode-mojo"
|
"modular-mojotools.vscode-mojo"
|
||||||
];
|
] ++ lib.optionals (!isDarwin) (with pkgs.vscode-extensions; [
|
||||||
|
# markdown-pdf pins ungoogled-chromium (Linux-only) as its PDF
|
||||||
|
# renderer. On macOS, install it from the marketplace by hand and set
|
||||||
|
# markdown-pdf.executablePath to Chrome/Brave, or render via typst.
|
||||||
|
yzane.markdown-pdf
|
||||||
|
]);
|
||||||
|
|
||||||
userSettings = {
|
userSettings = {
|
||||||
"editor.fontFamily" = "'JetBrains Mono', monospace";
|
"editor.fontFamily" = "'JetBrains Mono', monospace";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
programs.zed-editor = {
|
programs.zed-editor = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.zed-editor-fhs;
|
package = pkgs.zed-editor;
|
||||||
mutableUserSettings = true;
|
mutableUserSettings = true;
|
||||||
|
|
||||||
userSettings = {
|
userSettings = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, lib, isDarwin, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
la = "ls -A";
|
la = "ls -A";
|
||||||
l = "ls -CF";
|
l = "ls -CF";
|
||||||
tp = "tree -I '__init__*' -I '__pycache__'";
|
tp = "tree -I '__init__*' -I '__pycache__'";
|
||||||
clear = "/run/current-system/sw/bin/clear";
|
clear = "${pkgs.ncurses}/bin/clear";
|
||||||
zide = "zellij --layout ide";
|
zide = "zellij --layout ide";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,6 +45,11 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
TERMINFO_DIRS = "${pkgs.ghostty}/share/terminfo:${pkgs.ncurses}/share/terminfo";
|
# ghostty (GTK) ships terminfo under $out/share on Linux. The macOS
|
||||||
|
# ghostty-bin bundles its own, so only add ncurses there.
|
||||||
|
TERMINFO_DIRS = lib.concatStringsSep ":" (
|
||||||
|
lib.optional (!isDarwin) "${pkgs.ghostty}/share/terminfo"
|
||||||
|
++ [ "${pkgs.ncurses}/share/terminfo" ]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../modules/darwin.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# Apple Silicon. For an Intel Mac use "x86_64-darwin".
|
||||||
|
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||||
|
|
||||||
|
networking.hostName = "seasoned";
|
||||||
|
networking.localHostName = "seasoned";
|
||||||
|
networking.computerName = "seasoned";
|
||||||
|
|
||||||
|
system.primaryUser = "alex";
|
||||||
|
users.users.alex = {
|
||||||
|
name = "alex";
|
||||||
|
home = "/Users/alex";
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = 6;
|
||||||
|
}
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
set positional-arguments
|
set positional-arguments
|
||||||
|
|
||||||
host := `hostname`
|
# Flake host key. On macOS the LocalHostName is what matches the flake key
|
||||||
|
# (after the first rebuild); on Linux it's the plain hostname.
|
||||||
|
# Override: just host=myname rebuild
|
||||||
|
host := if os() == "macos" { `scutil --get LocalHostName` } else { `hostname` }
|
||||||
|
|
||||||
|
# Pick the rebuild tool for the current OS.
|
||||||
|
rebuild-cmd := if os() == "macos" { "darwin-rebuild" } else { "nixos-rebuild" }
|
||||||
|
|
||||||
# Default: list available recipes.
|
# Default: list available recipes.
|
||||||
default:
|
default:
|
||||||
@just --list
|
@just --list
|
||||||
|
|
||||||
# Rebuild the system and switch immediately
|
# Rebuild the system and switch immediately. Works on NixOS and macOS.
|
||||||
rebuild:
|
rebuild:
|
||||||
sudo nixos-rebuild switch --flake .#{{host}}
|
sudo {{rebuild-cmd}} switch --flake .#{{host}}
|
||||||
|
|
||||||
# Update flake.lock
|
# Update flake.lock
|
||||||
update:
|
update:
|
||||||
@@ -18,7 +24,7 @@ update:
|
|||||||
clean:
|
clean:
|
||||||
sudo nix-collect-garbage --delete-older-than 7d
|
sudo nix-collect-garbage --delete-older-than 7d
|
||||||
sudo nix-store --optimise
|
sudo nix-store --optimise
|
||||||
sudo nixos-rebuild boot --flake .#{{host}}
|
sudo {{ if os() == "macos" { "darwin-rebuild switch" } else { "nixos-rebuild boot" } }} --flake .#{{host}}
|
||||||
|
|
||||||
# Generate Ed25519 SSH keys for each named service (default: github gradescope).
|
# Generate Ed25519 SSH keys for each named service (default: github gradescope).
|
||||||
# Override: just gen-keys gitlab bitbucket
|
# Override: just gen-keys gitlab bitbucket
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{ inputs, pkgs, ... }:
|
||||||
|
{
|
||||||
|
# We installed Nix via the *Determinate* package (the installer
|
||||||
|
# asks on macOS Tahoe), Determinate manages /etc/nix/nix.conf itself and
|
||||||
|
# nix-darwin must NOT. Thus, we have to set `nix.enable = false;`.
|
||||||
|
nix.enable = false;
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
nixpkgs.overlays = [ inputs.nix4vscode.overlays.default ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
git
|
||||||
|
tree
|
||||||
|
coreutils
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
homebrew = {
|
||||||
|
enable = true;
|
||||||
|
onActivation = {
|
||||||
|
autoUpdate = false;
|
||||||
|
upgrade = false;
|
||||||
|
cleanup = "zap";
|
||||||
|
};
|
||||||
|
|
||||||
|
casks = [
|
||||||
|
"1password"
|
||||||
|
"1password-cli"
|
||||||
|
"dropbox"
|
||||||
|
"zoom"
|
||||||
|
"spotify"
|
||||||
|
"brave-browser"
|
||||||
|
"gimp"
|
||||||
|
"orbstack"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# macOS preferences, declaratively. Tweak to taste.
|
||||||
|
# Full option list: https://nix-darwin.github.io/nix-darwin/manual/
|
||||||
|
system.defaults = {
|
||||||
|
NSGlobalDomain = {
|
||||||
|
KeyRepeat = 2;
|
||||||
|
InitialKeyRepeat = 15;
|
||||||
|
AppleShowAllExtensions = true;
|
||||||
|
ApplePressAndHoldEnabled = false;
|
||||||
|
};
|
||||||
|
dock = {
|
||||||
|
autohide = true;
|
||||||
|
show-recents = false;
|
||||||
|
mru-spaces = false;
|
||||||
|
};
|
||||||
|
finder = {
|
||||||
|
AppleShowAllFiles = true;
|
||||||
|
FXPreferredViewStyle = "Nlsv";
|
||||||
|
ShowPathbar = true;
|
||||||
|
};
|
||||||
|
trackpad.Clicking = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user