Skip to content

Commit c576cb8

Browse files
committed
nix: move flake files into .nix
Move the final Nix content from the `.github/include` directory into `.nix`. This creates a clearer separation of concerns between packaging and CI scripts. Test plan: - CI
1 parent a410200 commit c576cb8

File tree

11 files changed

+30
-30
lines changed

11 files changed

+30
-30
lines changed

.github/actions/install-nix/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ runs:
1616
- name: Load dependencies
1717
if: ${{ runner.environment == 'self-hosted' }}
1818
run: |
19-
nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-common
19+
nix run ./.nix#nix-develop-gha -- ./.nix#gha-common
2020
shell: bash
2121

2222
- uses: cachix/cachix-action@v14

.github/include/ci.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def get_kernel_path(kernel_name: str) -> str:
5454
"build",
5555
"--no-link",
5656
"--print-out-paths",
57-
f"./.github/include#kernel_{kernel_name}",
57+
f"./.nix#kernel_{kernel_name}",
5858
]
5959
)
6060
return stdout.strip() + "/bzImage"
@@ -219,8 +219,8 @@ async def run_format():
219219
if nix_files:
220220
await run_command(
221221
["nix", "--extra-experimental-features", "nix-command flakes", "fmt"]
222-
+ [os.path.join("../../", x) for x in nix_files],
223-
cwd=".github/include",
222+
+ [os.path.join("../", x) for x in nix_files],
223+
cwd=".nix",
224224
no_capture=True,
225225
)
226226

@@ -600,7 +600,7 @@ async def generate_readable_output(result):
600600
if verdict != "success":
601601
prog_name = cleaned_row.get("prog_name", "")
602602
if prog_name:
603-
reproduction_cmd = f"nix run \".github/include#ci\" veristat {result['kernel']} {result['scheduler']} {prog_name}"
603+
reproduction_cmd = f"nix run \".nix#ci\" veristat {result['kernel']} {result['scheduler']} {prog_name}"
604604
reproduction_cmds.add(reproduction_cmd)
605605

606606
for cmd in sorted(reproduction_cmds):

.github/include/list-integration-tests.py

100644100755
File mode changed.

.github/include/update-kernels.py

100644100755
File mode changed.

.github/workflows/build-kernels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
1616

1717
- name: Load dependencies
18-
run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-build-kernels
18+
run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-build-kernels
1919

2020
- name: Build all kernels
2121
id: nix-build
2222
run: |
23-
drvnames=$(nix flake show ./.github/include --json | jq -r '
23+
drvnames=$(nix flake show ./.nix --json | jq -r '
2424
.packages["x86_64-linux"] | keys[] | select(startswith("kernel_"))' |
25-
awk '{ print "./.github/include#" $0 "\n./.github/include#" $0 ".headers" }')
25+
awk '{ print "./.nix#" $0 "\n./.nix#" $0 ".headers" }')
2626
2727
echo 'kernel-paths<<EOF' >> $GITHUB_OUTPUT
2828
xargs nix build --no-link --print-out-paths <<< "$drvnames" >>$GITHUB_OUTPUT

.github/workflows/caching-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
2424

2525
- name: Format
26-
run: nix run ./.github/include#ci -- format
26+
run: nix run ./.nix#ci -- format
2727

2828
- name: Clippy
29-
run: nix run ./.github/include#ci -- clippy
29+
run: nix run ./.nix#ci -- clippy
3030

3131
build-and-test:
3232
runs-on: ${{ github.repository_owner == 'sched-ext' && fromJSON('[ "self-hosted", "linux", "x64", "metal:nixos" ]') || 'ubuntu-latest' }}
@@ -40,13 +40,13 @@ jobs:
4040
cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
4141

4242
- name: Build
43-
run: nix run ./.github/include#ci -- build
43+
run: nix run ./.nix#ci -- build
4444

4545
- name: Test
46-
run: nix run ./.github/include#ci -- test
46+
run: nix run ./.nix#ci -- test
4747

4848
- name: Veristat
49-
run: nix run ./.github/include#ci -- veristat
49+
run: nix run ./.nix#ci -- veristat
5050

5151
integration-test:
5252
uses: ./.github/workflows/integration-tests.yml
@@ -65,7 +65,7 @@ jobs:
6565
NEEDS_CONTEXT: ${{ toJSON(needs) }}
6666
steps:
6767
- uses: actions/checkout@v4
68-
- run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-build-kernels
68+
- run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-build-kernels
6969
- run: echo "$NEEDS_CONTEXT" | jq -e 'to_entries | all(.value.result == "success")'
7070

7171
pages:

.github/workflows/integration-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: List tests
2525
id: output
26-
run: nix run ./.github/include#list-integration-tests -- "${{ inputs.repo-name }}" >> $GITHUB_OUTPUT
26+
run: nix run ./.nix#list-integration-tests -- "${{ inputs.repo-name }}" >> $GITHUB_OUTPUT
2727

2828
integration-test:
2929
runs-on: ubuntu-24.04
@@ -67,8 +67,8 @@ jobs:
6767
fi
6868
6969
echo "KERNEL_NAME=$KERNEL_NAME" >> $GITHUB_ENV
70-
echo "KERNEL_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}")" >> $GITHUB_ENV
71-
echo "KERNEL_HEADERS_STORE_PATH=$(nix build --no-link --print-out-paths ./.github/include#"kernel_${KERNEL_NAME}".headers)" >> $GITHUB_ENV
70+
echo "KERNEL_STORE_PATH=$(nix build --no-link --print-out-paths ./.nix#"kernel_${KERNEL_NAME}")" >> $GITHUB_ENV
71+
echo "KERNEL_HEADERS_STORE_PATH=$(nix build --no-link --print-out-paths ./.nix#"kernel_${KERNEL_NAME}".headers)" >> $GITHUB_ENV
7272
7373
# cache virtiofsd (goes away w/ 24.04)
7474
- name: Cache virtiofsd
@@ -133,5 +133,5 @@ jobs:
133133
NEEDS_CONTEXT: ${{ toJSON(needs) }}
134134
steps:
135135
- uses: actions/checkout@v4
136-
- run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-build-kernels
136+
- run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-build-kernels
137137
- run: echo "$NEEDS_CONTEXT" | jq -e 'to_entries | all(.value.result == "success")'

.github/workflows/update-kernels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
1919

2020
- name: Load dependencies
21-
run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-update-kernels
21+
run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-update-kernels
2222

2323
- name: List kernels
2424
id: output
@@ -45,7 +45,7 @@ jobs:
4545
cachix-auth-token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
4646

4747
- name: Load dependencies
48-
run: nix run ./.github/include#nix-develop-gha -- ./.github/include#gha-update-kernels
48+
run: nix run ./.nix#nix-develop-gha -- ./.nix#gha-update-kernels
4949

5050
- name: Update kernel
5151
run: |
@@ -55,7 +55,7 @@ jobs:
5555
INITIAL_COMMIT=$(git rev-parse HEAD)
5656
5757
git switch -c "deps/kernel/${{ matrix.version }}"
58-
nix run ./.github/include#update-kernels -- ${{ matrix.version }}
58+
nix run ./.nix#update-kernels -- ${{ matrix.version }}
5959
6060
FINAL_COMMIT=$(git rev-parse HEAD)
6161
if [ "$INITIAL_COMMIT" != "$FINAL_COMMIT" ]; then
File renamed without changes.

.github/include/flake.nix renamed to .nix/flake.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
src = libbpf-src;
4242
version = "git";
4343
});
44-
virtme-ng = prev.callPackage ../../.nix/pkgs/virtme-ng.nix { };
44+
virtme-ng = prev.callPackage ./pkgs/virtme-ng.nix { };
4545
})
4646
];
4747
};
@@ -142,7 +142,7 @@
142142
nix-develop-gha = nix-develop-gha.packages.${system}.default;
143143
bpf-clang = makeBpfClang pkgs.llvmPackages self.packages.${system}."kernel_sched_ext/for-next";
144144

145-
veristat = pkgs.callPackage ../../.nix/pkgs/veristat.nix {
145+
veristat = pkgs.callPackage ./pkgs/veristat.nix {
146146
version = "git";
147147
src = veristat-src;
148148
libbpf = pkgs.libbpf-git;
@@ -159,7 +159,7 @@
159159
rust-toolchain # requires cargo, use the toolchain to match version exactly
160160
];
161161

162-
installPhase = "install -Dm755 ${./list-integration-tests.py} $out/bin/list-integration-tests";
162+
installPhase = "install -Dm755 ${../.github/include/list-integration-tests.py} $out/bin/list-integration-tests";
163163
};
164164

165165
ci = pkgs.python3Packages.buildPythonApplication rec {
@@ -235,16 +235,16 @@
235235
]
236236
] ++ (lib.mapAttrsToList (key: val: "--set ${key} \"${val}\"") build-env-vars));
237237

238-
installPhase = "install -Dm755 ${../include/ci.py} $out/bin/ci";
238+
installPhase = "install -Dm755 ${../.github/include/ci.py} $out/bin/ci";
239239
};
240240
} // (with lib.attrsets; mapAttrs'
241-
(name: details: nameValuePair "kernel_${name}" (pkgs.callPackage ../../.nix/pkgs/build-kernel.nix {
241+
(name: details: nameValuePair "kernel_${name}" (pkgs.callPackage ./pkgs/build-kernel.nix {
242242
inherit name;
243243
inherit (details) repo branch commitHash narHash;
244244
version = details.kernelVersion;
245245
patches = map (patchName: ./kernel-patches + ("/" + patchName)) (details.patches or [ ]);
246246
}))
247-
(builtins.fromJSON (builtins.readFile ./../../kernel-versions.json)));
247+
(builtins.fromJSON (builtins.readFile ./../kernel-versions.json)));
248248
}) // flake-utils.lib.eachDefaultSystem (system:
249249
let
250250
pkgs = import nixpkgs { inherit system; };
@@ -271,7 +271,7 @@
271271
nix
272272
];
273273

274-
installPhase = "install -Dm755 ${../include/update-kernels.py} $out/bin/update-kernels";
274+
installPhase = "install -Dm755 ${../.github/include/update-kernels.py} $out/bin/update-kernels";
275275
};
276276
in
277277
{

0 commit comments

Comments
 (0)