diff --git a/.config/flakebox/id b/.config/flakebox/id index c805c8f..1697551 100644 --- a/.config/flakebox/id +++ b/.config/flakebox/id @@ -1 +1 @@ -9501c5c269226a4ea1bca7043d0b0cbe88e451514e3d43c089f74880a8a482980b414fb9d8f933589b2a1598f79fbc5646cca86da35e49ec694f6070a7ff53e5 +6cc53c747a56bca36668bb5f215a632e03f97014ccea2c382c18a47ee7d0f802b281f01ea2fd16a8546b95c0d56bde4919ced91952b4a48ae16eada7bccd2235 diff --git a/fedimint-nwc/src/database/invoice.rs b/fedimint-nwc/src/database/invoice.rs index 4074372..65e28cc 100644 --- a/fedimint-nwc/src/database/invoice.rs +++ b/fedimint-nwc/src/database/invoice.rs @@ -54,8 +54,14 @@ impl From<&Bolt11Invoice> for Invoice { } impl Value for Invoice { - type SelfType<'a> = Self where Self: 'a; - type AsBytes<'a> = Vec where Self: 'a; + type SelfType<'a> + = Self + where + Self: 'a; + type AsBytes<'a> + = Vec + where + Self: 'a; fn as_bytes<'a, 'b: 'a>(value: &'a Self::SelfType<'b>) -> Vec { // nosemgrep: use-of-unwrap diff --git a/fedimint-nwc/src/database/payment.rs b/fedimint-nwc/src/database/payment.rs index 7bd4652..ff39c9c 100644 --- a/fedimint-nwc/src/database/payment.rs +++ b/fedimint-nwc/src/database/payment.rs @@ -22,8 +22,14 @@ impl Payment { } impl Value for Payment { - type SelfType<'a> = Self where Self: 'a; - type AsBytes<'a> = Vec where Self: 'a; + type SelfType<'a> + = Self + where + Self: 'a; + type AsBytes<'a> + = Vec + where + Self: 'a; fn as_bytes<'a, 'b: 'a>(value: &'a Self::SelfType<'b>) -> Vec { // nosemgrep: use-of-unwrap diff --git a/flake.lock b/flake.lock index cc374cc..69697c7 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1706115649, - "narHash": "sha256-Qrqb54qGaRsFdLDj8EJtI5leFGFfqWHLRgC+t6KWlpQ=", + "lastModified": 1727103737, + "narHash": "sha256-otyUwbqaXYkeBxPy3Gf0ACB0rHl23OzAlfpsVvY1hbc=", "owner": "rustsec", "repo": "advisory-db", - "rev": "1d2202ea2b32fabd3307641010301bfe187ef11a", + "rev": "45780a4d66ad647bd3c148509fb081943efdacfd", "type": "github" }, "original": { @@ -19,7 +19,7 @@ "android-nixpkgs": { "inputs": { "devshell": "devshell", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "nixpkgs": [ "fedimint", "flakebox", @@ -27,41 +27,41 @@ ] }, "locked": { - "lastModified": 1695500413, - "narHash": "sha256-yinrAWIc4XZbWQoXOYkUO0lCNQ5z/vMyl+QCYuIwdPc=", - "owner": "dpc", + "lastModified": 1719001124, + "narHash": "sha256-JXrMwYlQarZPyjN5UkD4fS9mrHSE1PUa7P//1Z5Sqr0=", + "owner": "tadfisher", "repo": "android-nixpkgs", - "rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4", + "rev": "7fa1348249564e43185d3053f579f9fa923d46cc", "type": "github" }, "original": { - "owner": "dpc", + "owner": "tadfisher", "repo": "android-nixpkgs", - "rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4", + "rev": "7fa1348249564e43185d3053f579f9fa923d46cc", "type": "github" } }, "android-nixpkgs_2": { "inputs": { "devshell": "devshell_2", - "flake-utils": "flake-utils_6", + "flake-utils": "flake-utils_8", "nixpkgs": [ "flakebox", "nixpkgs" ] }, "locked": { - "lastModified": 1695500413, - "narHash": "sha256-yinrAWIc4XZbWQoXOYkUO0lCNQ5z/vMyl+QCYuIwdPc=", - "owner": "dpc", + "lastModified": 1727381935, + "narHash": "sha256-G2fOYRZM7bXK5eBb+GK3k/WmO+q5JA/GtFwSPc3kdc8=", + "owner": "tadfisher", "repo": "android-nixpkgs", - "rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4", + "rev": "522d86121cbd413aff922c54f38106ecf8740107", "type": "github" }, "original": { - "owner": "dpc", + "owner": "tadfisher", "repo": "android-nixpkgs", - "rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4", + "rev": "522d86121cbd413aff922c54f38106ecf8740107", "type": "github" } }, @@ -95,17 +95,17 @@ ] }, "locked": { - "lastModified": 1699217310, - "narHash": "sha256-xpW3VFUG7yE6UE6Wl0dhqencuENSkV7qpnpe9I8VbPw=", + "lastModified": 1717383740, + "narHash": "sha256-559HbY4uhNeoYvK3H6AMZAtVfmR3y8plXZ1x6ON/cWU=", "owner": "ipetkov", "repo": "crane", - "rev": "d535642bbe6f377077f7c23f0febb78b1463f449", + "rev": "b65673fce97d277934488a451724be94cc62499a", "type": "github" }, "original": { "owner": "ipetkov", "repo": "crane", - "rev": "d535642bbe6f377077f7c23f0febb78b1463f449", + "rev": "b65673fce97d277934488a451724be94cc62499a", "type": "github" } }, @@ -117,36 +117,36 @@ ] }, "locked": { - "lastModified": 1710886643, - "narHash": "sha256-saTZuv9YeZ9COHPuj8oedGdUwJZcbQ3vyRqe7NVJMsQ=", + "lastModified": 1717383740, + "narHash": "sha256-559HbY4uhNeoYvK3H6AMZAtVfmR3y8plXZ1x6ON/cWU=", "owner": "ipetkov", "repo": "crane", - "rev": "5bace74e9a65165c918205cf67ad3977fe79c584", + "rev": "b65673fce97d277934488a451724be94cc62499a", "type": "github" }, "original": { "owner": "ipetkov", "repo": "crane", - "rev": "5bace74e9a65165c918205cf67ad3977fe79c584", + "rev": "b65673fce97d277934488a451724be94cc62499a", "type": "github" } }, "devshell": { "inputs": { + "flake-utils": "flake-utils_3", "nixpkgs": [ "fedimint", "flakebox", "android-nixpkgs", "nixpkgs" - ], - "systems": "systems_2" + ] }, "locked": { - "lastModified": 1695195896, - "narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=", + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", "owner": "numtide", "repo": "devshell", - "rev": "05d40d17bf3459606316e3e9ec683b784ff28f16", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", "type": "github" }, "original": { @@ -157,19 +157,19 @@ }, "devshell_2": { "inputs": { + "flake-utils": "flake-utils_7", "nixpkgs": [ "flakebox", "android-nixpkgs", "nixpkgs" - ], - "systems": "systems_6" + ] }, "locked": { - "lastModified": 1695195896, - "narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=", + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", "owner": "numtide", "repo": "devshell", - "rev": "05d40d17bf3459606316e3e9ec683b784ff28f16", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", "type": "github" }, "original": { @@ -188,17 +188,16 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1715195282, - "narHash": "sha256-XDrJ2JtLuaSUcfuo3Fgfy416/a/8mrABaFmOIiYn7bs=", + "lastModified": 1728332776, + "narHash": "sha256-9sXaZxnrRk/8I2PHUYxKzWuLdL8pOIHXIZoVjrv0kmA=", "owner": "fedimint", "repo": "fedimint", - "rev": "dbabb5f44de5401d24ca9414534a36a22e89c6df", + "rev": "ab014f58ea178a5b9a36b6426cb270b815b6d630", "type": "github" }, "original": { "owner": "fedimint", "repo": "fedimint", - "rev": "dbabb5f44de5401d24ca9414534a36a22e89c6df", "type": "github" } }, @@ -211,11 +210,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1708928609, - "narHash": "sha256-LcXC2NP/TzHMmJThZGG1e+7rht5HeuZK5WOirIDg+lU=", + "lastModified": 1727245890, + "narHash": "sha256-B4gUhZxqdn24PqL7z7ZuvLOS84HVskhKRByWdgA4/RI=", "owner": "nix-community", "repo": "fenix", - "rev": "e928fb6b5179ebd032c19afac5c461ccc0b6de55", + "rev": "de3acda8b67b92abeeb35ac236924afd959874ad", "type": "github" }, "original": { @@ -227,16 +226,17 @@ "fenix_2": { "inputs": { "nixpkgs": [ + "flakebox", "nixpkgs" ], "rust-analyzer-src": "rust-analyzer-src_2" }, "locked": { - "lastModified": 1715581585, - "narHash": "sha256-/JjvIn1NXW3yOaDcD8Me987/QcXjo+rhg+uThasPAnI=", + "lastModified": 1727418876, + "narHash": "sha256-a4iKujD+2XqzT1QXWzStu31qzpZGJi7K6AS5AlpSDY0=", "owner": "nix-community", "repo": "fenix", - "rev": "2c4905096782e8e908205e7fa54ef987fba62793", + "rev": "6ed50e3b7558220f1854cf348fcbf40540709fc3", "type": "github" }, "original": { @@ -265,11 +265,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -280,14 +280,14 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_3" + "systems": "systems_2" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -297,6 +297,24 @@ } }, "flake-utils_4": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { "inputs": { "systems": [ "fedimint", @@ -305,11 +323,11 @@ ] }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -318,16 +336,16 @@ "type": "github" } }, - "flake-utils_5": { + "flake-utils_6": { "inputs": { "systems": "systems_5" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -336,16 +354,34 @@ "type": "github" } }, - "flake-utils_6": { + "flake-utils_7": { + "inputs": { + "systems": "systems_6" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_8": { "inputs": { "systems": "systems_7" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -354,7 +390,7 @@ "type": "github" } }, - "flake-utils_7": { + "flake-utils_9": { "inputs": { "systems": [ "flakebox", @@ -362,11 +398,11 @@ ] }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -383,7 +419,7 @@ "fedimint", "fenix" ], - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixpkgs": [ "fedimint", "nixpkgs" @@ -391,17 +427,17 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1709623646, - "narHash": "sha256-kqN+O/D+s2SKYfDdJUrmh1/tpc476gn+JU7JjjnkSik=", + "lastModified": 1719004469, + "narHash": "sha256-TZSHiEJ3qYgA46vikQKT2bwGCEF2LrJVw7cettqa+/g=", "owner": "dpc", "repo": "flakebox", - "rev": "27ecbf8f2b252dd843d0f58d45658eb56bb5e223", + "rev": "12d5ee4f6c47bc01f07ec6f5848a83db265902d3", "type": "github" }, "original": { "owner": "dpc", "repo": "flakebox", - "rev": "27ecbf8f2b252dd843d0f58d45658eb56bb5e223", + "rev": "12d5ee4f6c47bc01f07ec6f5848a83db265902d3", "type": "github" } }, @@ -409,27 +445,25 @@ "inputs": { "android-nixpkgs": "android-nixpkgs_2", "crane": "crane_2", - "fenix": [ - "fenix" - ], - "flake-utils": "flake-utils_7", + "fenix": "fenix_2", + "flake-utils": "flake-utils_9", "nixpkgs": [ "nixpkgs" ], "systems": "systems_8" }, "locked": { - "lastModified": 1712778429, - "narHash": "sha256-oile9hEqPZdlLLGAy359Lpek36lPoKPbWtda63I3/5o=", - "owner": "dpc", + "lastModified": 1727478500, + "narHash": "sha256-nrDYdwIAI1nskNEE/r9rhDJDaouZ4tpSyURfndRsPho=", + "owner": "rustshop", "repo": "flakebox", - "rev": "226d584e9a288b9a0471af08c5712e7fac6f87dc", + "rev": "ee39d59b2c3779e5827f8fa2d269610c556c04c8", "type": "github" }, "original": { - "owner": "dpc", + "owner": "rustshop", "repo": "flakebox", - "rev": "226d584e9a288b9a0471af08c5712e7fac6f87dc", + "rev": "ee39d59b2c3779e5827f8fa2d269610c556c04c8", "type": "github" } }, @@ -516,32 +550,32 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1709309926, - "narHash": "sha256-VZFBtXGVD9LWTecGi6eXrE0hJ/mVB3zGUlHImUs2Qak=", + "lastModified": 1727129439, + "narHash": "sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "79baff8812a0d68e24a836df0a364c678089e2c7", + "rev": "babc25a577c3310cce57c72d5bed70f4c3c3843a", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_5": { "locked": { - "lastModified": 1715542476, - "narHash": "sha256-FF593AtlzQqa8JpzrXyRws4CeKbc5W86o8tHt4nRfIg=", + "lastModified": 1728193676, + "narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "44072e24566c5bcc0b7aa9178a0104f4cfffab19", + "rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } @@ -549,8 +583,7 @@ "root": { "inputs": { "fedimint": "fedimint", - "fenix": "fenix_2", - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_6", "flakebox": "flakebox_2", "nixpkgs": "nixpkgs_5" } @@ -558,11 +591,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1708878562, - "narHash": "sha256-IBHMNEe3lspVdIzjpM2OVZiBFmFw1DKtdgVN5G41pRc=", + "lastModified": 1727104575, + "narHash": "sha256-lB/ZS0SnHyE8Z3G8DIL/QJPg6w6x5ZhgVO2pBqnz89g=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "5346002d07d09badaf37949bec68012d963d61fc", + "rev": "3d0343251fe084b335b55c17a52bb4a3527b1bd0", "type": "github" }, "original": { @@ -575,11 +608,11 @@ "rust-analyzer-src_2": { "flake": false, "locked": { - "lastModified": 1715255944, - "narHash": "sha256-vLLgYpdtKBaGYTamNLg1rbRo1bPXp4Jgded/gnprPVw=", + "lastModified": 1727376968, + "narHash": "sha256-0Vmk8/7uOg7IxZOQIcY2deuUnTUTm1d/mZe8yycbCAA=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "5bf2f85c8054d80424899fa581db1b192230efb5", + "rev": "c88ea11832277b6c010088d658965c39c1181d20", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index dae2af1..ad78cd2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,31 +1,33 @@ { - description = - "A fedimint client daemon for server side applications to hold, use, and manage Bitcoin and ecash"; + description = "A fedimint client daemon for server side applications to hold, use, and manage Bitcoin and ecash"; inputs = { - nixpkgs = { url = "github:nixos/nixpkgs/nixos-23.11"; }; - - fenix = { - url = "github:nix-community/fenix"; - inputs.nixpkgs.follows = "nixpkgs"; + nixpkgs = { + url = "github:nixos/nixpkgs/nixos-24.05"; }; flakebox = { - url = "github:dpc/flakebox?rev=226d584e9a288b9a0471af08c5712e7fac6f87dc"; + url = "github:rustshop/flakebox?rev=ee39d59b2c3779e5827f8fa2d269610c556c04c8"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.fenix.follows = "fenix"; }; flake-utils.url = "github:numtide/flake-utils"; fedimint = { - url = - "github:fedimint/fedimint?rev=dbabb5f44de5401d24ca9414534a36a22e89c6df"; + url = "github:fedimint/fedimint"; }; }; - outputs = { self, nixpkgs, flakebox, fenix, flake-utils, fedimint }: - flake-utils.lib.eachDefaultSystem (system: + outputs = + { + self, + nixpkgs, + flakebox, + flake-utils, + fedimint, + }: + flake-utils.lib.eachDefaultSystem ( + system: let pkgs = import nixpkgs { inherit system; @@ -49,59 +51,69 @@ ]; }; - toolchainArgs = let llvmPackages = pkgs.llvmPackages_11; - in { - extraRustFlags = "--cfg tokio_unstable"; + toolchainArgs = + let + llvmPackages = pkgs.llvmPackages_11; + in + { + extraRustFlags = "--cfg tokio_unstable"; - components = [ "rustc" "cargo" "clippy" "rust-analyzer" "rust-src" ]; + components = [ + "rustc" + "cargo" + "clippy" + "rust-analyzer" + "rust-src" + ]; - args = { - nativeBuildInputs = - [ pkgs.wasm-bindgen-cli pkgs.geckodriver pkgs.wasm-pack ] - ++ lib.optionals (!pkgs.stdenv.isDarwin) [ pkgs.firefox ]; + args = { + nativeBuildInputs = [ + pkgs.wasm-bindgen-cli + pkgs.geckodriver + pkgs.wasm-pack + ] ++ lib.optionals (!pkgs.stdenv.isDarwin) [ pkgs.firefox ]; + }; }; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - # on Darwin newest stdenv doesn't seem to work - # linking rocksdb - stdenv = pkgs.clang11Stdenv; - clang = llvmPackages.clang; - libclang = llvmPackages.libclang.lib; - clang-unwrapped = llvmPackages.clang-unwrapped; - }; # all standard toolchains provided by flakebox toolchainsStd = flakeboxLib.mkStdFenixToolchains toolchainArgs; toolchainsNative = (pkgs.lib.getAttrs [ "default" ] toolchainsStd); - toolchainNative = - flakeboxLib.mkFenixMultiToolchain { toolchains = toolchainsNative; }; + toolchainNative = flakeboxLib.mkFenixMultiToolchain { toolchains = toolchainsNative; }; commonArgs = { - buildInputs = [ ] ++ lib.optionals pkgs.stdenv.isDarwin - [ pkgs.darwin.apple_sdk.frameworks.SystemConfiguration ]; + buildInputs = + [ ] + ++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.SystemConfiguration ]; nativeBuildInputs = [ pkgs.pkg-config ]; }; - outputs = (flakeboxLib.craneMultiBuild { toolchains = toolchainsStd; }) - (craneLib': - let - craneLib = (craneLib'.overrideArgs { + outputs = (flakeboxLib.craneMultiBuild { toolchains = toolchainsStd; }) ( + craneLib': + let + craneLib = + (craneLib'.overrideArgs { pname = "flexbox-multibuild"; src = rustSrc; - }).overrideArgs commonArgs; - in rec { - workspaceDeps = craneLib.buildWorkspaceDepsOnly { }; - workspaceBuild = - craneLib.buildWorkspace { cargoArtifacts = workspaceDeps; }; - fedimint-clientd = craneLib.buildPackageGroup { - pname = "fedimint-clientd"; - packages = [ "fedimint-clientd" ]; - mainProgram = "fedimint-clientd"; - }; - }); - in { + }).overrideArgs + commonArgs; + in + rec { + workspaceDeps = craneLib.buildWorkspaceDepsOnly { }; + workspaceBuild = craneLib.buildWorkspace { cargoArtifacts = workspaceDeps; }; + fedimint-clientd = craneLib.buildPackageGroup { + pname = "fedimint-clientd"; + packages = [ "fedimint-clientd" ]; + mainProgram = "fedimint-clientd"; + }; + } + ); + in + { legacyPackages = outputs; - packages = { default = outputs.fedimint-clientd; }; + packages = { + default = outputs.fedimint-clientd; + }; devShells = flakeboxLib.mkShells { packages = [ ]; buildInputs = commonArgs.buildInputs; @@ -125,5 +137,6 @@ export RUST_LOG="info" ''; }; - }); + } + ); } diff --git a/JUSTFILE b/justfile similarity index 97% rename from JUSTFILE rename to justfile index 67a9592..b04cd88 100644 --- a/JUSTFILE +++ b/justfile @@ -1,5 +1,4 @@ # THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION -import "justfile.local.just" alias b := build alias c := check @@ -38,7 +37,6 @@ final-check: lint clippy if [ ! -f Cargo.toml ]; then cd {{invocation_directory()}} fi - cargo test --doc just test @@ -50,7 +48,7 @@ format: cd {{invocation_directory()}} fi cargo fmt --all - nixpkgs-fmt $(echo **.nix) + nixfmt $(git ls-files | grep "\.nix$") # run lints (git pre-commit hook) diff --git a/misc/git-hooks/commit-msg b/misc/git-hooks/commit-msg index b4fe09a..922aa4c 100755 --- a/misc/git-hooks/commit-msg +++ b/misc/git-hooks/commit-msg @@ -18,6 +18,6 @@ MESSAGE="$( MESSAGE="${MESSAGE#fixup! }" if ! convco check --from-stdin <<<"$MESSAGE" ; then >&2 echo "Please follow conventional commits(https://www.conventionalcommits.org)" - >&2 echo "Use git recommit to fix your commit" + >&2 echo "Use git commit to fix your commit" exit 1 fi diff --git a/misc/git-hooks/pre-commit b/misc/git-hooks/pre-commit index 9e0d58e..8ef0f14 100755 --- a/misc/git-hooks/pre-commit +++ b/misc/git-hooks/pre-commit @@ -9,13 +9,13 @@ set -e # Revert `git stash` on exit function revert_git_stash { - echo >&2 "Unstashing uncommitted changes..." + >&2 echo "Unstashing uncommitted changes..." git stash pop -q } # Stash pending changes and revert them when script ends if [ -z "${NO_STASH:-}" ] && [ $is_unclean -ne 0 ]; then - echo >&2 "Stashing uncommitted changes..." + >&2 echo "Stashing uncommitted changes..." GIT_LITERAL_PATHSPECS=0 git stash -q --keep-index trap revert_git_stash EXIT fi @@ -25,144 +25,146 @@ FLAKEBOX_GIT_LS="$(git ls-files)" export FLAKEBOX_GIT_LS_TEXT FLAKEBOX_GIT_LS_TEXT="$(echo "$FLAKEBOX_GIT_LS" | grep -v -E "\.(png|ods|jpg|jpeg|woff2|keystore|wasm|ttf|jar|ico|gif)\$")" + function check_nothing() { true } export -f check_nothing function check_cargo_fmt() { - set -euo pipefail + set -euo pipefail - flakebox-in-each-cargo-workspace cargo fmt --all --check + flakebox-in-each-cargo-workspace cargo fmt --all --check } export -f check_cargo_fmt function check_cargo_lock() { - set -euo pipefail + set -euo pipefail - # https://users.rust-lang.org/t/check-if-the-cargo-lock-is-up-to-date-without-building-anything/91048/5 - flakebox-in-each-cargo-workspace cargo update --workspace --locked + # https://users.rust-lang.org/t/check-if-the-cargo-lock-is-up-to-date-without-building-anything/91048/5 + flakebox-in-each-cargo-workspace cargo update --workspace --locked |& while read -r note ; do echo "$note (cargo)"; done } export -f check_cargo_lock function check_leftover_dbg() { - set -euo pipefail - - errors="" - for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep '.*\.rs'); do - if grep 'dbg!(' "$path" >/dev/null; then - echo >&2 "$path contains dbg! macro" - errors="true" + set -euo pipefail + + errors="" + for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep '.*\.rs'); do + if grep 'dbg!(' "$path" > /dev/null; then + >&2 echo "$path contains dbg! macro" + errors="true" + fi + done + + if [ -n "$errors" ]; then + >&2 echo "Fix the problems above or use --no-verify" 1>&2 + return 1 fi - done - - if [ -n "$errors" ]; then - echo >&2 "Fix the problems above or use --no-verify" 1>&2 - return 1 - fi } export -f check_leftover_dbg function check_semgrep() { - set -euo pipefail + set -euo pipefail - # semgrep is not available on MacOS - if ! command -v semgrep >/dev/null; then - echo >&2 "Skipping semgrep check: not available" - return 0 - fi + # semgrep is not available on MacOS + if ! command -v semgrep > /dev/null ; then + >&2 echo "Skipping semgrep check: not available" + return 0 + fi - if [ ! -f .config/semgrep.yaml ]; then - echo >&2 "Skipping semgrep check: .config/semgrep.yaml doesn't exist" - return 0 - fi + if [ ! -f .config/semgrep.yaml ] ; then + >&2 echo "Skipping semgrep check: .config/semgrep.yaml doesn't exist" + return 0 + fi - if [ ! -s .config/semgrep.yaml ]; then - echo >&2 "Skipping semgrep check: .config/semgrep.yaml empty" - return 0 - fi + if [ ! -s .config/semgrep.yaml ] ; then + >&2 echo "Skipping semgrep check: .config/semgrep.yaml empty" + return 0 + fi - env SEMGREP_ENABLE_VERSION_CHECK=0 \ - semgrep -q --error --no-rewrite-rule-ids --config .config/semgrep.yaml + env SEMGREP_ENABLE_VERSION_CHECK=0 \ + semgrep -q --error --no-rewrite-rule-ids --config .config/semgrep.yaml } export -f check_semgrep function check_shellcheck() { - set -euo pipefail + set -euo pipefail - for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep -E '.*\.sh$'); do - shellcheck --severity=warning "$path" - done + for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep -E '.*\.sh$'); do + shellcheck --severity=warning "$path" + done } export -f check_shellcheck function check_trailing_newline() { - set -euo pipefail - - errors="" - for path in $(echo "$FLAKEBOX_GIT_LS_TEXT"); do - - # extra branches for clarity - if [ ! -s "$path" ]; then - # echo "$path is empty" - true - elif [ -z "$(tail -c 1 <"$path")" ]; then - # echo "$path ends with a newline or with a null byte" - true - else - echo >&2 "$path doesn't end with a newline" 1>&2 - errors="true" + set -euo pipefail + + errors="" + for path in $(echo "$FLAKEBOX_GIT_LS_TEXT"); do + + # extra branches for clarity + if [ ! -s "$path" ]; then + # echo "$path is empty" + true + elif [ -z "$(tail -c 1 < "$path")" ]; then + # echo "$path ends with a newline or with a null byte" + true + else + >&2 echo "$path doesn't end with a newline" 1>&2 + errors="true" + fi + done + + if [ -n "$errors" ]; then + >&2 echo "Fix the problems above or use --no-verify" 1>&2 + return 1 fi - done - - if [ -n "$errors" ]; then - echo >&2 "Fix the problems above or use --no-verify" 1>&2 - return 1 - fi } export -f check_trailing_newline function check_trailing_whitespace() { - set -euo pipefail - - rev="HEAD" - if ! git rev-parse -q HEAD 1>/dev/null 2>/dev/null; then - echo >&2 "Warning: no commits yet, checking against --root" - rev="--root" - fi - if ! git diff --check $rev; then - echo >&2 "Trailing whitespace detected. Please remove them before committing." - return 1 - fi + set -euo pipefail + + rev="HEAD" + if ! git rev-parse -q 1>/dev/null HEAD 2>/dev/null ; then + >&2 echo "Warning: no commits yet, checking against --root" + rev="--root" + fi + if ! git diff --check $rev ; then + >&2 echo "Trailing whitespace detected. Please remove them before committing." + return 1 + fi } export -f check_trailing_whitespace function check_typos() { - set -euo pipefail + set -euo pipefail - if ! echo "$FLAKEBOX_GIT_LS_TEXT" | typos --file-list - --force-exclude; then - echo >&2 "Typos found: Valid new words can be added to '.typos.toml'" - return 1 - fi + if ! echo "$FLAKEBOX_GIT_LS_TEXT" | typos --file-list - --force-exclude ; then + >&2 echo "Typos found: Valid new words can be added to '.typos.toml'" + return 1 + fi } export -f check_typos parallel \ --nonotice \ - ::: \ - check_cargo_fmt \ - check_cargo_lock \ - check_leftover_dbg \ - check_semgrep \ - check_shellcheck \ - check_trailing_newline \ - check_trailing_whitespace \ - check_nothing # check_typos \ +::: \ + check_cargo_fmt \ + check_cargo_lock \ + check_leftover_dbg \ + check_semgrep \ + check_shellcheck \ + check_trailing_newline \ + check_trailing_whitespace \ + check_typos \ + check_nothing diff --git a/shell.nix b/shell.nix index bfcd84b..429e55e 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,6 @@ # save this as shell.nix -{ pkgs ? import {}}: +{ + pkgs ? import { }, +}: -pkgs.mkShell { - packages = [ pkgs.hello ]; -} +pkgs.mkShell { packages = [ pkgs.hello ]; } diff --git a/wrappers/fedimint-go/flake.nix b/wrappers/fedimint-go/flake.nix index e12a111..82ec12d 100644 --- a/wrappers/fedimint-go/flake.nix +++ b/wrappers/fedimint-go/flake.nix @@ -6,17 +6,29 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { inherit system; }; - in { + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { devShells = { default = pkgs.mkShell { - nativeBuildInputs = [ pkgs.go_1_21 pkgs.starship ]; + nativeBuildInputs = [ + pkgs.go_1_21 + pkgs.starship + ]; shellHook = '' eval "$(starship init bash)" ''; }; }; - }); + } + ); } diff --git a/wrappers/fedimint-ts/flake.nix b/wrappers/fedimint-ts/flake.nix index 6786906..29f59c8 100644 --- a/wrappers/fedimint-ts/flake.nix +++ b/wrappers/fedimint-ts/flake.nix @@ -6,18 +6,31 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { inherit system; }; - in { + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { devShells = { default = pkgs.mkShell { - nativeBuildInputs = [ pkgs.bun pkgs.nodejs_20 pkgs.starship ]; + nativeBuildInputs = [ + pkgs.bun + pkgs.nodejs_20 + pkgs.starship + ]; shellHook = '' bun install eval "$(starship init bash)" ''; }; }; - }); + } + ); } diff --git a/wrappers/fedimintex/README.md b/wrappers/fedimintex/README.md index 2f72ec9..fdcdf13 100644 --- a/wrappers/fedimintex/README.md +++ b/wrappers/fedimintex/README.md @@ -2,7 +2,7 @@ # Fedimintex: Fedimint SDK in Elixir -This is an elixir library that consumes Fedimint HTTP (https://github.com/kodylow/fedimint-http-client)[https://github.com/kodylow/fedimint-http-client], communicating with it via REST endpoints + passowrd. It's a hacky prototype, but it works until we can get a proper elixir client for Fedimint. All of the federation handling code happens in the fedimint-http, this just exposes a simple API for interacting with the client from elixir (mirrored in Go, Python, and TS). +This is an elixir library that consumes Fedimint HTTP (https://github.com/kodylow/fedimint-http-client)[https://github.com/kodylow/fedimint-http-client], communicating with it via REST endpoints + password. It's a hacky prototype, but it works until we can get a proper elixir client for Fedimint. All of the federation handling code happens in the fedimint-http, this just exposes a simple API for interacting with the client from elixir (mirrored in Go, Python, and TS). Start the following in the fedimint-http-client `.env` file: