fix ci
This commit is contained in:
parent
20262fbd09
commit
5930c3233c
8
.github/workflows/cache.yml
vendored
8
.github/workflows/cache.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
echo "machine cache.ataraxiadev.com" > /home/runner/.config/nix/netrc
|
echo "machine cache.ataraxiadev.com" > /home/runner/.config/nix/netrc
|
||||||
echo "password ${{ secrets.ATTIC_TOKEN }}" >> /home/runner/.config/nix/netrc
|
echo "password ${{ secrets.ATTIC_TOKEN }}" >> /home/runner/.config/nix/netrc
|
||||||
nix run github:AtaraxiaSjel/attic#attic -- login dev https://cache.ataraxiadev.com/ ${{ secrets.ATTIC_TOKEN }}
|
nix run github:AtaraxiaSjel/attic#attic -- login dev https://cache.ataraxiadev.com/ ${{ secrets.ATTIC_TOKEN }}
|
||||||
- name: Build system and push to cache
|
- name: Build system
|
||||||
run: |
|
run: nix develop .#ci -c nix-build-uncached ci.nix -A buildOutputs
|
||||||
nix develop .#ci -c nix-build-uncached ci.nix
|
- name: Push to cache
|
||||||
nix develop .#ci -c attic push ataraxiadev ./result*
|
run: nix develop .#ci -c attic push ataraxiadev ./result*
|
||||||
|
45
ci.nix
45
ci.nix
@ -1,7 +1,42 @@
|
|||||||
|
with builtins;
|
||||||
let
|
let
|
||||||
outputs = builtins.getFlake (toString ./.);
|
outputs = builtins.getFlake (toString ./.);
|
||||||
system = "x86_64-linux";
|
pkgs = outputs.inputs.nixpkgs;
|
||||||
pkgs = import outputs.inputs.nixpkgs { inherit system; };
|
|
||||||
host-workstation = (pkgs.callPackage ./scripts/force_cached.nix {}) outputs.packages.x86_64-linux.host-workstation;
|
isHost = n: pkgs.lib.strings.hasPrefix "host" n;
|
||||||
host-hypervisor = (pkgs.callPackage ./scripts/force_cached.nix {}) outputs.packages.x86_64-linux.host-hypervisor;
|
isDerivation = p: isAttrs p && p ? type && p.type == "derivation";
|
||||||
in host-workstation // host-hypervisor
|
isBuildable = p: !(p.meta.broken or false);
|
||||||
|
isCacheable = p: !(p.preferLocalBuild or false);
|
||||||
|
shouldRecurseForDerivations = p:
|
||||||
|
isAttrs p && p.recurseForDerivations or false;
|
||||||
|
|
||||||
|
nameValuePair = n: v: {
|
||||||
|
name = n;
|
||||||
|
value = v;
|
||||||
|
};
|
||||||
|
|
||||||
|
concatMap = builtins.concatMap or (f: xs: concatLists (map f xs));
|
||||||
|
|
||||||
|
flattenPkgs = s:
|
||||||
|
let
|
||||||
|
f = p:
|
||||||
|
if shouldRecurseForDerivations p then
|
||||||
|
flattenPkgs p
|
||||||
|
else if isDerivation p then
|
||||||
|
[ p ]
|
||||||
|
else
|
||||||
|
[ ];
|
||||||
|
in concatMap f (attrValues s);
|
||||||
|
|
||||||
|
outputsOf = p: map (o: p.${o}) p.outputs;
|
||||||
|
hostAttrs = outputs.packages.x86_64-linux;
|
||||||
|
|
||||||
|
hostPkgs = flattenPkgs (listToAttrs (map (n: nameValuePair n hostAttrs.${n})
|
||||||
|
(filter (n: isHost n) (attrNames hostAttrs))));
|
||||||
|
in rec {
|
||||||
|
buildPkgs = filter isBuildable hostPkgs;
|
||||||
|
cachePkgs = filter isCacheable buildPkgs;
|
||||||
|
|
||||||
|
buildOutputs = concatMap outputsOf buildPkgs;
|
||||||
|
cacheOutputs = concatMap outputsOf cachePkgs;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user