From cbe03d10606aca4355d20e019f01af49060cd1a2 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 25 Nov 2024 14:22:52 +0100 Subject: [PATCH] Rename and refactor Darwin-specific modules Renamed several modules to better align with Darwin-specific configurations. Refactored configuration for Alacritty and removed it from system packages where not needed. Introduced Homebrew settings and cleaned up redundant entries in multiple Nix files. --- homes/aarch64-darwin/harald@m4/default.nix | 10 ++-- homes/x86_64-darwin/harald@mpro/default.nix | 1 - modules/darwin/nix/default.nix | 52 +++++++++++-------- modules/darwin/services/base/default.nix | 8 ++- modules/darwin/tools/alacritty/default.nix | 18 +++++++ .../{home => darwin}/tools/direnv/default.nix | 0 modules/home/tools/alacritty/default.nix | 29 ----------- systems/aarch64-darwin/m4/default.nix | 3 ++ 8 files changed, 63 insertions(+), 58 deletions(-) create mode 100644 modules/darwin/tools/alacritty/default.nix rename modules/{home => darwin}/tools/direnv/default.nix (100%) delete mode 100644 modules/home/tools/alacritty/default.nix diff --git a/homes/aarch64-darwin/harald@m4/default.nix b/homes/aarch64-darwin/harald@m4/default.nix index 7871e1b..e00a2bf 100644 --- a/homes/aarch64-darwin/harald@m4/default.nix +++ b/homes/aarch64-darwin/harald@m4/default.nix @@ -9,11 +9,9 @@ username = "harald"; homeDirectory = "/Users/${config.home.username}"; stateVersion = "23.11"; # Please read the comment before changing. - # sessionPath = [ "$HOME/bin" ]; }; metacfg = { - cli-apps = { bash.enable = true; fish.enable = true; @@ -24,9 +22,15 @@ }; tools = { - direnv.enable = true; + #direnv.enable = true; ssh.enable = true; git.enable = true; }; }; + + xdg.configFile."alacritty/alacritty.toml".source = (pkgs.formats.toml { }).generate "alacritty-config" { + font = { + size = 17; + }; + }; } diff --git a/homes/x86_64-darwin/harald@mpro/default.nix b/homes/x86_64-darwin/harald@mpro/default.nix index 139f1e5..16f4cc7 100644 --- a/homes/x86_64-darwin/harald@mpro/default.nix +++ b/homes/x86_64-darwin/harald@mpro/default.nix @@ -24,7 +24,6 @@ }; tools = { - direnv.enable = true; ssh.enable = true; git.enable = true; }; diff --git a/modules/darwin/nix/default.nix b/modules/darwin/nix/default.nix index b0e5ec4..78b7cf8 100644 --- a/modules/darwin/nix/default.nix +++ b/modules/darwin/nix/default.nix @@ -24,6 +24,11 @@ in nix-prefetch-git ]; + homebrew = { + enable = true; + onActivation.autoUpdate = false; + }; + nix = let users = [ @@ -34,34 +39,35 @@ in { package = cfg.package; - settings = { - experimental-features = "nix-command flakes"; - http-connections = 50; - warn-dirty = false; - log-lines = 50; + settings = + { + experimental-features = "nix-command flakes"; + http-connections = 50; + warn-dirty = false; + log-lines = 50; - # Large builds apparently fail due to an issue with darwin: - # https://github.com/NixOS/nix/issues/4119 - sandbox = false; + # Large builds apparently fail due to an issue with darwin: + # https://github.com/NixOS/nix/issues/4119 + sandbox = false; - # This appears to break on darwin - # https://github.com/NixOS/nix/issues/7273 - auto-optimise-store = false; + # This appears to break on darwin + # https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = false; - allow-import-from-derivation = true; + allow-import-from-derivation = true; - trusted-users = users; - allowed-users = users; + trusted-users = users; + allowed-users = users; - # NOTE: This configuration is generated by nix-installer so I'm adding it here in - # case it becomes important. - extra-nix-path = "nixpkgs=flake:nixpkgs"; - build-users-group = "nixbld"; - }; - #// (lib.optionalAttrs config.metacfg.tools.direnv.enable { - # keep-outputs = true; - # keep-derivations = true; - #}); + # NOTE: This configuration is generated by nix-installer so I'm adding it here in + # case it becomes important. + extra-nix-path = "nixpkgs=flake:nixpkgs"; + build-users-group = "nixbld"; + } + // (lib.optionalAttrs config.metacfg.tools.direnv.enable { + keep-outputs = true; + keep-derivations = true; + }); gc = { automatic = true; diff --git a/modules/darwin/services/base/default.nix b/modules/darwin/services/base/default.nix index d50f779..2ccb2ed 100644 --- a/modules/darwin/services/base/default.nix +++ b/modules/darwin/services/base/default.nix @@ -19,7 +19,6 @@ in config = mkIf cfg.enable { environment = { systemPackages = with pkgs; [ - alacritty age delta git @@ -45,6 +44,12 @@ in ]; }; + programs = { + fish.enable = true; + }; + + environment.systemPath = [ /run/current-system/sw/bin ]; + programs = { bash = { ## shellInit = '' @@ -53,7 +58,6 @@ in bind '"\e[B": history-search-forward' ''; }; - fish.enable = true; }; security = { diff --git a/modules/darwin/tools/alacritty/default.nix b/modules/darwin/tools/alacritty/default.nix new file mode 100644 index 0000000..d537662 --- /dev/null +++ b/modules/darwin/tools/alacritty/default.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + pkgs, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + + cfg = config.metacfg.tools.alacritty; +in +{ + options.metacfg.tools.alacritty = { + enable = mkEnableOption "alacritty"; + }; + + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ alacritty ]; }; +} diff --git a/modules/home/tools/direnv/default.nix b/modules/darwin/tools/direnv/default.nix similarity index 100% rename from modules/home/tools/direnv/default.nix rename to modules/darwin/tools/direnv/default.nix diff --git a/modules/home/tools/alacritty/default.nix b/modules/home/tools/alacritty/default.nix deleted file mode 100644 index a0b4a3b..0000000 --- a/modules/home/tools/alacritty/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -let - inherit (lib) mkEnableOption mkIf; - - cfg = config.metacfg.tools.alacritty; -in -{ - options.metacfg.tools.alacritty = { - enable = mkEnableOption "alacritty"; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - alacritty - (pkgs.nerdfonts.override { - fonts = [ - "FiraCode" - "DroidSansMono" - "JetBrainsMono" - ]; - }) - ]; - }; -} diff --git a/systems/aarch64-darwin/m4/default.nix b/systems/aarch64-darwin/m4/default.nix index 61b4a65..5985c8b 100644 --- a/systems/aarch64-darwin/m4/default.nix +++ b/systems/aarch64-darwin/m4/default.nix @@ -6,6 +6,9 @@ with lib.metacfg; suites = { common = enabled; }; + tools = { + direnv.enable = true; + }; }; environment.systemPackages = with pkgs; [