-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add modules and helper scripts for working with tfgrid/zos micr…
…ovms * nixosModule.zosVmDir add `config.system.build.zosVmDir` which results in a directory that contains a rootfs, (uncompressed) kernel and initramfs. the resulting file structure can either be booted using virtiofsd + cloud-hypervisor or published to an s3 endpoint for consumption on tfgrid * zos-vm-*: scripts to build, publish and local-boot zos microvm system images
- Loading branch information
Showing
10 changed files
with
707 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.minio/ | ||
result* | ||
.decrypted~keys.yaml | ||
.storage | ||
.direnv | ||
zosVmDir** |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ stdenv | ||
, closureInfo | ||
, pixz | ||
|
||
, # The files and directories to be placed in the directory. | ||
# This is a list of attribute sets {source, target} where `source' | ||
# is the file system object (regular file or directory) to be | ||
# grafted in the file system at path `target'. | ||
contents | ||
|
||
, # In addition to `contents', the closure of the store paths listed | ||
# in `packages' are also placed in the Nix store of the tarball. This is | ||
# a list of attribute sets {object, symlink} where `object' if a | ||
# store path whose closure will be copied, and `symlink' is a | ||
# symlink to `object' that will be added to the tarball. | ||
storeContents ? [ ] | ||
|
||
# Extra commands to be executed before archiving files | ||
, extraCommands ? "" | ||
|
||
# extra inputs | ||
, extraInputs ? [ ] | ||
}: | ||
|
||
let | ||
symlinks = map (x: x.symlink) storeContents; | ||
objects = map (x: x.object) storeContents; | ||
in | ||
|
||
stdenv.mkDerivation { | ||
name = "system-directory"; | ||
builder = ./make-system-directory.sh; | ||
nativeBuildInputs = extraInputs; | ||
|
||
inherit extraCommands; | ||
|
||
# !!! should use XML. | ||
sources = map (x: x.source) contents; | ||
targets = map (x: x.target) contents; | ||
|
||
# !!! should use XML. | ||
inherit symlinks objects; | ||
|
||
closureInfo = closureInfo { | ||
rootPaths = objects; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
source $stdenv/setup | ||
|
||
sources_=($sources) | ||
targets_=($targets) | ||
|
||
objects=($objects) | ||
symlinks=($symlinks) | ||
|
||
# Remove the initial slash from a path, since genisofs likes it that way. | ||
stripSlash() { | ||
res="$1" | ||
if test "${res:0:1}" = /; then res=${res:1}; fi | ||
} | ||
|
||
# Add the individual files. | ||
for ((i = 0; i < ${#targets_[@]}; i++)); do | ||
stripSlash "${targets_[$i]}" | ||
mkdir -p "$(dirname "$res")" | ||
cp -a "${sources_[$i]}" "$res" | ||
done | ||
|
||
# Add the closures of the top-level store objects. | ||
chmod +w . | ||
mkdir -p nix/store | ||
for i in $(<$closureInfo/store-paths); do | ||
cp -a "$i" "${i:1}" | ||
done | ||
|
||
# TODO tar ruxo | ||
# Also include a manifest of the closures in a format suitable for | ||
# nix-store --load-db. | ||
cp $closureInfo/registration nix-path-registration | ||
|
||
# Add symlinks to the top-level store objects. | ||
for ((n = 0; n < ${#objects[*]}; n++)); do | ||
object=${objects[$n]} | ||
symlink=${symlinks[$n]} | ||
if test "$symlink" != "none"; then | ||
mkdir -p $(dirname ./$symlink) | ||
ln -s $object ./$symlink | ||
fi | ||
done | ||
|
||
$extraCommands | ||
|
||
rm env-vars | ||
|
||
mkdir $out | ||
cp -a --reflink=always * $out/ | ||
|
||
mkdir -p $out/nix-support | ||
echo $system >$out/nix-support/system | ||
echo "file system-directory $out" >$out/nix-support/hydra-build-products |
38 changes: 38 additions & 0 deletions
38
modules/flake-parts/nixosConfigurations.tfgrid-devnet-vm0/configuration.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
config, | ||
inputs, | ||
self, | ||
pkgs, | ||
... | ||
}: let | ||
hostName = "tfgrid-devnet-vm0"; | ||
in { | ||
imports = [ | ||
inputs.srvos.nixosModules.server | ||
inputs.srvos.nixosModules.mixins-terminfo | ||
|
||
inputs.sops-nix.nixosModules.sops | ||
|
||
self.nixosModules.holo-users | ||
../../nixos/shared.nix | ||
../../nixos/shared-nix-settings.nix | ||
|
||
self.nixosModules.zosVmDir | ||
]; | ||
|
||
networking.hostName = hostName; | ||
|
||
hostName = "TODO"; | ||
|
||
nix.settings.max-jobs = 8; | ||
|
||
nix.settings.substituters = [ | ||
"https://holochain-ci.cachix.org" | ||
]; | ||
|
||
nix.settings.trusted-public-keys = [ | ||
"holochain-ci.cachix.org-1:5IUSkZc0aoRS53rfkvH9Kid40NpyjwCMCzwRTXy+QN8=" | ||
]; | ||
|
||
system.stateVersion = "23.11"; | ||
} |
Oops, something went wrong.