Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,17 @@ jobs:
uses: psf/black@stable
with:
src: "./watchtower-plugin/tests"
options: "--check -l 120"
options: "--check -l 120"

check-flake:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v12
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Check flake
run: nix flake check

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target
__pycache__
.vscode
.idea
.idea
result
116 changes: 116 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
description = "Build teos (The Eye of Satoshi) server and plugin";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";

crane.url = "github:ipetkov/crane";

fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};

flake-utils.url = "github:numtide/flake-utils";
};

outputs =
{
nixpkgs,
crane,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};

inherit (pkgs) lib;

craneLib = (crane.mkLib pkgs).overrideToolchain fenix.packages.${system}.stable.minimalToolchain;

env = {
PROTOC = "${pkgs.protobuf}/bin/protoc";
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.openssl.out ];
};
commonArgs = {
inherit env;
strictDeps = true;

nativeBuildInputs = [
pkgs.pkg-config
pkgs.rustfmt # needed for tonic build
pkgs.cacert
pkgs.openssl.dev
];

buildInputs =
[ ]
++ lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
};

fileSetForCrate =
crate:
lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./teos-common
./teos
./watchtower-plugin
crate
];
};

plugin = craneLib.buildPackage (
commonArgs
// {
pname = "watchtower-plugin";
cargoExtraArgs = "-p watchtower-plugin";
src = fileSetForCrate ./watchtower-plugin;
inherit (craneLib.crateNameFromCargoToml { cargoToml = ./watchtower-plugin/Cargo.toml; }) version;
}
);
teos = craneLib.buildPackage (
commonArgs
// {
pname = "teos";
cargoExtraArgs = "-p teos";
src = fileSetForCrate ./teos;
inherit (craneLib.crateNameFromCargoToml { cargoToml = ./teos/Cargo.toml; }) version;
}
);
in
{
packages = {
inherit plugin teos;
default = teos;
};

apps = {
plugin = flake-utils.lib.mkApp { drv = plugin; };
teos = flake-utils.lib.mkApp { drv = teos; };
};

formatter = pkgs.nixfmt-tree;

checks = {
inherit teos plugin;
};

devShells.default = craneLib.devShell {
inherit env;
packages = commonArgs.buildInputs ++ commonArgs.nativeBuildInputs;
};
}
);
}