Hosts and derivations.

This commit is contained in:
Joseph Hanson 2024-02-23 15:54:03 -06:00
parent db86fe6244
commit 532a01853b
3 changed files with 27 additions and 7 deletions

View file

@ -47,6 +47,7 @@
]; ];
in in
{ {
hosts = import ./hosts.nix;
pkgs = forAllSystems (localSystem: import nixpkgs { pkgs = forAllSystems (localSystem: import nixpkgs {
inherit localSystem; inherit localSystem;
config = { config = {

21
hosts.nix Normal file
View file

@ -0,0 +1,21 @@
{
durincore = {
type = "nixos";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
};
gandalf = {
type = "nixos";
address = "gandalf.jahanson.tech";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
remoteBuild = true;
};
este = {
type = "nixos";
address = "este.jahanson.tech";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
remoteBuild = true;
};
}

View file

@ -6,23 +6,21 @@
hostPlatform: hostPlatform:
let let
inherit (self.pkgs.${hostPlatform}) callPackage lib linkFarm; inherit (self.pkgs."x86_64-linux") callPackage lib linkFarm;
nixosDrvs = lib.mapAttrs (_: nixos: nixos.config.system.build.toplevel) self.nixosConfigurations; hostDrvs = lib.mapAttrs (_: nixos: nixos.config.system.build.toplevel) self.nixosConfigurations;
darwinDrvs = lib.mapAttrs (_: darwin: darwin.system) self.darwinConfigurations;
hostDrvs = nixosDrvs // darwinDrvs;
compatHosts = lib.filterAttrs (_: host: host.hostPlatform == hostPlatform) self.hosts; compatHosts = lib.filterAttrs (_: host: host.hostPlatform == hostPlatform) self.hosts;
compatHostDrvs = lib.mapAttrs compatHostDrvs = lib.mapAttrs
(name: _: hostDrvs.${name}) (name: _: hostDrvs.${name})
compatHosts; compatHosts;
compatHostsFarm = linkFarm "hosts-${hostPlatform}" (lib.mapAttrsToList (name: path: { inherit name path; }) compatHostDrvs); compatHostsFarm = linkFarm "hosts-x86_64-linux" (lib.mapAttrsToList (name: path: { inherit name path; }) compatHostDrvs);
in in
compatHostDrvs compatHostDrvs
// (lib.optionalAttrs (compatHosts != { }) { // (lib.optionalAttrs (compatHosts != { }) {
default = compatHostsFarm; default = compatHostsFarm;
}) // { }) // {
inherit (nix-fast-build.packages.${hostPlatform}) nix-fast-build; inherit (nix-fast-build.packages."x86_64-linux") nix-fast-build;
inherit (self.pkgs.${hostPlatform}) cachix nix-eval-jobs; inherit (self.pkgs."x86_64-linux") cachix nix-eval-jobs;
} }