add gitlab configuration and mail stuff

This commit is contained in:
Ingolf Wagner 2022-01-07 15:25:29 +01:00
parent 9fec2c53c5
commit 0d8595163f
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
6 changed files with 225 additions and 2 deletions

View file

@ -641,8 +641,8 @@ in
${pkgs.notmuch}/bin/notmuch new
${notmuchTaggingNew}
${threadTag "muted"}
${threadTag "wohnung"}
${threadTag "flagged"}
${threadTag "mute"}
${threadTag "ignore"}
'';
};
systemd.timers.fetchmail = {

3
terranix/gitlab/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.terraform*
terraform.tfstate*
config.tf.json

View file

@ -0,0 +1,7 @@
# nix flake example
This example shows how you could use terranix as flake.
* `nix run` run `nix run ".#apply"`
* `nix run ".#apply"` run `terraform apply`
* `nix run ".#destroy"` run `terraform destroy`

View file

@ -0,0 +1,31 @@
# start with:
# export GITLAB_TOKEN=""
{ config, lib, ... }:
{
terraform.required_providers.gitlab.source = "gitlabhq/gitlab";
provider.gitlab = {
base_url = "https://gitlab.ingolf-wagner.de/api/v4/";
};
resource.gitlab_deploy_key =
let
ssh_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDNRzdW7SYizwrECoTJbL0peeTkaRfAT5Jjefgad+MmHFHsRRy/q2bDQLlhKGPC4I0gXsaYuZSeSpaCwa6JHwDXDUjeSwj/osKE7lDnRx0XmGKKwZPNU4KuI9CUH450p5M9w3KgSmKEXJKayUz1/8E4WlSjfSkqpGwkhCeHtuIVd6Wei+fU/7uzYrL6tg8ZZD3omvvD4AxCEzNvM3wuX915K0x52GySJLpQUt9xYZLb1qrQAkVAnOE2ZZLx5rVzDLJkPrPRQ5Og3Yi3mT469AbKM/XPPuVgluiMCLOq8avAOQGK2brKjdaw2m3bDKuH18WJfMwwu/0uzSe1CWBwNj8/gAQapevhoYwMLjK9eJvWBh2Wc7tgHO51uZM3mVTylWFlsundM2ASssVHueReNpnUtMvXdCPHb0ZmZNy/3NW0u+y7FnLRvnrRSF8TYPeUYTOoRd0nbvwb6R0mBvHFqjs6ILLL7+d+JHCBnGAxu3AwgWAsS8LP3G+VL7arb1pEVJK52Svjoi2tPXWaRixAB1KxMep44UtY+TCGs+5fx++y2sUGhcEJBxXywpFmAPjOZLRuiDcnsWxZfTSMkQowoG6PUtcplasY4+NzJ/ivBjfka111KRLURNIRkCGaBZKPAROkGd9iKdiSENdpXRwubFl5ISjEPR3tdZaTY97w+hj8OQ==";
work_repositories = {
mindcurv = "palo/mindcurv_nix";
timewarrior = "palo/timewarrior_mindcurv";
};
repository = name: project_path: {
name = name;
value = {
project = project_path;
title = "Deployment key";
key = ssh_key;
};
};
in
lib.mapAttrs' repository work_repositories;
}

129
terranix/gitlab/flake.lock Normal file
View file

@ -0,0 +1,129 @@
{
"nodes": {
"bats-assert": {
"flake": false,
"locked": {
"lastModified": 1636059754,
"narHash": "sha256-ewME0l27ZqfmAwJO4h5biTALc9bDLv7Bl3ftBzBuZwk=",
"owner": "bats-core",
"repo": "bats-assert",
"rev": "34551b1d7f8c7b677c1a66fc0ac140d6223409e5",
"type": "github"
},
"original": {
"owner": "bats-core",
"repo": "bats-assert",
"type": "github"
}
},
"bats-support": {
"flake": false,
"locked": {
"lastModified": 1548869839,
"narHash": "sha256-Gr4ntadr42F2Ks8Pte2D4wNDbijhujuoJi4OPZnTAZU=",
"owner": "bats-core",
"repo": "bats-support",
"rev": "d140a65044b2d6810381935ae7f0c94c7023c8c3",
"type": "github"
},
"original": {
"owner": "bats-core",
"repo": "bats-support",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1631561581,
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1633074215,
"narHash": "sha256-epmR1H1amgFWuU7xW9OXGjsAqltMqCSqkv1U2+9rOlM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "378d2c5dcec7fef958cca3760448c09a9be2b7a3",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"terranix": "terranix"
}
},
"terranix": {
"inputs": {
"bats-assert": "bats-assert",
"bats-support": "bats-support",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"terranix-examples": "terranix-examples"
},
"locked": {
"lastModified": 1636274003,
"narHash": "sha256-HDiyJGgyDUoLnpL8N+wDm3cM/vEfYYc/p4N1kKH/kLk=",
"owner": "terranix",
"repo": "terranix",
"rev": "87fe67a2c254e74c1c3f3206c504fe7ba76a3c59",
"type": "github"
},
"original": {
"owner": "terranix",
"repo": "terranix",
"type": "github"
}
},
"terranix-examples": {
"locked": {
"lastModified": 1633465925,
"narHash": "sha256-BfXRW1ZHpK5jh5CVcw7eFpGsWE1CyVxL8R+V7uXemaU=",
"owner": "terranix",
"repo": "terranix-examples",
"rev": "70bf5d5a1ad4eabef1e4e71c1eb101021decd5a4",
"type": "github"
},
"original": {
"owner": "terranix",
"repo": "terranix-examples",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

53
terranix/gitlab/flake.nix Normal file
View file

@ -0,0 +1,53 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
terranix = {
url = "github:terranix/terranix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, terranix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
terraform = pkgs.terraform_0_15;
terraformConfiguration = terranix.lib.terranixConfiguration {
inherit system;
modules = [ ./config.nix ];
};
in
{
defaultPackage = terraformConfiguration;
# nix develop
devShell = pkgs.mkShell {
buildInputs = [
pkgs.terraform_0_15
terranix.defaultPackage.${system}
];
};
# nix run ".#apply"
apps.apply = {
type = "app";
program = toString (pkgs.writers.writeBash "apply" ''
if [[ -e config.tf.json ]]; then rm -f config.tf.json; fi
cp ${terraformConfiguration} config.tf.json \
&& ${terraform}/bin/terraform init \
&& ${terraform}/bin/terraform apply
'');
};
# nix run ".#destroy"
apps.destroy = {
type = "app";
program = toString (pkgs.writers.writeBash "destroy" ''
if [[ -e config.tf.json ]]; then rm -f config.tf.json; fi
cp ${terraformConfiguration} config.tf.json \
&& ${terraform}/bin/terraform init \
&& ${terraform}/bin/terraform destroy
'');
};
# nix run
defaultApp = self.apps.${system}.apply;
});
}