Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flake.nix #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add flake.nix #262

wants to merge 1 commit into from

Conversation

RCasatta
Copy link

@RCasatta RCasatta commented Jul 8, 2024

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
Copy link
Collaborator

mariocynicys commented Jul 10, 2024

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
Copy link
Author

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

flake.nix Outdated
@@ -0,0 +1,124 @@
{
description = "Build teos (The Eyes of Satoshi) server and plugin";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Eyes -> Eye

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

pkgs.libiconv
];

# TODO: hack but without there are warnings and I can't make other method work
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about what the issue with this is. I'm not familiar with Nix so just wondering

Copy link
Author

@RCasatta RCasatta Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that changing the released version in Cargo.toml require changing the version here, while instead the value should be read from the Cargo.toml thus not requiring to keep this file in sync.

@sr-gi
Copy link
Member

sr-gi commented Jul 26, 2024

@seberm you may be interested in this, given fort-nix/nix-bitcoin#543

Would you mind giving it a try if so?

Copy link

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sr-gi
Copy link
Member

sr-gi commented Aug 5, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants