Compare commits
1 commit
main
...
talos-pxe-
Author | SHA1 | Date | |
---|---|---|---|
c009df2813 |
4 changed files with 81 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.mySystem.services.talos.bootstrapAssets;
|
||||
download-undionly = pkgs.writeShellScript "download-undionly" import ./resources/download-undionly.sh;
|
||||
in
|
||||
{
|
||||
options.mySystem.services.talos.bootstrapAssets = {
|
||||
enable = mkEnableOption "talos.bootstrapAssets";
|
||||
bootAsset = mkOption {
|
||||
type = types.str;
|
||||
example = "http://10.1.1.57:8086/boot.ipxe";
|
||||
};
|
||||
tftpRoot = mkOption {
|
||||
type = types.str;
|
||||
example = "/srv/tftp";
|
||||
};
|
||||
matchboxDataPath = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/lib/matchbox";
|
||||
};
|
||||
matchboxAssetPath = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/lib/matchbox/assets";
|
||||
};
|
||||
talosSchematicIds = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "22b1d04da881ef7c57edb0f24d1f3ba2c78a8e22cbe3fa9af4f42d487b2863f7" ];
|
||||
};
|
||||
talhelperConfig = mkOption {
|
||||
type = types.str;
|
||||
example = "/etc/talhelper/config.yaml";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# nix grab talconfig.yaml from git repo
|
||||
#
|
||||
};
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p cacert curl --pure
|
||||
#shellcheck shell=bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Check if argument $1 is set
|
||||
if [ -z "${1:-}" ]; then
|
||||
echo "Usage: $0 <path>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
path="$1"
|
||||
|
||||
# Check is file exists and exit with success.
|
||||
if [ -f "$path/undionly.kpxe" ]; then
|
||||
echo "File $path/undionly.kpxe already exists."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Downloading assets to $path"
|
||||
|
||||
# Check if the directory exists
|
||||
if [ ! -d "$(dirname "$path")" ]; then
|
||||
echo "Error: "$path" does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the path is writable
|
||||
if [ ! -w "$path" ]; then
|
||||
echo "Error: $path is not writable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download the file
|
||||
curl -o "$path/undionly.kpxe" http://boot.ipxe.org/undionly.kpxe
|
5
nixos/modules/nixos/services/talos/default.nix
Normal file
5
nixos/modules/nixos/services/talos/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./bootstrapAssets
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue