From e452250b1bcafaa74cc7301fc644be7133c9aeb3 Mon Sep 17 00:00:00 2001 From: Madeleine Date: Mon, 30 Oct 2023 23:04:56 +0000 Subject: [PATCH] Improved nix-darwin by a lot, and some small fixes for nixos and yt-dlp --- flake.lock | 467 +++++++++++++++++++++++++++- flake.nix | 10 +- maddie/common/yt-dlp/ytdlp-music.sh | 5 +- maddie/nixos/mpd.nix | 6 + maddie/nixos/yubikey.nix | 7 + systems/mmacbookpro/apps.nix | 24 +- systems/mmacbookpro/dock.nix | 53 ++++ systems/mmacbookpro/finder.nix | 4 +- systems/mmacbookpro/keyboard.nix | 7 + systems/mmacbookpro/networking.nix | 8 + systems/mmacbookpro/nix.nix | 5 +- systems/mmacbookpro/setDock.nix | 68 ++++ systems/mmacbookpro/settings.nix | 83 +++++ 13 files changed, 717 insertions(+), 30 deletions(-) create mode 100644 maddie/nixos/yubikey.nix create mode 100644 systems/mmacbookpro/dock.nix create mode 100644 systems/mmacbookpro/networking.nix create mode 100644 systems/mmacbookpro/setDock.nix create mode 100644 systems/mmacbookpro/settings.nix diff --git a/flake.lock b/flake.lock index c8a8709..2a233e0 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1696360011, - "narHash": "sha256-HpPv27qMuPou4acXcZ8Klm7Zt0Elv9dgDvSJaomWb9Y=", + "lastModified": 1697723594, + "narHash": "sha256-W7lTC+kHGS1YCOutGpxUHF0cK66iY/GYr3INaTyVa/I=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "8b6ea26d5d2e8359d06278364f41fbc4b903b28a", + "rev": "19f75c2b45fbfc307ecfeb9dadc41a4c1e4fb980", "type": "github" }, "original": { @@ -20,6 +20,203 @@ "type": "github" } }, + "doom-emacs": { + "flake": false, + "locked": { + "lastModified": 1662497747, + "narHash": "sha256-4n7E1fqda7cn5/F2jTkOnKw1juG6XMS/FI9gqODL3aU=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + } + }, + "doom-snippets": { + "flake": false, + "locked": { + "lastModified": 1694887483, + "narHash": "sha256-KlKhruPSLPSKqUnr5/U65arm16VrY9ORzm+XKNZhpTQ=", + "owner": "doomemacs", + "repo": "snippets", + "rev": "f022984ee1318a4015d5d081b3c3dab5a60dc6ff", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "snippets", + "type": "github" + } + }, + "emacs-overlay": { + "flake": false, + "locked": { + "lastModified": 1676366521, + "narHash": "sha256-i4UAY8t9Au9SJtsgYppa3NHSVf1YkV6yqnNIQd+Km4g=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + } + }, + "emacs-so-long": { + "flake": false, + "locked": { + "lastModified": 1575031854, + "narHash": "sha256-xIa5zO0ZaToDrec1OFjBK6l39AbA4l/CE4LInVu2hi0=", + "owner": "hlissner", + "repo": "emacs-so-long", + "rev": "ed666b0716f60e8988c455804de24b55919e71ca", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "emacs-so-long", + "type": "github" + } + }, + "evil-escape": { + "flake": false, + "locked": { + "lastModified": 1588439096, + "narHash": "sha256-aB2Ge5o/93B18tPf4fN1c+O46CNh/nOqwLJbox4c8Gw=", + "owner": "hlissner", + "repo": "evil-escape", + "rev": "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-escape", + "type": "github" + } + }, + "evil-markdown": { + "flake": false, + "locked": { + "lastModified": 1626852210, + "narHash": "sha256-HBBuZ1VWIn6kwK5CtGIvHM1+9eiNiKPH0GUsyvpUVN8=", + "owner": "Somelauw", + "repo": "evil-markdown", + "rev": "8e6cc68af83914b2fa9fd3a3b8472573dbcef477", + "type": "github" + }, + "original": { + "owner": "Somelauw", + "repo": "evil-markdown", + "type": "github" + } + }, + "evil-org-mode": { + "flake": false, + "locked": { + "lastModified": 1607203864, + "narHash": "sha256-JxwqVYDN6OIJEH15MVI6XOZAPtUWUhJQWHyzcrUvrFg=", + "owner": "hlissner", + "repo": "evil-org-mode", + "rev": "a9706da260c45b98601bcd72b1d2c0a24a017700", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-org-mode", + "type": "github" + } + }, + "evil-quick-diff": { + "flake": false, + "locked": { + "lastModified": 1575189609, + "narHash": "sha256-oGzl1ayW9rIuq0haoiFS7RZsS8NFMdEA7K1BSozgnJU=", + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "rev": "69c883720b30a892c63bc89f49d4f0e8b8028908", + "type": "github" + }, + "original": { + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "type": "github" + } + }, + "explain-pause-mode": { + "flake": false, + "locked": { + "lastModified": 1595842060, + "narHash": "sha256-++znrjiDSx+cy4okFBBXUBkRFdtnE2x+trkmqjB3Njs=", + "owner": "lastquestion", + "repo": "explain-pause-mode", + "rev": "2356c8c3639cbeeb9751744dbe737267849b4b51", + "type": "github" + }, + "original": { + "owner": "lastquestion", + "repo": "explain-pause-mode", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "format-all": { + "flake": false, + "locked": { + "lastModified": 1581716637, + "narHash": "sha256-ul7LCe60W8TIvUmUtZtZRo8489TK9iTPDsLHmzxY57M=", + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + }, + "original": { + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -27,11 +224,11 @@ ] }, "locked": { - "lastModified": 1696409884, - "narHash": "sha256-hz3i4wFJHoTIAEI19oF1fiPn6TpV+VuTSOrSHUoJMgs=", + "lastModified": 1698250431, + "narHash": "sha256-qs2gTeH4wpnWPO6Oi6sOhp2IhG0i0DzcnrJxIY3/CP8=", "owner": "nix-community", "repo": "home-manager", - "rev": "8aef005d44ee726911e9f793495bb40f2fbf5a05", + "rev": "09587fbbc6a669f7725613e044c2577dc5d43ab5", "type": "github" }, "original": { @@ -40,13 +237,73 @@ "type": "github" } }, + "nix-doom-emacs": { + "inputs": { + "doom-emacs": "doom-emacs", + "doom-snippets": "doom-snippets", + "emacs-overlay": "emacs-overlay", + "emacs-so-long": "emacs-so-long", + "evil-escape": "evil-escape", + "evil-markdown": "evil-markdown", + "evil-org-mode": "evil-org-mode", + "evil-quick-diff": "evil-quick-diff", + "explain-pause-mode": "explain-pause-mode", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "format-all": "format-all", + "nix-straight": "nix-straight", + "nixpkgs": [ + "nixpkgs" + ], + "nose": "nose", + "ob-racket": "ob-racket", + "org": "org", + "org-contrib": "org-contrib", + "org-yt": "org-yt", + "php-extras": "php-extras", + "revealjs": "revealjs", + "rotate-text": "rotate-text", + "sln-mode": "sln-mode", + "ts-fold": "ts-fold", + "ws-butler": "ws-butler" + }, + "locked": { + "lastModified": 1697814738, + "narHash": "sha256-mwQmykamvRuHmO6I2VTm8+TOIhhmgy2g5YrMjoCHawY=", + "owner": "nix-community", + "repo": "nix-doom-emacs", + "rev": "c1c99cf41694440d76e31126dc394f52faeb691e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-doom-emacs", + "type": "github" + } + }, + "nix-straight": { + "flake": false, + "locked": { + "lastModified": 1694361489, + "narHash": "sha256-kjDp+j6OtrmqbtjQB5uuOtjS08+kgJQuxFqhWE1Y9Rw=", + "owner": "nix-community", + "repo": "nix-straight.el", + "rev": "748be99b84be0b130e946288099806a0f16d6e57", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-straight.el", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1696385948, - "narHash": "sha256-GSUIyYROcOExkGt3hDPDPeu/7ska2StMCL0voxMK/ws=", + "lastModified": 1698266953, + "narHash": "sha256-jf72t7pC8+8h8fUslUYbWTX5rKsRwOzRMX8jJsGqDXA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d1c9180c6d1f8fce9469436f48c1cb8180d7087d", + "rev": "75a52265bda7fd25e06e3a67dee3f0354e73243c", "type": "github" }, "original": { @@ -54,12 +311,204 @@ "type": "indirect" } }, + "nose": { + "flake": false, + "locked": { + "lastModified": 1400604510, + "narHash": "sha256-daEi8Kta1oGaDEmUUDDQMahTTPOpvNpDKk22rlr7cB0=", + "owner": "emacsattic", + "repo": "nose", + "rev": "f8528297519eba911696c4e68fa88892de9a7b72", + "type": "github" + }, + "original": { + "owner": "emacsattic", + "repo": "nose", + "type": "github" + } + }, + "ob-racket": { + "flake": false, + "locked": { + "lastModified": 1584656173, + "narHash": "sha256-rBUYDDCXb+3D4xTPQo9UocbTPZ32kWV1Uya/1DmZknU=", + "owner": "xchrishawk", + "repo": "ob-racket", + "rev": "83457ec9e1e96a29fd2086ed19432b9d75787673", + "type": "github" + }, + "original": { + "owner": "xchrishawk", + "repo": "ob-racket", + "type": "github" + } + }, + "org": { + "flake": false, + "locked": { + "lastModified": 1695726851, + "narHash": "sha256-qgbjspklSoI8M3cbCJOcUdjuijRgsL/+PSyEOW9VX4I=", + "owner": "emacs-straight", + "repo": "org-mode", + "rev": "aa9177e1a8b039c357d369c1c9aaab710bb247a9", + "type": "github" + }, + "original": { + "owner": "emacs-straight", + "repo": "org-mode", + "type": "github" + } + }, + "org-contrib": { + "flake": false, + "locked": { + "lastModified": 1694946041, + "narHash": "sha256-X/HFG6NZe5BY00KvGbcsIuf9R6Lg8x7Uhd0Y5+Q3qZU=", + "owner": "emacsmirror", + "repo": "org-contrib", + "rev": "5eabbf22bdd4523c922a30787e98ee66c24221aa", + "type": "github" + }, + "original": { + "owner": "emacsmirror", + "repo": "org-contrib", + "type": "github" + } + }, + "org-yt": { + "flake": false, + "locked": { + "lastModified": 1527381913, + "narHash": "sha256-dzQ6B7ryzatHCTLyEnRSbWO0VUiX/FHYnpHTs74aVUs=", + "owner": "TobiasZawada", + "repo": "org-yt", + "rev": "40cc1ac76d741055cbefa13860d9f070a7ade001", + "type": "github" + }, + "original": { + "owner": "TobiasZawada", + "repo": "org-yt", + "type": "github" + } + }, + "php-extras": { + "flake": false, + "locked": { + "lastModified": 1573312690, + "narHash": "sha256-r4WyVbzvT0ra4Z6JywNBOw5RxOEYd6Qe2IpebHXkj1U=", + "owner": "arnested", + "repo": "php-extras", + "rev": "d410c5af663c30c01d461ac476d1cbfbacb49367", + "type": "github" + }, + "original": { + "owner": "arnested", + "repo": "php-extras", + "type": "github" + } + }, + "revealjs": { + "flake": false, + "locked": { + "lastModified": 1695738029, + "narHash": "sha256-Z9c9Q41jMkj/DyXOiZYyIa7Gmn8VB8yauTyWrSsT+ps=", + "owner": "hakimel", + "repo": "reveal.js", + "rev": "88fbfc5751ad01e3f6adee5819eabeb9e73c3757", + "type": "github" + }, + "original": { + "owner": "hakimel", + "repo": "reveal.js", + "type": "github" + } + }, "root": { "inputs": { "darwin": "darwin", "home-manager": "home-manager", + "nix-doom-emacs": "nix-doom-emacs", "nixpkgs": "nixpkgs" } + }, + "rotate-text": { + "flake": false, + "locked": { + "lastModified": 1322962747, + "narHash": "sha256-SOeOgSlcEIsKhUiYDJv0p+mLUb420s9E2BmvZQvZ0wk=", + "owner": "debug-ito", + "repo": "rotate-text.el", + "rev": "48f193697db996855aee1ad2bc99b38c6646fe76", + "type": "github" + }, + "original": { + "owner": "debug-ito", + "repo": "rotate-text.el", + "type": "github" + } + }, + "sln-mode": { + "flake": false, + "locked": { + "lastModified": 1423727528, + "narHash": "sha256-XqkqPyEJuTtFslOz1fpTf/Klbd/zA7IGpzpmum/MGao=", + "owner": "sensorflo", + "repo": "sln-mode", + "rev": "0f91d1b957c7d2a7bab9278ec57b54d57f1dbd9c", + "type": "github" + }, + "original": { + "owner": "sensorflo", + "repo": "sln-mode", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "ts-fold": { + "flake": false, + "locked": { + "lastModified": 1695278494, + "narHash": "sha256-O4NcUC1u08W8ZslqoA/i+iTaLotKwheURXQWBxLLMFc=", + "owner": "jcs-elpa", + "repo": "ts-fold", + "rev": "70b2c79ff4daa7351d4e2917b0343b9a18d4d4f2", + "type": "github" + }, + "original": { + "owner": "jcs-elpa", + "repo": "ts-fold", + "type": "github" + } + }, + "ws-butler": { + "flake": false, + "locked": { + "lastModified": 1634511126, + "narHash": "sha256-c0y0ZPtxxICPk+eaNbbQf6t+FRCliNY54CCz9QHQ8ZI=", + "owner": "hlissner", + "repo": "ws-butler", + "rev": "572a10c11b6cb88293de48acbb59a059d36f9ba5", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "ws-butler", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index be25c24..57bf70d 100644 --- a/flake.nix +++ b/flake.nix @@ -6,11 +6,15 @@ home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # Doom Emacs + nix-doom-emacs.url = "github:nix-community/nix-doom-emacs"; + nix-doom-emacs.inputs.nixpkgs.follows = "nixpkgs"; + darwin.url = "github:LnL7/nix-darwin"; darwin.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, home-manager, darwin }: + outputs = { self, nixpkgs, home-manager, darwin, nix-doom-emacs }: let username = "maddie"; utils = import ./utils nixpkgs; @@ -51,7 +55,7 @@ modules = [ home-manager.nixosModules.home-manager { - home-manager.users.${username}.imports = utils.nixFilesIn ./maddie/common ++ utils.nixFilesIn ./maddie/nixos; + home-manager.users.${username}.imports = utils.nixFilesIn ./maddie/common ++ utils.nixFilesIn ./maddie/nixos ++ [ nix-doom-emacs.hmModule ]; home-manager.extraSpecialArgs = { inherit username; pkgs = nixpkgs_x86_64; }; } ] ++ utils.nixFilesIn ./systems/mdesktop; @@ -65,7 +69,7 @@ modules = [ home-manager.nixosModules.home-manager { - home-manager.users.${username}.imports = utils.nixFilesIn ./maddie/common ++ utils.nixFilesIn ./maddie/nixos; + home-manager.users.${username}.imports = utils.nixFilesIn ./maddie/common ++ utils.nixFilesIn ./maddie/nixos ++ [ nix-doom-emacs.hmModule ]; home-manager.extraSpecialArgs = { inherit username; pkgs = nixpkgs_aarch64_linux; }; } ] ++ utils.nixFilesIn ./systems/tau; diff --git a/maddie/common/yt-dlp/ytdlp-music.sh b/maddie/common/yt-dlp/ytdlp-music.sh index 7128ada..d22fb3e 100755 --- a/maddie/common/yt-dlp/ytdlp-music.sh +++ b/maddie/common/yt-dlp/ytdlp-music.sh @@ -3,12 +3,13 @@ printf "YT URL: " && read url printf "Title: " && read title printf "Artist: " && read artist +printf "Album: " && read album # Download file from youtube yt-dlp -x --no-playlist --embed-thumbnail --no-embed-metadata --audio-quality 0 --audio-format flac -o "$title.flac" "$url" # Set metadata flags -metaflac --set-tag="TITLE=$title" --set-tag="ARTIST=$artist" "$title.flac" +metaflac --set-tag="TITLE=$title" --set-tag="ARTIST=$artist" --set-tag="ALBUM=$album" "$title.flac" # Export thumbnail metaflac --export-picture-to="$title.png" "$title.flac" @@ -21,4 +22,4 @@ rm -rf "$title.png" convert "$title.jpg" -gravity center -crop 1:1 "$title.jpg" # Move the files to the correct directory -mv "$title.flac" "$title.jpg" $HOME/Music/iPod +mv "$title.flac" "$title.jpg" $HOME/Music/Library/Liked diff --git a/maddie/nixos/mpd.nix b/maddie/nixos/mpd.nix index af1fff6..03e84c5 100644 --- a/maddie/nixos/mpd.nix +++ b/maddie/nixos/mpd.nix @@ -21,6 +21,12 @@ ''; }; + services.mpdris2 = { + enable = true; + multimediaKeys = true; + notifications = true; + }; + home.packages = with pkgs; [ mpc_cli ]; diff --git a/maddie/nixos/yubikey.nix b/maddie/nixos/yubikey.nix new file mode 100644 index 0000000..f898774 --- /dev/null +++ b/maddie/nixos/yubikey.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + yubioath-flutter + ]; +} diff --git a/systems/mmacbookpro/apps.nix b/systems/mmacbookpro/apps.nix index 61eef16..b45c0e6 100644 --- a/systems/mmacbookpro/apps.nix +++ b/systems/mmacbookpro/apps.nix @@ -8,11 +8,6 @@ cleanup = "zap"; }; taps = [ - { - name = "popcorn-official/popcorn-desktop"; - clone_target = "https://github.com/popcorn-official/popcorn-desktop.git"; - force_auto_update = true; - } { name = "kde-mac/kde"; clone_target = "https://invent.kde.org/packaging/homebrew-kde.git"; @@ -21,9 +16,7 @@ ]; casks = [ # Media - /* "popcorn-time" */ "syncplay" - "deluge" "mpv" # Messaging @@ -40,21 +33,17 @@ "sketch" # Development - "zed" - "neovide" "pycharm" - "rustrover" "webstorm" "clion" "goland" - "appcode" "datagrip" - "android-studio" + "rustrover" "fleet" "tower" "secretive" - "visual-studio-code" "sf-symbols" + "iterm2" # Learning "anki" @@ -70,7 +59,14 @@ ]; masApps = { "Codye" = 1516894961; - /* "Xcode" = 497799835; */ + "Wireguard" = 1451685025; + "Xcode" = 497799835; + "One Thing" = 1604176982; + "Today" = 6443714928; + "Wipr" = 1320666476; + "Vinegar" = 1591303229; + "Noir" = 1592917505; + /* "Element X" = 1631335820; */ }; }; } diff --git a/systems/mmacbookpro/dock.nix b/systems/mmacbookpro/dock.nix new file mode 100644 index 0000000..2db85de --- /dev/null +++ b/systems/mmacbookpro/dock.nix @@ -0,0 +1,53 @@ +{ config, pkgs, ... }: + +{ + system.defaults = { + dock = { + # Don't show recent applications + show-recents = false; + # Set the dock size + tilesize = 55; + # Bottom right hot corner - Quick Nnote + wvous-br-corner = 14; + # Disable these hot corners + wvous-bl-corner = 1; + wvous-tl-corner = 1; + wvous-tr-corner = 1; + }; + }; + + # Set the applications and folders on the dock + local.dock.entries = [ + # Applications + { path = "/System/Applications/Launchpad.app/"; } + { path = "/Applications/Things3.app/"; } + { path = "/Applications/RustRover.app/"; } + { path = "/Applications/PyCharm.app/"; } + { path = "/Applications/iTerm.app/"; } + { path = "/Applications/Obsidian.app/"; } + { path = "/Applications/Tower.app/"; } + { path = "/Applications/Sketch.app/"; } + { path = "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app"; } + { path = "/System/Applications/Calendar.app/"; } + { path = "/System/Applications/Notes.app/"; } + { path = "/System/Applications/Freeform.app/"; } + { path = "/System/Applications/FindMy.app/"; } + { path = "/System/Applications/Music.app/"; } + { path = "/System/Applications/Mail.app/"; } + { path = "/System/Applications/Messages.app/"; } + { path = "/System/Applications/FaceTime.app/"; } + { path = "/Applications/Element.app/"; } + + # Folders + { + path = "/Users/maddie/Documents/"; + section = "others"; + options = "--sort name --display folder"; + } + { + path = "/Users/maddie/Downloads/"; + section = "others"; + options = "--sort dateadded"; + } + ]; +} diff --git a/systems/mmacbookpro/finder.nix b/systems/mmacbookpro/finder.nix index 7c4d987..27c6aca 100644 --- a/systems/mmacbookpro/finder.nix +++ b/systems/mmacbookpro/finder.nix @@ -4,9 +4,11 @@ system.defaults = { finder = { AppleShowAllExtensions = true; - QuitMenuItem = true; ShowPathbar = true; ShowStatusBar = true; + FXDefaultSearchScope = "SCcf"; + FXPreferredViewStyle = "Nlsv"; + FXEnableExtensionChangeWarning = false; }; NSGlobalDomain.AppleShowAllExtensions = true; }; diff --git a/systems/mmacbookpro/keyboard.nix b/systems/mmacbookpro/keyboard.nix index 08a8789..586b270 100644 --- a/systems/mmacbookpro/keyboard.nix +++ b/systems/mmacbookpro/keyboard.nix @@ -7,7 +7,14 @@ }; system.defaults.NSGlobalDomain = { + # Speed up key repeat InitialKeyRepeat = 14; KeyRepeat = 1; + # In general, have Apple not mess with our text + NSAutomaticCapitalizationEnabled = false; + NSAutomaticDashSubstitutionEnabled = false; + NSAutomaticPeriodSubstitutionEnabled = false; + NSAutomaticQuoteSubstitutionEnabled = null; + NSAutomaticSpellingCorrectionEnabled = false; }; } diff --git a/systems/mmacbookpro/networking.nix b/systems/mmacbookpro/networking.nix new file mode 100644 index 0000000..c938cc4 --- /dev/null +++ b/systems/mmacbookpro/networking.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + networking = { + computerName = "MacBook Pro"; + hostName = "MMacBookPro"; + }; +} diff --git a/systems/mmacbookpro/nix.nix b/systems/mmacbookpro/nix.nix index 88d721e..45ba453 100644 --- a/systems/mmacbookpro/nix.nix +++ b/systems/mmacbookpro/nix.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { # Enable flakes and nix-command @@ -12,6 +12,9 @@ automatic = true; options = "--delete-older-than 7d"; }; + extraOptions = lib.optionalString (pkgs.system == "aarch64-darwin") '' + extra-platforms = x86_64-darwin aarch64-darwin + ''; }; services.nix-daemon.enable = true; } diff --git a/systems/mmacbookpro/setDock.nix b/systems/mmacbookpro/setDock.nix new file mode 100644 index 0000000..3401be2 --- /dev/null +++ b/systems/mmacbookpro/setDock.nix @@ -0,0 +1,68 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.local.dock; + stdenv = pkgs.stdenv; + dockutil = pkgs.dockutil; +in +{ + options = { + local.dock.enable = mkOption { + description = "Enable dock"; + default = stdenv.isDarwin; + example = false; + }; + + local.dock.entries = mkOption + { + description = "Entries on the Dock"; + type = with types; listOf (submodule { + options = { + path = lib.mkOption { type = str; }; + section = lib.mkOption { + type = str; + default = "apps"; + }; + options = lib.mkOption { + type = str; + default = ""; + }; + }; + }); + readOnly = true; + }; + }; + + config = + mkIf (cfg.enable) + ( + let + normalize = path: if hasSuffix ".app" path then path + "/" else path; + entryURI = path: "file://" + (builtins.replaceStrings + [" " "!" "\"" "#" "$" "%" "&" "'" "(" ")"] + ["%20" "%21" "%22" "%23" "%24" "%25" "%26" "%27" "%28" "%29"] + (normalize path) + ); + wantURIs = concatMapStrings + (entry: "${entryURI entry.path}\n") + cfg.entries; + createEntries = concatMapStrings + (entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n") + cfg.entries; + in + { + system.activationScripts.postUserActivation.text = '' + echo >&2 "Setting up the Dock..." + haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" + if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then + echo >&2 "Resetting Dock." + ${dockutil}/bin/dockutil --no-restart --remove all + ${createEntries} + killall Dock + else + echo >&2 "Dock setup complete." + fi + ''; + } + ); +} diff --git a/systems/mmacbookpro/settings.nix b/systems/mmacbookpro/settings.nix new file mode 100644 index 0000000..966f561 --- /dev/null +++ b/systems/mmacbookpro/settings.nix @@ -0,0 +1,83 @@ +{ config, ... }: + +{ + system.defaults = { + CustomUserPreferences = { + NSGlobalDomain = { + # Set system accent and highlight color to purple + AppleAccentColor = 5; + AppleHighlightColor = "0.968627 0.831373 1.000000 Purple"; + # Make the menu bar always visible + AppleMenuBarVisibleInFullscreen = 1; + }; + "com.apple.desktopservices" = { + # Don't write .DS_Store files to network or usb drives + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + # Magic Mouse + "com.apple.AppleMultitouchMouse" = { + # Enable right click + MouseButtonMode = "TwoButton"; + # Enable horizontal scrolling + MouseHorizontalScroll = 1; + # Enable one finger double tap for smart zoom + MouseOneFingerDoubleTapGesture = 1; + # Enable two finger tap for mission control + MouseTwoFingerDoubleTapGesture = 3; + # Enable two finger swipe to pan spaces + MouseTwoFingerHorizSwipeGesture = 2; + }; + # Trackpad + "com.apple.AppleMultitouchTrackpad" = { + # Don't secondary click on the corner of the trackpad + TrackpadCornerSecondaryClick = 0; + # Four/Five finger pinch for launchpad + TrackpadFourFingerPinchGesture = 2; + TrackpadFiveFingerPinchGesture = 2; + # Three/Four fingers swipe horizontally to pan spaces + TrackpadThreeFingerHorizSwipeGesture = 2; + TrackpadFourFingerHorizSwipeGesture = 2; + # Three/Four finger swipe vertically to activate mission control and app expose + TrackpadThreeFingerVertSwipeGesture = 2; + TrackpadFourFingerVertSwipeGesture = 2; + # Swipe two fingers from the right edge to open notification centre + TrackpadTwoFingerFromRightEdgeSwipeGesture = 3; + }; + }; + }; + + system.defaults = { + NSGlobalDomain = { + # Automatically enable dark theme at night + AppleInterfaceStyleSwitchesAutomatically = true; + # Use the metric system throughout macOS + AppleMetricUnits = 1; + # Always start with save dialog panels expanded + NSNavPanelExpandedStateForSaveMode = true; + NSNavPanelExpandedStateForSaveMode2 = true; + }; + loginwindow = { + # Disable using a guest user account + GuestEnabled = false; + }; + menuExtraClock = { + # Show seconds and date on menu bar clock + ShowSeconds = true; + ShowDate = 1; + }; + }; + + # Enable Touch ID for sudo + security.pam.enableSudoTouchIdAuth = true; + + # Run extra initialization on provisioning. + environment.extraInit = '' + # Show the ~/Library folder + chflags nohidden /Users/maddie/Library + + # Show the /Volumes folder + chflags nohidden /Volumes + ''; +} +