diff --git a/README.md b/README.md index e77e987..c2642e3 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,10 @@ Initial install of nix using the determinate nix installer. Then a "full" bootst sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .#Remys-MacBook-Pro ``` > some modifications might be necessary (i.e. due to faulty git setup at that stage). - +``` +# could also try something like this: +nix-shell -p git nh +``` Finally, the desired state has been reached where `nh` is available: ``` nh darwin switch . diff --git a/flake.nix b/flake.nix index cd8c75d..faea01a 100644 --- a/flake.nix +++ b/flake.nix @@ -166,7 +166,7 @@ mac-app-util.homeManagerModules.default ]; } - # mac-app-util.darwinModules.default + mac-app-util.darwinModules.default { nixpkgs.overlays = [ inputs.nix4vscode.overlays.default ]; } ./hosts/macbook-pro ]; diff --git a/hosts/macbook-pro/default.nix b/hosts/macbook-pro/default.nix index ccae284..8e3b93f 100644 --- a/hosts/macbook-pro/default.nix +++ b/hosts/macbook-pro/default.nix @@ -10,6 +10,6 @@ # Merge the configuration and hardware configuration imports = [ ./configuration.nix - # ../../modules/nixos/macos-tiling + ../../modules/macos/tiling.nix ]; } diff --git a/modules/home-manager/browser.nix b/modules/home-manager/browser.nix index 9f7b73d..95099db 100644 --- a/modules/home-manager/browser.nix +++ b/modules/home-manager/browser.nix @@ -1,12 +1,27 @@ {pkgs, inputs, ...}: { - programs.firefox = { - ## Enable the Firefox web browser + imports = [ + inputs.zen-browser.homeModules.beta + ]; + + programs.zen-browser = { enable = true; + ## Global preferences policies = { BlockAboutConfig = true; - DefaultDownloadDirectory = "\${home}/Downloads"; + AutofillAddressEnabled = false; + AutofillCreditCardEnabled = false; + + DisableAppUpdate = true; + DisableFeedbackCommands = true; + DisableTelemetry = true; + DisablePocket = true; + + DontCheckDefaultBrowser = true; + OfferToSaveLogins = false; + + ExtensionSettings = with builtins; let extension = shortId: uuid: { name = uuid; @@ -17,128 +32,20 @@ }; in listToAttrs [ (extension "ublock-origin" "uBlock0@raymondhill.net") - (extension "tabliss" "extension@tabliss.io") - (extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}") - (extension "keepassxc-browser" "keepassxc-browser@keepassxc.org") (extension "ghostery" "firefox@ghostery.com") + (extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}") ]; }; - ## Per-profile preferences - profiles.default = { - search = { - force = true; - default = "ddg"; - privateDefault = "ddg"; - order = ["ddg" "google"]; - }; - settings = { - "browser.startup.homepage" = "about:home"; - - # Disable irritating first-run stuff - "browser.disableResetPrompt" = true; - "browser.download.panel.shown" = true; - "browser.feeds.showFirstRunUI" = false; - "browser.messaging-system.whatsNewPanel.enabled" = false; - "browser.rights.3.shown" = true; - "browser.shell.checkDefaultBrowser" = false; - "browser.shell.defaultBrowserCheckCount" = 1; - "browser.startup.homepage_override.mstone" = "ignore"; - "browser.uitour.enabled" = false; - "startup.homepage_override_url" = ""; - "trailhead.firstrun.didSeeAboutWelcome" = true; - "browser.bookmarks.restore_default_bookmarks" = false; - "browser.bookmarks.addedImportButton" = true; - - # Disable "save password" prompt - "signon.rememberSignons" = false; - - # Harden - "privacy.trackingprotection.enabled" = true; - "dom.security.https_only_mode" = true; - - # Disable Pocket - "extensions.pocket.enabled" = false; - - # Disable telemetry - "toolkit.telemetry.enabled" = false; - - # Remove bookmarks toolbar - "browser.toolbars.bookmarks.visibility" = "never"; - - # Restore session on startup - "browser.startup.page" = 3; - - # Automatically enable extensions - "extensions.autoDisableScopes" = 0; - - - }; - - }; + # ## Per-profile preferences + # profiles.default = { + # search = { + # force = true; + # default = "ddg"; + # privateDefault = "ddg"; + # order = ["ddg" "google"]; + # }; + # }; }; - home.packages = with pkgs; [ - inputs.zen-browser.packages."${system}".default - - # inputs.zen-browser.packages."${system}".default.override { - # policies = { - # DisableAppUpdate = true; - # DisableTelemetry = true; - - # OfferToSaveLogins = false; - # AutofillAddressEnabled = true; - # AutofillCreditCardEnabled = false; - # # BlockAboutConfig = true; - - # DefaultDownloadDirectory = "\${home}/Downloads"; - - # ExtensionSettings = with builtins; - # let extension = shortId: uuid: { - # name = uuid; - # value = { - # install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; - # installation_mode = "normal_installed"; - # }; - # }; - # in listToAttrs [ - # (extension "ublock-origin" "uBlock0@raymondhill.net") - # (extension "ghostery" "firefox@ghostery.com") - # (extension "keepassxc-browser" "keepassxc-browser@keepassxc.org") - # (extension "morphine" "{b252db54-e4f6-440f-914a-1f017a3a390d}") - # ]; - # }; - # } - - ]; - # programs.zen-browser = { - # enable = true; - - # policies = { - # DisableAppUpdate = true; - # DisableTelemetry = true; - - # OfferToSaveLogins = false; - # AutofillAddressEnabled = true; - # AutofillCreditCardEnabled = false; - # # BlockAboutConfig = true; - - # DefaultDownloadDirectory = "\${home}/Downloads"; - - # ExtensionSettings = with builtins; - # let extension = shortId: uuid: { - # name = uuid; - # value = { - # install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; - # installation_mode = "normal_installed"; - # }; - # }; - # in listToAttrs [ - # (extension "ublock-origin" "uBlock0@raymondhill.net") - # (extension "ghostery" "firefox@ghostery.com") - # (extension "keepassxc-browser" "keepassxc-browser@keepassxc.org") - # (extension "morphine" "{b252db54-e4f6-440f-914a-1f017a3a390d}") - # ]; - # }; - # }; } diff --git a/modules/home-manager/code.nix b/modules/home-manager/code.nix index d27fec5..9162f0a 100644 --- a/modules/home-manager/code.nix +++ b/modules/home-manager/code.nix @@ -181,6 +181,7 @@ in extensions = baseExtensions ++ pkgs.nix4vscode.forVscode [ "Tim-Koehler.helm-intellisense" "HashiCorp.terraform" + "signageos.signageos-vscode-sops" ]; keybindings = baseKeybindings; userSettings = baseSettings; diff --git a/modules/home-manager/macos-fixes.nix b/modules/home-manager/macos-fixes.nix new file mode 100644 index 0000000..4f309ce --- /dev/null +++ b/modules/home-manager/macos-fixes.nix @@ -0,0 +1,21 @@ +{pkgs, ...}: + +{ + # on macos we don't set the default shell to fish + # instead we just tell the terminal to run fish as the first command + # this means that the first thing fish should do is to clear the screen + programs.fish = { + interactiveShellInit = "clear"; + }; + + + # stylix will be tricky as well, so we just install the fonts manually + fonts.fontconfig.enable = true; + + home.packages = with pkgs; [ + nerd-fonts.fira-code + noto-fonts-color-emoji + ] ++ [ # some more packages that are not available as flatpaks + pkgs.spotify + ]; +} diff --git a/modules/home-manager/macos-tiling/default.nix b/modules/home-manager/macos-tiling/default.nix deleted file mode 100644 index 5bf61ca..0000000 --- a/modules/home-manager/macos-tiling/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nix-config.macos; -in -{ - options = { - }; - - imports = [ - ./tiling.nix - ]; -} diff --git a/modules/home-manager/macos-tiling/tiling.nix b/modules/home-manager/macos-tiling/tiling.nix deleted file mode 100644 index 9a61fdc..0000000 --- a/modules/home-manager/macos-tiling/tiling.nix +++ /dev/null @@ -1,48 +0,0 @@ -{pkgs, ...}: { - home.packages = [ - pkgs.scroll-reverser - ]; - programs.aerospace = { - enable = true; - - launchd.enable = true; - - settings = { - gaps = { - outer.left = 4; - outer.bottom = 4; - outer.top = 4; - outer.right = 4; - - inner.vertical = 2; - inner.horizontal = 2; - }; - - mode.main.binding = { - alt-enter = ''exec-and-forget osascript -e ' - tell application "Terminal" - do script - activate - end tell' - ''; - - alt-f = "fullscreen"; - - alt-h = "focus left"; - alt-j = "focus down"; - alt-k = "focus up"; - alt-l = "focus right"; - - alt-1 = "workspace 1"; - alt-2 = "workspace 2"; - alt-3 = "workspace 3"; - - alt-shift-1 = "move-node-to-workspace 1"; - alt-shift-2 = "move-node-to-workspace 2"; - alt-shift-3 = "move-node-to-workspace 3"; - - alt-tab = "workspace-back-and-forth"; - }; - }; - }; -} diff --git a/modules/home-manager/work/default.nix b/modules/home-manager/work/default.nix index d8dc575..cd35d46 100644 --- a/modules/home-manager/work/default.nix +++ b/modules/home-manager/work/default.nix @@ -13,6 +13,7 @@ in imports = [ ./aliases.nix ./cryptography.nix + ./git.nix ./kluster.nix ]; } diff --git a/modules/home-manager/work/git.nix b/modules/home-manager/work/git.nix new file mode 100644 index 0000000..dd0edd3 --- /dev/null +++ b/modules/home-manager/work/git.nix @@ -0,0 +1,14 @@ +{ + config, + lib, + ... +}: +{ + programs.git = { + enable = true; + settings = { + user.name = "Remy Moll"; + user.email = "remy.moll@artidis.com"; + }; + }; +} diff --git a/modules/macos/tiling.nix b/modules/macos/tiling.nix new file mode 100644 index 0000000..ecd4ed0 --- /dev/null +++ b/modules/macos/tiling.nix @@ -0,0 +1,79 @@ +{ config, pkgs, lib, ... }: + +{ + # Enable yabai service + # Caution: at the very least yabai requires Accessibility permissions to be granted + # https://github.com/koekeishiya/yabai/issues/2688 + services.yabai = { + enable = true; + config = { + layout = "bsp"; + focus_follows_mouse = "autoraise"; + + window_placement = "second_child"; + window_topmost = "on"; + window_shadow = "float"; + + # by default, set balanced split ratio and auto balance => three windows will be evenly spaced on an ultrawide monitor + split_ratio = "0.50"; + auto_balance = "on"; + + mouse_modifier = "alt"; + mouse_action1 = "move";# + mouse_action2 = "resize"; + + window_opacity = "on"; + normal_window_opacity = 0.9; + + top_padding = 0; + bottom_padding = 0; + left_padding = 0; + right_padding = 0; + window_gap = 10; + }; + + extraConfig = '' + # Example: rules for floating windows + yabai -m rule --add app="System Preferences" manage=off + ''; + }; + + # # Enable skhd service + # services.skhd = { + # enable = true; + # package = pkgs.skhd; + # skhdConfig = '' + # # Focus windows with Command + Arrow keys + # cmd - left : yabai -m window --focus west + # cmd - right : yabai -m window --focus east + # cmd - up : yabai -m window --focus north + # cmd - down : yabai -m window --focus south + + # # Swap windows with Command + Shift + Arrow keys + # cmd + shift - left : yabai -m window --swap west + # cmd + shift - right : yabai -m window --swap east + # cmd + shift - up : yabai -m window --swap north + # cmd + shift - down : yabai -m window --swap south + + # # Move windows with Command + Control + Arrow keys + # cmd + ctrl - left : yabai -m window --warp west + # cmd + ctrl - right : yabai -m window --warp east + # cmd + ctrl - up : yabai -m window --warp north + # cmd + ctrl - down : yabai -m window --warp south + + # # Resize windows with Command + Option + Arrow keys + # cmd + alt - left : yabai -m window --resize left:-50:0 + # cmd + alt - right : yabai -m window --resize right:50:0 + # cmd + alt - up : yabai -m window --resize top:0:-50 + # cmd + alt - down : yabai -m window --resize bottom:0:50 + + # # Toggle window float with Command + F + # cmd - f : yabai -m window --toggle float + + # # Toggle window fullscreen with Command + Enter + # cmd - return : yabai -m window --toggle zoom-fullscreen + + # ''; + # }; + +} diff --git a/users/remy_macos/default.nix b/users/remy_macos/default.nix index 1d8eb59..22c6d93 100644 --- a/users/remy_macos/default.nix +++ b/users/remy_macos/default.nix @@ -3,27 +3,11 @@ with lib.hm.gvariant; { config = { home.stateVersion = "24.05"; - programs.git = { - enable = true; - settings = { - user.name = "Remy Moll"; - user.email = "remy.moll@artidis.com"; - }; - }; - - # on macos we don't set the default shell to fish as it breaks some things - # instead we just tell the terminal to run fish as the first command - # this means that the first thing fish should do is to clear the screen - programs.fish = { - interactiveShellInit = "clear"; - }; - }; imports = [ - ../../modules/home-manager/browser.nix ../../modules/home-manager/code.nix @@ -31,10 +15,9 @@ with lib.hm.gvariant; ../../modules/home-manager/fish.nix ../../modules/home-manager/kubectl.nix - ../../modules/home-manager/macos-tiling + ../../modules/home-manager/macos-fixes.nix ../../modules/home-manager/nh.nix + ../../modules/home-manager/obsidian.nix ../../modules/home-manager/work ]; - - }