From 8293c6593e26bc203bae61cbc7af3fb0db5ce0ae Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Fri, 17 Dec 2021 18:59:35 +0100 Subject: [PATCH] Trying hydra --- flake.nix | 3 +++ machines/newton.nix | 21 +++++++++++++++++++++ modules/nix/default.nix | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ae7a38a..2b3c467 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,9 @@ (builtins.attrNames (builtins.readDir ./modules))); nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines); + hydraJobs = (nixpkgs.lib.mapAttrs' (name: config: + nixpkgs.lib.nameValuePair "nixos-${name}" + config.config.system.build.toplevel) self.nixosConfigurations); }; } diff --git a/machines/newton.nix b/machines/newton.nix index 7eba21d..0670e24 100644 --- a/machines/newton.nix +++ b/machines/newton.nix @@ -14,7 +14,28 @@ in }; }; + services.hydra = { + enable = true; + hydraURL = "https://hydra.julienmalka.me"; # externally visible URL + notificationSender = "hydra@localhost"; # e-mail of hydra service + port = 9876; # Default + # a standalone hydra will require you to unset the buildMachinesFiles list to avoid using a nonexistant /etc/nix/machines + buildMachinesFiles = [ ]; + # you will probably also want, otherwise *everything* will be built from scratch + useSubstitutes = true; + }; + + services.nginx = { + enable = true; + virtualHosts = { + "hydra.julienmalka.me" = { + forceSSL = true; + enableACME = true; + locations."/" = { proxyPass = "http://127.0.0.1:9876"; }; + }; + }; + }; boot.loader.grub.enable = true; boot.loader.grub.version = 2; boot.supportedFilesystems = [ "zfs" ]; diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 26c08fd..8e4a177 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -12,7 +12,7 @@ with lib; { nix = { autoOptimiseStore = true; - allowedUsers = [ "julien" ]; + allowedUsers = [ "julien" "hydra" ]; gc = { automatic = true; dates = "daily";