talaia-labs / rust-teos

The Eye of Satoshi - Lightning Watchtower
https://talaia-labs.github.io/talaia.watch/
MIT License
136 stars 63 forks source link

add flake.nix #262

Open RCasatta opened 4 months ago

RCasatta commented 4 months ago

This allow to build the project executables with nix.

nix build . # builds teosd and teos-cli
nix build .#plugin # builds watchtower-client

UPDATE: worth mentioning experimental features nix-command and flake are required, either enabled via the command or globally

mariocynicys commented 4 months ago

Thanks!

Could this tolerate being in a sub/nested directory (e.g. dist).

There are probably other package managers could build/use teos in a certain way. I imagine lots of these files in the projects root directory gonna be messy in the future.

Maybe this could fit here: https://github.com/talaia-labs/rust-teos/tree/master/contrib

RCasatta commented 4 months ago

Putting it in a sub-directory would prevent most of the usefulness. From the docs:

A flake refers to a file-system tree whose root directory contains the Nix file specification called flake.nix.

The standard position allows to run the executable also with this syntax:

nix run github:talaia-labs/rust-teos # this is for master, it's possible to use a specific branch or commit hash
sr-gi commented 4 months ago

@seberm you may be interested in this, given https://github.com/fort-nix/nix-bitcoin/pull/543

Would you mind giving it a try if so?

sr-gi commented 3 months ago

Works for me, but I don't know if this flake.nix is idiomatic. There are a bunch of trailing whitespaces and a tab.

Is this fixable by running it though nixfmt?

JosephGoulden commented 2 months ago

I made a few changes and got this working, see my fork here here

@RCasatta let me know if you want to fix up your PR or I can open a new one.

JosephGoulden commented 2 months ago

Works for me, but I don't know if this flake.nix is idiomatic. There are a bunch of trailing whitespaces and a tab.

Is this fixable by running it though nixfmt?

I added nixfmt as well.

RCasatta commented 2 months ago

Please go ahead with a new one, thanks!