This commit is contained in:
Greg Burd 2023-09-20 14:40:29 -04:00
parent 88af5ee966
commit f4eceb8971
No known key found for this signature in database
GPG key ID: 1FC1E7793410DE46
5 changed files with 31 additions and 65 deletions

View file

@ -34,8 +34,9 @@ jobs:
name: Generate Nix Matrix
run: |
set -Eeu
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
echo 'matrix={"include":[{"attr":"githubActions.checks.x86_64-linux.hello","os":["ubuntu-22.04"]},{"attr":"githubActions.checks.x86_64-linux.container","os":["ubuntu-22.04"]}]}' >> "$GITHUB_OUTPUT"
#echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
#echo 'matrix={"include":[{"attr":"githubActions.checks.x86_64-linux.hello","os":["ubuntu-22.04"]},{"attr":"githubActions.checks.x86_64-linux.lxc","os":["ubuntu-22.04"]}]}' >> "$GITHUB_OUTPUT"
echo 'matrix={"include":[{"attr":"githubActions.checks.x86_64-linux.lxc","os":["ubuntu-22.04"]}]}' >> "$GITHUB_OUTPUT"
nix-build:
needs: nix-matrix

View file

@ -43,12 +43,8 @@
inherit system;
overlays = [
zicross.overlays.zig
zicross.overlays.debian
zicross.overlays.windows
(final: prev: {
hello = with final; zigStdenv.mkDerivation rec {
hello = with final; stdenv.mkDerivation rec {
inherit version;
inherit system;
pname = "hello";
@ -87,15 +83,19 @@
in rec {
packages = {
inherit (pkgs) hello;
# This changes things in "packages" below of the form: "packages.x86_64-linux" into
# "githubActions.checks.x86_64-linux.hello" so that the GHA matrix can iterate over them.
githubActions = nix-github-actions.lib.mkGithubMatrix {
checks = nixpkgs.lib.getAttrs [ "x86_64-linux" "x86_64-darwin" ] self.packages;
#checks = nixpkgs.lib.getAttrs [ "x86_64-linux" "x86_64-darwin" ] self.packages;
checks = nixpkgs.lib.getAttrs supportedSystems self.packages;
};
hello = nixpkgs.legacyPackages.${system}.hello;
lxc = pkgs.callPackage ./nix/lxc.nix { package = packages.default; };
};
packages.default = self.packages.${system}.hello;
packages.container = pkgs.callPackage ./container.nix { package = packages.default; };
#packages.win64zip = pkgs.callPackage ./win64zip.nix { package = packages.default; };
#packages.win64zip = pkgs.callPackage ./nix/pkg-win64zip.nix { package = packages.default; };
#packages.win64zip = pkgs.callPackage ./nix/pkg-win64-wix.nix { package = packages.default; };
packages.win64zip = pkgs.packageForWindows packages.default {
targetSystem = "x86_64-windows";
appendExe = [ "hello" ];

View file

@ -1,53 +0,0 @@
name: "Hello"
on:
push:
branches: [ main, master ]
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
issues: write
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
GIT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
jobs:
build_job:
runs-on: ubuntu-latest
name: Build on ${{ matrix.distro }} (${{ matrix.version }}) for ${{ matrix.arch }}
strategy:
matrix:
include:
- arch: x86_64
distro: Debian
version: bullseye
# - arch: aarch64
# distro: Debian
# version: bullseye
# - arch: ppc64le
# distro: Debian
# version: bullseye
# - arch: risc64
# distro: Ubuntu
# version: ubuntu_latest
id: build
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Print nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- run: nix build
- run: nix flake check

18
nix/pkg-win64zip.nix Normal file
View file

@ -0,0 +1,18 @@
overlays = [
zicross.overlays.zig
zicross.overlays.debian
zicross.overlays.windows
(final: prev: {
hello = with final; zigStdenv.mkDerivation rec {
pkgs.packageForWindows packages.default {
targetSystem = "x86_64-windows";
appendExe = [ "hello" ];
deps = {
libcpp = {
tail = "libc++-14.0.3-1-any.pkg.tar.zst";
sha256 = "1r73zs9naislzzjn7mr3m8s6pikgg3y4mv550hg09gcsjc719kzz";
};
};
};