mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
use ci channels
This commit is contained in:
parent
0c14e6c847
commit
34a41a64ba
2 changed files with 20 additions and 11 deletions
|
|
@ -1,13 +1,12 @@
|
||||||
{ lib, channels, env, ... }: with lib; let
|
{ lib, channels, env, ... }: with lib; {
|
||||||
nixfiles = import ../.;
|
|
||||||
in {
|
|
||||||
name = "hosts";
|
name = "hosts";
|
||||||
ci.gh-actions.enable = true;
|
ci.gh-actions.enable = true;
|
||||||
ci.gh-actions.export = true;
|
ci.gh-actions.export = true;
|
||||||
|
channels.nixfiles.path = ../.;
|
||||||
|
|
||||||
jobs = let hostnames = [ "samhain" "yule" "athame" ];
|
jobs = let hostnames = [ "samhain" "yule" "athame" ];
|
||||||
in mapAttrs' (k: nameValuePair "host-${k}") (genAttrs hostnames (host: {
|
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;
|
ci.gh-actions.checkoutOptions.submodules = false;
|
||||||
|
|
|
||||||
|
|
@ -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 = {
|
jobs.niv-update = {
|
||||||
tasks.niv-build.inputs = with channels.cipkgs;
|
tasks.niv-build.inputs = with channels.cipkgs;
|
||||||
ci.command {
|
ci.command {
|
||||||
name = "niv-update-build";
|
name = "niv-update-build";
|
||||||
displayName = "niv update build";
|
displayName = "niv update build";
|
||||||
nativeBuildInputs = [ nix cachix ];
|
|
||||||
environment = [ "OPENSSH_PRIVATE_KEY" "CACHIX_SIGNING_KEY" ];
|
environment = [ "OPENSSH_PRIVATE_KEY" "CACHIX_SIGNING_KEY" ];
|
||||||
command = let sources = (import ../.).sources; in
|
command = ''
|
||||||
''
|
|
||||||
mkdir ~/.ssh
|
mkdir ~/.ssh
|
||||||
echo "$OPENSSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
echo "$OPENSSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
chmod 0600 ~/.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
|
done
|
||||||
|
|
||||||
if git status --porcelain | grep -qF nix/sources.json; then
|
if git status --porcelain | grep -qF nix/sources.json; then
|
||||||
if nix build -Lf . hosts.{athame,yule,samhain}.config.system.build.toplevel; then
|
if nix build -Lf . hosts.{athame,yule,samhain}.config.system.build.toplevel; then
|
||||||
nix build -f ../. sourceCache
|
nix build -f ../. sourceCache
|
||||||
${cachix}/bin/cachix push kittywitch $(nix eval '(toString (import ../.).sourceCache)')
|
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
|
nix-build $(echo "-A hosts."{athame,yule,samhain}.config.system.build.toplevel) | cachix push kittywitch
|
||||||
git add nix/sources.json
|
git add nix/sources.json
|
||||||
export GIT_{COMMITTER,AUTHOR}_EMAIL=kat@kittywit.ch
|
export GIT_{COMMITTER,AUTHOR}_EMAIL=kat@kittywit.ch
|
||||||
export GIT_{COMMITTER,AUTHOR}_NAME=kat witch
|
export GIT_{COMMITTER,AUTHOR}_NAME=kat witch
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue