2023-02-06 22:44:12 +01:00
|
|
|
{
|
|
|
|
description = "NixOS Configuration";
|
2024-07-28 14:27:51 +02:00
|
|
|
inputs = {
|
2023-04-16 13:43:17 +02:00
|
|
|
nixpkgs-git.url = "github:/NixOS/nixpkgs";
|
2024-07-28 14:28:25 +02:00
|
|
|
nixpkgs-stable.url = "github:/NixOS/nixpkgs/nixos-24.05";
|
2023-04-16 13:43:17 +02:00
|
|
|
nixpkgs-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
|
|
|
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
2024-11-15 21:58:10 +01:00
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
|
|
|
impermanence.url = "github:nix-community/impermanence";
|
2024-11-16 18:44:05 +01:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2024-11-20 11:56:54 +01:00
|
|
|
nixpkgs-wayland = {
|
|
|
|
url = "github:nix-community/nixpkgs-wayland";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-02-06 22:44:12 +01:00
|
|
|
mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver";
|
|
|
|
sops-nix = {
|
2023-09-11 21:20:14 +02:00
|
|
|
url = "github:Mic92/sops-nix";
|
2023-02-06 22:44:12 +01:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
2023-09-11 20:23:04 +02:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
2024-11-16 18:44:05 +01:00
|
|
|
flake-utils,
|
2024-11-20 11:56:54 +01:00
|
|
|
nixpkgs-wayland,
|
2023-09-11 20:23:04 +02:00
|
|
|
mailserver,
|
|
|
|
sops-nix,
|
|
|
|
...
|
2024-11-16 18:44:05 +01:00
|
|
|
} @ attrs:
|
|
|
|
flake-utils.lib.eachDefaultSystem (
|
|
|
|
system: let
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
fn = import ./fn.nix {inherit lib;};
|
|
|
|
pkgs = nixpkgs.legacyPackages."${system}";
|
|
|
|
machineList = fn.lst {
|
|
|
|
p = toString ./machines;
|
|
|
|
t = "directory";
|
|
|
|
b = false;
|
2023-09-11 21:20:14 +02:00
|
|
|
};
|
2024-11-16 18:44:05 +01:00
|
|
|
nixosSystemFor = machine: {
|
|
|
|
name = machine;
|
|
|
|
value = let
|
|
|
|
configFiles = fn.lst {
|
|
|
|
p = toString ./config;
|
|
|
|
b = true;
|
|
|
|
};
|
|
|
|
pkgsFiles = fn.lst {
|
|
|
|
p = toString ./pkgs;
|
|
|
|
b = true;
|
|
|
|
};
|
|
|
|
serviceFiles = fn.lst {
|
|
|
|
p = toString ./services;
|
|
|
|
b = true;
|
|
|
|
};
|
|
|
|
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
|
|
|
|
machineFiles = lib.filter (lib.strings.hasSuffix ".nix") (fn.lst {
|
|
|
|
p = machinePath;
|
|
|
|
b = true;
|
|
|
|
});
|
|
|
|
in
|
|
|
|
nixpkgs.lib.nixosSystem {
|
2024-05-09 13:28:32 +02:00
|
|
|
inherit system;
|
2024-11-16 18:44:05 +01:00
|
|
|
specialArgs =
|
|
|
|
attrs
|
|
|
|
// {
|
|
|
|
inherit system;
|
|
|
|
inherit fn;
|
|
|
|
};
|
|
|
|
modules =
|
|
|
|
[
|
2024-11-20 11:56:54 +01:00
|
|
|
({config, ...}: {config.nixpkgs.overlays = [nixpkgs-wayland.overlay];})
|
2024-11-16 18:44:05 +01:00
|
|
|
(toString ./options/machine.nix)
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
]
|
|
|
|
++ machineFiles
|
|
|
|
++ configFiles
|
|
|
|
++ pkgsFiles
|
|
|
|
++ serviceFiles;
|
2024-05-09 13:28:32 +02:00
|
|
|
};
|
2023-09-11 20:23:04 +02:00
|
|
|
};
|
2024-11-16 18:44:05 +01:00
|
|
|
in {
|
|
|
|
apps = {
|
|
|
|
"lint" = {
|
|
|
|
type = "app";
|
|
|
|
program = "${pkgs.statix}/bin/statix";
|
|
|
|
};
|
|
|
|
};
|
2024-11-19 23:17:51 +01:00
|
|
|
formatter = pkgs.nixfmt-rfc-style;
|
2024-11-16 18:44:05 +01:00
|
|
|
packages.nixosConfigurations = lib.listToAttrs (map nixosSystemFor machineList);
|
|
|
|
}
|
|
|
|
);
|
2023-02-06 22:44:12 +01:00
|
|
|
}
|