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";