Compare commits
	
		
			50 Commits
		
	
	
		
			0efcf8f3fc
			...
			4f6e2c3369
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4f6e2c3369 | |||
| f9ba8473d2 | |||
| 20b7117560 | |||
| aa7121fe93 | |||
| 6929594da9 | |||
| 8f76ad3037 | |||
| 5a2f7eee0d | |||
| 3c5f72aed0 | |||
| ae3dc094f9 | |||
| 7160858f57 | |||
| 883a9fb28f | |||
| 4c4ee017e0 | |||
| feb006a99d | |||
| 6575977ce1 | |||
| 80774e8778 | |||
| 9af90be28b | |||
| fba5ac6c2b | |||
| 307dee979a | |||
| df9a227358 | |||
| f332e415cf | |||
| 1040a10e16 | |||
| ad198eb473 | |||
| b3b9e58ea3 | |||
| c44ab55aa0 | |||
| 71ba560b37 | |||
| cd5df4cb29 | |||
| ababb5b6b7 | |||
| 2a8f76e955 | |||
| de17d7c9dd | |||
| 82c2bf81b7 | |||
| a48c0a3b2a | |||
| e019fccbd2 | |||
| 358a0ffeed | |||
| 908b9c7b29 | |||
| f4b3ec91eb | |||
| bdc0dd5656 | |||
| d9127c7623 | |||
| c99b8619b8 | |||
| c2dd0b3330 | |||
| 90601f7744 | |||
| 97318fed84 | |||
| 34bc79b30d | |||
| 233cfce663 | |||
| 2cc4973a88 | |||
| d47198998b | |||
| da9193067d | |||
| 886c4c5250 | |||
| b83f28df91 | |||
| b913e5b2f8 | |||
| 1b6b284fa3 | 
							
								
								
									
										38
									
								
								.gitea/workflows/check-flake.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								.gitea/workflows/check-flake.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
name: Check Flake
 | 
			
		||||
 | 
			
		||||
on: [push]
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  DEBIAN_FRONTEND: noninteractive
 | 
			
		||||
  PATH: /run/current-system/sw/bin/:/nix/var/nix/profiles/per-user/gitea-runner/profile/bin
 | 
			
		||||
 | 
			
		||||
# defaults:
 | 
			
		||||
#   run:
 | 
			
		||||
#     shell: nix shell nixpkgs#nodejs-18_x
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  check-flake:
 | 
			
		||||
    runs-on: nixos
 | 
			
		||||
    steps:
 | 
			
		||||
      # - run: node --version
 | 
			
		||||
      # - name: Install basic dependencies
 | 
			
		||||
      #   run: apt-get update && apt-get install -y --no-install-recommends sudo curl ca-certificates xz-utils
 | 
			
		||||
 | 
			
		||||
      # - name: Install Nix
 | 
			
		||||
      #   uses: https://github.com/cachix/install-nix-action@v20
 | 
			
		||||
      #   with:
 | 
			
		||||
      #     github_access_token: ${{ secrets.__GITHUB_TOKEN }}
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: nix profile install nixpkgs#nodejs-18_x
 | 
			
		||||
 | 
			
		||||
      - name: Checkout the repository
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
        with:
 | 
			
		||||
          fetch-depth: 0
 | 
			
		||||
 | 
			
		||||
      # - name: Get ENV var names
 | 
			
		||||
      #   run: printenv | cut -d'=' -f1
 | 
			
		||||
 | 
			
		||||
      - name: Check Flake
 | 
			
		||||
        run: nix flake check --show-trace
 | 
			
		||||
@ -11,12 +11,6 @@ in
 | 
			
		||||
      type = lib.types.str;
 | 
			
		||||
      description = lib.mdDoc "gitea runner data directory.";
 | 
			
		||||
    };
 | 
			
		||||
    instanceUrl = lib.mkOption {
 | 
			
		||||
      type = lib.types.str;
 | 
			
		||||
    };
 | 
			
		||||
    registrationTokenFile = lib.mkOption {
 | 
			
		||||
      type = lib.types.path;
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf cfg.enable {
 | 
			
		||||
@ -35,13 +29,6 @@ in
 | 
			
		||||
    };
 | 
			
		||||
    users.groups.gitea-runner = { };
 | 
			
		||||
 | 
			
		||||
    # registration token
 | 
			
		||||
    services.gitea-runner.registrationTokenFile = "/run/agenix/gitea-runner-registration-token";
 | 
			
		||||
    age.secrets.gitea-runner-registration-token = {
 | 
			
		||||
      file = ../../secrets/gitea-runner-registration-token.age;
 | 
			
		||||
      owner = "gitea-runner";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    systemd.services.gitea-runner = {
 | 
			
		||||
      description = "Gitea Runner";
 | 
			
		||||
 | 
			
		||||
@ -57,40 +44,7 @@ in
 | 
			
		||||
 | 
			
		||||
      path = with pkgs; [ gitea-actions-runner ];
 | 
			
		||||
 | 
			
		||||
      # based on https://gitea.com/gitea/act_runner/src/branch/main/run.sh
 | 
			
		||||
      script = ''
 | 
			
		||||
        . ${cfg.registrationTokenFile}
 | 
			
		||||
 | 
			
		||||
        if [[ ! -s .runner ]]; then
 | 
			
		||||
          try=$((try + 1))
 | 
			
		||||
          success=0
 | 
			
		||||
 | 
			
		||||
          LOGFILE="$(mktemp)"
 | 
			
		||||
 | 
			
		||||
          # The point of this loop is to make it simple, when running both act_runner and gitea in docker,
 | 
			
		||||
          # for the act_runner to wait a moment for gitea to become available before erroring out.  Within
 | 
			
		||||
          # the context of a single docker-compose, something similar could be done via healthchecks, but
 | 
			
		||||
          # this is more flexible.
 | 
			
		||||
          while [[ $success -eq 0 ]] && [[ $try -lt ''${10:-10} ]]; do
 | 
			
		||||
            act_runner register \
 | 
			
		||||
              --instance "${cfg.instanceUrl}" \
 | 
			
		||||
              --token    "$GITEA_RUNNER_REGISTRATION_TOKEN" \
 | 
			
		||||
              --name     "${config.networking.hostName}" \
 | 
			
		||||
              --no-interactive > $LOGFILE 2>&1
 | 
			
		||||
 | 
			
		||||
            cat $LOGFILE
 | 
			
		||||
 | 
			
		||||
            cat $LOGFILE | grep 'Runner registered successfully' > /dev/null
 | 
			
		||||
            if [[ $? -eq 0 ]]; then
 | 
			
		||||
              echo "SUCCESS"
 | 
			
		||||
              success=1
 | 
			
		||||
            else
 | 
			
		||||
              echo "Waiting to retry ..."
 | 
			
		||||
              sleep 5
 | 
			
		||||
            fi
 | 
			
		||||
          done
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        exec act_runner daemon
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -6,8 +6,5 @@
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  networking.hostName = "phil";
 | 
			
		||||
  services.gitea-runner = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    instanceUrl = "https://git.neet.dev";
 | 
			
		||||
  };
 | 
			
		||||
  services.gitea-runner.enable = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,12 @@
 | 
			
		||||
 | 
			
		||||
  networking.hostName = "s0";
 | 
			
		||||
 | 
			
		||||
  system.autoUpgrade.enable = true;
 | 
			
		||||
  # system.autoUpgrade.enable = true;
 | 
			
		||||
 | 
			
		||||
  # gitea runner and allow it to build ARM derivations
 | 
			
		||||
  services.gitea-runner.enable = true;
 | 
			
		||||
  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
 | 
			
		||||
  nix.gc.automatic = lib.mkForce false; # allow the nix store to serve as a build cache
 | 
			
		||||
 | 
			
		||||
  services.iperf3.enable = true;
 | 
			
		||||
  services.iperf3.openFirewall = true;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user