summaryrefslogtreecommitdiff
path: root/hosts/mac/m1mba
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2024-07-21 01:49:04 +0700
committerpolwex <polwex@sortug.com>2024-07-21 01:49:04 +0700
commite64f7a78e01e5fa661471cb518cc71fc33223b5a (patch)
tree691c444cf66e2f9d1ee63e4589ed09ec502baa3b /hosts/mac/m1mba
parent0816d59542658a62928050ef5f08e1460e554959 (diff)
m
Diffstat (limited to 'hosts/mac/m1mba')
-rw-r--r--hosts/mac/m1mba/configuration.nix18
-rw-r--r--hosts/mac/m1mba/keyboard.nix53
-rw-r--r--hosts/mac/m1mba/mac.nix12
-rw-r--r--hosts/mac/m1mba/pkgs.nix68
-rw-r--r--hosts/mac/m1mba/services.nix11
-rw-r--r--hosts/mac/m1mba/users.nix43
6 files changed, 205 insertions, 0 deletions
diff --git a/hosts/mac/m1mba/configuration.nix b/hosts/mac/m1mba/configuration.nix
new file mode 100644
index 0000000..373f781
--- /dev/null
+++ b/hosts/mac/m1mba/configuration.nix
@@ -0,0 +1,18 @@
+{...}: {
+ imports = [
+ ../../base.nix
+ ../mac.nix
+ ./users.nix
+ ./pkgs.nix
+ ];
+
+ # Auto upgrade nix package and the daemon service.
+ services.nix-daemon.enable = true;
+ # nix.package = pkgs.nix;
+ # Used for backwards compatibility, please read the changelog before changing.
+ # $ darwin-rebuild changelog
+ system.stateVersion = 4;
+
+ # The platform the configuration will be used on.
+ nixpkgs.hostPlatform = "aarch64-darwin";
+}
diff --git a/hosts/mac/m1mba/keyboard.nix b/hosts/mac/m1mba/keyboard.nix
new file mode 100644
index 0000000..f6b164f
--- /dev/null
+++ b/hosts/mac/m1mba/keyboard.nix
@@ -0,0 +1,53 @@
+{ kmonad, config, lib, pkgs, ... }:
+
+let cfg = config.y.kmonad; in
+{
+ options.y.kmonad = {
+ enable = lib.mkEnableOption "kmonad";
+
+ config = lib.mkOption {
+ type = lib.types.lines;
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ nixpkgs.overlays = [ kmonad.overlays.default ];
+
+ launchd.daemons.kmonad-default.serviceConfig = {
+ EnvironmentVariables.PATH = "${pkgs.kmonad}/bin:${pkgs.overlays.Karabiner-DriverKit-VirtualHIDDevice}/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-DriverKit-VirtualHIDDeviceClient.app/Contents/MacOS:${config.environment.systemPath}";
+ KeepAlive = true;
+ Nice = -20;
+ ProgramArguments = [
+ "/Applications/.Karabiner-VirtualHIDDevice-Manager.app/kmonad-daemon-shim"
+ "--input"
+ ''iokit-name "Apple Internal Keyboard / Trackpad"''
+
+ (toString (builtins.toFile "../../kmonad/mac.kbd" ''
+ (defcfg
+ input (iokit-name "Apple Internal Keyboard / Trackpad")
+ output (kext)
+ fallthrough true
+ allow-cmd false
+ )
+
+ ${cfg.config}
+ ''))
+ ];
+ StandardOutPath = "/Library/Logs/KMonad/default-stdout";
+ StandardErrorPath = "/Library/Logs/KMonad/default-stderr";
+ RunAtLoad = true;
+ };
+
+ system.activationScripts.script.applications.text = ''
+ echo copying dext...
+ ${pkgs.rsync}/bin/rsync -a --delete ${pkgs.overlays.Karabiner-DriverKit-VirtualHIDDevice}/Applications/.Karabiner-VirtualHIDDevice-Manager.app/ /Applications/.Karabiner-VirtualHIDDevice-Manager.app
+ echo copying shim...
+ cp --no-preserve mode ${pkgs.overlays.kmonad-daemon-shim}/bin/kmonad-daemon-shim /Applications/.Karabiner-VirtualHIDDevice-Manager.app/kmonad-daemon-shim
+ chown root /Applications/.Karabiner-VirtualHIDDevice-Manager.app/kmonad-daemon-shim
+ chmod u=rx,og= /Applications/.Karabiner-VirtualHIDDevice-Manager.app/kmonad-daemon-shim
+ echo activating dext...
+ /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate
+ printf '\x1b[0;31mPlease grant Input Monitoring permissions to /Applications/.Karabiner-VirtualHIDDevice-Manager.app/kmonad-daemon-shim in System Preferences > Security & Privacy > Privacy > Input Monitoring\x1b[0m\n'
+ '';
+ };
+}
diff --git a/hosts/mac/m1mba/mac.nix b/hosts/mac/m1mba/mac.nix
new file mode 100644
index 0000000..dba3035
--- /dev/null
+++ b/hosts/mac/m1mba/mac.nix
@@ -0,0 +1,12 @@
+{ pkgs, ... }:
+{
+ fonts.fontDir.enable = true;
+ fonts.fonts = with pkgs; [
+ recursive
+ (nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
+ ];
+ system.keyboard = {
+ enableKeyMapping = true;
+ remapCapsLockToEscape = true;
+ };
+}
diff --git a/hosts/mac/m1mba/pkgs.nix b/hosts/mac/m1mba/pkgs.nix
new file mode 100644
index 0000000..dffcd66
--- /dev/null
+++ b/hosts/mac/m1mba/pkgs.nix
@@ -0,0 +1,68 @@
+{ pkgs, kmonad, unstablePkgs, ...}:
+
+{
+# custom
+# y.kmonad.enable = true;
+ environment.systemPackages = with unstablePkgs; [
+ # custom
+ pkgs.overlays.yabai
+ #unfree
+# slack
+# spotify
+# corefonts
+# symbola
+ #gui
+ alacritty
+ vscodium
+ tdesktop
+ # terminal
+ #
+ vim
+ neovim
+ helix
+ # ---
+ wget
+ htop
+ bat
+ gitAndTools.gitFull
+ lazygit
+ git-lfs
+ lsd
+ lsof
+ tmux
+ tmate
+ curlFull
+ ripgrep
+ ranger
+ minio
+ minio-client
+ zip
+ unzip
+ jq
+ vifm
+ nnn
+ # neovim asks for a c compiler just to run nvim-treesitter commands. let's see
+ fzf
+ killall
+ tree
+ deluge
+ ncdu
+ edir
+ bottom
+ pigz
+ rclone
+ # direnv
+ direnv
+ nix-direnv
+ # scraping
+ python310Packages.yt-dlp
+ # code
+ nodejs
+ node2nix
+ zig
+ gcc
+ gnumake
+ sqlite
+ ];
+}
+
diff --git a/hosts/mac/m1mba/services.nix b/hosts/mac/m1mba/services.nix
new file mode 100644
index 0000000..52572ac
--- /dev/null
+++ b/hosts/mac/m1mba/services.nix
@@ -0,0 +1,11 @@
+inputs: pkgs:
+let inherit (pkgs) callPackage
+in {
+ Karabiner-DriverKit-VirtualHIDDevice = callPackage
+ ./Karabiner-DriverKit-VirtualHIDDevice
+ { Karabiner-DriverKit-VirtualHIDDevice-src = inputs.kmonad + "/../c_src/mac/Karabiner-DriverKit-VirtualHIDDevice"; };
+ kmonad-daemon-shim = callPackage ./kmonad-daemon-shim { };
+ yabai = callPackage ./yabai {
+ inherit (pkgs) yabai;
+ };
+} \ No newline at end of file
diff --git a/hosts/mac/m1mba/users.nix b/hosts/mac/m1mba/users.nix
new file mode 100644
index 0000000..10eceac
--- /dev/null
+++ b/hosts/mac/m1mba/users.nix
@@ -0,0 +1,43 @@
+{ config, pkgs, ... }:
+
+
+let shellAliases = {
+ l = "lsd -lAh";
+ la = "lsd -lAh";
+ ports = "sudo lsof -i -P -n | grep LISTEN";
+ gco = "git checkout";
+ gcob = "git checkout -b";
+ v = "nvim";
+ sv = "sudo nvim";
+ dotsin = "sh ~/dotfiles/commit.sh";
+ sourceit = ". (sed 's/^/export /' .env | psub)";
+ rebuild = "darwin-rebuild switch --flake ~/dotfiles/nixos/mac";
+};
+
+in {
+ programs.fish = {
+ inherit shellAliases;
+ enable = true;
+# plugins = [{
+# name="foreign-env";
+# src = pkgs.fetchFromGitHub {
+# owner = "oh-my-fish";
+# repo = "plugin-foreign-env";
+# rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
+# sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
+# };
+# }];
+};
+
+ users = {
+ users = {
+ y = {
+ createHome = true;
+ home = "/home/y";
+ shell = pkgs.fish;
+ };
+ };
+ };
+}
+
+