nixos-module/server/lxc-containers: add prebuilt containers
parent
110f5c0ae3
commit
5c8fa22ca8
|
@ -138,6 +138,13 @@ let
|
|||
};
|
||||
hostOpts = { name, ... }: {
|
||||
options = {
|
||||
prebuilt = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Include the container system in the server's `build-container` script.
|
||||
'';
|
||||
};
|
||||
role = mkOption {
|
||||
type = types.enum [ "ap" "switch" "server" "container" "client" ];
|
||||
default = "client";
|
||||
|
|
|
@ -70,9 +70,27 @@ let
|
|||
mkdir -p /nix/var/nix/gcroots/lxc
|
||||
|
||||
for c in $@; do
|
||||
echo Building $c
|
||||
nix build -o /nix/var/nix/gcroots/lxc/$c zentralwerk-network#$c-rootfs
|
||||
SYSTEM=$(readlink /nix/var/nix/gcroots/lxc/$c)
|
||||
unset SYSTEM
|
||||
|
||||
case "$c" in
|
||||
${builtins.concatStringsSep "\n" (
|
||||
map (ctName: ''
|
||||
${ctName})
|
||||
echo Using prebuilt system for container $c
|
||||
SYSTEM=${self.packages.x86_64-linux."${ctName}-rootfs"}
|
||||
;;
|
||||
'') (
|
||||
builtins.attrNames (
|
||||
lib.filterAttrs (_: { prebuilt, ... }: prebuilt)
|
||||
containers
|
||||
))
|
||||
)}
|
||||
*)
|
||||
echo Building $c
|
||||
nix build -o /nix/var/nix/gcroots/lxc/$c zentralwerk-network#$c-rootfs
|
||||
SYSTEM=$(readlink /nix/var/nix/gcroots/lxc/$c)
|
||||
;;
|
||||
esac
|
||||
|
||||
echo Installing $c
|
||||
for d in \
|
||||
|
|
Loading…
Reference in New Issue