From 40ec7e9c8cc11f747861cfee66635e6bdc2b4b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Sun, 17 Nov 2024 01:02:23 +0100 Subject: [PATCH] Make a NixOps4 deployment for action runners --- flake.nix | 1 + infra/flake-part.nix | 47 +++++++++++++++++++++++++++++++++ infra/vm02179/configuration.nix | 11 -------- infra/vm02186/flake.nix | 24 ----------------- 4 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 infra/flake-part.nix delete mode 100644 infra/vm02186/flake.nix diff --git a/flake.nix b/flake.nix index 59a40fc..279345a 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ inputs.nixops4-nixos.modules.flake.default ./deployment/flake-part.nix + ./infra/flake-part.nix ./services/flake-part.nix ]; diff --git a/infra/flake-part.nix b/infra/flake-part.nix new file mode 100644 index 0000000..8b32f1c --- /dev/null +++ b/infra/flake-part.nix @@ -0,0 +1,47 @@ +{ inputs, self, ... }: + +{ + nixops4Deployments.actions-runners = + { providers, ... }: + { + providers.local = inputs.nixops4-nixos.modules.nixops4Provider.local; + + resources = { + vm02179 = { + type = providers.local.exec; + imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ]; + ssh = { + host = "185.206.232.179"; + opts = ""; + hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPAsOCOsJ0vNL9fGj0XC25ir8B+k2NlVJzsiVUx+0eWM"; + }; + nixpkgs = inputs.nixpkgs; + nixos.module = { + imports = [ + ./vm02179/configuration.nix + ./vm02186/hardware-configuration.nix + ./vm02179/gitea-runner.nix + ]; + }; + }; + + vm02186 = { + type = providers.local.exec; + imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ]; + ssh = { + host = "185.206.232.186"; + opts = ""; + hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII6mnBgEeyYE4tzHeFNHVNBV6KR+hAqh3PYSqlh0QViW"; + }; + nixpkgs = inputs.nixpkgs; + nixos.module = { + imports = [ + ./vm02186/procolix-configuration.nix + ./vm02186/hardware-configuration.nix + ./vm02186/gitea-runner.nix + ]; + }; + }; + }; + }; +} diff --git a/infra/vm02179/configuration.nix b/infra/vm02179/configuration.nix index 89c1e76..3856086 100644 --- a/infra/vm02179/configuration.nix +++ b/infra/vm02179/configuration.nix @@ -6,12 +6,6 @@ { config, pkgs, ... }: { - imports = - [ # Include the results of the hardware scan. - ./gitea-runner.nix - ./hardware-configuration.nix - ]; - # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -193,11 +187,6 @@ # Enable the OpenSSH daemon. services.openssh.enable = true; - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - system.copySystemConfiguration = true; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/infra/vm02186/flake.nix b/infra/vm02186/flake.nix deleted file mode 100644 index 178f7f6..0000000 --- a/infra/vm02186/flake.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; - snf.url = "git+https://git.fediversity.eu/fediversity/simple-nixos-fediverse.git"; - }; - - outputs = { self, nixpkgs, snf }: - let - vmName = "vm02186"; - - in { - nixosConfigurations.${vmName} = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - - modules = [ - ./procolix-configuration.nix - ./hardware-configuration.nix - ./gitea-runner.nix - ]; - }; - - isoInstallers.${vmName} = snf.mkInstaller nixpkgs self.nixosConfigurations.${vmName}; - }; -}