mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
80712f254c
diskSize defaults to the previous hard-coded 8192: no change for existing users. Users can set diskSize when building images which require larger disk space; thus avoiding the error: ERROR: cptofs failed. diskSize might be too small for closure. Signed-off-by: Sirio Balmelli <sirio@b-ad.ch> Co-authored-by: superherointj <5861043+superherointj@users.noreply.github.com>
50 lines
1.4 KiB
Nix
50 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.oci;
|
|
in
|
|
{
|
|
imports = [ ./oci-common.nix ];
|
|
|
|
config = {
|
|
system.build.OCIImage = import ../../lib/make-disk-image.nix {
|
|
inherit config lib pkgs;
|
|
inherit (cfg) diskSize;
|
|
name = "oci-image";
|
|
configFile = ./oci-config-user.nix;
|
|
format = "qcow2";
|
|
partitionTableType = if cfg.efi then "efi" else "legacy";
|
|
};
|
|
|
|
systemd.services.fetch-ssh-keys = {
|
|
description = "Fetch authorized_keys for root user";
|
|
|
|
wantedBy = [ "sshd.service" ];
|
|
before = [ "sshd.service" ];
|
|
|
|
after = [ "network-online.target" ];
|
|
wants = [ "network-online.target" ];
|
|
|
|
path = [ pkgs.coreutils pkgs.curl ];
|
|
script = ''
|
|
mkdir -m 0700 -p /root/.ssh
|
|
if [ -f /root/.ssh/authorized_keys ]; then
|
|
echo "Authorized keys have already been downloaded"
|
|
else
|
|
echo "Downloading authorized keys from Instance Metadata Service v2"
|
|
curl -s -S -L \
|
|
-H "Authorization: Bearer Oracle" \
|
|
-o /root/.ssh/authorized_keys \
|
|
http://169.254.169.254/opc/v2/instance/metadata/ssh_authorized_keys
|
|
chmod 600 /root/.ssh/authorized_keys
|
|
fi
|
|
'';
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
StandardError = "journal+console";
|
|
StandardOutput = "journal+console";
|
|
};
|
|
};
|
|
};
|
|
}
|