I created a common packages nix file as { pkgs }: with pkgs: [ exa bat ...] and two other separate files for mac and linux packages that looked similar and then imported these into home.nix let combinedPackages = lib.lists.concatLists [ import ./common.pkgs.nix { inherit lib; inherit pkgs; } import ./mac.pkgs.nix { inherit lib; inherit pkgs; } ] ... anyone does this in a better way?