Refactor setup
This commit is contained in:
parent
b6b118f819
commit
a7e892635c
16 changed files with 124 additions and 210 deletions
62
flake.nix
62
flake.nix
|
|
@ -15,46 +15,38 @@
|
|||
|
||||
outputs = inputs@{ self, darwin, nixpkgs, nix-custom, ... }:
|
||||
let
|
||||
darwinConfigDir = ./darwin;
|
||||
linuxConfigDir = ./linux;
|
||||
linuxCfgDir = ./linux;
|
||||
templateDir = ./template;
|
||||
systemArgs = archPath: instance: {
|
||||
modules = [
|
||||
# Import config from folder
|
||||
(archPath + "/${instance}")
|
||||
# Setup Nix
|
||||
({ pkgs, ... }: {
|
||||
networking.hostName = instance;
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
};
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
overlays = [ nix-custom.overlay ];
|
||||
};
|
||||
})
|
||||
];
|
||||
specialArgs = { inherit inputs; inherit instance; };
|
||||
};
|
||||
in
|
||||
{
|
||||
darwinConfigurations = builtins.mapAttrs
|
||||
(instance: _:
|
||||
darwin.lib.darwinSystem (systemArgs darwinConfigDir instance // {
|
||||
system = "aarch64-darwin";
|
||||
}))
|
||||
(builtins.readDir darwinConfigDir);
|
||||
nixosConfigurations = builtins.mapAttrs
|
||||
(instance: _:
|
||||
nixpkgs.lib.nixosSystem (systemArgs linuxConfigDir instance))
|
||||
(builtins.readDir linuxConfigDir);
|
||||
nixpkgs.lib.nixosSystem ({
|
||||
modules = [
|
||||
# Import config from folder
|
||||
(linuxCfgDir + "/${instance}")
|
||||
# Setup Nix
|
||||
({ pkgs, ... }: {
|
||||
networking.hostName = instance;
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
};
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
overlays = [ nix-custom.overlay ];
|
||||
};
|
||||
})
|
||||
];
|
||||
specialArgs = { inherit inputs; };
|
||||
}))
|
||||
(builtins.readDir linuxCfgDir);
|
||||
templates = builtins.mapAttrs
|
||||
(template: _: {
|
||||
path = templateDir + "/${template}";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue