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