From 16b5175acb97f10d58b533a660908234cd2fc630 Mon Sep 17 00:00:00 2001
From: Julien Malka <julien.malka@me.com>
Date: Fri, 24 Dec 2021 16:43:30 +0100
Subject: [PATCH] This is a test

---
 .drone.yml | 309 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 309 insertions(+)
 create mode 100644 .drone.yml

diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..71ac972
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,309 @@
+---
+kind: pipeline
+type: exec
+name: Build all hosts
+
+platform:
+  os: linux
+  arch: amd64
+
+clone:
+  depth: 1
+
+steps:
+
+- name: Show flake info
+  commands:
+  - nix --experimental-features "nix-command flakes" flake show
+  - nix --experimental-features "nix-command flakes" flake metadata
+  - nix --experimental-features "nix-command flakes" flake check
+
+- name: Run flake checks
+  commands:
+  - nix --experimental-features "nix-command flakes" flake check --show-trace
+
+- name: Build aida
+  commands:
+  - nix build -v '.#nixosConfigurations.aida.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+# - name: Build arm-server
+#   commands:
+#   - nix build -v '.#nixosConfigurations.arm-server.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build deke
+  commands:
+  - nix build -v '.#nixosConfigurations.deke.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build enoch
+  commands:
+  - nix build -v '.#nixosConfigurations.enoch.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build flint
+  commands:
+  - nix build -v '.#nixosConfigurations.flint.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build kora
+  commands:
+  - nix build -v '.#nixosConfigurations.kora.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build simmons
+  commands:
+  - nix build -v '.#nixosConfigurations.simmons.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  
+- name: Build snowflake
+  commands:
+  - nix build -v '.#nixosConfigurations.snowflake.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build the-hub
+  commands:
+  - nix build -v '.#nixosConfigurations.the-hub.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build the-bus
+  commands:
+  - nix build -v '.#nixosConfigurations.the-bus.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+- name: Build water-on-fire
+  commands:
+  - nix build -v '.#nixosConfigurations.water-on-fire.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+
+trigger:
+  branch:
+  - main
+  event:
+  - push
+  - pull_request
+  
+---
+kind: pipeline
+type: exec
+name: Build flake apps
+
+platform:
+  os: linux
+  arch: amd64
+
+clone:
+  depth: 1
+
+steps:
+
+# - name: Build darknet
+#   commands:
+#   - nix build .#darknet
+  
+- name: Build owncast
+  commands:
+  - nix build .#owncast
+  
+- name: Build plexRaw
+  commands:
+  - nix build .#plexRaw
+  
+- name: Build tautulli
+  commands:
+  - nix build .#tautulli
+
+trigger:
+  branch:
+  - main
+  event:
+  - push
+
+
+---
+kind: pipeline
+type: exec
+name: build flake update
+
+platform:
+  os: linux
+  arch: amd64
+
+clone:
+  depth: 1
+
+steps:
+
+- name: create result-old files
+  commands:
+  - nix build -v '.#nixosConfigurations.aida.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result aida-old
+#   - nix build -v '.#nixosConfigurations.arm-server.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+#   - mv result arm-server-old
+  - nix build -v '.#nixosConfigurations.deke.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result deke-old
+  - nix build -v '.#nixosConfigurations.flint.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result flint-old
+  - nix build -v '.#nixosConfigurations.enoch.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result enoch-old
+  - nix build -v '.#nixosConfigurations.kora.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result kora-old
+  - nix build -v '.#nixosConfigurations.simmons.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result simmons-old
+  - nix build -v '.#nixosConfigurations.snowflake.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result snowflake-old
+  - nix build -v '.#nixosConfigurations.the-hub.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result the-hub-old
+  - nix build -v '.#nixosConfigurations.the-bus.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result the-bus-old
+  - nix build -v '.#nixosConfigurations.water-on-fire.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result water-on-fire-old
+
+- name: flake update
+  commands:
+  - nix --experimental-features "nix-command flakes" flake update --inputs-from nixpkgs
+  
+- name: Show git diff
+  commands:
+  - git diff
+
+- name: Show flake info
+  commands:
+  - nix --experimental-features "nix-command flakes" flake show
+  - nix --experimental-features "nix-command flakes" flake metadata
+  - nix --experimental-features "nix-command flakes" flake check
+
+- name: Run flake checks
+  commands:
+  - nix --experimental-features "nix-command flakes" flake check --show-trace
+
+- name: Build aida
+  commands:
+  - nix build -v '.#nixosConfigurations.aida.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result aida-new
+
+# - name: Build arm-server
+#   commands:
+#   - nix build -v '.#nixosConfigurations.arm-server.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+#   - mv result arm-server-new
+
+- name: Build deke
+  commands:
+  - nix build -v '.#nixosConfigurations.deke.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result deke-new
+
+- name: Build enoch
+  commands:
+  - nix build -v '.#nixosConfigurations.enoch.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result enoch-new
+
+- name: Build flint
+  commands:
+  - nix build -v '.#nixosConfigurations.flint.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result flint-new
+
+- name: Build kora
+  commands:
+  - nix build -v '.#nixosConfigurations.kora.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result kora-new
+
+- name: Build simmons
+  commands:
+  - nix build -v '.#nixosConfigurations.simmons.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result simmons-new
+
+- name: Build snowflake
+  commands:
+  - nix build -v '.#nixosConfigurations.snowflake.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result snowflake-new
+
+- name: Build the-hub
+  commands:
+  - nix build -v '.#nixosConfigurations.the-hub.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result the-hub-new
+
+- name: Build the-bus
+  commands:
+  - nix build -v '.#nixosConfigurations.the-bus.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result the-bus-new
+
+- name: Build water-on-fire
+  commands:
+  - nix build -v '.#nixosConfigurations.water-on-fire.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org"
+  - mv result water-on-fire-new
+
+# - name: Build darknet
+#   commands:
+#   - nix build .#darknet
+  
+- name: Build owncast
+  commands:
+  - nix build .#owncast
+  
+- name: Build plexRaw
+  commands:
+  - nix build .#plexRaw
+  
+- name: Build tautulli
+  commands:
+  - nix build .#tautulli
+
+- name: Print report
+  commands:
+  - echo "aida:" && nix store diff-closures $(readlink -f aida-old) $(readlink -f aida-new)
+#   - echo "arm-server:" && nix store diff-closures $(readlink -f arm-server-old) $(readlink -f arm-server-new)
+  - echo "deke:" && nix store diff-closures $(readlink -f deke-old) $(readlink -f deke-new)
+  - echo "enoch:" && nix store diff-closures $(readlink -f enoch-old) $(readlink -f enoch-new)
+  - echo "flint:" && nix store diff-closures $(readlink -f flint-old) $(readlink -f flint-new)
+  - echo "kora:" && nix store diff-closures $(readlink -f kora-old) $(readlink -f kora-new)
+  - echo "simmons:" && nix store diff-closures $(readlink -f simmons-old) $(readlink -f simmons-new)
+  - echo "snowflake:" && nix store diff-closures $(readlink -f snowflake-old) $(readlink -f snowflake-new)
+  - echo "the-hub:" && nix store diff-closures $(readlink -f the-hub-old) $(readlink -f the-hub-new)
+  - echo "the-bus:" && nix store diff-closures $(readlink -f the-bus-old) $(readlink -f the-bus-new)
+  - echo "water-on-fire:" && nix store diff-closures $(readlink -f water-on-fire-old) $(readlink -f water-on-fire-new)
+
+trigger:
+  branch:
+  - main
+  event:
+  - pull_request
+  - cron
+
+---
+kind: pipeline
+name: push flake update
+type: docker
+
+steps:
+- name: Update flake.lock
+  image: nixpkgs/nix-flakes
+  commands:
+  - nix flake update --inputs-from nixpkgs
+  - nix flake show
+  - nix flake metadata
+  - nix flake check
+  - nix flake check --show-trace
+  environment:
+    NIX_PATH: nixpkgs=channel:nixos-unstable
+
+- name: Push updated flake.lock
+  image: appleboy/drone-git-push
+  settings:
+    branch: update-flake
+    remote: git@github.com:MayNiklas/nixos.git
+    force: true
+    commit: true
+    force: true
+    commit_message: "❄️ Update flake.lock"
+    ssh_key:
+      from_secret: deploy_key
+
+- name: notify on failure
+  image: drillster/drone-email
+  settings:
+    username: apikey
+    from:
+      from_secret: email_from
+    host:
+      from_secret: email_host
+    password:
+      from_secret: email_password
+  when:
+    status:
+    - failure
+
+trigger:
+  branch:
+  - main
+  event:
+  - cron