use ci channels

This commit is contained in:
arcnmx 2021-05-19 08:13:45 -07:00
parent 0c14e6c847
commit 34a41a64ba
2 changed files with 20 additions and 11 deletions

View file

@ -1,13 +1,12 @@
{ lib, channels, env, ... }: with lib; let
nixfiles = import ../.;
in {
{ lib, channels, env, ... }: with lib; {
name = "hosts";
ci.gh-actions.enable = true;
ci.gh-actions.export = true;
channels.nixfiles.path = ../.;
jobs = let hostnames = [ "samhain" "yule" "athame" ];
in mapAttrs' (k: nameValuePair "host-${k}") (genAttrs hostnames (host: {
tasks.${host}.inputs = nixfiles.hosts.${host}.config.system.build.toplevel;
tasks.${host}.inputs = channels.nixfiles.hosts.${host}.config.system.build.toplevel;
}));
ci.gh-actions.checkoutOptions.submodules = false;

View file

@ -23,26 +23,36 @@ with lib; {
};
};
channels = {
nixfiles.path = ../.;
nixpkgs.path = "${channels.nixfiles.sources.nixpkgs}";
};
environment.test = {
inherit (channels.cipkgs) cachix;
inherit (channels.nixpkgs) niv;
};
jobs.niv-update = {
tasks.niv-build.inputs = with channels.cipkgs;
ci.command {
name = "niv-update-build";
displayName = "niv update build";
nativeBuildInputs = [ nix cachix ];
environment = [ "OPENSSH_PRIVATE_KEY" "CACHIX_SIGNING_KEY" ];
command = let sources = (import ../.).sources; in
''
command = ''
mkdir ~/.ssh
echo "$OPENSSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
for source in ${toString (attrNames sources)}; do
nix run -f . pkgs.niv -c niv update $source || true
for source in ${toString (attrNames channels.nixfiles.sources)}; do
niv update $source || true
done
if git status --porcelain | grep -qF nix/sources.json; then
if nix build -Lf . hosts.{athame,yule,samhain}.config.system.build.toplevel; then
nix build -f ../. sourceCache
${cachix}/bin/cachix push kittywitch $(nix eval '(toString (import ../.).sourceCache)')
nix-build $(echo "-A hosts."{athame,yule,samhain}.config.system.build.toplevel) | ${cachix}/bin/cachix push kittywitch
cachix push kittywitch $(nix eval '(toString (import ../.).sourceCache)')
nix-build $(echo "-A hosts."{athame,yule,samhain}.config.system.build.toplevel) | cachix push kittywitch
git add nix/sources.json
export GIT_{COMMITTER,AUTHOR}_EMAIL=kat@kittywit.ch
export GIT_{COMMITTER,AUTHOR}_NAME=kat witch