From 4036a2d951fb239f8d29f9227bc94dfb942e5e6e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 29 Nov 2022 16:21:38 +0100 Subject: [PATCH] Clean stuff up and update nix driver --- cluster/staging/app/drone-ci/build/.gitignore | 2 - cluster/staging/app/drone-ci/build/Makefile | 8 -- .../app/drone-ci/build/build-qcow2.nix | 24 ----- .../app/drone-ci/build/machine-config.nix | 89 ------------------- nix/nomad-driver-nix2.nix | 2 +- 5 files changed, 1 insertion(+), 124 deletions(-) delete mode 100644 cluster/staging/app/drone-ci/build/.gitignore delete mode 100644 cluster/staging/app/drone-ci/build/Makefile delete mode 100644 cluster/staging/app/drone-ci/build/build-qcow2.nix delete mode 100644 cluster/staging/app/drone-ci/build/machine-config.nix diff --git a/cluster/staging/app/drone-ci/build/.gitignore b/cluster/staging/app/drone-ci/build/.gitignore deleted file mode 100644 index ef92077..0000000 --- a/cluster/staging/app/drone-ci/build/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -result/ -*.qcow2.zst diff --git a/cluster/staging/app/drone-ci/build/Makefile b/cluster/staging/app/drone-ci/build/Makefile deleted file mode 100644 index 2814a0d..0000000 --- a/cluster/staging/app/drone-ci/build/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY: all - -all: - nix-build '' -A config.system.build.qcow2 --arg configuration "{ imports = [ ./build-qcow2.nix ]; }" --show-trace - zstd -7 -i result/nixos.qcow2 -o drone-runner.qcow2.zst -f - RESULTPATH=`readlink result`; rm result; nix-store --delete $$RESULTPATH - rclone copy drone-runner.qcow2.zst grgdf:alex/ -vv - diff --git a/cluster/staging/app/drone-ci/build/build-qcow2.nix b/cluster/staging/app/drone-ci/build/build-qcow2.nix deleted file mode 100644 index 3ad45f4..0000000 --- a/cluster/staging/app/drone-ci/build/build-qcow2.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -{ - imports = - [ - - ./machine-config.nix - ]; - - system.build.qcow2 = import { - inherit lib config; - pkgs = import { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package - diskSize = 32768; - format = "qcow2"; - configFile = pkgs.writeText "configuration.nix" - '' - { - imports = [ <./machine-config.nix> ]; - } - ''; - }; -} diff --git a/cluster/staging/app/drone-ci/build/machine-config.nix b/cluster/staging/app/drone-ci/build/machine-config.nix deleted file mode 100644 index 73d3f09..0000000 --- a/cluster/staging/app/drone-ci/build/machine-config.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ pkgs, lib, ... }: - -with lib; - -{ - imports = [ - - ]; - - config = { - fileSystems."/" = { - device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - autoResize = true; - }; - - fileSystems."/secrets" = { - device = "/dev/disk/by-label/QEMU\\x20VVFAT"; - fsType = "vfat"; - }; - - boot.growPartition = true; - boot.kernelParams = [ "console=ttyS0" ]; - boot.loader.grub.device = "/dev/vda"; - boot.loader.timeout = 0; - - environment.systemPackages = with pkgs; [ - iotop - jnettop - htop - ]; - - 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"; - systemd.services.drone_nix_setup = { - enable = true; - path = [ - pkgs.docker - ]; - script = '' - docker run --rm -v /var/lib/drone/nix:/mnt nixpkgs/nix:nixos-21.05 cp -r /nix/{store,var} /mnt/ - ''; - wantedBy = [ "multi-user.target" ]; - }; - virtualisation.oci-containers.containers = { - drone_runner = { - image = "drone/drone-runner-docker:1.4.0"; - volumes = [ - "/var/lib/drone/nix:/nix" - "/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 = [ - "/secrets/secret_env" - ]; - }; - 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"; - }; - }; - }; - }; -} diff --git a/nix/nomad-driver-nix2.nix b/nix/nomad-driver-nix2.nix index 1dcab57..45154bb 100644 --- a/nix/nomad-driver-nix2.nix +++ b/nix/nomad-driver-nix2.nix @@ -7,7 +7,7 @@ pkgs.buildGoModule rec { src = builtins.fetchGit { url = "https://git.deuxfleurs.fr/Deuxfleurs/nomad-driver-nix2"; - rev = "8b17eeac11b009e8ab7715aac0b56fbea555df59"; + rev = "59aba7607507193587be7c24229dc71066e3ae87"; }; vendorSha256 = "sha256-EQdTxVOBRYQjg7kAB+pFJYcNwk0zlsjjJxM+EO/cK84=";