{ description = "Advent of Code 2023"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let inherit (nixpkgs) lib; pkgs = import nixpkgs { inherit system; }; zig = pkgs.zig_0_11; in { devShells = { default = pkgs.mkShellNoCC { buildInputs = [ zig pkgs.zls ]; }; ci = pkgs.mkShellNoCC { buildInputs = [ zig ]; }; }; packages.default = let optimize = "ReleaseSafe"; in pkgs.stdenv.mkDerivation { name = "aoc23"; src = lib.cleanSource ./.; buildInputs = [ zig ]; # https://github.com/ziglang/zig/issues/6810 XDG_CACHE_HOME = "xdg_cache"; zigFlags = [ "-Doptimize=${optimize}" ]; buildPhase = '' runHook preBuild zig build $zigFlags runHook postBuild ''; doCheck = true; checkPhase = '' runHook preCheck zig build test $zigFlags runHook postCheck ''; installPhase = '' runHook preInstall zig build install --prefix $out $zigFlags runHook postInstall ''; }; }); }