Compare commits
2 Commits
de3e031dcf
...
9286a82d86
Author | SHA1 | Date | |
---|---|---|---|
9286a82d86 | |||
52371f9e13 |
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 xeals
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
15
flake.nix
15
flake.nix
@ -11,19 +11,24 @@
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
zig = pkgs.zig_0_11;
|
||||
buildZigPackage = import ./nix/build-zig-package.nix {
|
||||
inherit (pkgs) stdenv;
|
||||
inherit zig;
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
buildInputs = [ zig pkgs.zls ];
|
||||
};
|
||||
|
||||
packages.default = buildZigPackage {
|
||||
packages.default = pkgs.stdenv.mkDerivation {
|
||||
name = "aoc23";
|
||||
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
|
||||
|
||||
nativeBuildInputs = [ zig.hook ];
|
||||
|
||||
meta = {
|
||||
description = "Advent of Code 2023";
|
||||
homepage = "https://git.xeal.me/xeals/aoc23";
|
||||
license = nixpkgs.lib.licenses.mit;
|
||||
inherit (zig.meta) platforms;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
{ stdenv
|
||||
, zig
|
||||
}:
|
||||
|
||||
{ buildInputs ? [ ]
|
||||
, nativeBuildInputs ? [ ]
|
||||
, optimize ? "ReleaseSafe"
|
||||
, meta ? { }
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
stdenv.mkDerivation (args // {
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
zig
|
||||
];
|
||||
|
||||
buildInputs = buildInputs;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
configurePhase = args.configurePhase or ''
|
||||
runHook preConfigure
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
ZIGFLAGS = args.ZIGFLAGS or [
|
||||
"-Doptimize=${optimize}"
|
||||
];
|
||||
|
||||
# https://github.com/ziglang/zig/issues/6810 requires setting XDG_CACHE_HOME
|
||||
# in all zig build phases. --cache-dir and --global-cache-dir do not prevent
|
||||
# the builder from attempting to create the XDG cache.
|
||||
|
||||
buildPhase = args.buildPhase or ''
|
||||
runHook preBuild
|
||||
XDG_CACHE_HOME=_cache zig build $ZIGFLAGS
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
doCheck = args.doCheck or true;
|
||||
checkPhase = args.checkPhase or ''
|
||||
runHook preCheck
|
||||
XDG_CACHE_HOME=_cache zig build test $ZIGFLAGS
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = args.installPhase or ''
|
||||
runHook preInstall
|
||||
XDG_CACHE_HOME=_cache zig build install --prefix $out $ZIGFLAGS
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
# default to Zig's platforms
|
||||
platforms = zig.meta.platforms;
|
||||
} // meta;
|
||||
})
|
Loading…
Reference in New Issue
Block a user