nix-rewrite #4

Merged
jahanson merged 4 commits from nix-rewrite into main 2024-02-28 20:47:18 -06:00
3 changed files with 27 additions and 7 deletions
Showing only changes of commit 532a01853b - Show all commits

View file

@ -47,6 +47,7 @@
];
in
{
hosts = import ./hosts.nix;
pkgs = forAllSystems (localSystem: import nixpkgs {
inherit localSystem;
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:
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;
darwinDrvs = lib.mapAttrs (_: darwin: darwin.system) self.darwinConfigurations;
hostDrvs = nixosDrvs // darwinDrvs;
hostDrvs = lib.mapAttrs (_: nixos: nixos.config.system.build.toplevel) self.nixosConfigurations;
compatHosts = lib.filterAttrs (_: host: host.hostPlatform == hostPlatform) self.hosts;
compatHostDrvs = lib.mapAttrs
(name: _: hostDrvs.${name})
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
compatHostDrvs
// (lib.optionalAttrs (compatHosts != { }) {
default = compatHostsFarm;
}) // {
inherit (nix-fast-build.packages.${hostPlatform}) nix-fast-build;
inherit (self.pkgs.${hostPlatform}) cachix nix-eval-jobs;
inherit (nix-fast-build.packages."x86_64-linux") nix-fast-build;
inherit (self.pkgs."x86_64-linux") cachix nix-eval-jobs;
}