2023-10-09 10:44:07 -07:00
|
|
|
{
|
|
|
|
|
description = "Entrypoint of all nix configurations";
|
|
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
|
darwin.url = "github:lnl7/nix-darwin";
|
|
|
|
|
disko.url = "github:nix-community/disko";
|
|
|
|
|
hardware.url = "github:nixos/nixos-hardware";
|
|
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
|
|
|
mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
|
2023-11-09 19:37:21 -08:00
|
|
|
nh.url = "github:viperML/nh";
|
2023-10-09 10:44:07 -07:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
|
nix-custom.url = "git+https://forgejo.invariantspace.com/macronova/nix-custom";
|
|
|
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-27 15:20:59 -07:00
|
|
|
outputs = inputs@{ self, darwin, nixpkgs, nix-custom, ... }:
|
2023-10-09 10:44:07 -07:00
|
|
|
let
|
2023-12-06 21:46:16 -08:00
|
|
|
linuxCfgDir = ./linux;
|
2023-10-09 10:44:07 -07:00
|
|
|
templateDir = ./template;
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
nixosConfigurations = builtins.mapAttrs
|
|
|
|
|
(instance: _:
|
2023-12-06 21:46:16 -08:00
|
|
|
nixpkgs.lib.nixosSystem ({
|
|
|
|
|
modules = [
|
|
|
|
|
# Import config from folder
|
|
|
|
|
(linuxCfgDir + "/${instance}")
|
|
|
|
|
# Setup Nix
|
|
|
|
|
({ pkgs, ... }: {
|
|
|
|
|
networking.hostName = instance;
|
|
|
|
|
nix = {
|
2023-12-17 01:24:17 -08:00
|
|
|
binaryCaches = [ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" ];
|
2023-12-06 21:46:16 -08:00
|
|
|
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);
|
2023-10-09 10:44:07 -07:00
|
|
|
templates = builtins.mapAttrs
|
|
|
|
|
(template: _: {
|
|
|
|
|
path = templateDir + "/${template}";
|
|
|
|
|
description = "Template flake setup: ${template}";
|
|
|
|
|
})
|
|
|
|
|
(builtins.readDir templateDir);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|