reformat
This commit is contained in:
parent
95d70d5225
commit
973e3b3305
27 changed files with 359 additions and 291 deletions
|
@ -1,19 +1,23 @@
|
||||||
{
|
{
|
||||||
# cat ~/.ssh/id_rsa.pub
|
# cat ~/.ssh/id_rsa.pub
|
||||||
publicSshKey ? "",
|
publicSshKey ? ""
|
||||||
# remote-install-get-hiddenReceiver
|
, # remote-install-get-hiddenReceiver
|
||||||
hiddenReceiver ? "", }:
|
hiddenReceiver ? ""
|
||||||
|
,
|
||||||
|
}:
|
||||||
{ config, lib, pkgs, ... }: {
|
{ config, lib, pkgs, ... }: {
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
{ # system setup
|
{
|
||||||
|
# system setup
|
||||||
networking.hostName = "liveos";
|
networking.hostName = "liveos";
|
||||||
|
|
||||||
users.extraUsers = {
|
users.extraUsers = {
|
||||||
root = { openssh.authorizedKeys.keys = [ publicSshKey ]; };
|
root = { openssh.authorizedKeys.keys = [ publicSshKey ]; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{ # installed packages
|
{
|
||||||
|
# installed packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
#style
|
#style
|
||||||
|
@ -50,7 +54,8 @@ hiddenReceiver ? "", }:
|
||||||
dosfstools
|
dosfstools
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{ # bash configuration
|
{
|
||||||
|
# bash configuration
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
interactiveShellInit = ''
|
interactiveShellInit = ''
|
||||||
|
@ -81,16 +86,20 @@ hiddenReceiver ? "", }:
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{ # ssh configuration
|
{
|
||||||
|
# ssh configuration
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
services.openssh.passwordAuthentication = false;
|
services.openssh.passwordAuthentication = false;
|
||||||
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||||
}
|
}
|
||||||
{ # hidden ssh announce
|
{
|
||||||
config = let
|
# hidden ssh announce
|
||||||
|
config =
|
||||||
|
let
|
||||||
torDirectory = "/var/lib/tor";
|
torDirectory = "/var/lib/tor";
|
||||||
hiddenServiceDir = torDirectory + "/liveos";
|
hiddenServiceDir = torDirectory + "/liveos";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
services.tor = {
|
services.tor = {
|
||||||
enable = true;
|
enable = true;
|
||||||
client.enable = true;
|
client.enable = true;
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
hiddenReceiver = "";
|
hiddenReceiver = "";
|
||||||
|
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ remote-access ];
|
imports = [ remote-access ];
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ let
|
||||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw==";
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw==";
|
||||||
hiddenReceiver = "";
|
hiddenReceiver = "";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ remote-access ];
|
imports = [ remote-access ];
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
displayManager.auto.enable = true;
|
displayManager.auto.enable = true;
|
||||||
|
|
||||||
desktopManager = let
|
desktopManager =
|
||||||
|
let
|
||||||
guide = pkgs.stdenv.mkDerivation {
|
guide = pkgs.stdenv.mkDerivation {
|
||||||
name = "yubikey-guide-2019-01-21.html";
|
name = "yubikey-guide-2019-01-21.html";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
|
@ -54,7 +55,8 @@
|
||||||
installPhase =
|
installPhase =
|
||||||
"pandoc --highlight-style pygments -s --toc README.md -o $out";
|
"pandoc --highlight-style pygments -s --toc README.md -o $out";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
default = "xfce";
|
default = "xfce";
|
||||||
xterm.enable = false;
|
xterm.enable = false;
|
||||||
xfce.enable = true;
|
xfce.enable = true;
|
||||||
|
|
|
@ -12,7 +12,8 @@ let
|
||||||
${pkgs.black}/bin/black --exclude venv ${toString ./.}
|
${pkgs.black}/bin/black --exclude venv ${toString ./.}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = with pkgs; [ myPython startServer reformat ];
|
buildInputs = with pkgs; [ myPython startServer reformat ];
|
||||||
|
|
||||||
|
|
42
shell.nix
42
shell.nix
|
@ -45,7 +45,8 @@ let
|
||||||
property.file = toString ./submodules/property;
|
property.file = toString ./submodules/property;
|
||||||
} else
|
} else
|
||||||
{ };
|
{ };
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
system.file = toString ./system;
|
system.file = toString ./system;
|
||||||
configs.file = toString ./configs;
|
configs.file = toString ./configs;
|
||||||
nixos-config.symlink = "configs/${name}/configuration.nix";
|
nixos-config.symlink = "configs/${name}/configuration.nix";
|
||||||
|
@ -144,11 +145,17 @@ let
|
||||||
|
|
||||||
deployment = { secrets, content }:
|
deployment = { secrets, content }:
|
||||||
name:
|
name:
|
||||||
{ host ? (hostPattern name), target ? "/var/src/", user ? "root"
|
{ host ? (hostPattern name)
|
||||||
, commandPrefix ? "deploy", enableSwitch ? true, enableSecrets ? true }:
|
, target ? "/var/src/"
|
||||||
|
, user ? "root"
|
||||||
|
, commandPrefix ? "deploy"
|
||||||
|
, enableSwitch ? true
|
||||||
|
, enableSecrets ? true
|
||||||
|
}:
|
||||||
with ops;
|
with ops;
|
||||||
let
|
let
|
||||||
commandName = if enableSecrets then
|
commandName =
|
||||||
|
if enableSecrets then
|
||||||
"${commandPrefix}-${name}-with-secrets"
|
"${commandPrefix}-${name}-with-secrets"
|
||||||
else
|
else
|
||||||
"${commandPrefix}-${name}-without-secrets";
|
"${commandPrefix}-${name}-without-secrets";
|
||||||
|
@ -158,22 +165,26 @@ let
|
||||||
(optionals enableSecrets secrets)
|
(optionals enableSecrets secrets)
|
||||||
(optionals enableSwitch [ switch ])
|
(optionals enableSwitch [ switch ])
|
||||||
];
|
];
|
||||||
in jobs commandName "${user}@${host}${target}" populateCommands;
|
in
|
||||||
|
jobs commandName "${user}@${host}${target}" populateCommands;
|
||||||
|
|
||||||
serverDeployment = name:
|
serverDeployment = name:
|
||||||
with ops;
|
with ops;
|
||||||
deployment {
|
deployment
|
||||||
|
{
|
||||||
content = [
|
content = [
|
||||||
(populate source.nixPkgs)
|
(populate source.nixPkgs)
|
||||||
(populate source.modules)
|
(populate source.modules)
|
||||||
(populate (source.system name))
|
(populate (source.system name))
|
||||||
];
|
];
|
||||||
secrets = [ (populate (source.secrets name)) ];
|
secrets = [ (populate (source.secrets name)) ];
|
||||||
} name;
|
}
|
||||||
|
name;
|
||||||
|
|
||||||
desktopDeployment = name:
|
desktopDeployment = name:
|
||||||
with ops;
|
with ops;
|
||||||
deployment {
|
deployment
|
||||||
|
{
|
||||||
content = [
|
content = [
|
||||||
(populate source.nixPkgs)
|
(populate source.nixPkgs)
|
||||||
(populate source.modules)
|
(populate source.modules)
|
||||||
|
@ -181,7 +192,8 @@ let
|
||||||
];
|
];
|
||||||
secrets =
|
secrets =
|
||||||
[ (populate (source.secrets name)) (populate source.desktopSecrets) ];
|
[ (populate (source.secrets name)) (populate source.desktopSecrets) ];
|
||||||
} name;
|
}
|
||||||
|
name;
|
||||||
|
|
||||||
cleanupNix = name:
|
cleanupNix = name:
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
@ -191,7 +203,8 @@ let
|
||||||
user = "root";
|
user = "root";
|
||||||
port = "22";
|
port = "22";
|
||||||
};
|
};
|
||||||
in pkgs.writers.writeDashBin "clean-${name}" # sh
|
in
|
||||||
|
pkgs.writers.writeDashBin "clean-${name}" # sh
|
||||||
''
|
''
|
||||||
set -eu
|
set -eu
|
||||||
${pkgs.openssh}/bin/ssh \
|
${pkgs.openssh}/bin/ssh \
|
||||||
|
@ -217,7 +230,8 @@ let
|
||||||
target = "/mnt/var/src";
|
target = "/mnt/var/src";
|
||||||
enableSwitch = false;
|
enableSwitch = false;
|
||||||
};
|
};
|
||||||
in deployments ++ cleanup ++ install;
|
in
|
||||||
|
deployments ++ cleanup ++ install;
|
||||||
|
|
||||||
desktops = desktopList:
|
desktops = desktopList:
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -231,9 +245,11 @@ let
|
||||||
target = "/mnt/var/src";
|
target = "/mnt/var/src";
|
||||||
enableSwitch = false;
|
enableSwitch = false;
|
||||||
};
|
};
|
||||||
in deployments ++ cleanup ++ install;
|
in
|
||||||
|
deployments ++ cleanup ++ install;
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = with pkgs;
|
buildInputs = with pkgs;
|
||||||
(servers [ "workhorse" "sputnik" "porani" "dummy" ])
|
(servers [ "workhorse" "sputnik" "porani" "dummy" ])
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
# rev = "928f9e5e1d63e77a91f2ca57ffa2be1fef3078ec";
|
# rev = "928f9e5e1d63e77a91f2ca57ffa2be1fef3078ec";
|
||||||
#sha256 = "0rs84c549l863vbnnqgnx7v6m2zlq0wz46jbhm4v1l1a25d966s1";
|
#sha256 = "0rs84c549l863vbnnqgnx7v6m2zlq0wz46jbhm4v1l1a25d966s1";
|
||||||
#};
|
#};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [ (toString hcloud-modules) ];
|
imports = [ (toString hcloud-modules) ];
|
||||||
|
|
||||||
# configure admin ssh keys
|
# configure admin ssh keys
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
let
|
let
|
||||||
terranix = pkgs.callPackage (pkgs.fetchgit {
|
terranix = pkgs.callPackage
|
||||||
|
(pkgs.fetchgit {
|
||||||
url = "https://github.com/mrVanDalo/terranix.git";
|
url = "https://github.com/mrVanDalo/terranix.git";
|
||||||
rev = "2.3.0";
|
rev = "2.3.0";
|
||||||
sha256 = "030067h3gjc02llaa7rx5iml0ikvw6szadm0nrss2sqzshsfimm4";
|
sha256 = "030067h3gjc02llaa7rx5iml0ikvw6szadm0nrss2sqzshsfimm4";
|
||||||
}) { };
|
})
|
||||||
|
{ };
|
||||||
|
|
||||||
terraform = pkgs.writers.writeBashBin "terraform" ''
|
terraform = pkgs.writers.writeBashBin "terraform" ''
|
||||||
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
|
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
|
||||||
${pkgs.terraform_0_12}/bin/terraform "$@"
|
${pkgs.terraform_0_12}/bin/terraform "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,13 @@ with builtins; {
|
||||||
imports = [ ./provider.nix ./nginx.nix ./journald.nix ];
|
imports = [ ./provider.nix ./nginx.nix ./journald.nix ];
|
||||||
|
|
||||||
# create default index
|
# create default index
|
||||||
resource.graylog_index_set.default = let
|
resource.graylog_index_set.default =
|
||||||
|
let
|
||||||
maxIndexSize = 200;
|
maxIndexSize = 200;
|
||||||
maxIndexCount = 20;
|
maxIndexCount = 20;
|
||||||
isDefault = true;
|
isDefault = true;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
title = "default";
|
title = "default";
|
||||||
description = ''
|
description = ''
|
||||||
This is the default index set, where everything ends up which is
|
This is the default index set, where everything ends up which is
|
||||||
|
|
|
@ -269,7 +269,8 @@ with builtins; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
graylog_stream_rule = let
|
graylog_stream_rule =
|
||||||
|
let
|
||||||
nq_stream_rule = field: value: stream_id: {
|
nq_stream_rule = field: value: stream_id: {
|
||||||
inherit field value stream_id;
|
inherit field value stream_id;
|
||||||
type = 1;
|
type = 1;
|
||||||
|
@ -296,7 +297,8 @@ with builtins; {
|
||||||
"nginx_above${min}" = (gt_stream_rule "response_status" min stream_id);
|
"nginx_above${min}" = (gt_stream_rule "response_status" min stream_id);
|
||||||
"nginx_below${max}" = (lt_stream_rule "response_status" max stream_id);
|
"nginx_below${max}" = (lt_stream_rule "response_status" max stream_id);
|
||||||
};
|
};
|
||||||
in (between "499" "600" "\${graylog_stream.nginx5xx.id}")
|
in
|
||||||
|
(between "499" "600" "\${graylog_stream.nginx5xx.id}")
|
||||||
// (between "399" "500" "\${graylog_stream.nginx4xx.id}")
|
// (between "399" "500" "\${graylog_stream.nginx4xx.id}")
|
||||||
// (between "199" "300" "\${graylog_stream.nginx2xx.id}") // {
|
// (between "199" "300" "\${graylog_stream.nginx2xx.id}") // {
|
||||||
is_nginx_access = (eq_stream_rule "nginx_access" true
|
is_nginx_access = (eq_stream_rule "nginx_access" true
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
|
|
||||||
getVariable = name: "\${ var.${name} }";
|
getVariable = name: "\${ var.${name} }";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
hcloud = {
|
hcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.hcloud.nixserver;
|
cfg = config.hcloud.nixserver;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.hcloud.nixserver = {
|
options.hcloud.nixserver = {
|
||||||
enable = mkEnableOption ''
|
enable = mkEnableOption ''
|
||||||
|
|
|
@ -14,7 +14,8 @@ let
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
# needed pkgs
|
# needed pkgs
|
||||||
# -----------
|
# -----------
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
rev = "5fa359a482892cd973dcc6ecfc607f4709f24495";
|
rev = "5fa359a482892cd973dcc6ecfc607f4709f24495";
|
||||||
sha256 = "0smgmdiklj98y71fmcdjsqjq8l41i66hs8msc7k4m9dpkphqk86p";
|
sha256 = "0smgmdiklj98y71fmcdjsqjq8l41i66hs8msc7k4m9dpkphqk86p";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ "${hcloud-modules}/default.nix" ];
|
imports = [ "${hcloud-modules}/default.nix" ];
|
||||||
|
|
||||||
|
@ -43,7 +44,8 @@ in {
|
||||||
ServerAliveInterval 60
|
ServerAliveInterval 60
|
||||||
ServerAliveCountMax 3
|
ServerAliveCountMax 3
|
||||||
'';
|
'';
|
||||||
in concatStringsSep "\n"
|
in
|
||||||
|
concatStringsSep "\n"
|
||||||
(map configPart (attrNames config.hcloud.nixserver));
|
(map configPart (attrNames config.hcloud.nixserver));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ let
|
||||||
apiImage = "thecodingmachine/workadventure-back:develop";
|
apiImage = "thecodingmachine/workadventure-back:develop";
|
||||||
uploaderImage = "thecodingmachine/workadventure-uploader:develop";
|
uploaderImage = "thecodingmachine/workadventure-uploader:develop";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
||||||
|
|
|
@ -7,7 +7,8 @@ let
|
||||||
sha256 = "193pajq1gcd9jyd12nii06q1sf49xdhbjbfqk3lcq83s0miqfs63";
|
sha256 = "193pajq1gcd9jyd12nii06q1sf49xdhbjbfqk3lcq83s0miqfs63";
|
||||||
});
|
});
|
||||||
|
|
||||||
ops = let
|
ops =
|
||||||
|
let
|
||||||
overlay = self: super: {
|
overlay = self: super: {
|
||||||
# overwrite ssh to use the generated ssh configuration
|
# overwrite ssh to use the generated ssh configuration
|
||||||
openssh = super.writeShellScriptBin "ssh" ''
|
openssh = super.writeShellScriptBin "ssh" ''
|
||||||
|
@ -16,7 +17,8 @@ let
|
||||||
} "$@"
|
} "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in opsImport { overlays = [ overlay ]; };
|
in
|
||||||
|
opsImport { overlays = [ overlay ]; };
|
||||||
|
|
||||||
lib = ops.lib;
|
lib = ops.lib;
|
||||||
pkgs = ops.pkgs;
|
pkgs = ops.pkgs;
|
||||||
|
@ -60,7 +62,8 @@ let
|
||||||
switch
|
switch
|
||||||
];
|
];
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = lib.mapAttrsToList deployServer servers;
|
buildInputs = lib.mapAttrsToList deployServer servers;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ let
|
||||||
${pkgs.terraform_0_12}/bin/terraform "$@"
|
${pkgs.terraform_0_12}/bin/terraform "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ let
|
||||||
|
|
||||||
hcloud-modules = /home/palo/dev/terranix-hcloud/terraform-0.11;
|
hcloud-modules = /home/palo/dev/terranix-hcloud/terraform-0.11;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ (toString hcloud-modules) ./config/ssh-setup.nix ];
|
imports = [ (toString hcloud-modules) ./config/ssh-setup.nix ];
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
allServerParts = map serverPart (attrNames config.hcloud.server);
|
allServerParts = map serverPart (attrNames config.hcloud.server);
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
{
|
{
|
||||||
${concatStringsSep "\n" allServerParts}
|
${concatStringsSep "\n" allServerParts}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
publicKeyFile = ../../sshkey.pub;
|
publicKeyFile = ../../sshkey.pub;
|
||||||
};
|
};
|
||||||
target = file: "${toString ../../02-build/generated}/${file}";
|
target = file: "${toString ../../02-build/generated}/${file}";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# configure admin ssh keys
|
# configure admin ssh keys
|
||||||
users.admins.palo.publicKey = lib.fileContents ssh.publicKeyFile;
|
users.admins.palo.publicKey = lib.fileContents ssh.publicKeyFile;
|
||||||
|
|
||||||
|
@ -36,7 +37,8 @@ in {
|
||||||
ServerAliveInterval 60
|
ServerAliveInterval 60
|
||||||
ServerAliveCountMax 3
|
ServerAliveCountMax 3
|
||||||
'';
|
'';
|
||||||
in concatStringsSep "\n"
|
in
|
||||||
|
concatStringsSep "\n"
|
||||||
(map configPart (attrNames config.hcloud.server));
|
(map configPart (attrNames config.hcloud.server));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
terranix = pkgs.callPackage (pkgs.fetchgit {
|
terranix = pkgs.callPackage
|
||||||
|
(pkgs.fetchgit {
|
||||||
url = "https://github.com/mrVanDalo/terranix.git";
|
url = "https://github.com/mrVanDalo/terranix.git";
|
||||||
rev = "6097722f3a94972a92d810f3a707351cd425a4be";
|
rev = "6097722f3a94972a92d810f3a707351cd425a4be";
|
||||||
sha256 = "1d8w82mvgflmscvq133pz9ynr79cgd5qjggng85byk8axj6fg6jw";
|
sha256 = "1d8w82mvgflmscvq133pz9ynr79cgd5qjggng85byk8axj6fg6jw";
|
||||||
}) { };
|
})
|
||||||
|
{ };
|
||||||
|
|
||||||
terraform = pkgs.writers.writeDashBin "terraform" ''
|
terraform = pkgs.writers.writeDashBin "terraform" ''
|
||||||
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
|
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
|
||||||
|
@ -27,7 +29,8 @@ let
|
||||||
rm ${toString ./.}/terraform.tfstate*
|
rm ${toString ./.}/terraform.tfstate*
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = with pkgs; [ terranix terraform create destroy ];
|
buildInputs = with pkgs; [ terranix terraform create destroy ];
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
ops = let
|
ops =
|
||||||
|
let
|
||||||
opsImport = import ((import <nixpkgs> { }).fetchgit {
|
opsImport = import ((import <nixpkgs> { }).fetchgit {
|
||||||
url = "https://github.com/mrVanDalo/plops.git";
|
url = "https://github.com/mrVanDalo/plops.git";
|
||||||
rev = "9fabba016a3553ae6e13d5d17d279c4de2eb00ad";
|
rev = "9fabba016a3553ae6e13d5d17d279c4de2eb00ad";
|
||||||
|
@ -18,7 +19,8 @@ let
|
||||||
} "$@"
|
} "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in opsImport { overlays = [ overlay ]; };
|
in
|
||||||
|
opsImport { overlays = [ overlay ]; };
|
||||||
|
|
||||||
lib = ops.lib;
|
lib = ops.lib;
|
||||||
pkgs = ops.pkgs;
|
pkgs = ops.pkgs;
|
||||||
|
@ -66,7 +68,8 @@ let
|
||||||
"${user}@${host.ipv4}"
|
"${user}@${host.ipv4}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
buildInputs = lib.mapAttrsToList deployServer servers
|
buildInputs = lib.mapAttrsToList deployServer servers
|
||||||
++ mapAttrsToList moshServer servers;
|
++ mapAttrsToList moshServer servers;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
rev = "5fa359a482892cd973dcc6ecfc607f4709f24495";
|
rev = "5fa359a482892cd973dcc6ecfc607f4709f24495";
|
||||||
sha256 = "0smgmdiklj98y71fmcdjsqjq8l41i66hs8msc7k4m9dpkphqk86p";
|
sha256 = "0smgmdiklj98y71fmcdjsqjq8l41i66hs8msc7k4m9dpkphqk86p";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ "${hcloud-modules}/default.nix" ];
|
imports = [ "${hcloud-modules}/default.nix" ];
|
||||||
|
|
||||||
|
@ -40,7 +41,8 @@ in {
|
||||||
ServerAliveInterval 60
|
ServerAliveInterval 60
|
||||||
ServerAliveCountMax 3
|
ServerAliveCountMax 3
|
||||||
'';
|
'';
|
||||||
in concatStringsSep "\n"
|
in
|
||||||
|
concatStringsSep "\n"
|
||||||
(map configPart (attrNames config.hcloud.nixserver));
|
(map configPart (attrNames config.hcloud.nixserver));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ let
|
||||||
apiImage = "thecodingmachine/workadventure-back:${version}";
|
apiImage = "thecodingmachine/workadventure-back:${version}";
|
||||||
uploaderImage = "thecodingmachine/workadventure-uploader:${version}";
|
uploaderImage = "thecodingmachine/workadventure-uploader:${version}";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
||||||
|
|
|
@ -7,7 +7,8 @@ let
|
||||||
sha256 = "193pajq1gcd9jyd12nii06q1sf49xdhbjbfqk3lcq83s0miqfs63";
|
sha256 = "193pajq1gcd9jyd12nii06q1sf49xdhbjbfqk3lcq83s0miqfs63";
|
||||||
});
|
});
|
||||||
|
|
||||||
ops = let
|
ops =
|
||||||
|
let
|
||||||
overlay = self: super: {
|
overlay = self: super: {
|
||||||
# overwrite ssh to use the generated ssh configuration
|
# overwrite ssh to use the generated ssh configuration
|
||||||
openssh = super.writeShellScriptBin "ssh" ''
|
openssh = super.writeShellScriptBin "ssh" ''
|
||||||
|
@ -16,7 +17,8 @@ let
|
||||||
} "$@"
|
} "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in opsImport { overlays = [ overlay ]; };
|
in
|
||||||
|
opsImport { overlays = [ overlay ]; };
|
||||||
|
|
||||||
lib = ops.lib;
|
lib = ops.lib;
|
||||||
pkgs = ops.pkgs;
|
pkgs = ops.pkgs;
|
||||||
|
@ -60,7 +62,8 @@ let
|
||||||
switch
|
switch
|
||||||
];
|
];
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = lib.mapAttrsToList deployServer servers;
|
buildInputs = lib.mapAttrsToList deployServer servers;
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
let
|
let
|
||||||
|
|
||||||
terranix = pkgs.callPackage (pkgs.fetchgit {
|
terranix = pkgs.callPackage
|
||||||
|
(pkgs.fetchgit {
|
||||||
url = "https://github.com/mrVanDalo/terranix.git";
|
url = "https://github.com/mrVanDalo/terranix.git";
|
||||||
rev = "2.3.0";
|
rev = "2.3.0";
|
||||||
sha256 = "030067h3gjc02llaa7rx5iml0ikvw6szadm0nrss2sqzshsfimm4";
|
sha256 = "030067h3gjc02llaa7rx5iml0ikvw6szadm0nrss2sqzshsfimm4";
|
||||||
}) { };
|
})
|
||||||
|
{ };
|
||||||
|
|
||||||
terraform = pkgs.writers.writeBashBin "terraform" ''
|
terraform = pkgs.writers.writeBashBin "terraform" ''
|
||||||
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
|
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
|
||||||
${pkgs.terraform_0_12}/bin/terraform "$@"
|
${pkgs.terraform_0_12}/bin/terraform "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue