- description = "Zig project flake";
-
- inputs = {
- zig2nix.url = "github:Cloudef/zig2nix";
- };
-
- 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} {};
- zighttp = env.pkgs.fetchFromGitHub {
- owner = "patrick-scho";
- repo = "zighttp";
- rev = "274c46eb3f7e9987cc9260bb70c43b4f5d8555ac";
- sha256 = "sha256-SUFHiA0r46QfzhlO6Ie1CByzC/+qPR2kyAbeDEdKOJ0=";
- };
- ziglmdb = env.pkgs.fetchFromGitHub {
- owner = "patrick-scho";
- repo = "ziglmdb";
- rev = "88cb74a430fa9629c8127c3a866c40e79a8e4612";
- sha256 = "sha256-SUFHiA0r46QfzhlO6Ie1CByzC/+qPR2kyAbeDEdKOJ0=";
- };
- 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 [];
+ description = "Chirp Flake";
+
+ inputs.self.submodules = true;
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ inputs.flake-utils.url = "github:numtide/flake-utils";
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ in {
+ packages.default = pkgs.stdenv.mkDerivation {
+ pname = "chirp";
+ version = "0.0.0";
+ src = ./.;
+
+ buildPhase = ''
+ mkdir -p .zig-cache-global/zig
+ ${pkgs.zig}/bin/zig build --verbose --global-cache-dir .zig-cache-global
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp zig-out/bin/chirp $out/bin
+ '';
+ };
+
+ apps.default = {
+ type = "app";
+ program = "${self.packages.${system}.default}/bin/chirp";
+ };