diff --git a/checks/customer-portal/default.nix b/checks/customer-portal/default.nix new file mode 100644 index 0000000..24a1512 --- /dev/null +++ b/checks/customer-portal/default.nix @@ -0,0 +1,22 @@ +{ + pkgs, + nixosLib, + clan-core, + ... +}: +nixosLib.runTest ( + { ... }: + { + imports = [ + clan-core.modules.nixosTest.clanTest + ]; + + hostPkgs = pkgs; + + name = "service-customer-portal"; + + testScript = '' + start_all() + ''; + } +) diff --git a/checks/flake-module.nix b/checks/flake-module.nix new file mode 100644 index 0000000..205fc2d --- /dev/null +++ b/checks/flake-module.nix @@ -0,0 +1,15 @@ +{ self, ... }: +let + nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { }; +in +{ + perSystem = { pkgs, lib, ... }: + { + checks = { + service-customer-portal-test = import ./customer-portal { + inherit pkgs lib nixosLib self; + inherit (self.inputs) clan-core; + }; + }; + }; +} diff --git a/clanServices/customer-portal/default.nix b/clanServices/customer-portal/default.nix index dbbe7e6..0bc17dc 100644 --- a/clanServices/customer-portal/default.nix +++ b/clanServices/customer-portal/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ self, ... }: let inherit (builtins) readFile; in @@ -26,6 +26,8 @@ in perInstance = { instanceName, settings, machine, roles, ... }: { nixosModule = { config, pkgs, ... }: { + imports = [ self.inputs.amarth-customer-portal.nixosModules.default ]; + services.amarth-customer-portal = { enable = true; }; diff --git a/clanServices/customer-portal/flake-module.nix b/clanServices/customer-portal/flake-module.nix index fe21877..0952d2e 100644 --- a/clanServices/customer-portal/flake-module.nix +++ b/clanServices/customer-portal/flake-module.nix @@ -1,13 +1,15 @@ -{ ... }: +{ self, lib, ... }: let - module = ./default.nix; + module = lib.modules.importApply ./default.nix { inherit self; }; in { clan.modules.customer-portal = module; perSystem = { ... }: { clan.nixosTests.customer-portal = { - imports = [ ./tests/vm/default.nix ]; + imports = [ + ./tests/vm/default.nix + ]; clan.modules."@amarth/customer-portal" = module; }; diff --git a/clanServices/k3s/default.nix b/clanServices/k3s/default.nix index e246ac7..ee8f982 100644 --- a/clanServices/k3s/default.nix +++ b/clanServices/k3s/default.nix @@ -78,6 +78,45 @@ in role = "server"; tokenFile = config.clan.core.vars.generators.k3s.files.token.path; clusterInit = true; + + autoDeployCharts = { + harbor = { + name = "harbor"; + repo = "https://helm.goharbor.io"; + version = "1.14.0"; + hash = "sha256-fMP7q1MIbvzPGS9My91vbQ1d3OJMjwc+o8YE/BXZaYU="; + values = { + existingSecretAdminPassword = "harbor-admin"; + expose = { + tls = { + enabled = true; + certSource = "secret"; + secret.secretName = "my-tls-secret"; + }; + ingress = { + hosts.core = "example.com"; + className = "nginx"; + }; + }; + }; + }; + + crossplane = { + name = "crossplane"; + repo = "https://charts.crossplane.io/stable"; + version = "2.0.2"; + hash = "sha256-5gk/dvOJAy5O++QkrnS0oVZaanDgNmF0107qKyri3Js="; + + targetNamespace = "crossplane-system"; + createNamespace = true; + + values = { + replicas = 1; + + deploymentStrategy = "RollingUpdate"; + }; + }; + }; }; }; diff --git a/devShells/flake-module.nix b/devShells/flake-module.nix index 6fa23fd..a36e822 100755 --- a/devShells/flake-module.nix +++ b/devShells/flake-module.nix @@ -4,9 +4,10 @@ packages = with pkgs; [ bash sops - + just + inputs'.clan-core.packages.clan-cli ]; }; }; -} \ No newline at end of file +} diff --git a/flake.nix b/flake.nix index 21aecf7..2a8bf8d 100644 --- a/flake.nix +++ b/flake.nix @@ -34,8 +34,10 @@ clan-core.flakeModules.default clan-core.flakeModules.testModule - ./devShells/flake-module.nix + # ./checks/flake-module.nix ./clanServices/flake-module.nix + ./devShells/flake-module.nix + ./pkgs/flake-module.nix ]; flake = { diff --git a/pkgs/crossplane-cli/default.nix b/pkgs/crossplane-cli/default.nix new file mode 100644 index 0000000..a4858ff --- /dev/null +++ b/pkgs/crossplane-cli/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, ... }: + +pkgs.buildGoModule rec { + pname = "crossplane"; + version = "2.0.2"; + + src = pkgs.fetchFromGitHub { + owner = "crossplane"; + repo = "crossplane"; + tag = "v2.0.2"; + sha256 = "sha256-EIDrBQmtMaHlapVNUYABKejIj1I02g5R5h4cADZvtAg="; + }; + + vendorHash = "sha256-8VqKtWbnDGbmgxT13v2d4+nXHouZ4hi2c2m66SAd1KM="; +} diff --git a/pkgs/crossplane/default.nix b/pkgs/crossplane/default.nix new file mode 100644 index 0000000..9907430 --- /dev/null +++ b/pkgs/crossplane/default.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, ... }: + +pkgs.buildGoModule rec { + pname = "crossplane-cli"; + version = "2.0.2"; + + nativeBuildInputs = with pkgs; [ + earthly + ]; + + src = pkgs.fetchFromGitHub { + owner = "crossplane"; + repo = "crossplane"; + tag = "v2.0.2"; + sha256 = "sha256-EIDrBQmtMaHlapVNUYABKejIj1I02g5R5h4cADZvtAg="; + }; + + vendorHash = "sha256-8VqKtWbnDGbmgxT13v2d4+nXHouZ4hi2c2m66SAd1KM="; +} diff --git a/pkgs/flake-module.nix b/pkgs/flake-module.nix new file mode 100644 index 0000000..8e4d1bc --- /dev/null +++ b/pkgs/flake-module.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + imports = []; + + perSystem = + { config, pkgs, ... }: + { + packages = { + # crossplane = pkgs.callPackage ./crossplane { }; + crossplane-cli = pkgs.callPackage ./crossplane-cli { }; + }; + }; +}