commit 346136de49ef4a142077dc556dfa75e407e5c51a Author: Mikhail Klementev Date: Sat Feb 2 19:45:05 2019 +0000 Initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..afef27b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +secrets.nix +hardware-configuration.nix \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e45c9b4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Mikhail Klementev + +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 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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..28a54d5 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# code.dumpstack.io + +## Installation + + parted /dev/vda mklabel msdos + parted /dev/vda mkpart primary ext4 0% 100% + mkfs.ext4 -L system /dev/vda1 + mount /dev/vda1 /mnt/ + + nix-env -iA nixos.gitMinimal + git clone https://code.dumpstack.io/infra/code.dumpstack.io.git /mnt/etc/nixos/ + + nixos-generate-config --root /mnt + + nixos-install + reboot diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..e0fc32e --- /dev/null +++ b/configuration.nix @@ -0,0 +1,55 @@ +{ config, pkgs, ... }: +let + secrets = import ./secrets.nix; + hostname = "code.dumpstack.io"; +in { + imports = [ ./hardware-configuration.nix ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/vda"; + + networking.hostName = "${hostname}"; + + networking.firewall = { + enable = true; + allowedTCPPorts = [ 80 443 ]; + }; + + users.extraUsers.root = { + openssh.authorizedKeys.keys = [ secrets.pubkey ]; + }; + + services.openssh.enable = true; + + environment.systemPackages = with pkgs; [ + vim + ]; + + services.gitea = { + enable = true; + appName = "${hostname}"; + domain = "${hostname}"; + rootUrl = "https://${hostname}"; + extraConfig = '' + [service] + DISABLE_REGISTRATION = true + + [ui] + DEFAULT_THEME = arc-green + ''; + }; + + services.nginx = { + enable = true; + virtualHosts."${hostname}" = { + enableACME = true; + forceSSL = true; + + locations."/".proxyPass = "http://127.0.0.1:3000"; + }; + }; + + system.stateVersion = "18.09"; + system.autoUpgrade.enable = true; +} diff --git a/secrets.nix.example b/secrets.nix.example new file mode 100644 index 0000000..f85fd4b --- /dev/null +++ b/secrets.nix.example @@ -0,0 +1,3 @@ +{ + pubkey = "changeme"; # ssh-add -L +}