Hi Gergely,

 > Do we have some Amazon EC2 AMI that is ready to go for the whole nixpkgs
 > stuff and web interface and everything?

The problem with hydra.nixos.org is that the machine is so overloaded
that it manages only ~1 evaluation per day. This means that you'll have
to wait a day or two before you get feedback for a commit.

I used the nixops configuration attached below to spawn my own Hydra in
EC2. I haven't run it in a while, though, so it may have bit-rotted a
little. Anyway, I hope it helps.

Peter


{
  network.description = "Hydra Build Slave";

  machine = { config, pkgs, ... }: {

    require = [ /home/simons/src/hydra/hydra-module.nix ];

    nix = {
      extraOptions = ''
        trusted-binary-caches = http://hydra.nixos.org http://hydra.cryp.to
        build-cores = 0
      '';
      maxJobs = 4;              # this needs to be customized
      useChroot = true;
    };

    time.timeZone = "Europe/Berlin";

    environment.enableBashCompletion = true;

    i18n.defaultLocale = "en_US.UTF-8";

    users.extraUsers.hydra = {
      openssh.authorizedKeys.keyFiles = [ ./id_buildfarm.pub 
/home/simons/.ssh/id_dsa.pub ];
      password = "open sesame";
    };

    environment.etc = [
      { target = "nix/signing-key.pub"; source = ./nix-signing-key.pub; }
    ];

    services.openssh.usePAM = false;
    services.openssh.passwordAuthentication = false;

    services.nixosManual.showManual = false;

    services.ttyBackgrounds.enable = false;

    services.hydra = {
      enable = true;
      hydra = ((import /home/simons/src/hydra/release.nix {})).build {};
      hydraURL = "http://hydra.cryp.to";;
      notificationSender = "[email protected]";
      port = 8080;
    };

    systemd.services.hydra-db-setup = {
      description = "Create the PostgresSQL user and database for Hydra";
      serviceConfig.Type = "oneshot";
      serviceConfig.RemainAfterExit = true;
      before = [ "hydra-init.service" ];
      wantedBy = [ "hydra-init.service" ];
      script = ''
        if [ ! -e ~hydra/.pgpass ]; then
          ${pkgs.postgresql}/bin/createuser -S -D -R hydra
          ${pkgs.postgresql}/bin/createdb -O hydra hydra
          ${pkgs.postgresql}/bin/psql hydra -c "ALTER USER hydra with password 
'${config.users.extraUsers.hydra.password}';"
          echo >~hydra/.pgpass 
'localhost:*:hydra:hydra:${config.users.extraUsers.hydra.password}'
          chown hydra ~hydra/.pgpass
          chmod 400 ~hydra/.pgpass
        fi
      '';
      # echo "INSERT INTO Users(userName, emailAddress, password) VALUES 
('root', '[email protected]', '$(echo -n foobar | sha1sum | cut -c1-40)');" 
| psql hydra
      # echo "INSERT INTO UserRoles(userName, role) values('root', 'admin');" | 
psql hydra
    };

    services.postgresql = {
      enable = true;
    };
  };
}
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to