2025-02-03 07:55:17 +01:00
|
|
|
{
|
|
|
|
|
inputs,
|
|
|
|
|
withSystem,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
with lib; let
|
2025-02-18 20:17:57 +01:00
|
|
|
mkSystemImports = hostname: let
|
|
|
|
|
hostDirectory = ./. + ("/" + hostname);
|
|
|
|
|
nixFiles = filter (file: hasSuffix ".nix" file) (attrNames (builtins.readDir hostDirectory));
|
|
|
|
|
imports = map (file: ./. + ("/" + hostname + "/" + file)) nixFiles;
|
|
|
|
|
in {
|
|
|
|
|
inherit imports;
|
|
|
|
|
};
|
|
|
|
|
|
2025-02-03 07:55:17 +01:00
|
|
|
mkSystem = {
|
|
|
|
|
hostname,
|
|
|
|
|
username,
|
|
|
|
|
modules ? [],
|
2025-02-18 20:17:57 +01:00
|
|
|
system ? "x86_64-linux",
|
2025-02-03 07:55:17 +01:00
|
|
|
}:
|
2025-02-18 20:17:57 +01:00
|
|
|
withSystem system (
|
|
|
|
|
{system, ...}: let
|
|
|
|
|
pkgsUnstable = import inputs.nixpkgs-unstable {
|
|
|
|
|
inherit system;
|
|
|
|
|
config.allowUnfree = true;
|
|
|
|
|
};
|
|
|
|
|
in
|
2025-02-03 07:55:17 +01:00
|
|
|
inputs.nixpkgs.lib.nixosSystem {
|
|
|
|
|
inherit system;
|
2025-05-20 19:25:57 +02:00
|
|
|
specialArgs = {inherit inputs hostname username pkgsUnstable;};
|
2025-02-03 07:55:17 +01:00
|
|
|
modules =
|
|
|
|
|
[
|
|
|
|
|
inputs.disko.nixosModules.disko
|
2025-02-18 20:17:57 +01:00
|
|
|
inputs.nixos-generators.nixosModules.all-formats
|
2025-02-03 07:55:17 +01:00
|
|
|
inputs.home-manager.nixosModules.home-manager
|
|
|
|
|
inputs.agenix.nixosModules.default
|
|
|
|
|
inputs.agenix-rekey.nixosModules.default
|
2025-02-20 00:02:02 +01:00
|
|
|
inputs.nix-index-database.nixosModules.nix-index
|
2025-02-18 20:17:57 +01:00
|
|
|
inputs.nixos-facter-modules.nixosModules.facter
|
2025-02-24 22:20:16 +01:00
|
|
|
inputs.fireproof-shell.nixosModules.default
|
2025-04-27 23:58:02 +02:00
|
|
|
inputs.niri.nixosModules.niri
|
2025-05-14 16:09:29 +02:00
|
|
|
inputs.zwift.nixosModules.zwift
|
2025-05-20 20:05:23 +02:00
|
|
|
../modules/base
|
|
|
|
|
../modules/programs
|
2025-02-18 20:17:57 +01:00
|
|
|
(mkSystemImports hostname)
|
2025-05-20 19:25:57 +02:00
|
|
|
{ nixpkgs.config.allowUnfree = true; }
|
2025-02-03 07:55:17 +01:00
|
|
|
]
|
2025-02-18 20:17:57 +01:00
|
|
|
++ modules
|
|
|
|
|
++ (
|
|
|
|
|
lib.optional (builtins.pathExists ./${hostname}/facter.json)
|
|
|
|
|
{config.facter.reportPath = ./${hostname}/facter.json;}
|
|
|
|
|
);
|
2025-02-03 07:55:17 +01:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
in {
|
2025-02-18 20:17:57 +01:00
|
|
|
config.flake.nixosConfigurations = {
|
2025-02-20 22:50:06 +01:00
|
|
|
bootstrap = mkSystem {
|
|
|
|
|
hostname = "bootstrap";
|
|
|
|
|
username = "nixos";
|
|
|
|
|
};
|
|
|
|
|
|
2025-02-03 07:55:17 +01:00
|
|
|
laptop = mkSystem {
|
|
|
|
|
hostname = "laptop";
|
2025-02-18 20:17:57 +01:00
|
|
|
username = "nickolaj";
|
2025-02-03 07:55:17 +01:00
|
|
|
modules = [
|
2025-05-20 20:05:23 +02:00
|
|
|
../legacy_modules/graphical.nix
|
|
|
|
|
../legacy_modules/devenv.nix
|
2025-02-03 07:55:17 +01:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
desktop = mkSystem {
|
|
|
|
|
hostname = "desktop";
|
2025-02-18 20:17:57 +01:00
|
|
|
username = "nickolaj";
|
2025-02-03 07:55:17 +01:00
|
|
|
modules = [
|
2025-05-20 20:05:23 +02:00
|
|
|
../legacy_modules/graphical.nix
|
|
|
|
|
../legacy_modules/devenv.nix
|
2025-02-03 07:55:17 +01:00
|
|
|
];
|
|
|
|
|
};
|
2025-02-20 14:09:12 +01:00
|
|
|
work = mkSystem {
|
|
|
|
|
hostname = "work";
|
|
|
|
|
username = "nickolaj";
|
|
|
|
|
modules = [
|
2025-05-20 20:05:23 +02:00
|
|
|
../legacy_modules/graphical.nix
|
|
|
|
|
../legacy_modules/devenv.nix
|
2025-02-20 14:09:12 +01:00
|
|
|
];
|
|
|
|
|
};
|
2025-03-09 20:30:33 +01:00
|
|
|
homelab = mkSystem {
|
|
|
|
|
hostname = "homelab";
|
|
|
|
|
username = "nickolaj";
|
|
|
|
|
};
|
2025-02-03 07:55:17 +01:00
|
|
|
};
|
|
|
|
|
}
|