Skip to content

Commit e0b3e35

Browse files
committed
move cross-build to nix
1 parent 03867a9 commit e0b3e35

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ on:
1010
schedule:
1111
- cron: '51 2 * * *'
1212
jobs:
13-
cross-build:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v4
17-
- uses: cachix/install-nix-action@v23
18-
- run: nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz --pure -p gox -p go --run "gox -osarch '!darwin/386' ."
1913
tests:
2014
strategy:
2115
matrix:

.mergify.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
queue_rules:
22
- name: default
33
merge_conditions:
4-
- check-success=cross-build
54
- check-success=tests (nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-23.05.tar.gz,
65
macos-latest)
76
- check-success=tests (nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-23.05.tar.gz,

flake.nix

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,35 @@
66
flake-parts.url = "github:/hercules-ci/flake-parts";
77
};
88

9-
outputs = inputs@{ flake-parts, ... }:
9+
outputs = inputs@{ self, flake-parts, ... }:
1010
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: {
1111
systems = lib.systems.flakeExposed;
12-
perSystem = { config, self', inputs', pkgs, system, ... }: {
12+
perSystem = { config, self', inputs', pkgs, system, ... }: {
1313
packages = {
14-
ssh-to-age = (pkgs.callPackage ./default.nix {});
14+
ssh-to-age = (pkgs.callPackage ./default.nix { });
1515
default = config.packages.ssh-to-age;
1616
};
17-
checks = {
18-
cross-build = pkgs.runCommand "cross-build" { nativeBuildInputs = [ pkgs.gox ]; } ''
19-
cp -r ${./.} .
20-
chmod -R u+w .
21-
gox -osarch '!darwin/386' .
22-
'';
23-
};
17+
checks =
18+
let
19+
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
20+
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
21+
in
22+
{
23+
cross-build = self'.packages.ssh-to-age.overrideAttrs (old: {
24+
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gox ];
25+
buildPhase = ''
26+
runHook preBuild
27+
HOME=$TMPDIR gox -verbose -osarch '!darwin/386' ./cmd/ssh-to-age/
28+
runHook postBuild
29+
'';
30+
doCheck = false;
31+
installPhase = ''
32+
runHook preBuild
33+
touch $out
34+
runHook postBuild
35+
'';
36+
});
37+
} // packages // devShells;
2438
};
2539
});
2640
}

0 commit comments

Comments
 (0)