From f9205e1e963aa2ff9e31f93e80c536aa59f0842e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 9 Oct 2025 19:11:52 -0700 Subject: move common modules under modules/ Simplify the import on the various hosts. --- .../aarch64-darwin/HQ-KWNY2VH41P/default.nix | 6 ---- machines/darwin/aarch64-darwin/mba-m2/default.nix | 7 ---- machines/nixos/x86_64-linux/do-rproxy/default.nix | 1 - .../nixos/x86_64-linux/synology-vm/default.nix | 1 - modules/common/default.nix | 2 ++ modules/common/fish.nix | 4 +++ modules/common/ssh.nix | 7 ++++ modules/darwin/default.nix | 9 +++++ modules/darwin/desktop.nix | 34 ++++++++++++++++++ modules/darwin/keyboard.nix | 7 ++++ modules/darwin/nix.nix | 42 ++++++++++++++++++++++ modules/darwin/security.nix | 5 +++ profiles/darwin/desktop.nix | 30 ---------------- profiles/darwin/keyboard.nix | 7 ---- profiles/darwin/nix.nix | 42 ---------------------- profiles/darwin/security.nix | 5 --- profiles/desktop/fonts.nix | 6 ---- profiles/programs/fish.nix | 4 --- profiles/programs/ssh.nix | 7 ---- 19 files changed, 110 insertions(+), 116 deletions(-) create mode 100644 modules/common/fish.nix create mode 100644 modules/common/ssh.nix create mode 100644 modules/darwin/default.nix create mode 100644 modules/darwin/desktop.nix create mode 100644 modules/darwin/keyboard.nix create mode 100644 modules/darwin/nix.nix create mode 100644 modules/darwin/security.nix delete mode 100644 profiles/darwin/desktop.nix delete mode 100644 profiles/darwin/keyboard.nix delete mode 100644 profiles/darwin/nix.nix delete mode 100644 profiles/darwin/security.nix delete mode 100644 profiles/desktop/fonts.nix delete mode 100644 profiles/programs/fish.nix delete mode 100644 profiles/programs/ssh.nix diff --git a/machines/darwin/aarch64-darwin/HQ-KWNY2VH41P/default.nix b/machines/darwin/aarch64-darwin/HQ-KWNY2VH41P/default.nix index e9d78eb..766edf1 100644 --- a/machines/darwin/aarch64-darwin/HQ-KWNY2VH41P/default.nix +++ b/machines/darwin/aarch64-darwin/HQ-KWNY2VH41P/default.nix @@ -18,13 +18,7 @@ }; } "${self}/profiles/programs/home-manager.nix" - "${self}/profiles/darwin/desktop.nix" - "${self}/profiles/darwin/keyboard.nix" - "${self}/profiles/darwin/nix.nix" - "${self}/profiles/darwin/security.nix" "${self}/profiles/desktop/fonts.nix" - "${self}/profiles/programs/fish.nix" - "${self}/profiles/programs/ssh.nix" ]; system.primaryUser = adminUser.name; diff --git a/machines/darwin/aarch64-darwin/mba-m2/default.nix b/machines/darwin/aarch64-darwin/mba-m2/default.nix index d2f66bf..841352d 100644 --- a/machines/darwin/aarch64-darwin/mba-m2/default.nix +++ b/machines/darwin/aarch64-darwin/mba-m2/default.nix @@ -19,13 +19,6 @@ } "${self}/profiles/programs/home-manager.nix" "${self}/profiles/nix/remote-builder.nix" - "${self}/profiles/darwin/desktop.nix" - "${self}/profiles/darwin/keyboard.nix" - "${self}/profiles/darwin/nix.nix" - "${self}/profiles/darwin/security.nix" - "${self}/profiles/desktop/fonts.nix" - "${self}/profiles/programs/fish.nix" - "${self}/profiles/programs/ssh.nix" ]; system.primaryUser = adminUser.name; diff --git a/machines/nixos/x86_64-linux/do-rproxy/default.nix b/machines/nixos/x86_64-linux/do-rproxy/default.nix index 061a6ca..20a048f 100644 --- a/machines/nixos/x86_64-linux/do-rproxy/default.nix +++ b/machines/nixos/x86_64-linux/do-rproxy/default.nix @@ -29,7 +29,6 @@ "${self}/profiles/network/firewall.nix" "${self}/profiles/network/fail2ban.nix" "${self}/profiles/services/podman.nix" - "${self}/profiles/programs/fish.nix" ./profiles/nginx.nix ]; diff --git a/machines/nixos/x86_64-linux/synology-vm/default.nix b/machines/nixos/x86_64-linux/synology-vm/default.nix index 97eafaf..34d9962 100644 --- a/machines/nixos/x86_64-linux/synology-vm/default.nix +++ b/machines/nixos/x86_64-linux/synology-vm/default.nix @@ -24,7 +24,6 @@ "${self}/profiles/network/networkd.nix" "${self}/profiles/network/firewall.nix" "${self}/profiles/services/podman.nix" - "${self}/profiles/programs/fish.nix" ./profiles/forgejo.nix ./profiles/keycloak.nix ./profiles/goget.nix diff --git a/modules/common/default.nix b/modules/common/default.nix index b42a079..5a0da5f 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1,7 +1,9 @@ { ... }: { imports = [ + ./fish.nix ./home.nix ./host-config.nix + ./ssh.nix ]; } diff --git a/modules/common/fish.nix b/modules/common/fish.nix new file mode 100644 index 0000000..21fdf98 --- /dev/null +++ b/modules/common/fish.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + programs.fish.enable = true; +} diff --git a/modules/common/ssh.nix b/modules/common/ssh.nix new file mode 100644 index 0000000..3e975ee --- /dev/null +++ b/modules/common/ssh.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + programs.ssh.knownHosts = { + "github.com".publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; + }; +} diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix new file mode 100644 index 0000000..674e042 --- /dev/null +++ b/modules/darwin/default.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + imports = [ + ./desktop.nix + ./keyboard.nix + ./nix.nix + ./security.nix + ]; +} diff --git a/modules/darwin/desktop.nix b/modules/darwin/desktop.nix new file mode 100644 index 0000000..55cef64 --- /dev/null +++ b/modules/darwin/desktop.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: +{ + fonts.packages = with pkgs; [ + source-code-pro + ]; + + system.defaults = { + dock = { + autohide = true; + dashboard-in-overlay = false; + launchanim = false; # Don't animate opening applications. + mru-spaces = false; # don’t rearrange spaces based on the most recent use + orientation = "bottom"; + show-recents = false; + showhidden = false; + tilesize = 30; # Default is 64. + wvous-br-corner = 1; # Disable Notes hot corner. + }; + finder.AppleShowAllExtensions = true; + + CustomUserPreferences = { + "com.apple.desktopservices" = { + # Avoid creating .DS_Store files on network or USB volumes + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + }; + + # Requires the directory to already exist. + # See system.activationScripts.postUserActivation + screencapture.location = "~/Documents/screenshots"; + SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true; + }; +} diff --git a/modules/darwin/keyboard.nix b/modules/darwin/keyboard.nix new file mode 100644 index 0000000..c460bac --- /dev/null +++ b/modules/darwin/keyboard.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + system.keyboard = { + enableKeyMapping = true; + remapCapsLockToControl = true; + }; +} diff --git a/modules/darwin/nix.nix b/modules/darwin/nix.nix new file mode 100644 index 0000000..56d85ca --- /dev/null +++ b/modules/darwin/nix.nix @@ -0,0 +1,42 @@ +{ + lib, + adminUser, + pkgs, + ... +}: +{ + nix = { + extraOptions = '' + tarball-ttl = 900 + ''; + gc = { + automatic = true; + options = "--delete-older-than 7d"; + }; + optimise = { + automatic = true; + }; + package = pkgs.nixVersions.stable; + settings = { + trusted-substituters = [ + "https://cachix.cachix.org" + "https://nixpkgs.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM=" + "nixpkgs.cachix.org-1:q91R6hxbwFvDqTSDKwDAV4T5PxqXGxswD8vhONFMeOE=" + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-users = [ + "@admin" + adminUser.name + ]; + experimental-features = lib.mkDefault [ + "nix-command" + "flakes" + ]; + }; + }; +} diff --git a/modules/darwin/security.nix b/modules/darwin/security.nix new file mode 100644 index 0000000..178fca1 --- /dev/null +++ b/modules/darwin/security.nix @@ -0,0 +1,5 @@ +{ ... }: +{ + # Touch ID for sudo auth + security.pam.services.sudo_local.touchIdAuth = true; +} diff --git a/profiles/darwin/desktop.nix b/profiles/darwin/desktop.nix deleted file mode 100644 index a5ca970..0000000 --- a/profiles/darwin/desktop.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ ... }: -{ - system.defaults = { - dock = { - autohide = true; - dashboard-in-overlay = false; - launchanim = false; # Don't animate opening applications. - mru-spaces = false; # don’t rearrange spaces based on the most recent use - orientation = "bottom"; - show-recents = false; - showhidden = false; - tilesize = 30; # Default is 64. - wvous-br-corner = 1; # Disable Notes hot corner. - }; - finder.AppleShowAllExtensions = true; - - CustomUserPreferences = { - "com.apple.desktopservices" = { - # Avoid creating .DS_Store files on network or USB volumes - DSDontWriteNetworkStores = true; - DSDontWriteUSBStores = true; - }; - }; - - # Requires the directory to already exist. - # See system.activationScripts.postUserActivation - screencapture.location = "~/Documents/screenshots"; - SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true; - }; -} diff --git a/profiles/darwin/keyboard.nix b/profiles/darwin/keyboard.nix deleted file mode 100644 index c460bac..0000000 --- a/profiles/darwin/keyboard.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - system.keyboard = { - enableKeyMapping = true; - remapCapsLockToControl = true; - }; -} diff --git a/profiles/darwin/nix.nix b/profiles/darwin/nix.nix deleted file mode 100644 index 56d85ca..0000000 --- a/profiles/darwin/nix.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - lib, - adminUser, - pkgs, - ... -}: -{ - nix = { - extraOptions = '' - tarball-ttl = 900 - ''; - gc = { - automatic = true; - options = "--delete-older-than 7d"; - }; - optimise = { - automatic = true; - }; - package = pkgs.nixVersions.stable; - settings = { - trusted-substituters = [ - "https://cachix.cachix.org" - "https://nixpkgs.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM=" - "nixpkgs.cachix.org-1:q91R6hxbwFvDqTSDKwDAV4T5PxqXGxswD8vhONFMeOE=" - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - trusted-users = [ - "@admin" - adminUser.name - ]; - experimental-features = lib.mkDefault [ - "nix-command" - "flakes" - ]; - }; - }; -} diff --git a/profiles/darwin/security.nix b/profiles/darwin/security.nix deleted file mode 100644 index 178fca1..0000000 --- a/profiles/darwin/security.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: -{ - # Touch ID for sudo auth - security.pam.services.sudo_local.touchIdAuth = true; -} diff --git a/profiles/desktop/fonts.nix b/profiles/desktop/fonts.nix deleted file mode 100644 index 5767d3a..0000000 --- a/profiles/desktop/fonts.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - fonts.packages = with pkgs; [ - source-code-pro - ]; -} diff --git a/profiles/programs/fish.nix b/profiles/programs/fish.nix deleted file mode 100644 index 21fdf98..0000000 --- a/profiles/programs/fish.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: -{ - programs.fish.enable = true; -} diff --git a/profiles/programs/ssh.nix b/profiles/programs/ssh.nix deleted file mode 100644 index 3e975ee..0000000 --- a/profiles/programs/ssh.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - programs.ssh.knownHosts = { - "github.com".publicKey = - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; - }; -} -- cgit v1.2.3