Adding a mac to the fleet :/ #3

Open
remoll wants to merge 3 commits from feature/macos into main
12 changed files with 152 additions and 207 deletions
Showing only changes of commit 5a26b08ba3 - Show all commits

View File

@@ -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 .

View File

@@ -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
];

View File

@@ -10,6 +10,6 @@
# Merge the configuration and hardware configuration
imports = [
./configuration.nix
# ../../modules/nixos/macos-tiling
../../modules/macos/tiling.nix
];
}

View File

@@ -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}")
# ];
# };
# };
}

View File

@@ -181,6 +181,7 @@ in
extensions = baseExtensions ++ pkgs.nix4vscode.forVscode [
"Tim-Koehler.helm-intellisense"
"HashiCorp.terraform"
"signageos.signageos-vscode-sops"
];
keybindings = baseKeybindings;
userSettings = baseSettings;

View File

@@ -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
];
}

View File

@@ -1,16 +0,0 @@
{
config,
lib,
...
}:
let
cfg = config.nix-config.macos;
in
{
options = {
};
imports = [
./tiling.nix
];
}

View File

@@ -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";
};
};
};
}

View File

@@ -13,6 +13,7 @@ in
imports = [
./aliases.nix
./cryptography.nix
./git.nix
./kluster.nix
];
}

View File

@@ -0,0 +1,14 @@
{
config,
lib,
...
}:
{
programs.git = {
enable = true;
settings = {
user.name = "Remy Moll";
user.email = "remy.moll@artidis.com";
};
};
}

79
modules/macos/tiling.nix Normal file
View File

@@ -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
# '';
# };
}

View File

@@ -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
];
}