make clan-core-for-checks a dev flake input

This commit is contained in:
Jörg Thalheim
2025-07-07 18:13:34 +02:00
parent ddf2b57b3f
commit 567570e89c
9 changed files with 32 additions and 70 deletions

View File

@@ -1,28 +0,0 @@
name: "Update pinned clan-core for checks"
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: "51 2 * * *"
jobs:
update-pinned-clan-core:
runs-on: nix
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Update clan-core for checks
run: nix run .#update-clan-core-for-checks
- name: Create pull request
env:
CI_BOT_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
run: |
export GIT_AUTHOR_NAME=clan-bot GIT_AUTHOR_EMAIL=clan-bot@clan.lol GIT_COMMITTER_NAME=clan-bot GIT_COMMITTER_EMAIL=clan-bot@clan.lol
git commit -am "Update pinned clan-core for checks"
# Use shared PR creation script
export PR_BRANCH="update-clan-core-for-checks"
export PR_TITLE="Update Clan Core for Checks"
export PR_BODY="This PR updates the pinned clan-core flake input that is used for checks."
./.gitea/workflows/create-pr.sh

View File

@@ -2,6 +2,7 @@
self, self,
lib, lib,
inputs, inputs,
privateInputs ? { },
... ...
}: }:
let let
@@ -156,7 +157,7 @@ in
''; '';
clan-core-for-checks = pkgs.runCommand "clan-core-for-checks" { } '' clan-core-for-checks = pkgs.runCommand "clan-core-for-checks" { } ''
cp -r ${pkgs.callPackage ./clan-core-for-checks.nix { }} $out cp -r ${privateInputs.clan-core-for-checks} $out
chmod -R +w $out chmod -R +w $out
cp ${../flake.lock} $out/flake.lock cp ${../flake.lock} $out/flake.lock

View File

@@ -2,6 +2,7 @@
config, config,
self, self,
lib, lib,
privateInputs,
... ...
}: }:
{ {
@@ -80,7 +81,7 @@
# Some distros like to automount disks with spaces # Some distros like to automount disks with spaces
machine.succeed('mkdir -p "/mnt/with spaces" && mkfs.ext4 /dev/vdb && mount /dev/vdb "/mnt/with spaces"') machine.succeed('mkdir -p "/mnt/with spaces" && mkfs.ext4 /dev/vdb && mount /dev/vdb "/mnt/with spaces"')
machine.succeed("clan flash write --debug --flake ${self.checks.x86_64-linux.clan-core-for-checks} --yes --disk main /dev/vdb test-flash-machine-${pkgs.hostPlatform.system}") machine.succeed("clan flash write --debug --flake ${privateInputs.clan-core-for-checks} --yes --disk main /dev/vdb test-flash-machine-${pkgs.hostPlatform.system}")
''; '';
} { inherit pkgs self; }; } { inherit pkgs self; };
}; };

View File

@@ -1,6 +1,7 @@
{ {
self, self,
lib, lib,
privateInputs,
... ...
}: }:
@@ -151,7 +152,7 @@
let let
closureInfo = pkgs.closureInfo { closureInfo = pkgs.closureInfo {
rootPaths = [ rootPaths = [
self.checks.x86_64-linux.clan-core-for-checks privateInputs.clan-core-for-checks
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine-with-system.config.system.build.toplevel self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine-with-system.config.system.build.toplevel
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine-with-system.config.system.build.initialRamdisk self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine-with-system.config.system.build.initialRamdisk
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine-with-system.config.system.build.diskoScript self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine-with-system.config.system.build.diskoScript
@@ -207,7 +208,7 @@
# Prepare test flake and Nix store # Prepare test flake and Nix store
flake_dir = prepare_test_flake( flake_dir = prepare_test_flake(
temp_dir, temp_dir,
"${self.checks.x86_64-linux.clan-core-for-checks}", "${privateInputs.clan-core-for-checks}",
"${closureInfo}" "${closureInfo}"
) )
@@ -271,7 +272,7 @@
# Prepare test flake and Nix store # Prepare test flake and Nix store
flake_dir = prepare_test_flake( flake_dir = prepare_test_flake(
temp_dir, temp_dir,
"${self.checks.x86_64-linux.clan-core-for-checks}", "${privateInputs.clan-core-for-checks}",
"${closureInfo}" "${closureInfo}"
) )

View File

@@ -1,5 +1,6 @@
{ {
self, self,
privateInputs,
... ...
}: }:
{ {
@@ -54,7 +55,7 @@
testScript = '' testScript = ''
start_all() start_all()
actual.fail("cat /etc/testfile") actual.fail("cat /etc/testfile")
actual.succeed("env CLAN_DIR=${self.checks.x86_64-linux.clan-core-for-checks} clan machines morph test-morph-template --i-will-be-fired-for-using-this --debug --name test-morph-machine") actual.succeed("env CLAN_DIR=${privateInputs.clan-core-for-checks} clan machines morph test-morph-template --i-will-be-fired-for-using-this --debug --name test-morph-machine")
assert actual.succeed("cat /etc/testfile") == "morphed" assert actual.succeed("cat /etc/testfile") == "morphed"
''; '';
} { inherit pkgs self; }; } { inherit pkgs self; };

19
devFlake/flake.lock generated
View File

@@ -1,5 +1,23 @@
{ {
"nodes": { "nodes": {
"clan-core-for-checks": {
"flake": false,
"locked": {
"lastModified": 1754918666,
"narHash": "sha256-OHtVG9jX7FmwkB57w/nBR+Eek+a5HLT7Y72DwXUBLFo=",
"ref": "main",
"rev": "1524dc963eb4ffc5cbf14c46316844ef51e63471",
"shallow": true,
"type": "git",
"url": "https://git.clan.lol/clan/clan-core"
},
"original": {
"ref": "main",
"shallow": true,
"type": "git",
"url": "https://git.clan.lol/clan/clan-core"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": [ "systems": [
@@ -104,6 +122,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"clan-core-for-checks": "clan-core-for-checks",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs-dev": "nixpkgs-dev", "nixpkgs-dev": "nixpkgs-dev",
"nuschtos": "nuschtos", "nuschtos": "nuschtos",

View File

@@ -15,5 +15,8 @@
inputs.systems.url = "github:nix-systems/default"; inputs.systems.url = "github:nix-systems/default";
inputs.clan-core-for-checks.url = "git+https://git.clan.lol/clan/clan-core?ref=main&shallow=1";
inputs.clan-core-for-checks.flake = false;
outputs = inputs: inputs; outputs = inputs: inputs;
} }

View File

@@ -27,7 +27,6 @@
editor = pkgs.callPackage ./editor/clan-edit-codium.nix { }; editor = pkgs.callPackage ./editor/clan-edit-codium.nix { };
classgen = pkgs.callPackage ./classgen { }; classgen = pkgs.callPackage ./classgen { };
zerotierone = pkgs.callPackage ./zerotierone { }; zerotierone = pkgs.callPackage ./zerotierone { };
update-clan-core-for-checks = pkgs.callPackage ./update-clan-core-for-checks { };
}; };
}; };
} }

View File

@@ -1,35 +0,0 @@
{
writeShellApplication,
git,
jq,
nix-prefetch-git,
}:
writeShellApplication {
name = "update-clan-core-for-checks";
runtimeInputs = [
git
jq
nix-prefetch-git
];
text = ''
reporoot=$(git rev-parse --show-toplevel)
if [ -z "$reporoot" ]; then
echo "Not in a git repository. Please run this script from the root of the repository."
exit 1
fi
cd "$reporoot"
# get latest commit of clan-core
json=$(nix-prefetch-git "$(pwd)")
sha256=$(jq -r '.sha256' <<< "$json")
rev=$(jq -r '.rev' <<< "$json")
cat > ./checks/clan-core-for-checks.nix <<EOF
{ fetchgit }:
fetchgit {
url = "https://git.clan.lol/clan/clan-core.git";
rev = "$rev";
sha256 = "$sha256";
}
EOF
'';
}