diff --git a/darwin/shiro/configuration.nix b/darwin/shiro/configuration.nix new file mode 100644 index 00000000..d94c7e12 --- /dev/null +++ b/darwin/shiro/configuration.nix @@ -0,0 +1,80 @@ +{ + config, + pkgs, + device, + ... +}: { + imports = [./services]; + + # environment.systemPackages = with pkgs; [nix neovim]; + nix = { + settings = { + experimental-features = "nix-command flakes auto-allocate-uids"; + max-jobs = 8; + trusted-users = ["root" "servius"]; + substituters = [ + "https://nix-community.cachix.org" + "https://sh.darksailor.dev" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "mirai:bcVPoFGBZ0i7JAKMXIqLj2GY3CulLC4kP7rQyqes1RM=" + ]; + }; + extraOptions = '' + build-users-group = nixbld + extra-nix-path = nixpkgs=flake:nixpkgs + builders-use-substitutes = true + ''; + package = pkgs.nixVersions.latest; + buildMachines = [ + { + hostName = "sh.darksailor.dev"; + sshUser = "remotebuilder"; + system = "x86_64-linux"; + protocol = "ssh-ng"; + supportedFeatures = ["nixos-test" "benchmark" "big-parallel" "kvm"]; + } + ]; + distributedBuilds = true; + }; + + # security.pam.enableSudoTouchIdAuth = true; + # system.patches = [ + # (pkgs.writeText "pam-reattach.patch" + # # diff + # '' + # new file mode 100644 + # index 0000000..e4293c0 + # --- /dev/null + # +++ b/etc/pam.d/sudo_local + # @@ -0,0 +1,3 @@ + # +# sudo_local: local config file which survives system update and is included for sudo + # +# uncomment following line to enable Touch ID for sudo + # +auth optional ${pkgs.pam-reattach}/lib/pam/pam_reattach.so + # '') + # ]; + + # programs.bash.enable = true; + programs.zsh.enable = true; + programs.fish.enable = true; + + services.nix-daemon.enable = true; + system.stateVersion = 4; + + system.keyboard.enableKeyMapping = true; + system.keyboard.remapCapsLockToControl = true; + system.keyboard.swapLeftCommandAndLeftAlt = true; + system.keyboard.userKeyMapping = [ + { + # Right Command to Option + HIDKeyboardModifierMappingSrc = 30064771303; + HIDKeyboardModifierMappingDst = 30064771302; + } + { + # Right Option to command + HIDKeyboardModifierMappingSrc = 30064771302; + HIDKeyboardModifierMappingDst = 30064771303; + } + ]; +} diff --git a/darwin/shiro/services/default.nix b/darwin/shiro/services/default.nix new file mode 100644 index 00000000..b99c8d34 --- /dev/null +++ b/darwin/shiro/services/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [ + ./yabai.nix + ./skhd.nix + ./tailscale.nix + ]; +} diff --git a/darwin/shiro/services/skhd.nix b/darwin/shiro/services/skhd.nix new file mode 100644 index 00000000..33848429 --- /dev/null +++ b/darwin/shiro/services/skhd.nix @@ -0,0 +1,69 @@ +{pkgs, ...}: { + services = { + skhd = { + enable = true; + skhdConfig = '' + # alt - return : ${pkgs.lib.getExe pkgs.kitty} --single-instance --directory ~ + alt - return : ${pkgs.lib.getExe pkgs.wezterm} + shift + alt - return: pkill afplay + + # close focused window + # alt - w : yabai -m window --close + + alt - d : open -na "$(ls /Applications /System/Applications/ /System/Applications/Utilities/ | choose)" + + # focus window + alt - h : yabai -m window --focus west + alt - j : yabai -m window --focus south + alt - k : yabai -m window --focus north + alt - l : yabai -m window --focus east + + # alt - j : yabai -m window --focus prev + # alt - k : yabai -m window --focus next + + # Float + shift + alt - f: yabai -m window --toggle float + alt - f: yabai -m window --toggle native-fullscreen + + # swap window + # shift + alt - h : yabai -m window --swap west + # shift + alt - j : yabai -m window --swap south + # shift + alt - k : yabai -m window --swap north + # shift + alt - l : yabai -m window --swap east + + # move window + shift + alt - h : yabai -m window --warp west + shift + alt - j : yabai -m window --warp south + shift + alt - k : yabai -m window --warp north + shift + alt - l : yabai -m window --warp east + + # restart skhd + shift + alt - r : pkill skhd + + # fast focus desktop + alt - 1 : yabai -m space --focus 1 + alt - 2 : yabai -m space --focus 2 + alt - 3 : yabai -m space --focus 3 + alt - 4 : yabai -m space --focus 4 + alt - 5 : yabai -m space --focus 5 + alt - 6 : yabai -m space --focus 6 + alt - 7 : yabai -m space --focus 7 + alt - 8 : yabai -m space --focus 8 + alt - 9 : yabai -m space --focus 9 + alt - 0 : yabai -m space --focus 10 + + # Move window to desktop + shift + alt - 1 : yabai -m window --space 1 + shift + alt - 2 : yabai -m window --space 2 + shift + alt - 3 : yabai -m window --space 3 + shift + alt - 4 : yabai -m window --space 4 + shift + alt - 5 : yabai -m window --space 5 + shift + alt - 6 : yabai -m window --space 6 + shift + alt - 7 : yabai -m window --space 7 + shift + alt - 8 : yabai -m window --space 8 + shift + alt - 9 : yabai -m window --space 9 + shift + alt - 0 : yabai -m window --space 10 + ''; + }; + }; +} diff --git a/darwin/shiro/services/tailscale.nix b/darwin/shiro/services/tailscale.nix new file mode 100644 index 00000000..44ce5785 --- /dev/null +++ b/darwin/shiro/services/tailscale.nix @@ -0,0 +1,5 @@ +{...}: { + services.tailscale = { + enable = true; + }; +} diff --git a/darwin/shiro/services/yabai.nix b/darwin/shiro/services/yabai.nix new file mode 100644 index 00000000..7e2e9bc9 --- /dev/null +++ b/darwin/shiro/services/yabai.nix @@ -0,0 +1,44 @@ +{...}: { + services = { + yabai = { + enable = true; + enableScriptingAddition = true; + config = { + mouse_follows_focus = "on"; + focus_follows_mouse = "on"; + window_origin_display = "default"; + window_placement = "second_child"; + window_topmost = "off"; + window_shadow = "on"; + window_opacity = "off"; + window_opacity_duration = "0.0"; + active_window_opacity = "1.0"; + normal_window_opacity = "0.90"; + window_border = "off"; + window_border_width = "6"; + active_window_border_color = "0xff775759"; + normal_window_border_color = "0xff555555"; + insert_feedback_color = "0xffd75f5f"; + split_ratio = "0.50"; + auto_balance = "off"; + mouse_modifier = "fn"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + mouse_drop_action = "swap"; + layout = "bsp"; + top_padding = "5"; + bottom_padding = "5"; + left_padding = "5"; + right_padding = "5"; + window_gap = "06"; + }; + + extraConfig = '' + yabai -m rule --add app='System Preferences' manage=off + yabai -m rule --add app="choose" manage=off + yabai -m rule --add app="barrier" manage=off + yabai -m rule --add app="steam" manage=off + ''; + }; + }; +} diff --git a/flake.nix b/flake.nix index 9134d5c0..9323c03c 100644 --- a/flake.nix +++ b/flake.nix @@ -203,6 +203,11 @@ system = "aarch64-darwin"; user = "fs0c131y"; } + { + name = "shiro"; + system = "aarch64-darwin"; + user = "servius"; + } { name = "SteamDeck"; system = "x86_64-linux"; diff --git a/home/gui-programs/default.nix b/home/gui-programs/default.nix index e5e43785..45ea838a 100644 --- a/home/gui-programs/default.nix +++ b/home/gui-programs/default.nix @@ -12,5 +12,6 @@ ./kitty.nix ./vscodium.nix ./wezterm.nix + ./raycast.nix ]); } diff --git a/home/gui-programs/raycast.nix b/home/gui-programs/raycast.nix new file mode 100644 index 00000000..56b442e4 --- /dev/null +++ b/home/gui-programs/raycast.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + home.packages = [pkgs.raycast]; +}