From 07075cc45f43102f31f71800004bf9415a560e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Jul 2024 14:15:33 +0200 Subject: [PATCH 1/5] update nixos-mailserver flake inputs --- flake.lock | 23 ++++------------------- flake.nix | 2 +- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index 9e72ad1..8088101 100644 --- a/flake.lock +++ b/flake.lock @@ -202,7 +202,7 @@ "nixpkgs": [ "nixpkgs" ], - "nixpkgs-24_05": "nixpkgs-24_05" + "nixpkgs-24_05": [] }, "locked": { "lastModified": 1718697807, @@ -220,11 +220,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719468428, - "narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=", + "lastModified": 1719760900, + "narHash": "sha256-NkvFphHXKtQQ8F0XrqGlqkOhjHbE3671F8oLxwtTHhk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d", + "rev": "12a9c0004bc987afb1ff511ebb97b67497a68e22", "type": "github" }, "original": { @@ -234,21 +234,6 @@ "type": "github" } }, - "nixpkgs-24_05": { - "locked": { - "lastModified": 1717144377, - "narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "805a384895c696f802a9bf5bf4720f37385df547", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-24.05", - "type": "indirect" - } - }, "root": { "inputs": { "buildbot-nix": "buildbot-nix", diff --git a/flake.nix b/flake.nix index 6f556a8..1eff437 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ nixos-mailserver = { url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.utils.follows = "flake-utils"; + inputs.nixpkgs-24_05.follows = ""; inputs.flake-compat.follows = "flake-compat"; }; From 6533ed7b6e5a655fd4d22f00a8ca5f9ce5d625ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Jul 2024 14:23:52 +0200 Subject: [PATCH 2/5] treefmt dns.tf --- terraform/web01/dns.tf | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/terraform/web01/dns.tf b/terraform/web01/dns.tf index 3b716da..e994ec7 100644 --- a/terraform/web01/dns.tf +++ b/terraform/web01/dns.tf @@ -4,31 +4,31 @@ resource "hetznerdns_zone" "server" { } resource "hetznerdns_record" "root_a" { - zone_id = hetznerdns_zone.server.id - name = "@" - type = "A" - value = var.ipv4_address + zone_id = hetznerdns_zone.server.id + name = "@" + type = "A" + value = var.ipv4_address } resource "hetznerdns_record" "root_aaaa" { - zone_id = hetznerdns_zone.server.id - name = "@" - type = "AAAA" - value = var.ipv6_address + zone_id = hetznerdns_zone.server.id + name = "@" + type = "AAAA" + value = var.ipv6_address } resource "hetznerdns_record" "wildcard_a" { - zone_id = hetznerdns_zone.server.id - name = "*" - type = "A" - value = var.ipv4_address + zone_id = hetznerdns_zone.server.id + name = "*" + type = "A" + value = var.ipv4_address } resource "hetznerdns_record" "wildcard_aaaa" { - zone_id = hetznerdns_zone.server.id - name = "*" - type = "AAAA" - value = var.ipv6_address + zone_id = hetznerdns_zone.server.id + name = "*" + type = "AAAA" + value = var.ipv6_address } # for sending emails From 0037d7d21856ee4c932554161e3f6d8d07a90728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Jul 2024 14:24:08 +0200 Subject: [PATCH 3/5] switch back to terraform for formatting --- flake.lock | 7 ++++--- flake.nix | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 8088101..d897580 100644 --- a/flake.lock +++ b/flake.lock @@ -313,15 +313,16 @@ ] }, "locked": { - "lastModified": 1719749022, - "narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=", + "lastModified": 1719836491, + "narHash": "sha256-0kZeCwwYe51lN/9X2eCcBaAxFHeHTN1ieyuq/4UG8xg=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd", + "rev": "e78a4ce2041d5179f84b9a91001d9d35e72d3d21", "type": "github" }, "original": { "owner": "numtide", + "ref": "opentofu", "repo": "treefmt-nix", "type": "github" } diff --git a/flake.nix b/flake.nix index 1eff437..1cbf9a1 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ flake-compat.url = "github:edolstra/flake-compat"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; - treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.url = "github:numtide/treefmt-nix/opentofu"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; nixos-mailserver = { @@ -63,7 +63,7 @@ { treefmt = { projectRootFile = ".git/config"; - programs.hclfmt.enable = true; + programs.terraform.enable = true; programs.nixfmt-rfc-style.enable = true; settings.formatter.nixfmt-rfc-style.excludes = [ # generated files From abb431276fe15062f19cc328e1e11ef4764e5383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Jul 2024 14:49:41 +0200 Subject: [PATCH 4/5] enable deno/shellcheck formatter --- LICENSE.md | 17 ++++++++++++++--- README.md | 10 +++++++--- flake.nix | 12 ++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 06af4d1..f1366af 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,18 @@ Copyright 2023 Clan contributers -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index c0fa8a2..7b7ea76 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ This repository contains nixos modules and terraform code that powers clan.lol. The website and git hosting is currently on [hetzner](https://www.hetzner.com/). ## Servers + - web01: - - Instance type: [ex101](https://www.hetzner.com/de/dedicated-rootserver/ex101) + - Instance type: + [ex101](https://www.hetzner.com/de/dedicated-rootserver/ex101) - CPU: Intel Core i9-13900 (24 cores / 32 threads) - RAM: 64GB DDR5 - Drives: 2 x 1.92 TB NVME @@ -26,5 +28,7 @@ $ ./tf.sh apply ## To add a new project to CI -1. Add the 'buildbot-clan' topic to the repository using the "Manage topics" button below the project description -2. Go to https://buildbot.clan.lol/#/builders/2 and press "Update projects" after you have logged in. +1. Add the 'buildbot-clan' topic to the repository using the "Manage topics" + button below the project description +2. Go to https://buildbot.clan.lol/#/builders/2 and press "Update projects" + after you have logged in. diff --git a/flake.nix b/flake.nix index 1cbf9a1..66a0c44 100644 --- a/flake.nix +++ b/flake.nix @@ -64,6 +64,18 @@ treefmt = { projectRootFile = ".git/config"; programs.terraform.enable = true; + programs.shellcheck.enable = true; + + programs.deno.enable = true; + settings.formatter.deno.excludes = [ + # generated files + "sops/*" + "terraform.tfstate" + "*.tfvars.sops.json" + "*nixos-vars.json" + "secrets.yaml" + ]; + programs.nixfmt-rfc-style.enable = true; settings.formatter.nixfmt-rfc-style.excludes = [ # generated files From 6ade2432600e6db1c1db6050e48df0b3d9f601df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Jul 2024 15:29:43 +0200 Subject: [PATCH 5/5] apply treefmt fix to respect global excludes --- flake.nix | 7 ++++++- treefmt-config.patch | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 treefmt-config.patch diff --git a/flake.nix b/flake.nix index 66a0c44..fa6e1d8 100644 --- a/flake.nix +++ b/flake.nix @@ -58,16 +58,21 @@ lib, self', system, + pkgs, ... }: { treefmt = { + package = pkgs.treefmt.overrideAttrs (_old: { + # https://github.com/numtide/treefmt/pull/325 + patches = [ ./treefmt-config.patch ]; + }); projectRootFile = ".git/config"; programs.terraform.enable = true; programs.shellcheck.enable = true; programs.deno.enable = true; - settings.formatter.deno.excludes = [ + settings.global.excludes = [ # generated files "sops/*" "terraform.tfstate" diff --git a/treefmt-config.patch b/treefmt-config.patch new file mode 100644 index 0000000..3e3f5b4 --- /dev/null +++ b/treefmt-config.patch @@ -0,0 +1,23 @@ +From 43b15f8757a7f8de0340cc977ff9619741a5d43f Mon Sep 17 00:00:00 2001 +From: Brian McGee +Date: Mon, 1 Jul 2024 14:20:22 +0100 +Subject: [PATCH] fix: configure toml key for global excludes + +Signed-off-by: Brian McGee +--- + config/config.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/config.go b/config/config.go +index d9e281f..be5c991 100644 +--- a/config/config.go ++++ b/config/config.go +@@ -10,7 +10,7 @@ import ( + type Config struct { + Global struct { + // Excludes is an optional list of glob patterns used to exclude certain files from all formatters. +- Excludes []string ++ Excludes []string `toml:"excludes"` + } + Formatters map[string]*Formatter `toml:"formatter"` + }