mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 14:25:57 +03:00
Add nix flake config
This commit is contained in:
parent
b4c5dc746d
commit
b9fa94f543
1
.gitignore
vendored
1
.gitignore
vendored
@ -60,3 +60,4 @@ dhat-heap.json
|
||||
/winget-pkgs
|
||||
/assets/flatpak/generated-sources.json
|
||||
/__pycache__/
|
||||
/result
|
||||
|
115
flake.lock
Normal file
115
flake.lock
Normal file
@ -0,0 +1,115 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1680776469,
|
||||
"narHash": "sha256-3CXUDK/3q/kieWtdsYpDOBJw3Gw4Af6x+2EiSnIkNQw=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "411e8764155aa9354dbcd6d5faaeb97e9e3dce24",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"freetype2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1675923892,
|
||||
"narHash": "sha256-dOm8VKYdclTLLkqWMLv7DQI0Qyjit7S4SOCszKEkG3o=",
|
||||
"owner": "wez",
|
||||
"repo": "freetype2",
|
||||
"rev": "de8b92dd7ec634e9e2b25ef534c54a3537555c11",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "wez",
|
||||
"repo": "freetype2",
|
||||
"rev": "de8b92dd7ec634e9e2b25ef534c54a3537555c11",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"harfbuzz": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1677798343,
|
||||
"narHash": "sha256-Lsd0Vrkrv67CMyV0ZveShfjUvqh/jDhI8rAK9ps+SZQ=",
|
||||
"owner": "harfbuzz",
|
||||
"repo": "harfbuzz",
|
||||
"rev": "60841e26187576bff477c1a09ee2ffe544844abc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "harfbuzz",
|
||||
"repo": "harfbuzz",
|
||||
"rev": "60841e26187576bff477c1a09ee2ffe544844abc",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"libpng": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1549245649,
|
||||
"narHash": "sha256-1+cRp0Ungme/OGfc9kGJbklYIWAFxk8Il1M+NV4KSgw=",
|
||||
"owner": "glennrp",
|
||||
"repo": "libpng",
|
||||
"rev": "8439534daa1d3a5705ba92e653eda9251246dd61",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "glennrp",
|
||||
"repo": "libpng",
|
||||
"rev": "8439534daa1d3a5705ba92e653eda9251246dd61",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1680728981,
|
||||
"narHash": "sha256-ZhsViPJJvET7iLyD9ey63q6GwPKquDqIbOn2letvb/A=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "38263d02cf3a22e011e137b8f67cdf8419f28015",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"freetype2": "freetype2",
|
||||
"harfbuzz": "harfbuzz",
|
||||
"libpng": "libpng",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"zlib": "zlib"
|
||||
}
|
||||
},
|
||||
"zlib": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1484501380,
|
||||
"narHash": "sha256-j5b6aki1ztrzfCqu8y729sPar8GpyQWIrajdzpJC+ww=",
|
||||
"owner": "madler",
|
||||
"repo": "zlib",
|
||||
"rev": "cacf7f1d4e3d44d871b605da3b647f07d718623f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "madler",
|
||||
"repo": "zlib",
|
||||
"rev": "cacf7f1d4e3d44d871b605da3b647f07d718623f",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
141
flake.nix
Normal file
141
flake.nix
Normal file
@ -0,0 +1,141 @@
|
||||
{
|
||||
description = "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
freetype2 = {
|
||||
url = "github:wez/freetype2/de8b92dd7ec634e9e2b25ef534c54a3537555c11";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
harfbuzz = {
|
||||
url = "github:harfbuzz/harfbuzz/60841e26187576bff477c1a09ee2ffe544844abc";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
libpng = {
|
||||
url = "github:glennrp/libpng/8439534daa1d3a5705ba92e653eda9251246dd61";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
zlib = {
|
||||
url = "github:madler/zlib/cacf7f1d4e3d44d871b605da3b647f07d718623f";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
freetype2,
|
||||
harfbuzz,
|
||||
libpng,
|
||||
zlib,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (pkgs) stdenv;
|
||||
|
||||
nativeBuildInputs = with pkgs;
|
||||
[
|
||||
installShellFiles
|
||||
ncurses # tic for terminfo
|
||||
pkg-config
|
||||
python3
|
||||
]
|
||||
++ lib.optional stdenv.isDarwin perl;
|
||||
|
||||
buildInputs = with pkgs;
|
||||
[
|
||||
fontconfig
|
||||
pkgs.zlib
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
xorg.libX11
|
||||
xorg.libxcb
|
||||
libxkbcommon
|
||||
openssl
|
||||
wayland
|
||||
xorg.xcbutil
|
||||
xorg.xcbutilimage
|
||||
xorg.xcbutilkeysyms
|
||||
xorg.xcbutilwm # contains xcb-ewmh among others
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
Cocoa
|
||||
CoreGraphics
|
||||
Foundation
|
||||
libiconv
|
||||
UserNotifications
|
||||
];
|
||||
|
||||
libPath = lib.makeLibraryPath (with pkgs; [libGL vulkan-loader]);
|
||||
in {
|
||||
packages.default = pkgs.rustPlatform.buildRustPackage rec {
|
||||
inherit buildInputs nativeBuildInputs;
|
||||
|
||||
name = "wezterm";
|
||||
src = ./.;
|
||||
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
||||
version = self.shortRev or "dev";
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"image-0.24.5" = "sha256-fTajVwm88OInqCPZerWcSAm1ga46ansQ3EzAmbT58Js=";
|
||||
"xcb-imdkit-0.2.0" = "sha256-L+NKD0rsCk9bFABQF4FZi9YoqBHr4VAZeKAWgsaAegw=";
|
||||
"xcb-1.2.1" = "sha256-zkuW5ATix3WXBAj2hzum1MJ5JTX3+uVQ01R1vL6F1rY=";
|
||||
};
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
rm -rf deps/freetype/freetype2 deps/freetype/libpng \
|
||||
deps/freetype/zlib deps/harfbuzz/harfbuzz
|
||||
|
||||
ln -s ${freetype2} deps/freetype/freetype2
|
||||
ln -s ${libpng} deps/freetype/libpng
|
||||
ln -s ${zlib} deps/freetype/zlib
|
||||
ln -s ${harfbuzz} deps/harfbuzz/harfbuzz
|
||||
|
||||
echo "==> harfbuzz"
|
||||
ls deps/harfbuzz/harfbuzz/src
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
echo ${version} > .tag
|
||||
|
||||
# tests are failing with: Unable to exchange encryption keys
|
||||
rm -r wezterm-ssh/tests
|
||||
'';
|
||||
|
||||
preFixup = lib.optionalString stdenv.isLinux ''
|
||||
patchelf \
|
||||
--add-needed "${pkgs.libGL}/lib/libEGL.so.1" \
|
||||
--add-needed "${pkgs.vulkan-loader}/lib/libvulkan.so.1" \
|
||||
$out/bin/wezterm-gui
|
||||
'';
|
||||
};
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
name = "wezterm-shell";
|
||||
|
||||
inherit nativeBuildInputs;
|
||||
buildInputs =
|
||||
buildInputs
|
||||
++ (with pkgs; [
|
||||
cargo
|
||||
rustc
|
||||
rustfmt
|
||||
rustPackages.clippy
|
||||
]);
|
||||
|
||||
LD_LIBRARY_PATH = libPath;
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user