2022-07-18 18:12:17 +01:00
|
|
|
{
|
2023-03-05 19:38:27 +00:00
|
|
|
inputs =
|
|
|
|
{
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2022-07-18 18:12:17 +01:00
|
|
|
|
2023-03-05 19:38:27 +00:00
|
|
|
zig-overlay.url = "github:mitchellh/zig-overlay";
|
|
|
|
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
2022-07-18 18:12:17 +01:00
|
|
|
|
2023-03-05 19:38:27 +00:00
|
|
|
gitignore.url = "github:hercules-ci/gitignore.nix";
|
|
|
|
gitignore.inputs.nixpkgs.follows = "nixpkgs";
|
2022-07-19 04:42:20 +01:00
|
|
|
|
2023-03-05 19:38:27 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2022-07-19 07:08:04 +01:00
|
|
|
|
2023-06-05 07:20:06 +01:00
|
|
|
binned_allocator.url = "https://gist.github.com/silversquirl/c1e4840048fdf48e669b6eac76d80634/archive/8bbe137e65f26854ff936046d884a45d4fa156de.tar.gz";
|
|
|
|
binned_allocator.flake = false;
|
|
|
|
|
2023-06-17 19:34:27 +01:00
|
|
|
diffz.url = "https://github.com/ziglibs/diffz/archive/2fd03fc72760a700e41f30f2b180f26e11c3365b.tar.gz";
|
2023-06-05 07:20:06 +01:00
|
|
|
diffz.flake = false;
|
|
|
|
|
2023-03-05 19:38:27 +00:00
|
|
|
known_folders.url = "https://github.com/ziglibs/known-folders/archive/d13ba6137084e55f873f6afb67447fe8906cc951.tar.gz";
|
|
|
|
known_folders.flake = false;
|
2022-12-29 18:36:38 +00:00
|
|
|
|
2023-05-19 13:25:25 +01:00
|
|
|
tres.url = "https://github.com/ziglibs/tres/archive/220d01f3931595e3a2e2a6a0693363c0bfaf47e9.tar.gz";
|
2023-03-05 19:38:27 +00:00
|
|
|
tres.flake = false;
|
|
|
|
};
|
2022-11-03 18:44:01 +00:00
|
|
|
|
2023-03-05 19:38:27 +00:00
|
|
|
outputs = inputs:
|
2022-07-18 18:12:17 +01:00
|
|
|
let
|
2023-03-05 19:38:27 +00:00
|
|
|
inherit (inputs) nixpkgs zig-overlay gitignore flake-utils;
|
2022-07-19 04:42:20 +01:00
|
|
|
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2022-07-18 18:12:17 +01:00
|
|
|
inherit (gitignore.lib) gitignoreSource;
|
2022-11-03 18:44:01 +00:00
|
|
|
in
|
|
|
|
flake-utils.lib.eachSystem systems (system:
|
2022-07-19 04:42:20 +01:00
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2022-08-26 16:34:18 +01:00
|
|
|
zig = zig-overlay.packages.${system}.master;
|
2023-03-05 19:38:27 +00:00
|
|
|
zon = builtins.fromJSON (
|
|
|
|
builtins.concatStringsSep "" [
|
|
|
|
"{"
|
|
|
|
(builtins.replaceStrings [ "}, " ] [ "}" ]
|
|
|
|
(builtins.replaceStrings [ " ." " =" "\n" ", }" ] [ "\"" "\" :" "" "}" ]
|
|
|
|
(builtins.replaceStrings [ ".{" ] [ "{" ]
|
|
|
|
(builtins.concatStringsSep " "
|
|
|
|
(builtins.filter builtins.isString
|
|
|
|
(builtins.split "[ \n]+"
|
|
|
|
(builtins.elemAt
|
|
|
|
(builtins.match ".*dependencies = .[{](.*)[}].*" (builtins.readFile ./build.zig.zon))
|
|
|
|
0)))))))
|
|
|
|
]
|
|
|
|
);
|
|
|
|
cp-phase = builtins.concatStringsSep ";" (builtins.attrValues (builtins.mapAttrs (k: v: "cp -r ${inputs.${k}} .cache/p/${v.hash}") zon));
|
2022-11-03 18:44:01 +00:00
|
|
|
in
|
|
|
|
rec {
|
2023-03-11 01:27:50 +00:00
|
|
|
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
|
2022-07-19 04:42:20 +01:00
|
|
|
packages.default = packages.zls;
|
|
|
|
packages.zls = pkgs.stdenvNoCC.mkDerivation {
|
|
|
|
name = "zls";
|
|
|
|
version = "master";
|
|
|
|
src = gitignoreSource ./.;
|
|
|
|
nativeBuildInputs = [ zig ];
|
|
|
|
dontConfigure = true;
|
|
|
|
dontInstall = true;
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir -p $out
|
2023-03-05 19:38:27 +00:00
|
|
|
mkdir -p .cache/{p,z,tmp}
|
|
|
|
${cp-phase}
|
|
|
|
zig build install --cache-dir $(pwd)/zig-cache --global-cache-dir $(pwd)/.cache -Dcpu=baseline -Doptimize=ReleaseSafe -Ddata_version=master --prefix $out
|
2022-07-19 04:42:20 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|
2022-11-03 18:44:01 +00:00
|
|
|
);
|
2022-07-18 18:12:17 +01:00
|
|
|
}
|