Skip to content

Commit

Permalink
feat: clean up the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
kittywitch committed Apr 29, 2023
1 parent bc9c310 commit f6ec9f3
Show file tree
Hide file tree
Showing 249 changed files with 803 additions and 13,047 deletions.
174 changes: 0 additions & 174 deletions 1

This file was deleted.

128 changes: 64 additions & 64 deletions ci/flake-cron.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ lib, channels, config, ... }:
{
lib,
channels,
config,
...
}:
with lib; let
gitBranch = "arc";
in {
Expand All @@ -14,27 +19,25 @@ in {
};
};


gh-actions.env.CACHIX_SIGNING_KEY = "\${{ secrets.CACHIX_SIGNING_KEY }}";


nix.config = {
extra-platforms = [ "aarch64-linux" "armv6l-linux" "armv7l-linux" ];
extra-platforms = ["aarch64-linux" "armv6l-linux" "armv7l-linux"];
#extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"];
};

environment.bootstrap = {
archbinfmt =
let
makeQemuWrapper = name: ''
mkdir -p /run/binfmt
rm -f /run/binfmt/${name}-linux
cat > /run/binfmt/${name}-linux << 'EOF'
#!${channels.cipkgs.bash}/bin/sh
exec -- ${channels.cipkgs.qemu}/bin/qemu-${name} "$@"
EOF
chmod +x /run/binfmt/${name}-linux
''; in
archbinfmt = let
makeQemuWrapper = name: ''
mkdir -p /run/binfmt
rm -f /run/binfmt/${name}-linux
cat > /run/binfmt/${name}-linux << 'EOF'
#!${channels.cipkgs.bash}/bin/sh
exec -- ${channels.cipkgs.qemu}/bin/qemu-${name} "$@"
EOF
chmod +x /run/binfmt/${name}-linux
'';
in
channels.cipkgs.writeShellScriptBin "archbinfmt" ''
${makeQemuWrapper "aarch64"}
${makeQemuWrapper "arm"}
Expand All @@ -46,25 +49,25 @@ in {
};

gh-actions = {
on =
let
paths = [
"default.nix" # sourceCache
"ci/flake-cron.nix"
config.ci.gh-actions.path
];
in
{
push = {
inherit paths;
};
pull_request = {
inherit paths;
};
schedule = [{
cron = "0 0 * * *";
}];
on = let
paths = [
"default.nix" # sourceCache
"ci/flake-cron.nix"
config.ci.gh-actions.path
];
in {
push = {
inherit paths;
};
pull_request = {
inherit paths;
};
schedule = [
{
cron = "0 0 * * *";
}
];
};
jobs = mkIf (config.id != "ci") {
${config.id}.step.architectures = {
order = 201;
Expand All @@ -90,38 +93,36 @@ in {
enable = false;
};
displayName = "flake update build";
environment = [ "CACHIX_SIGNING_KEY" "GITHUB_REF" ];
command =
let
filteredHosts = [ "tewi" ];
nodeBuildString = concatMapStringsSep " && " (node: "nix build -Lf . network.nodes.nixos.${node}.deploy.system -o result-${node} && nix-collect-garbage -d") filteredHosts;
in
''
# ${toString builtins.currentTime}
nix flake update
if git status --porcelain | grep -qF flake.lock; then
git -P diff flake.lock
echo "checking that network.nodes.still build..." >&2
if ${nodeBuildString}; then
if [[ -n $CACHIX_SIGNING_KEY ]]; then
cachix push kittywitch result*/ &
CACHIX_PUSH=$!
fi
git add flake.lock
export GIT_{COMMITTER,AUTHOR}_EMAIL=github@kittywit.ch
export GIT_{COMMITTER,AUTHOR}_NAME="flake cron job"
git commit --message="ci: flake update"
if [[ $GITHUB_REF = refs/heads/${gitBranch} ]]; then
git push origin HEAD:${gitBranch}
fi
environment = ["CACHIX_SIGNING_KEY" "GITHUB_REF"];
command = let
filteredHosts = ["tewi"];
nodeBuildString = concatMapStringsSep " && " (node: "nix build -Lf . network.nodes.${node}.deploy.system -o result-${node} && nix-collect-garbage -d") filteredHosts;
in ''
# ${toString builtins.currentTime}
nix flake update
wait ''${CACHIX_PUSH-}
if git status --porcelain | grep -qF flake.lock; then
git -P diff flake.lock
echo "checking that network.nodes.still build..." >&2
if ${nodeBuildString}; then
if [[ -n $CACHIX_SIGNING_KEY ]]; then
cachix push kittywitch result*/ &
CACHIX_PUSH=$!
fi
else
echo "no source changes" >&2
git add flake.lock
export GIT_{COMMITTER,AUTHOR}_EMAIL=github@kittywit.ch
export GIT_{COMMITTER,AUTHOR}_NAME="flake cron job"
git commit --message="ci: flake update"
if [[ $GITHUB_REF = refs/heads/${gitBranch} ]]; then
git push origin HEAD:${gitBranch}
fi
wait ''${CACHIX_PUSH-}
fi
'';
else
echo "no source changes" >&2
fi
'';
impure = true;
};
};
Expand All @@ -139,8 +140,7 @@ in {
};
kittywitch = {
enable = true;
publicKey =
"kittywitch.cachix.org-1:KIzX/G5cuPw5WgrXad6UnrRZ8UDr7jhXzRTK/lmqyK0=";
publicKey = "kittywitch.cachix.org-1:KIzX/G5cuPw5WgrXad6UnrRZ8UDr7jhXzRTK/lmqyK0=";
signingKey = "mewp";
};
};
Expand Down
Loading

0 comments on commit f6ec9f3

Please sign in to comment.