chore(nix): add flake support for build, run, and devShell#11
Open
sshawn9 wants to merge 1 commit intotimhartmann7:mainfrom
Open
chore(nix): add flake support for build, run, and devShell#11sshawn9 wants to merge 1 commit intotimhartmann7:mainfrom
sshawn9 wants to merge 1 commit intotimhartmann7:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
There is no first-class way to build or run OmnySSH from a Nix-based system.
Users on NixOS, nix-darwin, or with Nix installed on other distros currently
have to either install Rust system-wide or fall back to
cargo install omnyssh, neither of which fits a reproducible Nix workflow.Solution
Add a
flake.nixthat exposes:packages.default(andpackages.omnyssh) — builds theomnybinary viarustPlatform.buildRustPackage, usingCargo.lockfor hash pinning, andinstalls the generated
doc/omny.1man page viainstallManPage.apps.default— entry point fornix run, withmetapopulated from thepackage so
nix flake checkis warning-free.devShells.default—rustc,cargo,rustfmt,clippy,rust-analyzer,plus all build inputs from the package, with
RUST_SRC_PATHset for LSPstd-library navigation.
Implementation notes:
pname/version/description/homepageare read fromCargo.tomlvia
builtins.fromTOML, so they stay in sync without duplication.darwin.apple_sdk.frameworks.*paths were removed in recent nixpkgs andmodern stdenv on Darwin already exposes what
russhneeds.nixpkgsis pinned tonixos-unstable;flake-utilsis used only foreachDefaultSystemto avoid hand-rolling the system list.README.mdgets a new ❄️ Nix (Flakes) section under Installation, afterFrom Source, coveringnix run,nix build,nix profile install, andnix develop.Test plan
nix flake check --all-systems— passes forx86_64-linux,aarch64-linux,x86_64-darwin,aarch64-darwinwith no warnings.nix build .onx86_64-linux— produces./result/bin/omny.nix run .andnix run . -- --help— binary launches.nix develop— drops into a shell wherecargo buildandcargo clippy -- -D warningssucceed.cargo test && cargo clippy -- -D warnings && cargo fmt --check—unaffected; no Rust source changes.
README.mdrenders correctly on GitHub.Checklist
cargo test)cargo clippy -- -D warnings)cargo fmt)prefer; left out for now since this is build-tooling, not a user-visible
runtime change
Files changed
flake.nix— newflake.lock— new (generated, pinsnixpkgsandflake-utils)README.md— new "❄️ Nix (Flakes)" section under Installation