From 26e4112aa30f7a3ce86f8c4182634fffd80f7297 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sat, 3 Dec 2022 12:24:13 -0500 Subject: [PATCH] Use nixosModules and darwinModules --- flake.nix | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 05de5fc..ad56c6c 100644 --- a/flake.nix +++ b/flake.nix @@ -70,9 +70,6 @@ flake = let userName = "srid"; - platformIndependentModules = [ - ./nixos/caches - ]; platformIndependentHomeModules = [ ./home/tmux.nix ./home/neovim.nix @@ -83,17 +80,26 @@ ]; in { + # Configuration common to all Linux systems + nixosModules.default = { + imports = [ + ./nixos/caches + ./nixos/self-ide.nix + ./nixos/takemessh + ./nixos/current-location.nix + ]; + }; + # Configuration common to macOS Linux systems + darwinModules.default = { + imports = [ + ./nixos/caches + ]; + }; # Configurations for Linux (NixOS) systems nixosConfigurations = let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; - # Configuration common to all Linux systems - commonFeatures = platformIndependentModules ++ [ - ./nixos/self-ide.nix - ./nixos/takemessh - ./nixos/current-location.nix - ]; homeFeatures = [ home-manager.nixosModules.home-manager { @@ -108,7 +114,6 @@ }) ./home/vscode-server.nix ]; - programs.bash = { enable = true; } // (import ./home/shellcommon.nix { inherit pkgs; }); @@ -131,7 +136,7 @@ # Arguments to pass to all modules. specialArgs = { inherit system inputs; }; modules = - commonFeatures ++ homeFeatures ++ extraModules; + [ self.nixosModules.default ] ++ homeFeatures ++ extraModules; }; in { @@ -154,7 +159,8 @@ inherit inputs system; rosettaPkgs = import nixpkgs { system = "x86_64-darwin"; }; }; - modules = platformIndependentModules ++ [ + modules = [ + self.darwinModules.default ./systems/darwin.nix home-manager.darwinModules.home-manager {