From 79eec8b97169356c8a22b2b8720452bb5f7edb1d Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 14 Jul 2025 00:01:11 +0800 Subject: [PATCH 1/4] refactor(nix): Use mkConfigurations for darwinConfigurations --- nix/configurations.nix | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/nix/configurations.nix b/nix/configurations.nix index e460cdd..04c1776 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -36,6 +36,23 @@ let (value.extraCfg or { }) ] ++ optional value.graphical cfg.modules.nixos.graphical; } + else if class == "darwin" then + darwinSystem { + specialArgs = { inherit (config.flake) self; }; + modules = [ + cfg.modules.darwin.default + ( + { pkgs, ... }: + { + environment.systemPackages = [ pkgs.vim ]; + services.tailscale.enable = true; + nix.settings.experimental-features = "nix-command flakes"; + nix.enable = false; + nixpkgs.hostPlatform = "x86_64-darwin"; + } + ) + ]; + } else { } ) hosts; @@ -43,21 +60,5 @@ in { imports = [ inputs.home-manager.flakeModules.home-manager ]; flake.nixosConfigurations = mkConfigurations "nixos" hosts.nixos; - flake.darwinConfigurations.venus = darwinSystem { - specialArgs = { inherit (config.flake) self; }; - modules = [ - ( - { pkgs, self, ... }: - { - environment.systemPackages = [ pkgs.vim ]; - services.tailscale.enable = true; - nix.settings.experimental-features = "nix-command flakes"; - nix.enable = false; - system.configurationRevision = self.rev or self.dirtyRev or null; - system.stateVersion = 6; - nixpkgs.hostPlatform = "x86_64-darwin"; - } - ) - ]; - }; + flake.darwinConfigurations = mkConfigurations "darwin" hosts.darwin; } From cd984132eeb18f8fd3c97df06384413a849cd38e Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 14 Jul 2025 00:09:24 +0800 Subject: [PATCH 2/4] refactor(darwin): move tailscale to module --- nix/configurations.nix | 10 ---------- nix/modules/networking/tailscale.nix | 3 +++ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/nix/configurations.nix b/nix/configurations.nix index 04c1776..7687a76 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -41,16 +41,6 @@ let specialArgs = { inherit (config.flake) self; }; modules = [ cfg.modules.darwin.default - ( - { pkgs, ... }: - { - environment.systemPackages = [ pkgs.vim ]; - services.tailscale.enable = true; - nix.settings.experimental-features = "nix-command flakes"; - nix.enable = false; - nixpkgs.hostPlatform = "x86_64-darwin"; - } - ) ]; } else diff --git a/nix/modules/networking/tailscale.nix b/nix/modules/networking/tailscale.nix index ddf1b9a..8f2a000 100644 --- a/nix/modules/networking/tailscale.nix +++ b/nix/modules/networking/tailscale.nix @@ -14,4 +14,7 @@ in persistDirs = [ "/var/lib/tailscale" ]; sops.secrets."tailscale/client-secret".sopsFile = secrets + "/tailscale.yaml"; }; + flake.modules.darwin.default = { + services.tailscale.enable = true; + }; } From 65659908cf762ce78bae5212c7db5afe7d6e9664 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 14 Jul 2025 00:16:05 +0800 Subject: [PATCH 3/4] refactor(home-manage): hardcode homeVersion --- nix/modules/system/system.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nix/modules/system/system.nix b/nix/modules/system/system.nix index 9b50970..cee1df3 100644 --- a/nix/modules/system/system.nix +++ b/nix/modules/system/system.nix @@ -7,11 +7,7 @@ i18n.defaultLocale = "en_US.UTF-8"; system.stateVersion = "25.11"; }; - homeManager.default = - { osConfig, ... }: - { - home.stateVersion = osConfig.system.stateVersion; - }; + homeManager.default.home.stateVersion = "25.11"; darwin.default = { self, ... }: { From 9470ea2f9018a943beceec7ccde588e3f4596e10 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 14 Jul 2025 00:18:04 +0800 Subject: [PATCH 4/4] feat(darwin): Add stylix and user modules --- nix/configurations.nix | 2 ++ nix/modules/graphical/stylix.nix | 8 ++++++++ nix/modules/system/users.nix | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/nix/configurations.nix b/nix/configurations.nix index 7687a76..66b9b83 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -41,6 +41,8 @@ let specialArgs = { inherit (config.flake) self; }; modules = [ cfg.modules.darwin.default + inputs.home-manager.darwinModules.home-manager + { home-manager = globalCfg name value; } ]; } else diff --git a/nix/modules/graphical/stylix.nix b/nix/modules/graphical/stylix.nix index c4b3c65..c347b6a 100644 --- a/nix/modules/graphical/stylix.nix +++ b/nix/modules/graphical/stylix.nix @@ -9,4 +9,12 @@ stylix.enable = true; stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; }; + flake.modules.darwin.default = + { pkgs, ... }: + { + imports = [ inputs.stylix.darwinModules.stylix ]; + stylix.enable = true; + #TODO: move into manifest + stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; + }; } diff --git a/nix/modules/system/users.nix b/nix/modules/system/users.nix index 5815089..c9f8768 100644 --- a/nix/modules/system/users.nix +++ b/nix/modules/system/users.nix @@ -31,4 +31,14 @@ in } ); }; + flake.modules.darwin.default = + { config, ... }: + { + home-manager.users = forAllUsers' ( + name: _: { + home.username = name; + home.homeDirectory = config.users.users.${name}.home; + } + ); + }; }