Stable modular build
This commit is contained in:
1 parent
e9df5d8c46
commit
d83255dc91
1 file changed
+33
-14
+33
-14
@@ -2,26 +2,45 @@
|
|||||||
, home-manager
|
, home-manager
|
||||||
, nix-darwin
|
, nix-darwin
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
makeImports =
|
||||||
|
{ attrs
|
||||||
|
, home-manager-modules
|
||||||
|
}: (if (isNull attrs.configuration) then [ ] else [ attrs.configuration ])
|
||||||
|
++ [
|
||||||
|
(import ./main.nix attrs)
|
||||||
|
] ++ (if attrs.home-manager.enable then
|
||||||
|
home-manager-modules
|
||||||
|
else
|
||||||
|
[ ]);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
makeNixOsModule = { system, configuration ? null, ... }@attrs:
|
makeNixOsModule =
|
||||||
|
{ system
|
||||||
|
, configuration ? null
|
||||||
|
, ...
|
||||||
|
}@attrs:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
system = system;
|
system = system;
|
||||||
modules = (if (isNull configuration) then [ ] else [ configuration ]) ++
|
modules = (makeImports {
|
||||||
(if attrs.home-manager.enable then
|
attrs = attrs;
|
||||||
[ home-manager.nixosModules.default ]
|
home-manager-modules = [ home-manager.nixosModules.default ];
|
||||||
else
|
});
|
||||||
[ ]);
|
|
||||||
};
|
};
|
||||||
makeDarwinModule =
|
makeDarwinModule =
|
||||||
{ system ? "x86_64-darwin", user, configuration ? null, ... }@attrs:
|
{ system ? "x86_64-darwin"
|
||||||
|
, user
|
||||||
|
, configuration ? null
|
||||||
|
, ...
|
||||||
|
}@attrs:
|
||||||
nix-darwin.lib.darwinSystem {
|
nix-darwin.lib.darwinSystem {
|
||||||
modules = (import ./main.nix attrs)
|
modules = (makeImports {
|
||||||
++ (if attrs.home-manager.enable then [
|
attrs = attrs;
|
||||||
home-manager.darwinModules.home-manager
|
home-manager-modules = [
|
||||||
(import ./macos-home-manager.nix { user = user; })
|
home-manager.darwinModules.home-manager
|
||||||
] else
|
(import ./macos-home-manager.nix { user = user; })
|
||||||
[ ])
|
];
|
||||||
++ (if (isNull configuration) then [ configuration ] else [ ]) ++ [
|
}) ++ [
|
||||||
(import ./macos.nix {
|
(import ./macos.nix {
|
||||||
user = user;
|
user = user;
|
||||||
system = system;
|
system = system;
|
||||||
|
|||||||
Reference in new issue
Block a user