nixos-config/flake.nix

59 lines
1.9 KiB
Nix
Raw Normal View History

2023-10-09 10:44:07 -07:00
{
description = "Entrypoint of all nix configurations";
inputs = {
disko.url = "github:nix-community/disko";
hardware.url = "github:nixos/nixos-hardware";
home-manager.url = "github:nix-community/home-manager";
2024-03-02 15:10:23 -08:00
jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
2023-10-09 10:44:07 -07:00
mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2024-06-11 00:13:33 -07:00
nix-custom.url = "/home/macronova/Desktop/nix-custom";
2023-10-09 10:44:07 -07:00
sops-nix.url = "github:Mic92/sops-nix";
};
2024-01-16 19:05:51 -08:00
outputs = inputs@{ self, 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 = {
gc = {
automatic = true;
options = "--delete-older-than 30d";
};
settings = {
auto-optimise-store = true;
2023-12-17 01:58:24 -08:00
experimental-features = [ "nix-command" "flakes" ];
trusted-substituters = [ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" ];
2023-12-06 21:46:16 -08:00
};
};
nixpkgs = {
config.allowUnfree = true;
2024-03-23 19:27:31 -07:00
overlays = [ nix-custom.overlays.default ];
2023-12-06 21:46:16 -08:00
};
})
];
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);
};
}