2022-05-30 12:57:05 +00:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
fileSystems."/" = {
|
|
|
|
device = "/dev/disk/by-label/nixos";
|
|
|
|
fsType = "ext4";
|
|
|
|
autoResize = true;
|
|
|
|
};
|
|
|
|
|
2022-05-30 14:36:17 +00:00
|
|
|
fileSystems."/secrets" = {
|
|
|
|
device = "/dev/disk/by-label/QEMU\\x20VVFAT";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
|
2022-05-30 12:57:05 +00:00
|
|
|
boot.growPartition = true;
|
|
|
|
boot.kernelParams = [ "console=ttyS0" ];
|
|
|
|
boot.loader.grub.device = "/dev/vda";
|
|
|
|
boot.loader.timeout = 0;
|
|
|
|
|
2022-05-30 14:36:17 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
iotop
|
|
|
|
jnettop
|
|
|
|
htop
|
|
|
|
];
|
|
|
|
|
2022-05-30 12:57:05 +00:00
|
|
|
users.extraUsers.root.openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJpaBZdYxHqMxhv2RExAOa7nkKhPBOHupMP3mYaZ73w9 lx@lindy"
|
|
|
|
];
|
|
|
|
services.openssh.enable = true;
|
|
|
|
services.openssh.permitRootLogin = "prohibit-password";
|
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowedTCPPorts = [ 22 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
virtualisation.oci-containers.backend = "docker";
|
2022-05-30 15:04:03 +00:00
|
|
|
systemd.services.drone_nix_setup = {
|
|
|
|
enable = true;
|
|
|
|
path = [
|
|
|
|
pkgs.docker
|
|
|
|
];
|
2022-05-30 14:36:17 +00:00
|
|
|
script = ''
|
2022-05-30 15:04:03 +00:00
|
|
|
docker run --rm -v /var/lib/drone/nix:/mnt nixpkgs/nix:nixos-21.05 cp -r /nix/{store,var} /mnt/
|
2022-05-30 14:36:17 +00:00
|
|
|
'';
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
2022-05-30 12:57:05 +00:00
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
drone_runner = {
|
|
|
|
image = "drone/drone-runner-docker:1.4.0";
|
|
|
|
volumes = [
|
2022-05-30 14:36:17 +00:00
|
|
|
"/var/lib/drone/nix:/nix"
|
2022-05-30 12:57:05 +00:00
|
|
|
"/var/run/docker.sock:/var/run/docker.sock"
|
|
|
|
];
|
|
|
|
environment = {
|
|
|
|
DRONE_RPC_PROTO = "https";
|
|
|
|
DRONE_RPC_HOST = "drone.deuxfleurs.fr";
|
|
|
|
DRONE_RUNNER_CAPACITY = "1";
|
|
|
|
DRONE_DEBUG = "true";
|
|
|
|
DRONE_LOGS_TRACE = "true";
|
|
|
|
DRONE_RPC_DUMP_HTTP = "true";
|
|
|
|
DRONE_RPC_DUMP_HTTP_BODY = "true";
|
|
|
|
DRONE_RUNNER_LABELS = "nix:1";
|
|
|
|
};
|
|
|
|
environmentFiles = [
|
2022-05-30 14:36:17 +00:00
|
|
|
"/secrets/secret_env"
|
2022-05-30 12:57:05 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
drone_gc = {
|
|
|
|
image = "drone/gc:latest";
|
|
|
|
volumes = [
|
|
|
|
"/var/run/docker.sock:/var/run/docker.sock"
|
|
|
|
];
|
|
|
|
environment = {
|
|
|
|
GC_DEBUG = "true";
|
|
|
|
GC_CACHE = "10gb";
|
|
|
|
GC_INTERVAL = "10m";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|