From 63637f993f7d15cc8750d519e210a7d7c22a1efa Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 11 Mar 2024 17:15:43 -0700 Subject: reorganize common files for hosts Move the common configuration for nix to its own file. --- hosts/common/darwin/homebrew.nix | 42 ---------------------------------------- hosts/common/darwin/macos.nix | 23 ---------------------- hosts/common/homebrew.nix | 42 ++++++++++++++++++++++++++++++++++++++++ hosts/common/macos.nix | 23 ++++++++++++++++++++++ hosts/common/nix.nix | 24 +++++++++++++++++++++++ hosts/mba/default.nix | 21 +------------------- hosts/work/default.nix | 26 +------------------------ nix/flake/hosts.nix | 5 +++-- 8 files changed, 94 insertions(+), 112 deletions(-) delete mode 100644 hosts/common/darwin/homebrew.nix delete mode 100644 hosts/common/darwin/macos.nix create mode 100644 hosts/common/homebrew.nix create mode 100644 hosts/common/macos.nix create mode 100644 hosts/common/nix.nix diff --git a/hosts/common/darwin/homebrew.nix b/hosts/common/darwin/homebrew.nix deleted file mode 100644 index b358695..0000000 --- a/hosts/common/darwin/homebrew.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ ... }: -{ - # Required for homebrew on aarch64 - environment.systemPath = [ "/opt/homebrew/bin" "/opt/homebrew/sbin" ]; - - homebrew = { - enable = true; - onActivation.autoUpdate = true; - onActivation.upgrade = true; - - brews = [ - "aspell" # spelling - "envoy" # to do some testing with envoy - "go" # it's also installed by nix, but this is a fallback, just in case - "hashicorp/tap/boundary" # https://www.boundaryproject.io/ - "kind" # to run local k8s cluster - "kubebuilder" - "s3cmd" - ]; - - taps = [ - "homebrew/cask-fonts" - "hashicorp/tap" - ]; - - casks = [ - "1password-cli" - "docker" - "element" - "emacs" - "font-monaspace" # https://github.com/githubnext/monaspace - "font-source-code-pro" - "iterm2" - "netnewswire" - "transmission" - "vlc" - "wireshark" - "zed" - "zoom" - ]; - }; -} diff --git a/hosts/common/darwin/macos.nix b/hosts/common/darwin/macos.nix deleted file mode 100644 index edc57a0..0000000 --- a/hosts/common/darwin/macos.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: { - system.defaults.dock.autohide = true; - system.defaults.dock.orientation = "left"; - system.defaults.dock.showhidden = false; - system.defaults.dock.show-recents = false; - # don’t rearrange spaces based on the most recent use - system.defaults.dock.mru-spaces = false; - system.defaults.finder.AppleShowAllExtensions = true; - system.defaults.screencapture.location = "~/Documents/screenshots"; - - system.keyboard = { - enableKeyMapping = true; - remapCapsLockToControl = true; - }; - - system.defaults.CustomUserPreferences = { - "com.apple.desktopservices" = { - # Avoid creating .DS_Store files on network or USB volumes - DSDontWriteNetworkStores = true; - DSDontWriteUSBStores = true; - }; - }; -} diff --git a/hosts/common/homebrew.nix b/hosts/common/homebrew.nix new file mode 100644 index 0000000..b358695 --- /dev/null +++ b/hosts/common/homebrew.nix @@ -0,0 +1,42 @@ +{ ... }: +{ + # Required for homebrew on aarch64 + environment.systemPath = [ "/opt/homebrew/bin" "/opt/homebrew/sbin" ]; + + homebrew = { + enable = true; + onActivation.autoUpdate = true; + onActivation.upgrade = true; + + brews = [ + "aspell" # spelling + "envoy" # to do some testing with envoy + "go" # it's also installed by nix, but this is a fallback, just in case + "hashicorp/tap/boundary" # https://www.boundaryproject.io/ + "kind" # to run local k8s cluster + "kubebuilder" + "s3cmd" + ]; + + taps = [ + "homebrew/cask-fonts" + "hashicorp/tap" + ]; + + casks = [ + "1password-cli" + "docker" + "element" + "emacs" + "font-monaspace" # https://github.com/githubnext/monaspace + "font-source-code-pro" + "iterm2" + "netnewswire" + "transmission" + "vlc" + "wireshark" + "zed" + "zoom" + ]; + }; +} diff --git a/hosts/common/macos.nix b/hosts/common/macos.nix new file mode 100644 index 0000000..edc57a0 --- /dev/null +++ b/hosts/common/macos.nix @@ -0,0 +1,23 @@ +{ ... }: { + system.defaults.dock.autohide = true; + system.defaults.dock.orientation = "left"; + system.defaults.dock.showhidden = false; + system.defaults.dock.show-recents = false; + # don’t rearrange spaces based on the most recent use + system.defaults.dock.mru-spaces = false; + system.defaults.finder.AppleShowAllExtensions = true; + system.defaults.screencapture.location = "~/Documents/screenshots"; + + system.keyboard = { + enableKeyMapping = true; + remapCapsLockToControl = true; + }; + + system.defaults.CustomUserPreferences = { + "com.apple.desktopservices" = { + # Avoid creating .DS_Store files on network or USB volumes + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + }; +} diff --git a/hosts/common/nix.nix b/hosts/common/nix.nix new file mode 100644 index 0000000..c828a16 --- /dev/null +++ b/hosts/common/nix.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: { + nix = { + package = pkgs.nixFlakes; + + gc = { + user = "root"; + automatic = true; + interval = { Weekday = 0; Hour = 2; Minute = 0; }; + options = "--delete-older-than 30d"; + }; + + settings = { + trusted-users = [ "@admin" "fcuny" ]; + experimental-features = [ "nix-command" "flakes" ]; + }; + }; + + nixpkgs.config = { + allowUnfree = true; + permittedInsecurePackages = [ + "nix-2.16.2" # FIXME https://github.com/nix-community/nixd/issues/357 + ]; + }; +} diff --git a/hosts/mba/default.nix b/hosts/mba/default.nix index 6e59f7b..5908a53 100644 --- a/hosts/mba/default.nix +++ b/hosts/mba/default.nix @@ -1,26 +1,7 @@ -{ pkgs, ... }: +{ ... }: { services.nix-daemon.enable = true; - nix = { - package = pkgs.nixFlakes; - - gc = { - user = "root"; - automatic = true; - interval = { Weekday = 0; Hour = 2; Minute = 0; }; - options = "--delete-older-than 30d"; - }; - - settings = { - trusted-users = [ "@admin" "fcuny" ]; - experimental-features = [ "nix-command" "flakes" ]; - }; - }; - - # in order to install things like 1password's extensions - nixpkgs.config.allowUnfree = true; - programs.zsh.enable = true; users.users.fcuny.home = "/Users/fcuny"; diff --git a/hosts/work/default.nix b/hosts/work/default.nix index 6cc3d5d..3db1e6f 100644 --- a/hosts/work/default.nix +++ b/hosts/work/default.nix @@ -1,31 +1,7 @@ -{ pkgs, ... }: +{ ... }: { services.nix-daemon.enable = true; - nix = { - package = pkgs.nixFlakes; - - gc = { - user = "root"; - automatic = true; - interval.Day = 7; - options = "--delete-older-than 30d"; - }; - - settings = { - trusted-users = [ "@admin" "fcuny" ]; - experimental-features = [ "nix-command" "flakes" ]; - }; - }; - - # in order to install things like 1password's extensions - nixpkgs.config.allowUnfree = true; - - # FIXME https://github.com/nix-community/nixd/issues/357 - nixpkgs.config.permittedInsecurePackages = [ - "nix-2.16.2" - ]; - programs.zsh.enable = true; users.users.fcuny.home = "/Users/fcuny"; diff --git a/nix/flake/hosts.nix b/nix/flake/hosts.nix index c2ba71b..a6390e5 100644 --- a/nix/flake/hosts.nix +++ b/nix/flake/hosts.nix @@ -17,8 +17,9 @@ let }; }; } - ../../hosts/common/darwin/homebrew.nix - ../../hosts/common/darwin/macos.nix + ../../hosts/common/homebrew.nix + ../../hosts/common/macos.nix + ../../hosts/common/nix.nix path { nixpkgs.overlays = [ -- cgit 1.4.1