commit 641d910f850222bf7dbcddc9d23a831f181c30d9 Author: Sven Slootweg Date: Sun Mar 19 18:47:19 2017 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..454b655 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +credentials diff --git a/lib/joepie91.pub b/lib/joepie91.pub new file mode 100644 index 0000000..c1632a7 --- /dev/null +++ b/lib/joepie91.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzV5dI01NhwuL6ayiO0STcSQiDf7lEtu63NuLZKQUdZVuVHIqyt3Gquks2OI1NZGrJdXA315yw89ZqyMo+z7gSGHEV6P0fAXKW6G78JOFWsA5lGpaLxTsZ6Q7r0Z9FMqDvA5Jlsyznyj9hhO1cz01WPLzB92ypd9ifldtrAQIYQItxGXOuRkBJiShuIRqtr4Q2chXiOoRZKb4v4Gyt/UPxTpvfM/zcOz0zi1d4ijSbLqgIUJhxvrWADfdgEQ77unepDoD+HT51QBX7dj8RuYivxLSA3vpfNeCgt2CYBf6FYnmWkWSnN1RCtQPJNxsMuLzC2ZBbIkz0tDgcIBPbHxGr sven@linux-rfa7.site diff --git a/lib/remove-newlines.nix b/lib/remove-newlines.nix new file mode 100644 index 0000000..260cc40 --- /dev/null +++ b/lib/remove-newlines.nix @@ -0,0 +1 @@ +builtins.replaceStrings ["\n"] [""] diff --git a/lib/root-ssh.nix b/lib/root-ssh.nix new file mode 100644 index 0000000..36cf5b8 --- /dev/null +++ b/lib/root-ssh.nix @@ -0,0 +1,5 @@ +{ + users.users.root.openssh.authorizedKeys.keys = [ + (builtins.readFile ./joepie91.pub) + ]; +} diff --git a/lib/tools.nix b/lib/tools.nix new file mode 100644 index 0000000..f63eef3 --- /dev/null +++ b/lib/tools.nix @@ -0,0 +1,11 @@ +pkgs: { + environment.systemPackages = with pkgs; [ + wget + curl + htop + iotop + iftop + nload + lsof + ]; +} diff --git a/networks/default.nix b/networks/default.nix new file mode 100644 index 0000000..8a5eab3 --- /dev/null +++ b/networks/default.nix @@ -0,0 +1,32 @@ +{ + network.description = "Cryto"; + + osmium = { config, lib, pkgs, ... }: let + proxiedApplications = [{ + hostname = "pastebin-stream.cryto.net"; + tls = false; + config = '' + root ${pkgs.valgrind.doc}/share/doc/valgrind/html + ''; + }]; + + generateCaddyHostConfiguration = applications: + lib.concatStrings (map (application: '' + ${application.hostname} { + ${lib.optionalString (application.tls == false) "tls off"} + ${application.config} + } + '') applications); + in { + services.caddy = { + enable = true; + agree = true; + email = "admin@cryto.net"; + config = '' + ${generateCaddyHostConfiguration proxiedApplications} + ''; + }; + + networking.firewall.allowedTCPPorts = [ 2015 ]; + }; +} diff --git a/systems/osmium.nix b/systems/osmium.nix new file mode 100644 index 0000000..055d838 --- /dev/null +++ b/systems/osmium.nix @@ -0,0 +1,18 @@ +let + removeNewlines = (import ../lib/remove-newlines.nix); +in { + resources.sshKeyPairs.ssh-key = {}; + + osmium = { config, pkgs, ... }: { + services.openssh = { + enable = true; + passwordAuthentication = false; + challengeResponseAuthentication = false; + }; + + deployment.targetEnv = "digitalOcean"; + deployment.digitalOcean.region = "ams2"; + deployment.digitalOcean.size = "512mb"; + #deployment.digitalOcean.authToken = removeNewlines (builtins.readFile ../credentials/digitalocean-auth-token); + } // (import ../lib/root-ssh.nix) // ((import ../lib/tools.nix) pkgs); +}