Add flake.nix to allow running from tangled CI #7

open
opened by oeiuwq.com targeting main from oeiuwq.com/tangled-cli: flake
+18
README.md
···
The binary will be available at `target/release/tangled-cli`.
### Install from AUR (Arch Linux)
Community-maintained package:
···
The binary will be available at `target/release/tangled-cli`.
+
### Using with Nix
+
+
This repo provides a runnable flake:
+
+
```sh
+
nix run git+https://tangled.org/vitorpy.com/tangled-cli
+
```
+
+
#### On Tangled CI Pipelines
+
+
Register a [Spindle dependency](https://tangled.org/tangled.org/core/blob/master/docs/spindle/pipeline.md#dependencies) on your workflow:
+
+
```yaml
+
dependencies:
+
git+https://tangled.org/victorpy.com/tangled-cli:
+
- tangled-cli
+
```
+
### Install from AUR (Arch Linux)
Community-maintained package:
+27
flake.lock
···
···
+
{
+
"nodes": {
+
"nixpkgs": {
+
"locked": {
+
"lastModified": 1764242076,
+
"narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=",
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4",
+
"type": "github"
+
},
+
"original": {
+
"owner": "NixOS",
+
"ref": "nixos-unstable",
+
"repo": "nixpkgs",
+
"type": "github"
+
}
+
},
+
"root": {
+
"inputs": {
+
"nixpkgs": "nixpkgs"
+
}
+
}
+
},
+
"root": "root",
+
"version": 7
+
}
+5
flake.nix
···
···
+
{
+
description = "Tangled CLI";
+
outputs = inputs: import ./nix inputs;
+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
}
+47
nix/default.nix
···
···
+
inputs:
+
let
+
inherit (inputs) self nixpkgs;
+
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
+
+
cliToml = builtins.fromTOML (builtins.readFile ../crates/tangled-cli/Cargo.toml);
+
+
tangled-cli =
+
{
+
lib,
+
rustPlatform,
+
pkg-config,
+
openssl,
+
...
+
}:
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = cliToml.package.name;
+
version = cliToml.package.version;
+
src = ./..;
+
cargoDepsName = finalAttrs.pname;
+
cargoLock.lockFile = ../Cargo.lock;
+
+
nativeBuildInputs = [ pkg-config ];
+
buildInputs = [ openssl ];
+
+
meta = {
+
description = cliToml.package.description;
+
license = lib.licenses.mit;
+
};
+
});
+
+
packages = forAllSystems (
+
system:
+
let
+
pkgs = import nixpkgs { inherit system; };
+
default = pkgs.callPackage tangled-cli { };
+
in
+
{
+
inherit default;
+
tangled-cli = default;
+
}
+
);
+
+
in
+
{
+
inherit packages;
+
}