Nix packaging

This commit is contained in:
Erwin Boskma 2024-05-03 17:30:08 +02:00
parent ab1edbf0f4
commit 5bf7130e39
Signed by: erwin
SSH key fingerprint: SHA256:/Wk1WZdLg+vQHs3in9qq7PsIp8SMzwGSk/RLZ5zPuZk
4 changed files with 85 additions and 35 deletions

View file

@ -24,7 +24,10 @@
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
# This is until zls 0.12 is merged
./nix/zls
./nix/vegetable-hamper
];
perSystem =
@ -47,6 +50,8 @@
};
};
packages.default = config.packages.vegetable-hamper;
devShells.default =
with pkgs;
mkShell {

View file

@ -0,0 +1,35 @@
{
perSystem =
{ pkgs, ... }:
{
packages.vegetable-hamper = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "vegetable-hamper";
version = "0.1.0";
src = ../../.;
# langref = pkgs.fetchurl {
# url = "https://raw.githubusercontent.com/ziglang/zig/a685ab1499d6560c523f0dbce2890dc140671e43/doc/langref.html.in";
# hash = "sha256-7lFSfkVLOrn42nYnYyDmBkkRfM903lUUJZ5Sg+eBUpE=";
# };
# zigBuildFlags = [ "-Dversion_data_path=${finalAttrs.langref}" ];
postPatch = ''
ln -s ${pkgs.callPackage ./deps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
'';
nativeBuildInputs = with pkgs; [
zig_0_12.hook
pkg-config
];
buildInputs = with pkgs; [
wayland
wayland-protocols
wlroots_0_17
wlr-protocols
];
});
};
}

View file

@ -0,0 +1,13 @@
# generated by zon2nix (https://github.com/nix-community/zon2nix)
{ linkFarm, fetchzip }:
linkFarm "zig-packages" [
{
name = "12205b33855e3634201e6777a06d9d50ff8f4477b47ef95024009dd3e60df7b269d3";
path = fetchzip {
url = "https://codeberg.org/ifreund/zig-wayland/archive/fe04636c866c6289b74c0803e621c9cc1bc1d1a4.tar.gz";
hash = "sha256-PeNDvE/D9EPpmFxzhMxt6be6/7O6Ou/dYN8BuSNMHGQ=";
};
}
]

View file

@ -9,46 +9,43 @@
perSystem =
{ pkgs, lib, ... }:
{
packages.zls =
let
in
pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "zls";
version = "0.12.0";
packages.zls = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "zls";
version = "0.12.0";
src = pkgs.fetchFromGitHub {
owner = "zigtools";
repo = "zls";
rev = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-2iVDPUj9ExgTooDQmCCtZs3wxBe2be9xjzAk9HedPNY=";
};
src = pkgs.fetchFromGitHub {
owner = "zigtools";
repo = "zls";
rev = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-2iVDPUj9ExgTooDQmCCtZs3wxBe2be9xjzAk9HedPNY=";
};
langref = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/ziglang/zig/a685ab1499d6560c523f0dbce2890dc140671e43/doc/langref.html.in";
hash = "sha256-7lFSfkVLOrn42nYnYyDmBkkRfM903lUUJZ5Sg+eBUpE=";
};
langref = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/ziglang/zig/a685ab1499d6560c523f0dbce2890dc140671e43/doc/langref.html.in";
hash = "sha256-7lFSfkVLOrn42nYnYyDmBkkRfM903lUUJZ5Sg+eBUpE=";
};
zigBuildFlags = [ "-Dversion_data_path=${finalAttrs.langref}" ];
zigBuildFlags = [ "-Dversion_data_path=${finalAttrs.langref}" ];
nativeBuildInputs = [ pkgs.zig_0_12.hook ];
nativeBuildInputs = [ pkgs.zig_0_12.hook ];
postPatch = ''
ln -s ${pkgs.callPackage ./deps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
'';
postPatch = ''
ln -s ${pkgs.callPackage ./deps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
'';
meta = {
description = "Zig LSP implementation + Zig Language Server";
mainProgram = "zls";
changelog = "https://github.com/zigtools/zls/releases/tag/${finalAttrs.version}";
homepage = "https://github.com/zigtools/zls";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
figsoda
moni
];
platforms = lib.platforms.unix;
};
});
meta = {
description = "Zig LSP implementation + Zig Language Server";
mainProgram = "zls";
changelog = "https://github.com/zigtools/zls/releases/tag/${finalAttrs.version}";
homepage = "https://github.com/zigtools/zls";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
figsoda
moni
];
platforms = lib.platforms.unix;
};
});
};
}