mirror of
https://github.com/ziex-dev/ziex.git
synced 2026-07-20 02:29:36 -06:00
feat: add flake.nix (#86)
This commit is contained in:
parent
c85ba484b3
commit
994df50dc7
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1773840656,
|
||||
"narHash": "sha256-9tpvMGFteZnd3gRQZFlRCohVpqooygFuy9yjuyRL2C0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9cf7092bdd603554bd8b63c216e8943cf9b12512",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
35
flake.nix
Normal file
35
flake.nix
Normal file
@ -0,0 +1,35 @@
|
||||
# This flake does not package ziex.
|
||||
# It allows nix users to `nix run github:ziex-dev/ziex` which builds
|
||||
# and runs the `zx` binary. The build is not done inside a sandbox.
|
||||
#
|
||||
# This allows you to bootstrap a ziex project and then use whatever
|
||||
# zig dev environment you are comfortable with.
|
||||
{
|
||||
description = "Framework for building web applications with zig";
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
outputs = {nixpkgs, ...}:
|
||||
with builtins;
|
||||
with nixpkgs.lib;
|
||||
let
|
||||
forAllSystems = f: genAttrs systems.flakeExposed (s: f nixpkgs.legacyPackages.${s});
|
||||
src = cleanSource ./.;
|
||||
in {
|
||||
apps = forAllSystems (pkgs: {
|
||||
default = {
|
||||
type = "app";
|
||||
meta.description = "zx: framework for building web applications with zig";
|
||||
program = toString (pkgs.writeShellApplication {
|
||||
name = "zx";
|
||||
runtimeInputs = [pkgs.zig_0_15];
|
||||
text = ''
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
(cd "${src}" && ZIG_LOCAL_CACHE_DIR="$tmp" zig build -p "$tmp" -Doptimize=Debug)
|
||||
"$tmp/bin/zx" "$@"
|
||||
'';
|
||||
}) + "/bin/zx";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user