Shuffling lots of stuff around

This commit is contained in:
2021-11-29 16:40:16 -08:00
parent a71867ce94
commit c345daa524
11 changed files with 75 additions and 1449 deletions

View File

@@ -1,23 +0,0 @@
build-timestamp: hostname:
{ config, lib, ... }:
with lib;
{
config = {
instance = {
inherit build-timestamp;
};
deployment = let
fs-keys = config.fudo.secrets.files.host-filesystem-keys;
in {
keys = if (hasAttr hostname fs-keys) then
mapAttrs (secret: secret-file: {
keyFile = secret-file;
user = "root";
permissions = "0400";
}) fs-keys.${hostname} else {};
};
};
}

View File

@@ -1,37 +0,0 @@
lib: build-timestamp: hostname: hostOpts:
with lib;
let
pkgs-for = system: import nixpkgs {
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssh-with-gssapi-8.4p1"
];
overlays = [
(import (fudo-pkgs + /overlay.nix))
(import (fudo-nixos + /lib/overlay.nix))
];
};
};
in fudo-nixos.nixosConfigurations.${hostname} {
} // mapAttrs (hostname: hostOpts: let
pkgs = pkgs-for hostOpts.arch;
host-ip = networks.${hostOpts.domain}.hosts.${hostname}.ipv4-address;
in fudo-nixos.nixosConfigurations.${hostname} // {
config = {
nixpkgs.pkgs = pkgs;
imports = [
(host-config hostname)
];
instance = { inherit hostname; };
deployment.targetHost = host-ip;
};
}) deployment-hosts

View File

@@ -1,27 +0,0 @@
{ lib, ... }:
with lib;
let
regular-files = path: let
is-regular-file = filename: type: type == "regular" || type == "link";
in attrNames (filterAttrs is-regular-file (builtins.readDir path));
nix-files = path: let
is-nix-file = filename: (builtins.match "^(.+)\.nix$" filename) != null;
in
map
(file: path + "/${file}")
(filter is-nix-file (regular-files path));
strip-ext = filename: head (builtins.match "^(.+)[.]nix$" filename);
basename-to-map = path:
listToAttrs
(map
(file:
nameValuePair (strip-ext file)
(import (path + "${file}")))
(nix-files path));
in {
inherit regular-files nix-files strip-ext basename-to-map;
}