2023-12-01 11:29:39 +00:00
|
|
|
{
|
2024-05-01 12:00:39 +00:00
|
|
|
description = "NixOS Machine Configurations by manuth";
|
2023-12-01 11:29:39 +00:00
|
|
|
|
2024-05-01 12:00:39 +00:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "nixpkgs/38c01297e7ec11f7b9e3f2cae7d6fcec6cc767ec";
|
2024-05-01 16:14:25 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
|
2024-05-01 23:08:45 +00:00
|
|
|
sops-nix.url = "github:Mic92/sops-nix?ref=f1b0adc27265274e3b0c9b872a8f476a098679bd";
|
2024-05-01 12:00:39 +00:00
|
|
|
};
|
2023-12-01 11:29:39 +00:00
|
|
|
|
2024-05-01 23:08:45 +00:00
|
|
|
outputs = { self, nixpkgs, flake-utils, sops-nix }: (
|
2024-05-01 17:13:25 +00:00
|
|
|
flake-utils.lib.eachDefaultSystem (
|
|
|
|
system:
|
|
|
|
let
|
2024-05-01 23:08:45 +00:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
config = {};
|
|
|
|
|
|
|
|
overlays = [
|
|
|
|
sops-nix.overlays.default
|
|
|
|
];
|
|
|
|
};
|
2024-05-01 17:13:25 +00:00
|
|
|
in {
|
|
|
|
devShells.default = pkgs.mkShellNoCC (
|
|
|
|
with pkgs;
|
|
|
|
{
|
2024-05-01 23:08:45 +00:00
|
|
|
sopsPGPKeyDirs = [
|
|
|
|
"${toString ./.}/keys/hosts"
|
|
|
|
"${toString ./.}/keys/users"
|
|
|
|
];
|
|
|
|
|
2024-05-01 17:13:25 +00:00
|
|
|
packages = [
|
|
|
|
nixos-rebuild
|
2024-05-01 23:08:45 +00:00
|
|
|
sops-import-keys-hook
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
sops-import-keys-hook
|
2024-05-01 17:13:25 +00:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
) // {
|
|
|
|
nixosConfigurations =
|
2024-05-01 16:14:25 +00:00
|
|
|
let
|
2024-05-01 17:13:25 +00:00
|
|
|
systems = [
|
2024-05-01 16:14:25 +00:00
|
|
|
{
|
2024-05-01 17:13:25 +00:00
|
|
|
name = "nixos";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
in
|
|
|
|
builtins.listToAttrs (
|
2024-05-01 16:58:39 +00:00
|
|
|
builtins.map (
|
2024-05-01 17:13:25 +00:00
|
|
|
{ name, system ? "x86_64-linux", ... }@config: {
|
|
|
|
inherit name;
|
2024-05-01 16:58:39 +00:00
|
|
|
|
2024-05-01 17:13:25 +00:00
|
|
|
value = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
2024-05-01 16:58:39 +00:00
|
|
|
|
2024-05-01 17:13:25 +00:00
|
|
|
modules = [
|
|
|
|
({ ... }: { config._module.args = { machineConfig = config; }; })
|
2024-05-01 23:08:45 +00:00
|
|
|
sops-nix.nixosModules.sops
|
2024-05-01 17:13:25 +00:00
|
|
|
./lib/configuration.nix
|
2024-05-01 16:58:39 +00:00
|
|
|
|
2024-05-01 17:13:25 +00:00
|
|
|
(
|
|
|
|
let
|
|
|
|
configCandidate = ./lib/machines/${name}.nix;
|
|
|
|
|
|
|
|
machineConfigPath =
|
|
|
|
if builtins.pathExists configCandidate
|
|
|
|
then
|
|
|
|
configCandidate
|
|
|
|
else
|
|
|
|
./lib/hardware/base.nix;
|
|
|
|
in
|
|
|
|
machineConfigPath)
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
2024-05-01 16:58:39 +00:00
|
|
|
systems);
|
2024-05-01 17:13:25 +00:00
|
|
|
});
|
2023-12-01 11:29:39 +00:00
|
|
|
}
|