From f4eceb8971b8b0f2608acfebe4cd3f0a1844f5fb Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Wed, 20 Sep 2023 14:40:29 -0400 Subject: [PATCH] maybe --- .github/workflows/main.yml | 5 ++-- flake.nix | 20 +++++++------- main.yml | 53 ------------------------------------ container.nix => nix/lxc.nix | 0 nix/pkg-win64zip.nix | 18 ++++++++++++ 5 files changed, 31 insertions(+), 65 deletions(-) delete mode 100644 main.yml rename container.nix => nix/lxc.nix (100%) create mode 100644 nix/pkg-win64zip.nix diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f294e24..4281d5b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/flake.nix b/flake.nix index d34f875..8c3fb8e 100644 --- a/flake.nix +++ b/flake.nix @@ -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" ]; diff --git a/main.yml b/main.yml deleted file mode 100644 index 5fee50d..0000000 --- a/main.yml +++ /dev/null @@ -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 {}).lib.version' - - run: nix build - - run: nix flake check diff --git a/container.nix b/nix/lxc.nix similarity index 100% rename from container.nix rename to nix/lxc.nix diff --git a/nix/pkg-win64zip.nix b/nix/pkg-win64zip.nix new file mode 100644 index 0000000..d87755e --- /dev/null +++ b/nix/pkg-win64zip.nix @@ -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"; + }; + }; + };