DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

8534cd08221f6a00e2ff3888a0889291253eef7c — Jonni Liljamo 2 months ago 0796578
wip(systems/hosts/sqbuilds): fix to some degree
1 files changed, 51 insertions(+), 13 deletions(-)

M systems/hosts/sqbuilds/default.nix
M systems/hosts/sqbuilds/default.nix => systems/hosts/sqbuilds/default.nix +51 -13
@@ 1,5 1,6 @@
{
  config,
  lib,
  pkgs,
  ...
}: {


@@ 27,7 28,7 @@

  services.sourcehut = {
    enable = true;
    redis.enable = true;
    redis.enable = false;
    settings = {
      "sr.ht" = {
        owner-email = "jonni@liljamo.com";


@@ 51,6 52,7 @@
        migrate-on-upgrade = false;
        origin = "https://builds.src.quest";
        connection-string = "postgresql://buildsrht@gostir:5432/builds.sr.ht?sslmode=disable";
        redis = "redis://gostir:6379/2";

        oauth-client-id = "b239c860-1507-4398-bd56-969c2ac9a5d1";
        oauth-client-secret = config.sops.secrets."srht/builds/clientSecret".path;


@@ 62,24 64,60 @@
      };
      "meta.sr.ht".origin = "https://meta.src.quest";
    };
    meta = {
      enable = true; # FIXME: runner should not need, but the config file is
      #        not generated if not enabled...
      redis.host = "redis://gostir:6379/0";
    };
    builds = {
      enable = true;
      redis.host = "redis://gostir:6379/0";
      enableWorker = true;
      images = let
        pkgs_unstable = builtins.fetchGit {
          url = "https://github.com/NixOS/nixpkgs";
          # NOTE: last updated 29.8.2024
          rev = "a6292e34000dc93d43bccf78338770c1c5ec8a99";
          ref = "nixos-unstable";
        };
        image_from_nixpkgs = pkgs_unstable: (import "${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix" {
          pkgs = import pkgs_unstable {system = "x86_64-linux";};
        });
      in {
        nixos.unstable.x86_64 = image_from_nixpkgs pkgs_unstable;
      images = {
        #nixos.unstable.x86_64 = image_from_nixpkgs pkgs_unstable;
        /*
          nixos."24.05".x86_64 = let # TODO: current buildsrht version is out of date,
                                     #       and doesn't have 24.05
          pkgs_stable = builtins.fetchGit {
            url = "https://github.com/NixOS/nixpkgs";
            # NOTE: last updated 1.9.2024
            rev = "6e99f2a27d600612004fbd2c3282d614bfee6421";
            ref = "nixos-24.05";
          };
          pkgs = import pkgs_stable {system = "x86_64-linux";};
          image = pkgs_unstable: (import "${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix" {
            pkgs = pkgs;
            hostPlatform = "x86_64-linux";
          });
        in
          image pkgs;
        */
        nixos.unstable.x86_64 = let
          # TODO: this is lying to the system, but whatever
          pkgs_stable = builtins.fetchGit {
            url = "https://github.com/NixOS/nixpkgs";
            # NOTE: last updated 1.9.2024
            rev = "6e99f2a27d600612004fbd2c3282d614bfee6421";
            ref = "nixos-24.05";
          };
          pkgs = import pkgs_stable {system = "x86_64-linux";};
          image = pkgs_unstable: (import "${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix" {
            pkgs = pkgs;
            hostPlatform = "x86_64-linux";
          });
        in
          image pkgs;
      };
    };
  };

  # NOTE: the following services are not required, but are enabled by the
  #       options defined above, yes the module needs some work
  systemd.services."metasrht".wantedBy = lib.mkForce [];
  systemd.services."metasrht-api".wantedBy = lib.mkForce [];
  systemd.services."metasrht-webhooks".wantedBy = lib.mkForce [];

  systemd.services."buildsrht-api".wantedBy = lib.mkForce [];

  system.stateVersion = "24.05";
}