From ad2b96180f00d45e4319d1595b948bba38e3915a Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Tue, 23 Sep 2025 22:01:52 +0200 Subject: [PATCH 1/4] too lazy to think of a message, so enjoy this pointless text. Good luck future me... --- checks/customer-portal/default.nix | 22 +++++++++++++++++++ checks/flake-module.nix | 15 +++++++++++++ clanServices/customer-portal/default.nix | 4 +++- clanServices/customer-portal/flake-module.nix | 8 ++++--- devShells/flake-module.nix | 5 +++-- flake.nix | 1 + 6 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 checks/customer-portal/default.nix create mode 100644 checks/flake-module.nix 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/devShells/flake-module.nix b/devShells/flake-module.nix index 6fa23fd..a36e822 100644 --- 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..03e4d59 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ clan-core.flakeModules.default clan-core.flakeModules.testModule + # ./checks/flake-module.nix ./devShells/flake-module.nix ./clanServices/flake-module.nix ]; From a70ee51872c1b9be555e56c35f500fd2a65614d6 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Wed, 24 Sep 2025 19:13:51 +0200 Subject: [PATCH 2/4] too lazy to think of a message, so enjoy this pointless text. Good luck future me... --- clanServices/k3s/default.nix | 39 ++++++++++++++++++++++++++++++++++++ flake.nix | 3 ++- pkgs/crossplane/default.nix | 15 ++++++++++++++ pkgs/flake-module.nix | 13 ++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 pkgs/crossplane/default.nix create mode 100644 pkgs/flake-module.nix diff --git a/clanServices/k3s/default.nix b/clanServices/k3s/default.nix index 98db23f..6786984 100644 --- a/clanServices/k3s/default.nix +++ b/clanServices/k3s/default.nix @@ -76,6 +76,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-EIDrBQmtMaHlapVNUYABKejIj1I02g5R5h4cADZvtAg="; + + targetNamespace = "crossplane-system"; + createNamespace = true; + + values = { + replicas = 1; + + deploymentStrategy = "RollingUpdate"; + }; + }; + }; }; }; diff --git a/flake.nix b/flake.nix index 03e4d59..2a8bf8d 100644 --- a/flake.nix +++ b/flake.nix @@ -35,8 +35,9 @@ clan-core.flakeModules.testModule # ./checks/flake-module.nix - ./devShells/flake-module.nix ./clanServices/flake-module.nix + ./devShells/flake-module.nix + ./pkgs/flake-module.nix ]; flake = { diff --git a/pkgs/crossplane/default.nix b/pkgs/crossplane/default.nix new file mode 100644 index 0000000..a4858ff --- /dev/null +++ b/pkgs/crossplane/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/flake-module.nix b/pkgs/flake-module.nix new file mode 100644 index 0000000..0db79c3 --- /dev/null +++ b/pkgs/flake-module.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + imports = []; + + perSystem = + { config, pkgs, ... }: + { + packages = { + # crossplane = pkgs.callPackage ./crossplane { }; + }; + }; +} From f98b30b904895b96b029458741c66213187e4598 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Wed, 24 Sep 2025 19:23:57 +0200 Subject: [PATCH 3/4] too lazy to think of a message, so enjoy this pointless text. Good luck future me... --- clanServices/k3s/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clanServices/k3s/default.nix b/clanServices/k3s/default.nix index 6786984..7838c36 100644 --- a/clanServices/k3s/default.nix +++ b/clanServices/k3s/default.nix @@ -103,7 +103,7 @@ in name = "crossplane"; repo = "https://charts.crossplane.io/stable"; version = "2.0.2"; - hash = "sha256-EIDrBQmtMaHlapVNUYABKejIj1I02g5R5h4cADZvtAg="; + hash = "sha256-5gk/dvOJAy5O++QkrnS0oVZaanDgNmF0107qKyri3Js="; targetNamespace = "crossplane-system"; createNamespace = true; From 5b3e7ad76ac8a1bcd6ea177a72b296c4746860cc Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Wed, 24 Sep 2025 21:58:10 +0200 Subject: [PATCH 4/4] too lazy to think of a message, so enjoy this pointless text. Good luck future me... --- pkgs/crossplane-cli/default.nix | 15 +++++++++++++++ pkgs/crossplane/default.nix | 6 +++++- pkgs/flake-module.nix | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 pkgs/crossplane-cli/default.nix 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 index a4858ff..9907430 100644 --- a/pkgs/crossplane/default.nix +++ b/pkgs/crossplane/default.nix @@ -1,9 +1,13 @@ { pkgs, lib, ... }: pkgs.buildGoModule rec { - pname = "crossplane"; + pname = "crossplane-cli"; version = "2.0.2"; + nativeBuildInputs = with pkgs; [ + earthly + ]; + src = pkgs.fetchFromGitHub { owner = "crossplane"; repo = "crossplane"; diff --git a/pkgs/flake-module.nix b/pkgs/flake-module.nix index 0db79c3..8e4d1bc 100644 --- a/pkgs/flake-module.nix +++ b/pkgs/flake-module.nix @@ -8,6 +8,7 @@ { packages = { # crossplane = pkgs.callPackage ./crossplane { }; + crossplane-cli = pkgs.callPackage ./crossplane-cli { }; }; }; }