From 39f0a59f7748b7e4ced13d629c7919ee7fb70579 Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Wed, 20 Sep 2023 18:56:37 -0400 Subject: [PATCH] progress --- .github/workflows/main.yml | 6 ++---- flake.nix | 35 +++++++++++++++-------------------- nix/pkg-win64zip.nix | 28 +++++++++++----------------- 3 files changed, 28 insertions(+), 41 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4281d5b..dde20ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,9 +34,9 @@ jobs: name: Generate Nix Matrix run: | set -Eeu - #echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$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" + #echo 'matrix={"include":[{"attr":"githubActions.checks.x86_64-linux.lxc","os":["ubuntu-22.04"]}]}' >> "$GITHUB_OUTPUT" nix-build: needs: nix-matrix @@ -51,6 +51,4 @@ jobs: 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 -L ".#${{ matrix.attr }}" diff --git a/flake.nix b/flake.nix index 8c3fb8e..1752c3b 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,8 @@ then "" else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}"; - supportedSystems = [ "i386-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux" "x86_64-darwin" "aarch64-darwin" ]; + #supportedSystems = [ "i386-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "powerpc64le-linux" "riscv64-linux" "x86_64-darwin" "aarch64-darwin" "x86_64-windows" "x86_64-windows" ]; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" "x86_64-windows" ]; # Generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. forAllSystems = nixpkgs.lib.genAttrs supportedSystems; @@ -43,8 +44,12 @@ inherit system; overlays = [ + zicross.overlays.zig + zicross.overlays.debian + zicross.overlays.windows + (final: prev: { - hello = with final; stdenv.mkDerivation rec { + hello = with final; (if lib.strings.hasSuffix "windows" system then zigStdenv else stdenv).mkDerivation rec { inherit version; inherit system; pname = "hello"; @@ -83,32 +88,22 @@ 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.targets.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 supportedSystems self.packages; }; - hello = nixpkgs.legacyPackages.${system}.hello; - lxc = pkgs.callPackage ./nix/lxc.nix { package = packages.default; }; }; packages.default = self.packages.${system}.hello; - #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" ]; - deps = { - libcpp = { - tail = "libc++-14.0.3-1-any.pkg.tar.zst"; - sha256 = "1r73zs9naislzzjn7mr3m8s6pikgg3y4mv550hg09gcsjc719kzz"; - }; - }; - }; + packages.lxc = pkgs.callPackage ./nix/lxc.nix { package = packages.default; }; + packages.x86_64-windows = pkgs.callPackage ./nix/pkg-win64zip.nix { package = packages.default; }; + #packages.x86_64-wix = pkgs.callPackage ./nix/pkg-win64-wix.nix { inherit pkgs packages; }; - apps.hello = flake-utils.lib.mkApp { drv = packages.default; }; - apps.${system}.default = apps.hello; + #apps.hello = flake-utils.lib.mkApp { drv = packages.default; }; + #apps.${system}.default = apps.hello; devShells.default = import ./shell.nix { inherit pkgs; }; } diff --git a/nix/pkg-win64zip.nix b/nix/pkg-win64zip.nix index d87755e..a314547 100644 --- a/nix/pkg-win64zip.nix +++ b/nix/pkg-win64zip.nix @@ -1,18 +1,12 @@ - overlays = [ - zicross.overlays.zig - zicross.overlays.debian - zicross.overlays.windows +{ pkgs, package }: - (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"; - }; - }; - }; +pkgs.packageForWindows package { + targetSystem = "x86_64-windows"; + appendExe = [ "hello" ]; + deps = { + libcpp = { + tail = "libc++-14.0.3-1-any.pkg.tar.zst"; + sha256 = "1r73zs9naislzzjn7mr3m8s6pikgg3y4mv550hg09gcsjc719kzz"; + }; + }; +} \ No newline at end of file