diff options
author | a-kenji <aks.kenji@protonmail.com> | 2022-02-28 13:42:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 13:42:53 +0100 |
commit | 4132b747cae1a9b3edc814f35182c79f9f73ec3b (patch) | |
tree | 8f23e7acb36f4d0df7f476bbc01ceaa9ea7eef06 /flake.nix | |
parent | 04ce77267332a59fbf5a2b181b7f01439f099054 (diff) |
Nix add man (#1148)
* update(nix): add manpage to `man` output
* fmt(nix): nixpkgs-fmt
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 209 |
1 files changed, 107 insertions, 102 deletions
@@ -19,111 +19,116 @@ "i686-linux" "x86_64-darwin" "x86_64-linux" - ] (system: - let - overlays = [ (import rust-overlay) ]; - - pkgs = import nixpkgs { inherit system overlays; }; - - name = "zellij"; - pname = name; - root = toString ./.; - - ignoreSource = [ ".git" "target" ]; - - src = pkgs.nix-gitignore.gitignoreSource ignoreSource root; - - rustToolchainToml = - pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; - cargoLock = { lockFile = ./Cargo.lock; }; - cargo = rustToolchainToml; - rustc = rustToolchainToml; - - #env - RUST_BACKTRACE = 1; - - buildInputs = [ - rustToolchainToml - - # in order to run tests - pkgs.openssl - ]; - - nativeBuildInputs = [ - pkgs.installShellFiles - pkgs.copyDesktopItems - - # for openssl/openssl-sys - pkgs.pkg-config - ]; - - devInputs = [ - pkgs.cargo-make - pkgs.rust-analyzer - pkgs.nixpkgs-fmt - # generates manpages - pkgs.mandown - # optimizes wasm binaries - pkgs.binaryen - ]; - - in rec { - - packages.zellij = - (pkgs.makeRustPlatform { inherit cargo rustc; }).buildRustPackage { - inherit src name cargoLock buildInputs nativeBuildInputs; - - preCheck = '' - HOME=$TMPDIR - ''; - - postInstall = '' - - # 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 - - install -Dm644 ./assets/logo.png $out/share/icons/hicolor/scalable/apps/zellij.png - - copyDesktopItems - ''; - - desktopItems = [ - (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; { - homepage = "https://github.com/zellij-org/zellij/"; - description = "A terminal workspace with batteries included"; - license = [ licenses.mit ]; + ] + (system: + let + overlays = [ (import rust-overlay) ]; + + pkgs = import nixpkgs { inherit system overlays; }; + + name = "zellij"; + pname = name; + root = toString ./.; + + ignoreSource = [ ".git" "target" ]; + + src = pkgs.nix-gitignore.gitignoreSource ignoreSource root; + + rustToolchainToml = + pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; + cargoLock = { lockFile = ./Cargo.lock; }; + cargo = rustToolchainToml; + rustc = rustToolchainToml; + + #env + RUST_BACKTRACE = 1; + + buildInputs = [ + rustToolchainToml + + # in order to run tests + pkgs.openssl + ]; + + nativeBuildInputs = [ + # generates manpages + pkgs.mandown + + pkgs.installShellFiles + pkgs.copyDesktopItems + + # for openssl/openssl-sys + pkgs.pkg-config + ]; + + devInputs = [ + pkgs.cargo-make + pkgs.rust-analyzer + pkgs.nixpkgs-fmt + # optimizes wasm binaries + pkgs.binaryen + ]; + + in + rec { + + packages.zellij = + (pkgs.makeRustPlatform { inherit cargo rustc; }).buildRustPackage { + inherit src name cargoLock buildInputs nativeBuildInputs; + + preCheck = '' + HOME=$TMPDIR + ''; + + postInstall = '' + mandown ./docs/MANPAGE.md > ./zellij.1 + installManPage ./zellij.1 + + # 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 + + install -Dm644 ./assets/logo.png $out/share/icons/hicolor/scalable/apps/zellij.png + + copyDesktopItems + ''; + + desktopItems = [ + (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; { + homepage = "https://github.com/zellij-org/zellij/"; + description = "A terminal workspace with batteries included"; + license = [ licenses.mit ]; + }; }; - }; - defaultPackage = packages.zellij; + defaultPackage = packages.zellij; - # nix run - apps.zellij = flake-utils.lib.mkApp { drv = packages.zellij; }; - defaultApp = apps.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; - }; + devShell = pkgs.mkShell { + name = "zellij-dev"; + inherit buildInputs RUST_BACKTRACE; + nativeBuildInputs = nativeBuildInputs ++ devInputs; + }; - }); + }); } |