ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

add basic man pages (#395)

authored by

marshmallow and committed by
GitHub
a22b9446 9c6218d0

+79 -43
+4
CHANGELOG.md
··· 7 7 8 8 ## [Unreleased] - yyyy-mm-dd 9 9 10 + ### Added 11 + 12 + - Manpages for `1` & `5`, including subcommands. 13 + 10 14 ### Fixed 11 15 12 16 - Fix a bug where key permissions where being printed in decimal format instead
+19 -2
Cargo.lock
··· 306 306 checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" 307 307 308 308 [[package]] 309 + name = "clap_mangen" 310 + version = "0.2.31" 311 + source = "registry+https://github.com/rust-lang/crates.io-index" 312 + checksum = "439ea63a92086df93893164221ad4f24142086d535b3a0957b9b9bea2dc86301" 313 + dependencies = [ 314 + "clap", 315 + "roff", 316 + ] 317 + 318 + [[package]] 309 319 name = "colorchoice" 310 320 version = "1.0.4" 311 321 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 606 616 checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" 607 617 dependencies = [ 608 618 "libc", 609 - "windows-sys 0.52.0", 619 + "windows-sys 0.60.2", 610 620 ] 611 621 612 622 [[package]] ··· 1851 1861 ] 1852 1862 1853 1863 [[package]] 1864 + name = "roff" 1865 + version = "0.2.2" 1866 + source = "registry+https://github.com/rust-lang/crates.io-index" 1867 + checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" 1868 + 1869 + [[package]] 1854 1870 name = "rsa" 1855 1871 version = "0.9.9" 1856 1872 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1901 1917 "errno", 1902 1918 "libc", 1903 1919 "linux-raw-sys", 1904 - "windows-sys 0.52.0", 1920 + "windows-sys 0.60.2", 1905 1921 ] 1906 1922 1907 1923 [[package]] ··· 3164 3180 "clap-num", 3165 3181 "clap-verbosity-flag", 3166 3182 "clap_complete", 3183 + "clap_mangen", 3167 3184 "dhat", 3168 3185 "enum-display-derive", 3169 3186 "futures",
+2 -1
crates/cli/Cargo.toml
··· 23 23 enum-display-derive = "0.1.1" 24 24 futures = "0.3.31" 25 25 clap-num = "1.2.0" 26 - clap-markdown = "0.1.5" 27 26 itertools = "0.14.0" 28 27 dhat = "0.3.2" 29 28 clap_complete = { version = "4.5.60", features = ["unstable-dynamic"] } 30 29 owo-colors = { workspace = true } 31 30 signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] } 32 31 signal-hook = "0.3.18" 32 + clap-markdown = "0.1.5" 33 + clap_mangen = "0.2.31"
+36 -7
crates/cli/default.nix
··· 14 14 agents = lib.strings.concatMapStrings ( 15 15 system: "--set WIRE_KEY_AGENT_${cleanSystem system} ${(getSystem system).packages.agent} " 16 16 ) (import inputs.linux-systems); 17 + 18 + options = pkgs.callPackage ../../doc/options.nix { }; 19 + 20 + cliManpage = pkgs.runCommand "cli-manpage" { } '' 21 + mkdir $out 22 + 23 + ${lib.getExe' self'.packages.wire-unwrapped-dev "wire"} apply --roff $out 24 + ''; 17 25 in 18 26 { 19 27 packages = { 20 28 default = self'.packages.wire; 21 - wire-unwrapped = buildRustProgram { 29 + 30 + wire-unwrapped-dev = buildRustProgram { 22 31 name = "wire"; 23 32 pname = "wire"; 24 33 cargoExtraArgs = "-p wire"; 25 34 doCheck = true; 35 + CARGO_PROFILE = "dev"; 26 36 nativeBuildInputs = [ 27 - pkgs.installShellFiles 28 37 pkgs.sqlx-cli 29 38 ]; 30 39 preBuild = '' ··· 32 41 sqlx database create 33 42 sqlx migrate run --source ./crates/core/src/cache/migrations/ 34 43 ''; 44 + }; 45 + 46 + wire-unwrapped = self'.packages.wire-unwrapped-dev.overrideAttrs (old: { 47 + CARGO_PROFILE = "release"; 48 + nativeBuildInputs = old.nativeBuildInputs ++ [ 49 + pkgs.installShellFiles 50 + pkgs.ronn 51 + ]; 35 52 postInstall = '' 36 53 installShellCompletion --cmd wire \ 37 54 --bash <(COMPLETE=bash $out/bin/wire) \ 38 55 --fish <(COMPLETE=fish $out/bin/wire) \ 39 56 --zsh <(COMPLETE=zsh $out/bin/wire) 40 - ''; 41 - }; 57 + 58 + mkdir -p $out/share/man/man1/ 59 + mkdir -p $out/share/man/man5/ 60 + 61 + cp ${options} wire.5 62 + cp ${cliManpage}/* $out/share/man/man1/ 63 + 64 + ronn -r \ 65 + --manual="Module Options" \ 66 + --name="wire" \ 67 + --section="5" \ 68 + --date="2026-01-1" \ 69 + -o $out/share/man/man5/ \ 70 + wire.5 42 71 43 - wire-unwrapped-dev = self'.packages.wire-unwrapped.overrideAttrs { 44 - CARGO_PROFILE = "dev"; 45 - }; 72 + rm wire.5 73 + ''; 74 + }); 46 75 47 76 wire-unwrapped-perf = buildRustProgram { 48 77 name = "wire";
+6
crates/cli/src/cli.rs
··· 15 15 use wire_core::hive::{Hive, get_hive_location}; 16 16 17 17 use std::io::IsTerminal; 18 + #[cfg(debug_assertions)] 19 + use std::path::PathBuf; 18 20 use std::{ 19 21 fmt::{self, Display, Formatter}, 20 22 sync::Arc, ··· 58 60 #[cfg(debug_assertions)] 59 61 #[arg(long, hide = true, global = true)] 60 62 pub markdown_help: bool, 63 + 64 + #[cfg(debug_assertions)] 65 + #[arg(long, hide = true, global = true)] 66 + pub roff: Option<PathBuf>, 61 67 } 62 68 63 69 #[derive(Clone, Debug)]
+6
crates/cli/src/main.rs
··· 65 65 return Ok(()); 66 66 } 67 67 68 + #[cfg(debug_assertions)] 69 + if let Some(path) = args.roff { 70 + clap_mangen::generate_to(Cli::command(), path).unwrap(); 71 + return Ok(()); 72 + } 73 + 68 74 if !check_nix_available() { 69 75 miette::bail!("Nix is not available on this system."); 70 76 }
+4 -5
doc/options.nix
··· 20 20 }; 21 21 }; 22 22 23 - optionsMd = 24 - (nixosOptionsDoc { 25 - inherit (eval) options; 26 - }).optionsCommonMark; 23 + options = nixosOptionsDoc { 24 + inherit (eval) options; 25 + }; 27 26 in 28 27 runCommand "options-doc.md" { } '' 29 - cat ${optionsMd} > $out 28 + cat ${options.optionsCommonMark} > $out 30 29 sed -i -e '/\*Declared by:\*/,+1d' $out 31 30 ''
+2 -28
doc/package.nix
··· 1 1 { 2 - lib, 3 - nixosOptionsDoc, 4 - runCommand, 2 + callPackage, 5 3 wire-small-dev, 6 4 nix, 7 5 nodejs, ··· 11 9 ... 12 10 }: 13 11 let 14 - eval = lib.evalModules { 15 - modules = [ 16 - ../runtime/module/options.nix 17 - { 18 - options._module.args = lib.mkOption { 19 - internal = true; 20 - }; 21 - } 22 - ]; 23 - specialArgs = { 24 - name = "‹node name›"; 25 - nodes = { }; 26 - }; 27 - }; 28 - 29 - optionsMd = 30 - (nixosOptionsDoc { 31 - inherit (eval) options; 32 - }).optionsCommonMark; 33 - 34 - optionsDoc = runCommand "options-doc.md" { } '' 35 - cat ${optionsMd} > $out 36 - sed -i -e '/\*Declared by:\*/,+1d' $out 37 - ''; 38 - 12 + optionsDoc = callPackage ./options.nix { }; 39 13 pkg = builtins.fromJSON (builtins.readFile ./package.json); 40 14 in 41 15 stdenv.mkDerivation (finalAttrs: {