From 4364fb964ba2123dcc34b52f5127f215e07229bc Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Thu, 14 Sep 2023 12:47:45 -0400 Subject: [PATCH] zicross exe --- TODO | 4 +- flake.lock | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 39 ++++++++++++++--- 3 files changed, 155 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index be143c1..0bba161 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ -* add GitHub workflow to build all targets, upload/publish all artifacts - * deb, rpm, tgz of source +* add GitHub Actions/workflow to build all targets, upload/publish all artifacts + * deb, rpm?, tgz of source? * Docker container on DockerHub, GitHub Container Repository (ghcr.io) * containers could have multiple tags as in `latest` and `1.0.0` * build windows MSYS2 diff --git a/flake.lock b/flake.lock index 988ad6a..f4fd0db 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,36 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1666547822, + "narHash": "sha256-razwnAybPHyoAyhkKCwXdxihIqJi1G6e1XP4FQOJTEs=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "1a3b735e13e90a8d2fd5629f2f8363bd7ffbbec7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1694532420, @@ -33,10 +63,43 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1653936696, + "narHash": "sha256-M6bJShji9AIDZ7Kh7CPwPBPb/T7RiVev2PAcOi4fxDQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ce6aa13369b667ac2542593170993504932eb836", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1661151577, + "narHash": "sha256-++S0TuJtuz9IpqP8rKktWyHZKpgdyrzDFUXVY07MTRI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54060e816971276da05970a983487a25810c38a7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "zicross": "zicross" } }, "systems": { @@ -53,6 +116,61 @@ "repo": "default", "type": "github" } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "zicross": { + "inputs": { + "nix-filter": "nix-filter", + "nixpkgs": "nixpkgs_2", + "utils": "utils", + "zig-binaries": "zig-binaries" + }, + "locked": { + "lastModified": 1669413314, + "narHash": "sha256-OAdH2BrIFAhU1twWx5C8pUi2cTC8IQmB+6zqZLDW+uk=", + "owner": "flyx", + "repo": "Zicross", + "rev": "b145227c4afa2343b697799d9927507d7257e1ea", + "type": "github" + }, + "original": { + "owner": "flyx", + "repo": "Zicross", + "type": "github" + } + }, + "zig-binaries": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1669076785, + "narHash": "sha256-8NwdYxo+nyxpxzqPJhG8X2KN2DniceZzn+OtMuVQuRY=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "84fff3d6a669f15aadf738e7800c678fb5904246", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3c3b5aa..a681270 100644 --- a/flake.nix +++ b/flake.nix @@ -2,15 +2,16 @@ description = "A Nix Flake example for ANSI C using GNU Autoconf"; nixConfig = { - bash-prompt = "\\[\\e[34;1m\\]flake.nix ~ \\[\\e[0m\\]"; + bash-prompt = "\\[\\e[34;1m\\]hello.nix ~ \\[\\e[0m\\]"; }; inputs = { nixpkgs.url = "github:nixos/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; + zicross.url = "github:flyx/Zicross"; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, zicross }: let inherit (nixpkgs) lib; officialRelease = false; @@ -27,7 +28,10 @@ forAllSystems = nixpkgs.lib.genAttrs supportedSystems; # Nixpkgs instantiated for supported system types. - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; }); + nixpkgsFor = forAllSystems (system: import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }); in flake-utils.lib.eachDefaultSystem (system: @@ -36,13 +40,27 @@ inherit system; overlays = [ + zicross.overlays.zig + zicross.overlays.debian + zicross.overlays.windows + (final: prev: { - hello = with final; stdenv.mkDerivation rec { - pname = "hello"; + hello = with final; zigStdenv.mkDerivation rec { inherit version; + inherit system; + pname = "hello"; src = self; + configureFlags = [ + "--host ${system}" + ]; nativeBuildInputs = [ autoreconfHook ]; + meta = { + maintainers = [ "Symas Corporation " "Greg Burd " ]; + homepage = "https://github.com/openldap/openldap"; + license = licenses.openldap; + mainProgram = "hello"; }; + }; }) ]; }; @@ -51,6 +69,17 @@ packages = { inherit (pkgs) hello; }; 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.packageForWindows packages.default { + targetSystem = "x86_64-windows"; + appendExe = [ "hello" ]; + deps = { + libcpp = { + tail = "libc++-14.0.3-1-any.pkg.tar.zst"; + sha256 = "1r73zs9naislzzjn7mr3m8s6pikgg3y4mv550hg09gcsjc719kzz"; + }; + }; + }; apps.hello = flake-utils.lib.mkApp { drv = packages.default; }; apps.${system}.default = apps.hello;