Rename nixos hosts to x86 and fix up flake hosts creation
This commit is contained in:
parent
e7a22d3a2e
commit
534b18b9c5
48 changed files with 26 additions and 24 deletions
49
flake.nix
49
flake.nix
|
@ -92,54 +92,55 @@
|
||||||
|
|
||||||
## Host Config ##
|
## Host Config ##
|
||||||
|
|
||||||
mkHost = host: isARM: {
|
# read host-dirs under e.g. hosts/x86 or hosts/arm
|
||||||
${host} =
|
readHosts = arch: lib.attrNames (builtins.readDir ./hosts/${arch});
|
||||||
let
|
|
||||||
func = if isARM then ARM else X86;
|
# build one host, choosing folder + system by isARM flag
|
||||||
systemFunc = func;
|
mkHost =
|
||||||
in
|
host: isARM:
|
||||||
lib.nixosSystem {
|
let
|
||||||
|
folder = if isARM then "arm" else "x86";
|
||||||
|
system = if isARM then ARM else X86;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"${host}" = lib.nixosSystem {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit
|
inherit
|
||||||
inputs
|
inputs
|
||||||
outputs
|
outputs
|
||||||
isARM
|
isARM
|
||||||
|
system
|
||||||
;
|
;
|
||||||
system = systemFunc;
|
lib = nixpkgs.lib.extend (
|
||||||
# INFO: Extend lib with lib.custom; This approach allows lib.custom to propagate into hm
|
# INFO: Extend lib with lib.custom; This approach allows lib.custom to propagate into hm
|
||||||
lib = nixpkgs.lib.extend (self: super: { custom = import ./lib { inherit (nixpkgs) lib; }; });
|
self: super: {
|
||||||
|
custom = import ./lib { inherit (nixpkgs) lib; };
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{ nixpkgs.overlays = [ self.overlays.default ]; }
|
||||||
#INFO: Overlay application for custom packages
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
self.overlays.default
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Import secrets
|
# Import secrets
|
||||||
./modules/global/secret-spec.nix
|
./modules/global/secret-spec.nix
|
||||||
./secrets.nix
|
./secrets.nix
|
||||||
|
|
||||||
# Host-specific configuration
|
# Host-specific configuration
|
||||||
./hosts/nixos/${host}
|
./hosts/${folder}/${host}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Invoke mkHost for each host config that is declared for either X86 or ARM
|
# Invoke mkHost for each host config that is declared for either X86 or ARM
|
||||||
mkHostConfigs =
|
mkHostConfigs =
|
||||||
hosts: isARM: lib.foldl (acc: set: acc // set) { } (lib.map (host: mkHost host isARM) hosts);
|
hosts: isARM: lib.foldl (acc: set: acc // set) { } (lib.map (host: mkHost host isARM) hosts);
|
||||||
readHosts = folder: lib.attrNames (builtins.readDir ./hosts/${folder});
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
overlays = import ./overlays { inherit inputs; };
|
overlays = import ./overlays { inherit inputs; };
|
||||||
|
|
||||||
|
# now point at x86 *and* arm directories explicitly
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
# Generate X86 configurations
|
(mkHostConfigs (readHosts "x86") false) // (mkHostConfigs (readHosts "arm") true);
|
||||||
(mkHostConfigs (readHosts "nixos") false)
|
|
||||||
//
|
|
||||||
# Generate ARM configurations
|
|
||||||
(mkHostConfigs (readHosts "arm") true);
|
|
||||||
|
|
||||||
packages = forAllSystems (
|
packages = forAllSystems (
|
||||||
system:
|
system:
|
||||||
|
|
|
@ -41,6 +41,7 @@ in
|
||||||
"hosts/global/common/nvtop.nix" # GPU monitor (not available in home-manager)
|
"hosts/global/common/nvtop.nix" # GPU monitor (not available in home-manager)
|
||||||
"hosts/global/common/plymouth.nix" # fancy boot screen
|
"hosts/global/common/plymouth.nix" # fancy boot screen
|
||||||
"hosts/global/common/solaar.nix" # Logitech Unifying Receiver support
|
"hosts/global/common/solaar.nix" # Logitech Unifying Receiver support
|
||||||
|
"hosts/global/common/warp.nix" # Cloudflare WARP VPN
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue