Skip to content

Commit b35a1bb

Browse files
MartinNikovPetarKirov
authored andcommitted
config(github/install-nix): Add gitlab token and domain
1 parent 02ef5f5 commit b35a1bb

File tree

6 files changed

+55
-1
lines changed

6 files changed

+55
-1
lines changed

.github/install-nix/action.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ inputs:
2020
description: GitHub token to add as access-token in nix.conf
2121
default: ''
2222
required: false
23+
nix-gitlab-token:
24+
description: GitLab token to add as access-token in nix.conf
25+
default: ''
26+
required: false
27+
nix-gitlab-domain:
28+
description: GitLab domain to add as access-token in nix.conf
29+
default: 'gitlab.com'
30+
required: false
2331

2432
runs:
2533
using: 'composite'
@@ -34,7 +42,15 @@ runs:
3442
mkdir -p $HOME/.config/nix
3543
3644
cat << EOF > "$HOME/.config/nix/nix.conf"
37-
${{ inputs.nix-github-token != '' && format('access-tokens = github.com={0}', inputs.nix-github-token) || '' }}
45+
${{
46+
(inputs.nix-github-token != '' && inputs.nix-gitlab-token != '' && inputs.nix-gitlab-domain != '' &&
47+
format('access-tokens = github.com={0} {1}=PAT:{2}', inputs.nix-github-token, inputs.nix-gitlab-domain, inputs.nix-gitlab-token)) ||
48+
(inputs.nix-github-token != '' &&
49+
format('access-tokens = github.com={0}', inputs.nix-github-token)) ||
50+
(inputs.nix-gitlab-token != '' && inputs.nix-gitlab-domain != '' &&
51+
format('access-tokens = {0}=PAT:{1}', inputs.nix-gitlab-domain, inputs.nix-gitlab-token)) ||
52+
''
53+
}}
3854
allow-import-from-derivation = true
3955
substituters = https://cache.nixos.org ${{inputs.substituters}}
4056
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ${{inputs.trusted-public-keys}}

.github/print-matrix/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ inputs:
2828
description: GitHub token to add as access-token in nix.conf
2929
default: ''
3030
required: false
31+
nix-gitlab-token:
32+
description: GitLab token to add as access-token in nix.conf
33+
default: ''
34+
required: false
35+
nix-gitlab-domain:
36+
description: GitLab domain to add as access-token in nix.conf
37+
default: 'gitlab.com'
38+
required: false
3139

3240
outputs:
3341
matrix:
@@ -48,6 +56,8 @@ runs:
4856
trusted-public-keys: ${{ inputs.trusted-public-keys }}
4957
substituters: ${{ inputs.substituters }}
5058
nix-github-token: ${{ inputs.nix-github-token }}
59+
nix-gitlab-token: ${{ inputs.nix-gitlab-token }}
60+
nix-gitlab-domain: ${{ inputs.nix-gitlab-domain }}
5161

5262
- name: Print CI Matrix
5363
id: print-matrix

.github/workflows/reusable-flake-checks-ci-matrix.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ on:
2424
NIX_GITHUB_TOKEN:
2525
description: GitHub token to add as access-token in nix.conf
2626
required: false
27+
NIX_GITLAB_TOKEN:
28+
description: GitLab token to add as access-token in nix.conf
29+
required: false
2730

2831
jobs:
2932
post-initial-comment:
@@ -50,6 +53,8 @@ jobs:
5053
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
5154
substituters: ${{ vars.SUBSTITUTERS }}
5255
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
56+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
57+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
5358

5459
- uses: actions/checkout@v4
5560

@@ -78,6 +83,8 @@ jobs:
7883
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
7984
substituters: ${{ vars.SUBSTITUTERS }}
8085
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
86+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
87+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
8188

8289
- uses: actions/checkout@v4
8390

@@ -154,6 +161,8 @@ jobs:
154161
precalc_matrix: ${{ steps.matrix.outputs.fullMatrix }}
155162
pr-comment-github-token: ${{ secrets.GITHUB_TOKEN }}
156163
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
164+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
165+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
157166

158167
build:
159168
needs: slurp-matrix
@@ -178,6 +187,8 @@ jobs:
178187
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
179188
substituters: ${{ vars.SUBSTITUTERS }}
180189
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
190+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
191+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
181192

182193
- name: Build ${{ matrix.name }}
183194
run: |
@@ -205,6 +216,8 @@ jobs:
205216
precalc_matrix: ${{ needs.slurp-matrix.outputs.fullMatrix }}
206217
pr-comment-github-token: ${{ secrets.GITHUB_TOKEN }}
207218
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
219+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
220+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
208221

209222
- run: exit 1
210223
if: >-

.github/workflows/reusable-lint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
CACHIX_AUTH_TOKEN:
1818
description: 'Cachix auth token'
1919
required: true
20+
NIX_GITLAB_TOKEN:
21+
description: GitLab token to add as access-token in nix.conf
22+
required: false
2023

2124
jobs:
2225
lint:
@@ -28,6 +31,8 @@ jobs:
2831
uses: metacraft-labs/nixos-modules/.github/install-nix@main
2932
with:
3033
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
34+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
35+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
3136
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
3237
cachix-cache: ${{ vars.CACHIX_CACHE }}
3338
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}

.github/workflows/reusable-update-flake-lock.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
NIX_GITHUB_TOKEN:
2020
description: GitHub token to add as access-token in nix.conf
2121
required: false
22+
NIX_GITLAB_TOKEN:
23+
description: GitLab token to add as access-token in nix.conf
24+
required: false
2225
CACHIX_AUTH_TOKEN:
2326
description: 'Cachix auth token'
2427
required: true
@@ -51,6 +54,8 @@ jobs:
5154
uses: metacraft-labs/nixos-modules/.github/install-nix@main
5255
with:
5356
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
57+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
58+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
5459
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
5560
cachix-cache: ${{ vars.CACHIX_CACHE }}
5661
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}

.github/workflows/reusable-update-flake-packages.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
NIX_GITHUB_TOKEN:
1515
description: GitHub token to add as access-token in nix.conf
1616
required: false
17+
NIX_GITLAB_TOKEN:
18+
description: GitLab token to add as access-token in nix.conf
19+
required: false
1720
CACHIX_AUTH_TOKEN:
1821
description: 'Cachix auth token'
1922
required: true
@@ -42,6 +45,8 @@ jobs:
4245
uses: metacraft-labs/nixos-modules/.github/install-nix@main
4346
with:
4447
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
48+
nix-gitlab-token: ${{ secrets.NIX_GITLAB_TOKEN }}
49+
nix-gitlab-domain: ${{ vars.NIX_GITLAB_DOMAIN }}
4550
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
4651
cachix-cache: ${{ vars.CACHIX_CACHE }}
4752
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}

0 commit comments

Comments
 (0)