diff options
| author | Patrick Schönberger | 2026-04-24 16:33:42 +0200 |
|---|---|---|
| committer | Patrick Schönberger | 2026-04-24 16:33:42 +0200 |
| commit | 5b193f70d4cd96672394f08ed0936b1ccd09eece (patch) | |
| tree | fdf60c53707c94e081ba96b605fe23ab2d6634f1 | |
| parent | bfea8ab1db8866157b39a05e18de179eef544a96 (diff) | |
| download | zhttpws-5b193f70d4cd96672394f08ed0936b1ccd09eece.tar.gz zhttpws-5b193f70d4cd96672394f08ed0936b1ccd09eece.zip | |
update flake
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | flake.lock | 70 | ||||
| -rw-r--r-- | flake.nix | 98 |
3 files changed, 49 insertions, 122 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6708eb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.zig-cache/ +zig-out/ +result @@ -1,74 +1,42 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1776651835, - "narHash": "sha256-LSe+AguPHcpPz7tJvl4dDPgquMRFx5HISSMCLI4BAvc=", - "owner": "nixos", + "lastModified": 1776949667, + "narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "6e304368a33c825ce730f05456cfde2cbf94d350", + "rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30", "type": "github" }, "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "root": { "inputs": { - "zig2nix": "zig2nix" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "nixpkgs": "nixpkgs", + "zig": "zig" } }, - "zig2nix": { + "zig": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1776654168, - "narHash": "sha256-y7XLfr7+2Goc1rVL9Bmb+B0oL/C1Wnmnywh8bMO7zgE=", - "owner": "Cloudef", - "repo": "zig2nix", - "rev": "9840ffe3b6c2faa2baa68940146ef000d72e9fb2", + "lastModified": 1777022972, + "narHash": "sha256-JONIVp25MIU90jh5LOl1LJsFoVhWTyRmvvxaJMqG5/g=", + "owner": "silversquirl", + "repo": "zig-flake", + "rev": "a94c5ff62b4d642e6c12a38a5835ad13cbfd21d8", "type": "github" }, "original": { - "owner": "Cloudef", - "repo": "zig2nix", + "owner": "silversquirl", + "repo": "zig-flake", "type": "github" } } @@ -1,78 +1,34 @@ { - description = "Zig project flake"; - inputs = { - zig2nix.url = "github:Cloudef/zig2nix"; + nixpkgs.url = "nixpkgs"; + zig.url = "github:silversquirl/zig-flake"; + zig.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { zig2nix, ... }: let - flake-utils = zig2nix.inputs.flake-utils; - in (flake-utils.lib.eachDefaultSystem (system: let - # Zig flake helper - # Check the flake.nix in zig2nix project for more options: - # <https://github.com/Cloudef/zig2nix/blob/master/flake.nix> - env = zig2nix.outputs.zig-env.${system} {}; - in with builtins; with env.pkgs.lib; rec { - # Produces clean binaries meant to be ship'd outside of nix - # nix build .#foreign - packages.foreign = env.package { - src = cleanSource ./.; - - # Packages required for compiling - nativeBuildInputs = with env.pkgs; []; - - # Packages required for linking - buildInputs = with env.pkgs; []; - - # Smaller binaries and avoids shipping glibc. - zigPreferMusl = true; - }; - - # nix build . - packages.default = packages.foreign.override (attrs: { - # Prefer nix friendly settings. - zigPreferMusl = false; - - # Executables required for runtime - # These packages will be added to the PATH - zigWrapperBins = with env.pkgs; []; - - # Libraries required for runtime - # These packages will be added to the LD_LIBRARY_PATH - zigWrapperLibs = attrs.buildInputs or []; - }); - - # For bundling with nix bundle for running outside of nix - # example: https://github.com/ralismark/nix-appimage - apps.bundle = { - type = "app"; - program = "${packages.foreign}/bin/default"; + outputs = { + nixpkgs, + zig, + ... + }: let + forAllSystems = f: + builtins.mapAttrs + (system: pkgs: f pkgs zig.packages.${system}.nightly) + nixpkgs.legacyPackages; + in { + devShells = forAllSystems (pkgs: zig: { + default = pkgs.mkShellNoCC { + packages = [pkgs.bash zig zig.zls]; }; - - # nix run . - apps.default = env.app [] "zig build run -- \"$@\""; - - # nix run .#build - apps.build = env.app [] "zig build \"$@\""; - - # nix run .#test - apps.test = env.app [] "zig build test -- \"$@\""; - - # nix run .#docs - apps.docs = env.app [] "zig build docs -- \"$@\""; - - # nix run .#zig2nix - apps.zig2nix = env.app [] "zig2nix \"$@\""; - - # nix develop - devShells.default = env.mkShell { - # Packages required for compiling, linking and running - # Libraries added here will be automatically added to the LD_LIBRARY_PATH and PKG_CONFIG_PATH - nativeBuildInputs = [] - ++ packages.default.nativeBuildInputs - ++ packages.default.buildInputs - ++ packages.default.zigWrapperBins - ++ packages.default.zigWrapperLibs; + }); + + packages = forAllSystems (pkgs: zig: { + default = zig.makePackage { + pname = "zig-flake-template"; + version = "0.0.0"; + src = ./.; + zigReleaseMode = "fast"; + depsHash = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; }; - })); + }); + }; } |
