2023-02-06 22:44:12 +01:00
|
|
|
{
|
|
|
|
description = "NixOS Configuration";
|
|
|
|
inputs = rec {
|
2023-04-16 13:43:17 +02:00
|
|
|
nixpkgs-git.url = "github:/NixOS/nixpkgs";
|
2023-02-06 22:44:12 +01:00
|
|
|
nixpkgs-stable.url = "github:/NixOS/nixpkgs/nixos-22.11";
|
2023-04-16 13:43:17 +02:00
|
|
|
nixpkgs-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
|
|
|
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
2023-02-06 22:44:12 +01:00
|
|
|
mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver";
|
|
|
|
sops-nix = {
|
|
|
|
url = github:Mic92/sops-nix;
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
outputs = { self, nixpkgs, mailserver, sops-nix, ... }@attrs: let
|
|
|
|
lib = nixpkgs.lib;
|
|
|
|
fn = import ./fn.nix { inherit lib; };
|
|
|
|
system = "x86_64-linux";
|
|
|
|
machineList = fn.lst { p = (toString ./machines); t = "directory"; b = false; };
|
|
|
|
configFiles = fn.lst { p = (toString ./config); b = true; };
|
|
|
|
pkgsFiles = fn.lst { p = (toString ./pkgs); b = true; };
|
|
|
|
serviceFiles = fn.lst { p = (toString ./services); b = true; };
|
|
|
|
nixosSystemFor = machine: {
|
|
|
|
name = machine;
|
|
|
|
value = let
|
|
|
|
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
|
2023-04-15 16:27:27 +02:00
|
|
|
machineFiles = lib.filter (name: lib.strings.hasSuffix ".nix" name) (fn.lst { p = machinePath; b = true; });
|
2023-02-06 22:44:12 +01:00
|
|
|
in nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
2023-08-28 21:52:46 +02:00
|
|
|
specialArgs = attrs // { fn = fn; };
|
2023-02-06 22:44:12 +01:00
|
|
|
modules = [
|
|
|
|
(toString ./options/machine.nix)
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
] ++ machineFiles
|
|
|
|
++ configFiles
|
|
|
|
++ pkgsFiles
|
|
|
|
++ serviceFiles;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
result = lib.listToAttrs (map nixosSystemFor ["Lilim"]);
|
|
|
|
in {
|
|
|
|
nixosConfigurations = lib.listToAttrs (map nixosSystemFor machineList);
|
|
|
|
};
|
|
|
|
}
|