1 { config, lib, pkgs, ... }:
7 imports = [ ./oci-common.nix ];
10 system.build.OCIImage = import ../../lib/make-disk-image.nix {
11 inherit config lib pkgs;
12 inherit (cfg) diskSize;
14 configFile = ./oci-config-user.nix;
16 partitionTableType = if cfg.efi then "efi" else "legacy";
19 systemd.services.fetch-ssh-keys = {
20 description = "Fetch authorized_keys for root user";
22 wantedBy = [ "sshd.service" ];
23 before = [ "sshd.service" ];
25 after = [ "network-online.target" ];
26 wants = [ "network-online.target" ];
28 path = [ pkgs.coreutils pkgs.curl ];
30 mkdir -m 0700 -p /root/.ssh
31 if [ -f /root/.ssh/authorized_keys ]; then
32 echo "Authorized keys have already been downloaded"
34 echo "Downloading authorized keys from Instance Metadata Service v2"
36 -H "Authorization: Bearer Oracle" \
37 -o /root/.ssh/authorized_keys \
38 http://169.254.169.254/opc/v2/instance/metadata/ssh_authorized_keys
39 chmod 600 /root/.ssh/authorized_keys
44 RemainAfterExit = true;
45 StandardError = "journal+console";
46 StandardOutput = "journal+console";