From 1b5bd980e1ba156104cf9dc439396fd7f1886bdd Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 29 Nov 2019 15:52:06 +0100 Subject: [PATCH] Add nix-serve to Server7, enable flakes for hydra --- hosts/server7/configuration.nix | 11 ++- hosts/server7/hydra.nix | 2 +- hosts/server7/hydra.svg | 163 ++++++++++++++++++++++++++++++++ hosts/server7/nix-serve.nix | 8 ++ lib/hq.nix | 23 +++-- 5 files changed, 196 insertions(+), 11 deletions(-) create mode 100644 hosts/server7/hydra.svg create mode 100644 hosts/server7/nix-serve.nix diff --git a/hosts/server7/configuration.nix b/hosts/server7/configuration.nix index e1b97691..9eeca90f 100644 --- a/hosts/server7/configuration.nix +++ b/hosts/server7/configuration.nix @@ -10,13 +10,13 @@ ./hardware-configuration.nix ./yggdrasil-prefix.nix ./hydra.nix + ./nix-serve.nix ]; security.sudo.wheelNeedsPassword = false; services.openssh = { enable = true; passwordAuthentication = false; - permitRootLogin = "no"; # DO NOT CHANGE, KINDERGARTEN IS OVER }; @@ -35,12 +35,19 @@ nix = { package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; gc.automatic = true; trustedUsers = [ "root" ]; + buildMachines = [{ + hostName = "hydra.hq.c3d2.de"; + system = "x86_64-linux"; + maxJobs = 2; + }]; }; networking = { - hostName = "nixbert"; + firewall.enable = false; + hostName = "serve7"; useDHCP = false; bridges.br0.interfaces = [ "enp2s0f1" ]; interfaces = { diff --git a/hosts/server7/hydra.nix b/hosts/server7/hydra.nix index 61bef0d5..2fdfe196 100644 --- a/hosts/server7/hydra.nix +++ b/hosts/server7/hydra.nix @@ -163,7 +163,7 @@ in { config, pkgs, ... }: { services.hydra = { enable = true; hydraURL = "https://flakes.hq.c3d2.de"; - logo = ../../hosts/hydra/c3d2.svg; + logo = ./hydra.svg; notificationSender = "hydra@spam.works"; package = hydraFlakes pkgs; listenHost = "127.0.0.1"; diff --git a/hosts/server7/hydra.svg b/hosts/server7/hydra.svg new file mode 100644 index 00000000..d0b05e02 --- /dev/null +++ b/hosts/server7/hydra.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + FLAKES diff --git a/hosts/server7/nix-serve.nix b/hosts/server7/nix-serve.nix new file mode 100644 index 00000000..40fef2ac --- /dev/null +++ b/hosts/server7/nix-serve.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + services.nix-serve = { + enable = true; + secretKeyFile = "/var/cache-priv-key.pem"; + }; +} diff --git a/lib/hq.nix b/lib/hq.nix index 583d19ed..1ac49121 100644 --- a/lib/hq.nix +++ b/lib/hq.nix @@ -1,14 +1,21 @@ -{ config, ... }: +{ config, lib, ... }: -{ +let + notHydra = config.networking.hostName != "hydra"; + notServer7 = config.networking.hostName != "server7"; + port = toString config.services.nix-serve.port; +in { networking.domain = "hq.c3d2.de"; - nix = if config.networking.hostName == "hydra" then - { } - else { - binaryCaches = [ "https://nix-serve.hq.c3d2.de" ]; - binaryCachePublicKeys = - [ "nix-serve.hq.c3d2.de:FEi9GyFkou1Ua8INaEKmuGaww9E5y3XwrNGNRfKYeLo=" ]; + nix = { + binaryCaches = [ ] + ++ (lib.optional notHydra "http://hydra.hq.c3d2.de:${port}") + ++ (lib.optional notServer7 "http://server7.hq.c3d2.de:${port}"); + + binaryCachePublicKeys = [ + "nix-serve.hq.c3d2.de:FEi9GyFkou1Ua8INaEKmuGaww9E5y3XwrNGNRfKYeLo=" + "server7:PxMuG2KvTibHSqOWi+6bY6fbv2ztjzbSEZHVIna/sRA=" + ]; }; users.motd = builtins.readFile ./motd;