Files
nixos-config/hosts/default.nix

184 lines
6.4 KiB
Nix

#
# These are the different profiles that can be used when building NixOS.
#
# flake.nix
# └─ ./hosts
# ├─ default.nix *
# ├─ configuration_common.nix
# ├─ configuration_desktop.nix
# ├─ configuration_server.nix
# ├─ home.nix
# └─ ./desktop OR ./laptop OR ./vm
# ├─ ./default.nix
# └─ ./home.nix
#
{ lib, inputs, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, home-manager-unstable, agenix, jovian-nixos, microvm, impermanence, lanzaboote, ... }:
let
user = "kabbone";
location = builtins.getEnv "HOME" + "/.setup";
system = "x86_64-linux";
pkgs-unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
pkgs-kabbone = import ../packages {
inherit system;
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
# Prefer host-specific overlays over a global one here.
# Set nixpkgs.overlays inside the host's own module (e.g. hosts/desktop/default.nix)
# so only that host's pkgs is affected. Packages can be imported inline —
# no specialArgs needed. See hosts/desktop/default.nix for an example.
};
# Helper: returns [hm-module, config-attrset] for the modules list.
# hm - the home-manager flake input to use (stable or unstable)
# hmImports - list of home.nix paths for this host
mkHM = hm: hmImports: [
hm.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit user; };
home-manager.users.${user}.imports = hmImports;
}
];
in
{
hades = lib.nixosSystem { # Desktop profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix microvm nixpkgs lanzaboote; };
modules = [
agenix.nixosModules.default
microvm.nixosModules.host
lanzaboote.nixosModules.lanzaboote
./desktop # myDesktop options set inside
./configuration_common.nix
../modules/hardware/remoteBuilder.nix
nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-gpu-amd
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home.nix ./desktop/home.nix ]);
};
lifebook = lib.nixosSystem { # Laptop profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix lanzaboote; };
modules = [
agenix.nixosModules.default
lanzaboote.nixosModules.lanzaboote
./lifebook # myDesktop options set inside
./configuration_common.nix
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home.nix ./lifebook/home.nix ]);
};
steamdeck = nixpkgs-unstable.lib.nixosSystem { # steamdeck profile
inherit system;
specialArgs = { inherit inputs pkgs user location nixos-hardware agenix jovian-nixos lanzaboote; };
modules = [
agenix.nixosModules.default
jovian-nixos.nixosModules.default
lanzaboote.nixosModules.lanzaboote
./steamdeck
./configuration_desktop.nix
] ++ (mkHM home-manager-unstable [ ./home.nix ./steamdeck/home.nix ]);
};
kabtop = lib.nixosSystem { # Server profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix impermanence; };
modules = [
agenix.nixosModules.default
microvm.nixosModules.host
./kabtop
./configuration_server.nix
nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home_server.nix ./kabtop/home.nix ]);
};
nasbak = lib.nixosSystem { # Server profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix; };
modules = [
agenix.nixosModules.default
./nasbackup
./configuration_server.nix
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home_server.nix ./nasbackup/home.nix ]);
};
jupiter = lib.nixosSystem { # Server profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix; };
modules = [
agenix.nixosModules.default
./jupiter
./configuration_server.nix
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home_server.nix ./jupiter/home.nix ]);
};
kabtopci = lib.nixosSystem { # Server profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix impermanence; };
modules = [
agenix.nixosModules.default
microvm.nixosModules.host
./kabtopci
./configuration_server.nix
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home_server.nix ./kabtopci/home.nix ]);
};
kubemaster-1 = lib.nixosSystem { # Server profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix impermanence; };
modules = [
agenix.nixosModules.default
microvm.nixosModules.host
./kubemaster-1
./configuration_server.nix
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home_server.nix ./kubemaster-1/home.nix ]);
};
dmz = lib.nixosSystem { # Server profile
inherit system;
specialArgs = { inherit inputs user location nixos-hardware agenix impermanence; };
modules = [
agenix.nixosModules.default
microvm.nixosModules.host
./dmz
./configuration_server.nix
nixos-hardware.nixosModules.common-pc-ssd
] ++ (mkHM home-manager [ ./home_server.nix ./dmz/home.nix ]);
};
# vm = lib.nixosSystem { # VM profile
# inherit system;
# specialArgs = { inherit inputs user location; };
# modules = [
# ./vm
# ./configuration.nix
#
# (mkHM home-manager [ ./home.nix ./vm/home.nix ])
# ];
# };
}