edf83bcf00
Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/8d447c5626cfefb9b129d5b30103344377fe09bc' (2023-05-09) → 'github:NixOS/nixpkgs/7721e0d2c1845c24eafd5a016b9d349187c48097' (2023-05-18) • Updated input 'tres': '707a09313b
.tar.gz?narHash=sha256-WFI%2fnXcxy05kfrl4kLjP0LfwO9xCqjxKg7ZPEKiB6NY=' → '220d01f393
.tar.gz?narHash=sha256-yhAH7npmBmlOkoHAitbDEv9CUx3zOc2GyErR8WPQCYQ=' • Updated input 'zig-overlay': 'github:mitchellh/zig-overlay/7b05e01b76b1776859170ab9a8fe55e412cf17a1' (2023-05-09) → 'github:mitchellh/zig-overlay/15a16045ada1b3d22454f61c5902f0a5b1e7bec6' (2023-05-19)
70 lines
2.6 KiB
Nix
70 lines
2.6 KiB
Nix
{
|
|
inputs =
|
|
{
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
zig-overlay.url = "github:mitchellh/zig-overlay";
|
|
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
gitignore.url = "github:hercules-ci/gitignore.nix";
|
|
gitignore.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
known_folders.url = "https://github.com/ziglibs/known-folders/archive/d13ba6137084e55f873f6afb67447fe8906cc951.tar.gz";
|
|
known_folders.flake = false;
|
|
|
|
tres.url = "https://github.com/ziglibs/tres/archive/220d01f3931595e3a2e2a6a0693363c0bfaf47e9.tar.gz";
|
|
tres.flake = false;
|
|
|
|
diffz.url = "https://github.com/ziglibs/diffz/archive/b966296b4489eb082b0831ec9a37d6f5e1906040.tar.gz";
|
|
diffz.flake = false;
|
|
};
|
|
|
|
outputs = inputs:
|
|
let
|
|
inherit (inputs) nixpkgs zig-overlay gitignore flake-utils;
|
|
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
|
inherit (gitignore.lib) gitignoreSource;
|
|
in
|
|
flake-utils.lib.eachSystem systems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
zig = zig-overlay.packages.${system}.master;
|
|
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));
|
|
in
|
|
rec {
|
|
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
|
|
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
|
|
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
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|