nix: Split the package out and drop flake-utils
- Move the derivation into `nix/package.nix` as a callPackage function, deriving its version from the flake revision. - Derive the per-system list from nixpkgs instead of `flake-utils`. - Reuse the package's build inputs in the devShell via `inputsFrom`, keeping only the dlopened runtime libraries explicit.
This commit is contained in:
1 parent
2f9851c06f
commit
e1eae81a56
3 files changed
+308
-266
No files matched your search
Generated
-34
@@ -1,23 +1,5 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794427683,
|
||||
"narHash": "sha256-o7ey9gEilsxaifqJWnBDlYSKbNWYQYtKwDyXeZU2kaU=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cd489559845d81f673a12885576016c65cbe9363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"freetype2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@@ -87,7 +69,6 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"freetype2": "freetype2",
|
||||
"harfbuzz": "harfbuzz",
|
||||
"libpng": "libpng",
|
||||
@@ -116,21 +97,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1791244623,
|
||||
"narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zlib": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
||||
+71
-232
@@ -3,7 +3,6 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -41,218 +40,60 @@
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ self, ... }:
|
||||
inputs@{ self, nixpkgs, ... }:
|
||||
let
|
||||
perSystemOutputs = inputs.flake-utils.lib.eachDefaultSystem (
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
systems = builtins.attrNames nixpkgs.legacyPackages;
|
||||
forSystems = lib.genAttrs systems;
|
||||
forSys = system: {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ (import inputs.rust-overlay) ];
|
||||
};
|
||||
repopkgs = self.packages.${system};
|
||||
};
|
||||
|
||||
vmTestingSystem = "x86_64-linux";
|
||||
in
|
||||
{
|
||||
packages = forSystems (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import inputs.rust-overlay) ];
|
||||
pkgs = import inputs.nixpkgs { inherit system overlays; };
|
||||
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
inherit (pkgs) stdenv;
|
||||
|
||||
nativeBuildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
installShellFiles
|
||||
ncurses # tic for terminfo
|
||||
pkg-config
|
||||
python3
|
||||
]
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin perl;
|
||||
|
||||
buildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
fontconfig
|
||||
libgit2
|
||||
openssl
|
||||
sqlite # Required by the sync-color-schemes workspace member
|
||||
zlib
|
||||
zstd
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
libxkbcommon
|
||||
wayland
|
||||
|
||||
libx11
|
||||
libxcb
|
||||
libxcb-util
|
||||
libxcb-image
|
||||
libxcb-keysyms
|
||||
libxcb-wm # contains xcb-ewmh among others
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin ([
|
||||
libiconv
|
||||
]);
|
||||
|
||||
libPath = lib.makeLibraryPath (
|
||||
with pkgs;
|
||||
[
|
||||
libxcb-image
|
||||
libGL
|
||||
vulkan-loader
|
||||
]
|
||||
);
|
||||
|
||||
rustPlatform = pkgs.makeRustPlatform {
|
||||
cargo = pkgs.rust-bin.stable.latest.minimal;
|
||||
rustc = pkgs.rust-bin.stable.latest.minimal;
|
||||
pkgs = (forSys system).pkgs;
|
||||
wezterm = pkgs.callPackage ./package.nix {
|
||||
flakeInfo = {
|
||||
inherit (self) lastModifiedDate;
|
||||
# note: we can't use `inherit` here because `rev` & `dirtyRev` may not be present.
|
||||
rev = self.rev or null;
|
||||
dirtyRev = self.dirtyRev or null;
|
||||
};
|
||||
inputSubmodules = {
|
||||
inherit (inputs)
|
||||
freetype2
|
||||
harfbuzz
|
||||
libpng
|
||||
zlib
|
||||
;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.default = rustPlatform.buildRustPackage (finalAttrs: {
|
||||
inherit buildInputs nativeBuildInputs;
|
||||
default = wezterm;
|
||||
inherit wezterm;
|
||||
}
|
||||
);
|
||||
|
||||
pname = "wezterm";
|
||||
src = ./..;
|
||||
|
||||
# Rebuild the usual version number of the project from info of commit being built.
|
||||
# Format: `<date>-<time>-<shorthash>` (Example: `20200608-110940-3fb3a61`)
|
||||
# note: adds `-dirty` when the build includes uncomitted changes
|
||||
version = (
|
||||
builtins.concatStringsSep "-" (
|
||||
# note: `self.lastModifiedDate` looks like `20240209045744`
|
||||
# So this match gives list with 2 items: `20240209` (date) & `045744` (time)
|
||||
builtins.match "(.{8})(.{6})" self.lastModifiedDate
|
||||
++ [ (builtins.substring 0 8 self.rev or self.dirtyRev) ]
|
||||
++ lib.lists.optional (self ? dirtyRev) "dirty"
|
||||
)
|
||||
);
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ../Cargo.lock;
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
|
||||
# Inject collected submodules in-place for Nix build
|
||||
prePatch = ''
|
||||
rm -rf deps/freetype/{freetype2,libpng,zlib} deps/harfbuzz/harfbuzz
|
||||
|
||||
ln -s ${inputs.freetype2} deps/freetype/freetype2
|
||||
ln -s ${inputs.libpng} deps/freetype/libpng
|
||||
ln -s ${inputs.zlib} deps/freetype/zlib
|
||||
ln -s ${inputs.harfbuzz} deps/harfbuzz/harfbuzz
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
echo ${finalAttrs.version} > .tag
|
||||
|
||||
# tests are failing with: Unable to exchange encryption keys
|
||||
rm -r wezterm-ssh/tests
|
||||
|
||||
# hash does not work well with NixOS
|
||||
substituteInPlace assets/shell-integration/wezterm.sh \
|
||||
--replace-fail 'hash wezterm 2>/dev/null' 'command type -P wezterm &>/dev/null' \
|
||||
--replace-fail 'hash base64 2>/dev/null' 'command type -P base64 &>/dev/null' \
|
||||
--replace-fail 'hash hostname 2>/dev/null' 'command type -P hostname &>/dev/null' \
|
||||
--replace-fail 'hash hostnamectl 2>/dev/null' 'command type -P hostnamectl &>/dev/null'
|
||||
'';
|
||||
|
||||
# Disable cargo-auditable until https://github.com/rust-secure-code/cargo-auditable/issues/124 is fixed
|
||||
auditable = false;
|
||||
|
||||
preFixup =
|
||||
lib.optionalString stdenv.hostPlatform.isLinux /* bash */ ''
|
||||
patchelf \
|
||||
--add-needed "${pkgs.libGL}/lib/libEGL.so.1" \
|
||||
--add-needed "${pkgs.vulkan-loader}/lib/libvulkan.so.1" \
|
||||
$out/bin/wezterm-gui
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin /* bash */ ''
|
||||
mkdir -p "$out/Applications"
|
||||
OUT_APP="$out/Applications/WezTerm.app"
|
||||
cp -r assets/macos/WezTerm.app "$OUT_APP"
|
||||
rm $OUT_APP/*.dylib
|
||||
cp -r assets/shell-integration/* "$OUT_APP/Contents/Resources"
|
||||
# macOS will only recognize our application bundle
|
||||
# if the binaries are inside of it. Move them there
|
||||
# and create symbolic links for them in bin/.
|
||||
mkdir -p "$OUT_APP/Contents/MacOS"
|
||||
mv $out/bin/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$OUT_APP/Contents/MacOS"
|
||||
ln -s "$OUT_APP/Contents/MacOS"/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$out/bin"
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
echo "Building Wezterm ${finalAttrs.version}..."
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "${finalAttrs.passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages
|
||||
|
||||
install -Dm644 assets/icon/terminal.png $out/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png
|
||||
install -Dm644 assets/wezterm.desktop $out/share/applications/org.wezfurlong.wezterm.desktop
|
||||
install -Dm644 assets/wezterm.appdata.xml $out/share/metainfo/org.wezfurlong.wezterm.appdata.xml
|
||||
|
||||
install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d
|
||||
installShellCompletion --cmd wezterm \
|
||||
--bash assets/shell-completion/bash \
|
||||
--fish assets/shell-completion/fish \
|
||||
--zsh assets/shell-completion/zsh
|
||||
|
||||
install -Dm644 assets/wezterm-nautilus.py -t $out/share/nautilus-python/extensions
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
# the headless variant is useful when deploying wezterm's mux server on remote severs
|
||||
headless = rustPlatform.buildRustPackage {
|
||||
pname = "wezterm-headless";
|
||||
inherit (finalAttrs)
|
||||
version
|
||||
src
|
||||
postPatch
|
||||
# inherit `cargoDeps` here because `buildRustPackage` strips `cargoLock`
|
||||
# from `finalAttrs` via `excludeDrvArgNames`
|
||||
cargoDeps
|
||||
meta
|
||||
;
|
||||
|
||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||
|
||||
buildInputs = [
|
||||
pkgs.libgit2
|
||||
pkgs.openssl
|
||||
pkgs.zstd
|
||||
];
|
||||
|
||||
cargoBuildFlags = [
|
||||
"--package"
|
||||
"wezterm"
|
||||
"--package"
|
||||
"wezterm-mux-server"
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postInstall = ''
|
||||
install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d
|
||||
install -Dm644 ${finalAttrs.passthru.terminfo}/share/terminfo/w/wezterm -t $out/share/terminfo/w
|
||||
'';
|
||||
};
|
||||
|
||||
terminfo =
|
||||
pkgs.runCommand "wezterm-terminfo-${finalAttrs.version}"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.ncurses ];
|
||||
}
|
||||
''
|
||||
mkdir -p $out/share/terminfo $out/nix-support
|
||||
tic -x -o $out/share/terminfo ${finalAttrs.src}/termwiz/data/wezterm.terminfo
|
||||
'';
|
||||
};
|
||||
|
||||
meta.mainProgram = "wezterm";
|
||||
});
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
devShells = forSystems (
|
||||
system: with (forSys system); {
|
||||
default = pkgs.mkShell {
|
||||
name = "wezterm-shell";
|
||||
inherit nativeBuildInputs;
|
||||
|
||||
# reuse the package build inputs instead of duplicating them
|
||||
inputsFrom = [ repopkgs.wezterm ];
|
||||
|
||||
buildInputs =
|
||||
buildInputs
|
||||
++ (with pkgs.rust-bin; [
|
||||
(with pkgs.rust-bin; [
|
||||
(stable.latest.minimal.override {
|
||||
extensions = [
|
||||
"clippy"
|
||||
@@ -262,43 +103,41 @@
|
||||
|
||||
nightly.latest.rustfmt
|
||||
nightly.latest.rust-analyzer
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
])
|
||||
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
||||
# For local flatpak builds
|
||||
pkgs.flatpak-builder
|
||||
pkgs.flatpak-builder-tools # for flatpak-cargo-generator
|
||||
pkgs.appstream
|
||||
]);
|
||||
];
|
||||
|
||||
LD_LIBRARY_PATH = libPath;
|
||||
# `inputsFrom` does not provide a library search path.
|
||||
# The GUI dlopens libEGL and libvulkan at runtime, so we expose them in the shell.
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath repopkgs.wezterm._runtimeLibs;
|
||||
};
|
||||
|
||||
formatter = pkgs.nixfmt-tree;
|
||||
}
|
||||
);
|
||||
|
||||
testingSystem = "x86_64-linux";
|
||||
globalOutputs = {
|
||||
# 0. Build Wezterm locally: `cargo build`
|
||||
# 1. Build the VM: `nixos-rebuild build-vm --flake ./nix#testing-on-gnome`
|
||||
# 2. Start the VM: `REPO=$PWD ./result/bin/run-nixos-vm`
|
||||
# 3. (In the VM) (optional, 1-time) Adjust your keyboard layout in settings
|
||||
# 4. (In the VM) Open a terminal 'Console' on Gnome, 'Konsole' on KDE
|
||||
# 5. (In the VM) `cd ~/repo`
|
||||
# 6. (In the VM) Run the binary built! ``
|
||||
#
|
||||
# FIXME: cannot write to $REPO in the VM...
|
||||
nixosConfigurations.testing-on-gnome = import ./vm {
|
||||
inherit (inputs) nixpkgs;
|
||||
system = testingSystem;
|
||||
desktopModule = ./vm/desktop-gnome.nix;
|
||||
};
|
||||
nixosConfigurations.testing-on-plasma = import ./vm {
|
||||
inherit (inputs) nixpkgs;
|
||||
system = testingSystem;
|
||||
desktopModule = ./vm/desktop-plasma.nix;
|
||||
};
|
||||
formatter = forSystems (system: (forSys system).pkgs.nixfmt-tree);
|
||||
|
||||
# 0. Build Wezterm locally: `cargo build`
|
||||
# 1. Build the VM: `nixos-rebuild build-vm --flake ./nix#testing-on-gnome`
|
||||
# 2. Start the VM: `REPO=$PWD ./result/bin/run-nixos-vm`
|
||||
# 3. (In the VM) (optional, 1-time) Adjust your keyboard layout in settings
|
||||
# 4. (In the VM) Open a terminal 'Console' on Gnome, 'Konsole' on KDE
|
||||
# 5. (In the VM) `cd ~/repo`
|
||||
# 6. (In the VM) Run the binary built! ``
|
||||
#
|
||||
# FIXME: cannot write to $REPO in the VM...
|
||||
nixosConfigurations.testing-on-gnome = import ./vm {
|
||||
inherit nixpkgs;
|
||||
system = vmTestingSystem;
|
||||
desktopModule = ./vm/desktop-gnome.nix;
|
||||
};
|
||||
in
|
||||
perSystemOutputs // globalOutputs;
|
||||
nixosConfigurations.testing-on-plasma = import ./vm {
|
||||
inherit nixpkgs;
|
||||
system = vmTestingSystem;
|
||||
desktopModule = ./vm/desktop-plasma.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
runCommand,
|
||||
|
||||
# Native Build Inputs
|
||||
installShellFiles,
|
||||
ncurses,
|
||||
pkg-config,
|
||||
python3,
|
||||
# (Darwin only)
|
||||
perl,
|
||||
|
||||
# Build inputs
|
||||
fontconfig,
|
||||
libgit2,
|
||||
openssl,
|
||||
sqlite,
|
||||
zlib,
|
||||
zstd,
|
||||
# (Linux only)
|
||||
libxkbcommon,
|
||||
wayland,
|
||||
libx11,
|
||||
libxcb,
|
||||
libxcb-util,
|
||||
libxcb-image,
|
||||
libxcb-keysyms,
|
||||
libxcb-wm,
|
||||
# (Darwin only)
|
||||
libiconv,
|
||||
|
||||
# Rust (from rust-overlay)
|
||||
makeRustPlatform,
|
||||
rust-bin,
|
||||
|
||||
# Runtime libs
|
||||
libGL,
|
||||
vulkan-loader,
|
||||
|
||||
# Additionally injected stuff
|
||||
flakeInfo,
|
||||
inputSubmodules, # (packages from flake inputs)
|
||||
}:
|
||||
|
||||
let
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
ncurses # tic for terminfo
|
||||
pkg-config
|
||||
python3
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ perl ];
|
||||
|
||||
buildInputs = [
|
||||
fontconfig
|
||||
libgit2
|
||||
openssl
|
||||
sqlite # Required by the sync-color-schemes workspace member
|
||||
zlib
|
||||
zstd
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
libxkbcommon
|
||||
wayland
|
||||
|
||||
libx11
|
||||
libxcb
|
||||
libxcb-util
|
||||
libxcb-image
|
||||
libxcb-keysyms
|
||||
libxcb-wm # contains xcb-ewmh among others
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin ([
|
||||
libiconv
|
||||
]);
|
||||
|
||||
runtimeLibs = [
|
||||
libGL
|
||||
vulkan-loader
|
||||
];
|
||||
|
||||
rustPlatform = makeRustPlatform {
|
||||
cargo = rust-bin.stable.latest.minimal;
|
||||
rustc = rust-bin.stable.latest.minimal;
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
inherit buildInputs nativeBuildInputs;
|
||||
|
||||
pname = "wezterm";
|
||||
src = ./..;
|
||||
|
||||
# Rebuild the usual version number of the project from info of commit being built.
|
||||
# Format: `<date>-<time>-<shorthash>` (Example: `20200608-110940-3fb3a61`)
|
||||
# note: adds `-dirty` when the build includes uncomitted changes
|
||||
version =
|
||||
let
|
||||
# On a dirty tree `flakeInfo.rev` is null and only `flakeInfo.dirtyRev` is set.
|
||||
rev = if flakeInfo.rev != null then flakeInfo.rev else flakeInfo.dirtyRev;
|
||||
in
|
||||
builtins.concatStringsSep "-" (
|
||||
# note: `flakeInfo.lastModifiedDate` looks like `20240209045744`
|
||||
# So this match gives list with 2 items: `20240209` (date) & `045744` (time)
|
||||
builtins.match "(.{8})(.{6})" flakeInfo.lastModifiedDate
|
||||
++ [ (builtins.substring 0 8 rev) ]
|
||||
++ lib.lists.optional (flakeInfo.dirtyRev != null) "dirty"
|
||||
);
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ../Cargo.lock;
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
|
||||
# Inject collected submodules in-place for Nix build
|
||||
prePatch = ''
|
||||
rm -rf deps/freetype/{freetype2,libpng,zlib} deps/harfbuzz/harfbuzz
|
||||
|
||||
ln -s ${inputSubmodules.freetype2} deps/freetype/freetype2
|
||||
ln -s ${inputSubmodules.libpng} deps/freetype/libpng
|
||||
ln -s ${inputSubmodules.zlib} deps/freetype/zlib
|
||||
ln -s ${inputSubmodules.harfbuzz} deps/harfbuzz/harfbuzz
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
echo ${finalAttrs.version} > .tag
|
||||
|
||||
# tests are failing with: Unable to exchange encryption keys
|
||||
rm -r wezterm-ssh/tests
|
||||
|
||||
# hash does not work well with NixOS
|
||||
substituteInPlace assets/shell-integration/wezterm.sh \
|
||||
--replace-fail 'hash wezterm 2>/dev/null' 'command type -P wezterm &>/dev/null' \
|
||||
--replace-fail 'hash base64 2>/dev/null' 'command type -P base64 &>/dev/null' \
|
||||
--replace-fail 'hash hostname 2>/dev/null' 'command type -P hostname &>/dev/null' \
|
||||
--replace-fail 'hash hostnamectl 2>/dev/null' 'command type -P hostnamectl &>/dev/null'
|
||||
'';
|
||||
|
||||
# Disable cargo-auditable until https://github.com/rust-secure-code/cargo-auditable/issues/124 is fixed
|
||||
auditable = false;
|
||||
|
||||
preFixup =
|
||||
lib.optionalString stdenv.hostPlatform.isLinux /* bash */ ''
|
||||
patchelf \
|
||||
--add-needed "${libGL}/lib/libEGL.so.1" \
|
||||
--add-needed "${vulkan-loader}/lib/libvulkan.so.1" \
|
||||
$out/bin/wezterm-gui
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin /* bash */ ''
|
||||
mkdir -p "$out/Applications"
|
||||
OUT_APP="$out/Applications/WezTerm.app"
|
||||
cp -r assets/macos/WezTerm.app "$OUT_APP"
|
||||
rm $OUT_APP/*.dylib
|
||||
cp -r assets/shell-integration/* "$OUT_APP/Contents/Resources"
|
||||
# macOS will only recognize our application bundle
|
||||
# if the binaries are inside of it. Move them there
|
||||
# and create symbolic links for them in bin/.
|
||||
mkdir -p "$OUT_APP/Contents/MacOS"
|
||||
mv $out/bin/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$OUT_APP/Contents/MacOS"
|
||||
ln -s "$OUT_APP/Contents/MacOS"/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$out/bin"
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
echo "Building Wezterm ${finalAttrs.version}..."
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "${finalAttrs.passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages
|
||||
|
||||
install -Dm644 assets/icon/terminal.png $out/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png
|
||||
install -Dm644 assets/wezterm.desktop $out/share/applications/org.wezfurlong.wezterm.desktop
|
||||
install -Dm644 assets/wezterm.appdata.xml $out/share/metainfo/org.wezfurlong.wezterm.appdata.xml
|
||||
|
||||
install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d
|
||||
installShellCompletion --cmd wezterm \
|
||||
--bash assets/shell-completion/bash \
|
||||
--fish assets/shell-completion/fish \
|
||||
--zsh assets/shell-completion/zsh
|
||||
|
||||
install -Dm644 assets/wezterm-nautilus.py -t $out/share/nautilus-python/extensions
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
# Runtime libs are only dlopened by the GUI.
|
||||
# A devshell cannot derive them from `inputsFrom`, so it reads them here.
|
||||
_runtimeLibs = runtimeLibs;
|
||||
|
||||
# the headless variant is useful when deploying wezterm's mux server on remote severs
|
||||
headless = rustPlatform.buildRustPackage {
|
||||
pname = "wezterm-headless";
|
||||
inherit (finalAttrs)
|
||||
version
|
||||
src
|
||||
postPatch
|
||||
# inherit `cargoDeps` here because `buildRustPackage` strips `cargoLock`
|
||||
# from `finalAttrs` via `excludeDrvArgNames`
|
||||
cargoDeps
|
||||
meta
|
||||
;
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
|
||||
buildInputs = [
|
||||
libgit2
|
||||
openssl
|
||||
zstd
|
||||
];
|
||||
|
||||
cargoBuildFlags = [
|
||||
"--package"
|
||||
"wezterm"
|
||||
"--package"
|
||||
"wezterm-mux-server"
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postInstall = ''
|
||||
install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d
|
||||
install -Dm644 ${finalAttrs.passthru.terminfo}/share/terminfo/w/wezterm -t $out/share/terminfo/w
|
||||
'';
|
||||
};
|
||||
|
||||
terminfo =
|
||||
runCommand "wezterm-terminfo-${finalAttrs.version}"
|
||||
{
|
||||
nativeBuildInputs = [ ncurses ];
|
||||
}
|
||||
''
|
||||
mkdir -p $out/share/terminfo $out/nix-support
|
||||
tic -x -o $out/share/terminfo ${finalAttrs.src}/termwiz/data/wezterm.terminfo
|
||||
'';
|
||||
};
|
||||
|
||||
meta.mainProgram = "wezterm";
|
||||
})
|
||||
Reference in new issue
Block a user