From 07f74e74cb1b79e3992702f1ef9c3ce116551347 Mon Sep 17 00:00:00 2001 From: y0usaf Date: Mon, 19 Oct 2026 22:13:51 -0400 Subject: [PATCH] Add a Nix flake for the Rust CLI Package the binary with rustPlatform.buildRustPackage and read Cargo.lock directly, so version and dependency bumps need no hash refreshes. Tests stay off in the sandbox because a few keyring tests hardcode /bin/cat, /bin/sleep and /bin/kill. --- flake.lock | 27 ++++++++++++++++++++++++++ flake.nix | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..1c688afb --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1792210252, + "narHash": "sha256-Mh0PUaIv4nFY+8wAGonaEh8iBzwsmdNlwjVHmFg1Biw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "09063bd1f2b36fd9fd793c36dfade7bd40a93dfc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..6f3c2989 --- /dev/null +++ b/flake.nix @@ -0,0 +1,56 @@ +{ + description = "linear-cli: work with Linear issues from the command line"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { self, nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; + in + { + packages = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + inherit (pkgs) lib; + linear = pkgs.rustPlatform.buildRustPackage { + pname = "linear"; + inherit version; + src = lib.cleanSource ./.; + cargoLock.lockFile = ./Cargo.lock; + cargoBuildFlags = [ "--package" "linear" ]; + doCheck = false; + meta = { + description = "Work with Linear issues, projects and teams from the command line"; + homepage = "https://github.com/schpet/linear-cli"; + license = lib.licenses.isc; + mainProgram = "linear"; + platforms = systems; + }; + }; + in + { + default = linear; + inherit linear; + } + ); + + apps = forAllSystems (system: { + default = { + type = "app"; + program = "${self.packages.${system}.linear}/bin/linear"; + }; + }); + + overlays.default = final: prev: { + linear = self.packages.${prev.system}.linear; + }; + }; +}