Nix add man (#1148)

* update(nix): add manpage to `man` output

* fmt(nix): nixpkgs-fmt
This commit is contained in:
a-kenji 2022-02-28 13:42:53 +01:00 committed by GitHub
parent 04ce772673
commit 4132b747ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

173
flake.nix
View file

@ -19,111 +19,116 @@
"i686-linux" "i686-linux"
"x86_64-darwin" "x86_64-darwin"
"x86_64-linux" "x86_64-linux"
] (system: ]
let (system:
overlays = [ (import rust-overlay) ]; let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
name = "zellij"; name = "zellij";
pname = name; pname = name;
root = toString ./.; root = toString ./.;
ignoreSource = [ ".git" "target" ]; ignoreSource = [ ".git" "target" ];
src = pkgs.nix-gitignore.gitignoreSource ignoreSource root; src = pkgs.nix-gitignore.gitignoreSource ignoreSource root;
rustToolchainToml = rustToolchainToml =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
cargoLock = { lockFile = ./Cargo.lock; }; cargoLock = { lockFile = ./Cargo.lock; };
cargo = rustToolchainToml; cargo = rustToolchainToml;
rustc = rustToolchainToml; rustc = rustToolchainToml;
#env #env
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
buildInputs = [ buildInputs = [
rustToolchainToml rustToolchainToml
# in order to run tests # in order to run tests
pkgs.openssl pkgs.openssl
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.installShellFiles # generates manpages
pkgs.copyDesktopItems pkgs.mandown
# for openssl/openssl-sys pkgs.installShellFiles
pkgs.pkg-config pkgs.copyDesktopItems
];
devInputs = [ # for openssl/openssl-sys
pkgs.cargo-make pkgs.pkg-config
pkgs.rust-analyzer ];
pkgs.nixpkgs-fmt
# generates manpages
pkgs.mandown
# optimizes wasm binaries
pkgs.binaryen
];
in rec { devInputs = [
pkgs.cargo-make
pkgs.rust-analyzer
pkgs.nixpkgs-fmt
# optimizes wasm binaries
pkgs.binaryen
];
packages.zellij = in
(pkgs.makeRustPlatform { inherit cargo rustc; }).buildRustPackage { rec {
inherit src name cargoLock buildInputs nativeBuildInputs;
preCheck = '' packages.zellij =
HOME=$TMPDIR (pkgs.makeRustPlatform { inherit cargo rustc; }).buildRustPackage {
''; inherit src name cargoLock buildInputs nativeBuildInputs;
postInstall = '' preCheck = ''
HOME=$TMPDIR
'';
# explicit behavior postInstall = ''
$out/bin/zellij setup --generate-completion bash > ./completions.bash mandown ./docs/MANPAGE.md > ./zellij.1
installShellCompletion --bash --name ${pname}.bash ./completions.bash installManPage ./zellij.1
$out/bin/zellij setup --generate-completion fish > ./completions.fish
installShellCompletion --fish --name ${pname}.fish ./completions.fish
$out/bin/zellij setup --generate-completion zsh > ./completions.zsh
installShellCompletion --zsh --name _${pname} ./completions.zsh
install -Dm644 ./assets/logo.png $out/share/icons/hicolor/scalable/apps/zellij.png # explicit behavior
$out/bin/zellij setup --generate-completion bash > ./completions.bash
installShellCompletion --bash --name ${pname}.bash ./completions.bash
$out/bin/zellij setup --generate-completion fish > ./completions.fish
installShellCompletion --fish --name ${pname}.fish ./completions.fish
$out/bin/zellij setup --generate-completion zsh > ./completions.zsh
installShellCompletion --zsh --name _${pname} ./completions.zsh
copyDesktopItems install -Dm644 ./assets/logo.png $out/share/icons/hicolor/scalable/apps/zellij.png
'';
desktopItems = [ copyDesktopItems
(pkgs.makeDesktopItem { '';
type = "Application";
inherit name;
desktopName = "zellij";
terminal = true;
genericName = "Terminal multiplexer";
comment = "Manage your terminal applications";
exec = "zellij";
icon = "zellij";
categories = [ "ConsoleOnly;System" ];
})
];
meta = with pkgs.lib; { desktopItems = [
homepage = "https://github.com/zellij-org/zellij/"; (pkgs.makeDesktopItem {
description = "A terminal workspace with batteries included"; type = "Application";
license = [ licenses.mit ]; inherit name;
desktopName = "zellij";
terminal = true;
genericName = "Terminal multiplexer";
comment = "Manage your terminal applications";
exec = "zellij";
icon = "zellij";
categories = [ "ConsoleOnly;System" ];
})
];
meta = with pkgs.lib; {
homepage = "https://github.com/zellij-org/zellij/";
description = "A terminal workspace with batteries included";
license = [ licenses.mit ];
};
}; };
defaultPackage = packages.zellij;
# nix run
apps.zellij = flake-utils.lib.mkApp { drv = packages.zellij; };
defaultApp = apps.zellij;
devShell = pkgs.mkShell {
name = "zellij-dev";
inherit buildInputs RUST_BACKTRACE;
nativeBuildInputs = nativeBuildInputs ++ devInputs;
}; };
defaultPackage = packages.zellij; });
# nix run
apps.zellij = flake-utils.lib.mkApp { drv = packages.zellij; };
defaultApp = apps.zellij;
devShell = pkgs.mkShell {
name = "zellij-dev";
inherit buildInputs RUST_BACKTRACE;
nativeBuildInputs = nativeBuildInputs ++ devInputs;
};
});
} }