Skip to content

Commit

Permalink
Reorganize hydra modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Jan 25, 2024
1 parent 945c3bc commit 29a979a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ t/jobs/declarative/project.json
hydra-config.h
hydra-config.h.in
result
result-*
outputs
config
stamp-h1
Expand Down
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ endif

BOOTCLEAN_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = hydra-module.nix
EXTRA_DIST = nixos-modules/hydra.nix

install-data-local: hydra-module.nix
install-data-local: nixos-modules/hydra.nix
$(INSTALL) -d $(DESTDIR)$(datadir)/nix
$(INSTALL_DATA) hydra-module.nix $(DESTDIR)$(datadir)/nix/
$(INSTALL_DATA) nixos-modules/hydra.nix $(DESTDIR)$(datadir)/nix/hydra-module.nix
50 changes: 5 additions & 45 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
systems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = nixpkgs.lib.genAttrs systems;

overlayList = [ self.overlays.default nix.overlays.default ];

pkgsBySystem = forEachSystem (system: import nixpkgs {
inherit system;
overlays = [ self.overlays.default nix.overlays.default ];
overlays = overlayList;
});

# NixOS configuration used for VM tests.
Expand Down Expand Up @@ -386,50 +388,8 @@
default = pkgsBySystem.${system}.hydra;
});

nixosModules.hydra = {
imports = [ ./hydra-module.nix ];
nixpkgs.overlays = [ self.overlays.default nix.overlays.default ];
};

nixosModules.hydraTest = { pkgs, ... }: {
imports = [ self.nixosModules.hydra ];

services.hydra-dev.enable = true;
services.hydra-dev.hydraURL = "http://hydra.example.org";
services.hydra-dev.notificationSender = "[email protected]";

systemd.services.hydra-send-stats.enable = false;

services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql_11;

# The following is to work around the following error from hydra-server:
# [error] Caught exception in engine "Cannot determine local time zone"
time.timeZone = "UTC";

nix.extraOptions = ''
allowed-uris = https://github.com/
'';
};

nixosModules.hydraProxy = {
services.httpd = {
enable = true;
adminAddr = "[email protected]";
extraConfig = ''
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /apache-errors !
ErrorDocument 503 /apache-errors/503.html
ProxyPass / http://127.0.0.1:3000/ retry=5 disablereuse=on
ProxyPassReverse / http://127.0.0.1:3000/
'';
};
nixosModules = import ./nixos-modules {
overlays = overlayList;
};

nixosConfigurations.container = nixpkgs.lib.nixosSystem {
Expand Down
49 changes: 49 additions & 0 deletions nixos-modules/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ overlays }:

rec {
hydra = {
imports = [ ./hydra.nix ];
nixpkgs = { inherit overlays; };
};

hydraTest = { pkgs, ... }: {
imports = [ hydra ];

services.hydra-dev.enable = true;
services.hydra-dev.hydraURL = "http://hydra.example.org";
services.hydra-dev.notificationSender = "[email protected]";

systemd.services.hydra-send-stats.enable = false;

services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql_11;

# The following is to work around the following error from hydra-server:
# [error] Caught exception in engine "Cannot determine local time zone"
time.timeZone = "UTC";

nix.extraOptions = ''
allowed-uris = https://github.com/
'';
};

hydraProxy = {
services.httpd = {
enable = true;
adminAddr = "[email protected]";
extraConfig = ''
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /apache-errors !
ErrorDocument 503 /apache-errors/503.html
ProxyPass / http://127.0.0.1:3000/ retry=5 disablereuse=on
ProxyPassReverse / http://127.0.0.1:3000/
'';
};
};
}
File renamed without changes.
2 changes: 1 addition & 1 deletion package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ stdenv.mkDerivation (finalAttrs: {
./Makefile.am
./src
./doc
./hydra-module.nix
./nixos-modules/hydra.nix
# These are always needed to appease Automake
./t/Makefile.am
./t/jobs/config.nix.in
Expand Down

0 comments on commit 29a979a

Please sign in to comment.