From 5bb277b1a123be7274a503b5a5fe1ceefac704b7 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci <36405135+chrnin@users.noreply.github.com> Date: Tue, 7 Jan 2025 23:50:23 +0100 Subject: [PATCH 01/19] Update nixunits.nix --- src/nixunits.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nixunits.nix b/src/nixunits.nix index 9102fb2..87a24f8 100644 --- a/src/nixunits.nix +++ b/src/nixunits.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { platforms = platforms.linux; maintainers = [ maintainers.evoo ]; }; - nativeBuildInputs = with pkgs; [ jq ]; + nativeBuildInputs = with pkgs; [ jq util-linux ]; # phases = ["buildPhase"]; } From 71a313e5752b4606623d269a8f807353231b57ad Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 22:26:36 +0100 Subject: [PATCH 02/19] first workflow (broken) --- .github/workflows/tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f3d0b56 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,18 @@ +name: run-tests + on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + - run: nix-build From 05e28aadd129ddf1566e1dcfa1d22661ab9cb5c5 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 22:30:25 +0100 Subject: [PATCH 03/19] fix first error --- .github/workflows/tests.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f3d0b56..55f7e8a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,11 +1,12 @@ name: run-tests - on: - pull_request: - branches: - - main - push: - branches: - - main + +on: + pull_request: + branches: + - main + push: + branches: + - main jobs: test: @@ -15,4 +16,4 @@ jobs: - uses: cachix/install-nix-action@v27 with: nix_path: nixpkgs=channel:nixos-unstable - - run: nix-build + - run: nix develop .#CI --command=test From aa11de6a6bb468152149618ade77f202635878d6 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 22:32:13 +0100 Subject: [PATCH 04/19] fix second error --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 55f7e8a..d858bfd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,10 +3,10 @@ name: run-tests on: pull_request: branches: - - main + - main push: branches: - - main + - main jobs: test: From 11c0327b64f187d17518f282989086e7e1a4f744 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 22:49:53 +0100 Subject: [PATCH 05/19] test de l'environnement --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d858bfd..9321721 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,4 +16,6 @@ jobs: - uses: cachix/install-nix-action@v27 with: nix_path: nixpkgs=channel:nixos-unstable - - run: nix develop .#CI --command=test + - run: | + nix develop + nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6 From 594b7633fe52ff1bba73e5e833a2df52e07aaac4 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:00:14 +0100 Subject: [PATCH 06/19] test de l'environnement --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9321721..584b5ac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,5 +17,4 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - run: | - nix develop - nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6 + nix develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From c14796b6e446f66cf94760e933718a6be8eeb037 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:03:53 +0100 Subject: [PATCH 07/19] essai avec sudo --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 584b5ac..dbc4c24 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,4 +17,4 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - run: | - nix develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' + sudo nix develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From 3b72829017c78351c0728bfe66177fa6e745a860 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:08:45 +0100 Subject: [PATCH 08/19] another sudo flavor --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dbc4c24..f4f5713 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,4 +17,4 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - run: | - sudo nix develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' + nix develop --command bash -c 'sudo nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From 597606fd4fa261cc6970c08f507cc613bab8b987 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:13:07 +0100 Subject: [PATCH 09/19] with nixos/nix container image ? --- .github/workflows/tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4f5713..9997a6b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,10 +11,8 @@ on: jobs: test: runs-on: ubuntu-latest + container: nixos/nix steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v27 - with: - nix_path: nixpkgs=channel:nixos-unstable - run: | - nix develop --command bash -c 'sudo nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' + nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From bf17561c41f971c44a764443abd9d3d23ae205bc Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:17:35 +0100 Subject: [PATCH 10/19] another flavor of docker --- .github/workflows/tests.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9997a6b..dbc6cf7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,5 +14,11 @@ jobs: container: nixos/nix steps: - uses: actions/checkout@v4 - - run: | - nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' + - name: Run moi ça… + - name: Run in NixOS + uses: addnab/docker-run-action@v3 + with: + image: nixos/nix + options: --privileged # si nécessaire pour certaines fonctionnalités de Nix + run: | + nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From e73416baf4dd05efb80f022ecaf53f18208c118b Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:18:14 +0100 Subject: [PATCH 11/19] with correct yml --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dbc6cf7..865bfbb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run moi ça… - - name: Run in NixOS uses: addnab/docker-run-action@v3 with: image: nixos/nix From 90c6a4e1477823a73da685f7bc2e2dc7d9631931 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:19:49 +0100 Subject: [PATCH 12/19] gngngn --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 865bfbb..61374c3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,9 +15,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run moi ça… - uses: addnab/docker-run-action@v3 - with: - image: nixos/nix - options: --privileged # si nécessaire pour certaines fonctionnalités de Nix - run: | - nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' + uses: addnab/docker-run-action@v3 + with: + image: nixos/nix + options: --privileged # si nécessaire pour certaines fonctionnalités de Nix + run: | + nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From cd17b7d124e49038d55bb160d94af47abf68c775 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:23:46 +0100 Subject: [PATCH 13/19] no container for runner --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 61374c3..21a4066 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,6 @@ on: jobs: test: runs-on: ubuntu-latest - container: nixos/nix steps: - uses: actions/checkout@v4 - name: Run moi ça… From 588dadfa2c6fe3f0c6998b51b28cb2fc2b988fda Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:27:31 +0100 Subject: [PATCH 14/19] tentative de monter le workspace github dans le conteneur nixos --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 21a4066..3a30b0e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,6 +17,9 @@ jobs: uses: addnab/docker-run-action@v3 with: image: nixos/nix - options: --privileged # si nécessaire pour certaines fonctionnalités de Nix + options: >- + --privileged # si nécessaire pour certaines fonctionnalités de Nix + -v ${{ github.workspace }}:/workspace run: | + cd /workspace nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From e9b41fe222dc82e950b5390207c39d2975228f4f Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:29:15 +0100 Subject: [PATCH 15/19] =?UTF-8?q?touiller=20jusqu'=C3=A0=20obtenir=20une?= =?UTF-8?q?=20constitance=20lisse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a30b0e..189a9b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: image: nixos/nix options: >- --privileged # si nécessaire pour certaines fonctionnalités de Nix - -v ${{ github.workspace }}:/workspace run: | - cd /workspace + pwd + cd / nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From 5eb0bb2602a3a456778b8573e7c1c5550e369bc1 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:30:07 +0100 Subject: [PATCH 16/19] hmmmm me gusta --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 189a9b9..a746b9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,8 +17,7 @@ jobs: uses: addnab/docker-run-action@v3 with: image: nixos/nix - options: >- - --privileged # si nécessaire pour certaines fonctionnalités de Nix + options: --privileged # si nécessaire pour certaines fonctionnalités de Nix run: | pwd cd / From 365b33842bc42f7c800b8483df2bed606fb4f0ae Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:33:09 +0100 Subject: [PATCH 17/19] workspace odyssey --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a746b9c..a743f56 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,8 +17,8 @@ jobs: uses: addnab/docker-run-action@v3 with: image: nixos/nix - options: --privileged # si nécessaire pour certaines fonctionnalités de Nix + options: --privileged -v ${{ github.workspace }}:/workspace run: | - pwd - cd / + cd /workspace + ls nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From 9548aa8781b75496a1ee873860d974624925a71c Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:35:59 +0100 Subject: [PATCH 18/19] un peu d'introspection --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a743f56..f0c7a4e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,6 +19,6 @@ jobs: image: nixos/nix options: --privileged -v ${{ github.workspace }}:/workspace run: | + whoami cd /workspace - ls nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6' From 6e6b5fbf6b40b55da71f93928d7ae3e2bec9fad6 Mon Sep 17 00:00:00 2001 From: Christophe Ninucci Date: Tue, 7 Jan 2025 23:38:16 +0100 Subject: [PATCH 19/19] hackish lorraine --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f0c7a4e..d879766 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,6 +19,7 @@ jobs: image: nixos/nix options: --privileged -v ${{ github.workspace }}:/workspace run: | - whoami - cd /workspace + cp /workspace /tmp/workspace -r + chown root: /tmp/workspace -R + cd /tmp/workspace nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command bash -c 'nixunits build TOTO -cc "{ services.httpd.enable = true; }" -6'