feat: Nix flake build for Darwin #23

Open
aniva wants to merge 13 commits from system/darwin into main
9 changed files with 298 additions and 9 deletions

View File

@ -1,10 +1,27 @@
# Desktop Environment for MacOS
# Configuration for MacOS
* Installation
Install Homebrew.
Install
- [[https://brew.sh/][Homebrew]]
- [[https://lix.systems/install/][Lix]]
* Desktop Manager
and use ~nix-darwin~ to install the system flake
#+begin_src sh
nix run nix-darwin -- switch --flake ~/.config/nix-darwin
#+end_src
To update the system after flake changes,
#+begin_src sh
darwin-rebuild switch --flake .
#+end_src
Optionally, run
#+begin_src
nix-collect-garbage --delete-old
#+end_src
* Desktop Environment
- [[https://github.com/koekeishiya/yabai][yabai]]: Window manager, see [[https://github.com/koekeishiya/yabai/wiki][setup guide]]
@ -18,7 +35,4 @@ Install Homebrew.
~fn~ key is used as the workspace leader key and ~cmd~ key is used as window
leader key. The reason is that ~fn~ and arrow key combinations disable arrow
keys for other applications.
- ~Karabiner-elements~: Install and remap Caps Lock to Meh key. This is the
master key for window operations in ~yabai~.
- [[https://github.com/felixhageloh/uebersicht][Uebersicht]]: Widgets manager
- [[https://github.com/Jean-Tinland/simple-bar][simple-bar]]: Status bar (see page for installation guide)
- Sketchybar: Status Bar

View File

@ -160,6 +160,11 @@ Modifications to the default key bindings to mimic spacemacs
(map! :nvi "C" nil) ; remove this one weird binding
(map! "<f12>" #'toggle-input-method)
; Remap JIS yen key to backslash
(global-set-key (kbd "M-¥") (kbd "\\"))
(global-set-key (kbd "M-|") (kbd "|"))
(global-set-key (kbd "C-M-¥") (kbd "C-\\"))
#+end_src
** Font settings

View File

@ -95,7 +95,7 @@
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
(lsp +peek +eglot) ; M-x vscode
(lsp +eglot) ; M-x vscode
(magit +forge) ; a git porcelain for Emacs
make ; run make tasks from Emacs
pass ; password manager for nerds
@ -146,7 +146,7 @@
(julia +lsp) ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
(latex +latexmk +lsp) ; writing papers in Emacs has never been so fun
lean ; for folks with too much to prove
;;lean ; for folks with too much to prove
ledger ; be audit you can be
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore

48
flake.lock Normal file
View File

@ -0,0 +1,48 @@
{
"nodes": {
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-darwin"
]
},
"locked": {
"lastModified": 1731642829,
"narHash": "sha256-vG+O2RZRzYZ8BUMNNJ+BLSj6PUoGW7taDQbp6QNJ3Xo=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "f86f158efd4bab8dce3e207e4621f1df3a760b7a",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs-darwin": {
"locked": {
"lastModified": 1733326450,
"narHash": "sha256-hBG6Ix5ZzXCJoanrPOLtQRalYv6nnDu9AZeamRfjKJ8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f9ef77eb704d063bfbff7f04531a0b325cc1a18f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-24.11-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-darwin": "nix-darwin",
"nixpkgs-darwin": "nixpkgs-darwin"
}
}
},
"root": "root",
"version": 7
}

32
flake.nix Normal file
View File

@ -0,0 +1,32 @@
{
description = "Leni Aniva's Systems";
inputs = {
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-darwin";
};
};
outputs = inputs@{ self, nixpkgs-darwin, nix-darwin }: {
darwinConfigurations = {
tetrahedrite = nix-darwin.lib.darwinSystem {
modules = [
./nix-darwin/configuration.nix
{
nixpkgs.hostPlatform = "x86_64-darwin";
}
];
};
sphalerite = nix-darwin.lib.darwinSystem {
modules = [
./nix-darwin/configuration.nix
{
nixpkgs.hostPlatform = "aarch64-darwin";
}
];
};
};
};
}

View File

@ -0,0 +1,62 @@
{ config, pkgs, ... }: {
imports = [ ./homebrew.nix ./yabai-skhd.nix ];
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment = {
variables = {
EDITOR = "vim";
VISUAL = "vim";
};
systemPackages = with pkgs; [
vim
ripgrep
fd
gnupg
direnv
nix-direnv
rustup
elan
poetry
(import ./tex.nix { inherit pkgs; })
cmake
ispell
# Media
imagemagick
fontconfig
pass
python312Packages.pygments
];
};
# Auto upgrade nix package and the daemon service.
services = {
nix-daemon.enable = true;
#karabiner-elements.enable = true;
sketchybar = {
enable = true;
};
};
nix = {
package = pkgs.nix;
settings.experimental-features = "nix-command flakes";
};
# Enable alternative shell support in nix-darwin.
programs.fish.enable = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system = {
stateVersion = 5;
defaults = {
dock = {
autohide = true;
orientation = "bottom";
};
};
};
}

69
nix-darwin/homebrew.nix Normal file
View File

@ -0,0 +1,69 @@
{ ... }:
{
homebrew = {
enable = true;
onActivation = {
cleanup = "zap";
autoUpdate = false;
upgrade = false;
};
brews = [
"pinentry-mac"
# Building tools
"libtool"
"pkgconf"
"autoconf"
"poppler"
"automake"
];
casks = [
# System monitoring
"grandperspective"
"lulu"
"xrg"
# Desktop Environment
"karabiner-elements"
"kando"
# Inputs
"wacom-tablet"
# Multimedia
"vlc"
"darktable"
"adobe-dng-converter"
# Communications
"signal"
"slack"
"discord"
"zoom"
"zulip"
# Browsing
"firefox"
"zotero"
"anki"
"skim"
# Editors
"emacs-mac"
"arduino-ide"
"blender"
"inkscape"
# Terminal
"iterm2"
# Fonts
"font-noto-mono"
"font-source-code-pro"
];
taps = [
"koekeishiya/formulae"
"railwaycat/emacsmacport"
];
};
}

46
nix-darwin/tex.nix Normal file
View File

@ -0,0 +1,46 @@
{ pkgs, ... }:
pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-medium
latexmk
# Symbols
amsmath
cancel
hyphenat
xstring
mnsymbol
scalerel
# Typesetting
pdfcol
changepage
upquote
anyfontsize
# Misc
svg
datetime2
makecell
tcolorbox
type1cm
environ
minted
transparent
# Graphics
tikzmark
tikzfill
pgfplots
# Classes
llncs
beamerposter
# Fonts
gnu-freefont
raleway
lato
biblatex
;
}

13
nix-darwin/yabai-skhd.nix Normal file
View File

@ -0,0 +1,13 @@
{ ... }:
{
services = {
yabai = {
enable = true;
extraConfig = builtins.readFile ../yabai/yabairc;
};
skhd = {
enable = true;
skhdConfig = builtins.readFile ../skhd/skhdrc;
};
};
}