diff --git a/.github/actions/install-nix/action.yml b/.github/actions/install-nix/action.yml index 881fac1b5b..c7f300d6b0 100644 --- a/.github/actions/install-nix/action.yml +++ b/.github/actions/install-nix/action.yml @@ -16,7 +16,7 @@ runs: - name: Load dependencies if: ${{ runner.environment == 'self-hosted' }} run: | - nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-common + nix run ./.nix#nix-develop-gha -- ./.nix#gha-common shell: bash - uses: cachix/cachix-action@v14 diff --git a/.github/include/ci.py b/.github/include/ci.py index fa12c27568..a138a53de8 100755 --- a/.github/include/ci.py +++ b/.github/include/ci.py @@ -54,7 +54,7 @@ async def get_kernel_path(kernel_name: str) -> str: "build", "--no-link", "--print-out-paths", - f"./.github/include#kernel_{kernel_name}", + f"./.nix#kernel_{kernel_name}", ] ) return stdout.strip() + "/bzImage" @@ -219,8 +219,8 @@ async def run_format(): if nix_files: await run_command( ["nix", "--extra-experimental-features", "nix-command flakes", "fmt"] - + [os.path.join("../../", x) for x in nix_files], - cwd=".github/include", + + [os.path.join("../", x) for x in nix_files], + cwd=".nix", no_capture=True, ) @@ -600,7 +600,7 @@ async def generate_readable_output(result): if verdict != "success": prog_name = cleaned_row.get("prog_name", "") if prog_name: - reproduction_cmd = f"nix run \".github/include#ci\" veristat {result['kernel']} {result['scheduler']} {prog_name}" + reproduction_cmd = f"nix run \".nix#ci\" veristat {result['kernel']} {result['scheduler']} {prog_name}" reproduction_cmds.add(reproduction_cmd) for cmd in sorted(reproduction_cmds): diff --git a/.github/include/list-integration-tests.py b/.github/include/list-integration-tests.py old mode 100644 new mode 100755 diff --git a/.github/include/update-kernels.py b/.github/include/update-kernels.py old mode 100644 new mode 100755 diff --git a/.github/workflows/build-kernels.yml b/.github/workflows/build-kernels.yml index 0eda6513cd..17424c8bd9 100644 --- a/.github/workflows/build-kernels.yml +++ b/.github/workflows/build-kernels.yml @@ -15,14 +15,14 @@ jobs: cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Load dependencies - run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-build-kernels + run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-build-kernels - name: Build all kernels id: nix-build run: | - drvnames=$(nix flake show ./.github/include --json | jq -r ' + drvnames=$(nix flake show ./.nix --json | jq -r ' .packages["x86_64-linux"] | keys[] | select(startswith("kernel_"))' | - awk '{ print "./.github/include#" $0 "\n./.github/include#" $0 ".headers" }') + awk '{ print "./.nix#" $0 "\n./.nix#" $0 ".headers" }') echo 'kernel-paths<> $GITHUB_OUTPUT xargs nix build --no-link --print-out-paths <<< "$drvnames" >>$GITHUB_OUTPUT diff --git a/.github/workflows/caching-build.yml b/.github/workflows/caching-build.yml index 03f0f93551..1e8e87de77 100644 --- a/.github/workflows/caching-build.yml +++ b/.github/workflows/caching-build.yml @@ -23,10 +23,10 @@ jobs: cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Format - run: nix run ./.github/include#ci -- format + run: nix run ./.nix#ci -- format - name: Clippy - run: nix run ./.github/include#ci -- clippy + run: nix run ./.nix#ci -- clippy build-and-test: runs-on: ${{ github.repository_owner == 'sched-ext' && fromJSON('[ "self-hosted", "linux", "x64", "metal:nixos" ]') || 'ubuntu-latest' }} @@ -40,13 +40,13 @@ jobs: cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build - run: nix run ./.github/include#ci -- build + run: nix run ./.nix#ci -- build - name: Test - run: nix run ./.github/include#ci -- test + run: nix run ./.nix#ci -- test - name: Veristat - run: nix run ./.github/include#ci -- veristat + run: nix run ./.nix#ci -- veristat integration-test: uses: ./.github/workflows/integration-tests.yml @@ -65,7 +65,7 @@ jobs: NEEDS_CONTEXT: ${{ toJSON(needs) }} steps: - uses: actions/checkout@v4 - - run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-build-kernels + - run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-build-kernels - run: echo "$NEEDS_CONTEXT" | jq -e 'to_entries | all(.value.result == "success")' pages: diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index de41e96ca2..37696e7a23 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -23,7 +23,7 @@ jobs: - name: List tests id: output - run: nix run ./.github/include#list-integration-tests -- "${{ inputs.repo-name }}" >> $GITHUB_OUTPUT + run: nix run ./.nix#list-integration-tests -- "${{ inputs.repo-name }}" >> $GITHUB_OUTPUT integration-test: runs-on: ubuntu-24.04 @@ -67,8 +67,8 @@ jobs: fi echo "KERNEL_NAME=$KERNEL_NAME" >> $GITHUB_ENV - echo "KERNEL_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}")" >> $GITHUB_ENV - echo "KERNEL_HEADERS_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}".headers)" >> $GITHUB_ENV + echo "KERNEL_STORE_PATH=$(nix build --no-link --print-out-paths ./.nix#"kernel_${KERNEL_NAME}")" >> $GITHUB_ENV + echo "KERNEL_HEADERS_STORE_PATH=$(nix build --no-link --print-out-paths ./.nix#"kernel_${KERNEL_NAME}".headers)" >> $GITHUB_ENV # cache virtiofsd (goes away w/ 24.04) - name: Cache virtiofsd @@ -133,5 +133,5 @@ jobs: NEEDS_CONTEXT: ${{ toJSON(needs) }} steps: - uses: actions/checkout@v4 - - run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-build-kernels + - run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-build-kernels - run: echo "$NEEDS_CONTEXT" | jq -e 'to_entries | all(.value.result == "success")' diff --git a/.github/workflows/update-kernels.yml b/.github/workflows/update-kernels.yml index 8ed723fbab..40f47626ba 100644 --- a/.github/workflows/update-kernels.yml +++ b/.github/workflows/update-kernels.yml @@ -18,7 +18,7 @@ jobs: cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Load dependencies - run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-update-kernels + run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-update-kernels - name: List kernels id: output @@ -45,7 +45,7 @@ jobs: cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Load dependencies - run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-update-kernels + run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-update-kernels - name: Update kernel run: | @@ -55,7 +55,7 @@ jobs: INITIAL_COMMIT=$(git rev-parse HEAD) git switch -c "deps/kernel/${{ matrix.version }}" - nix run ./.github/include#update-kernels -- ${{ matrix.version }} + nix run ./.nix#update-kernels -- ${{ matrix.version }} FINAL_COMMIT=$(git rev-parse HEAD) if [ "$INITIAL_COMMIT" != "$FINAL_COMMIT" ]; then diff --git a/.github/include/flake.lock b/.nix/flake.lock similarity index 100% rename from .github/include/flake.lock rename to .nix/flake.lock diff --git a/.github/include/flake.nix b/.nix/flake.nix similarity index 93% rename from .github/include/flake.nix rename to .nix/flake.nix index 79dc7bc944..50d947d06e 100644 --- a/.github/include/flake.nix +++ b/.nix/flake.nix @@ -41,7 +41,7 @@ src = libbpf-src; version = "git"; }); - virtme-ng = prev.callPackage ../../.nix/pkgs/virtme-ng.nix { }; + virtme-ng = prev.callPackage ./pkgs/virtme-ng.nix { }; }) ]; }; @@ -142,7 +142,7 @@ nix-develop-gha = nix-develop-gha.packages.${system}.default; bpf-clang = makeBpfClang pkgs.llvmPackages self.packages.${system}."kernel_sched_ext/for-next"; - veristat = pkgs.callPackage ../../.nix/pkgs/veristat.nix { + veristat = pkgs.callPackage ./pkgs/veristat.nix { version = "git"; src = veristat-src; libbpf = pkgs.libbpf-git; @@ -159,7 +159,7 @@ rust-toolchain # requires cargo, use the toolchain to match version exactly ]; - installPhase = "install -Dm755 ${./list-integration-tests.py} $out/bin/list-integration-tests"; + installPhase = "install -Dm755 ${../.github/include/list-integration-tests.py} $out/bin/list-integration-tests"; }; ci = pkgs.python3Packages.buildPythonApplication rec { @@ -235,16 +235,16 @@ ] ] ++ (lib.mapAttrsToList (key: val: "--set ${key} \"${val}\"") build-env-vars)); - installPhase = "install -Dm755 ${../include/ci.py} $out/bin/ci"; + installPhase = "install -Dm755 ${../.github/include/ci.py} $out/bin/ci"; }; } // (with lib.attrsets; mapAttrs' - (name: details: nameValuePair "kernel_${name}" (pkgs.callPackage ../../.nix/pkgs/build-kernel.nix { + (name: details: nameValuePair "kernel_${name}" (pkgs.callPackage ./pkgs/build-kernel.nix { inherit name; inherit (details) repo branch commitHash narHash; version = details.kernelVersion; patches = map (patchName: ./kernel-patches + ("/" + patchName)) (details.patches or [ ]); })) - (builtins.fromJSON (builtins.readFile ./../../kernel-versions.json))); + (builtins.fromJSON (builtins.readFile ./../kernel-versions.json))); }) // flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; @@ -271,7 +271,7 @@ nix ]; - installPhase = "install -Dm755 ${../include/update-kernels.py} $out/bin/update-kernels"; + installPhase = "install -Dm755 ${../.github/include/update-kernels.py} $out/bin/update-kernels"; }; in { diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index a7c9c464ee..3a87ef3250 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -40,7 +40,7 @@ This repository has a kernel lock file at `./kernel-versions.json` where we trac several kernels important to development. If your change requires a new commit from a branch, you can update this file with: - `nix run ./.github/include#update-kernels` + `nix run ./.nix#update-kernels` or with: `python3 ./.github/include/update-kernels.py` @@ -52,7 +52,7 @@ both updating the kernel lock and making necessary fixes to the codebase. We use `virtme-ng` for testing in the CI environment, and it should be possible to reproduce behaviour locally with the same pinned kernels. To get an identical kernel to the CI with Nix installed, run: - `nix build ./.github/include#kernel_sched_ext/for-next` + `nix build ./.nix#kernel_sched_ext/for-next` And the kernel image will be available at `result/bzImage`. Alternatively you can clone the repo/commit from `kernel-versions.json`, but this isn't guaranteed to be reproducible.