diff --git a/README.md b/README.md
index a495df0..a3b748b 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,30 @@
-# nim-e2e-reliability
-Nim implementation of the e2e reliability protocol
+# nim-sds
+
+Nim implementation of the e2e reliability protocol.
+
+## Quick start
+
+```bash
+# Build the shared library
+nix build '.?submodules=1#libsds'
+
+# Run tests
+nix develop '.?submodules=1' --command nim test sds.nims
+
+# Clean the Nix store
+nix run '.#clean'
+```
## Building
-### Nix (recommended)
+### Desktop
-Build the shared library:
```bash
nix build --print-out-paths '.?submodules=1#libsds'
```
-Build for Android:
+### Android
+
```bash
nix build --print-out-paths '.?submodules=1#libsds-android-arm64'
nix build --print-out-paths '.?submodules=1#libsds-android-amd64'
@@ -18,14 +32,15 @@ nix build --print-out-paths '.?submodules=1#libsds-android-x86'
nix build --print-out-paths '.?submodules=1#libsds-android-arm'
```
-### Development shell
+
+Development shell
Enter the dev shell (sets up vendored dependencies automatically):
```bash
nix develop '.?submodules=1'
```
-Then build directly with nim:
+Then build directly with Nim:
```bash
# Linux
nim libsdsDynamicLinux sds.nims
@@ -42,12 +57,15 @@ nim libsdsStaticWindows sds.nims
Run tests:
```bash
-nimble test
+nim test sds.nims
```
The built library is output to `build/`.
-### Android (without Nix)
+
+
+
+Android (without Nix)
Download the latest Android NDK. For example, on Ubuntu with Intel:
@@ -82,3 +100,12 @@ ARCH=arm64 ANDROID_ARCH=aarch64-linux-android ARCH_DIRNAME=aarch64-linux-android
| arm | `arm` | `armv7a-linux-androideabi` | `arm-linux-androideabi` |
The library is output to `build/libsds.so`.
+
+
+
+## Maintenance
+
+```bash
+# Clean unreferenced Nix store packages
+nix run '.#clean'
+```
diff --git a/flake.lock b/flake.lock
index cc4a595..1ca4043 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,27 +1,5 @@
{
"nodes": {
- "nimbusBuildSystem": {
- "inputs": {
- "nixpkgs": [
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1769685810,
- "narHash": "sha256-mANqcQcRXb08ZR8WF6SoyVrL/nXUePtMZfpNx25BlLI=",
- "ref": "refs/heads/master",
- "rev": "0e7a764edae92b224326b3700f062702489ce2b4",
- "revCount": 238,
- "submodules": true,
- "type": "git",
- "url": "file:./vendor/nimbus-build-system"
- },
- "original": {
- "submodules": true,
- "type": "git",
- "url": "file:./vendor/nimbus-build-system"
- }
- },
"nixpkgs": {
"locked": {
"lastModified": 1757590060,
@@ -40,7 +18,6 @@
},
"root": {
"inputs": {
- "nimbusBuildSystem": "nimbusBuildSystem",
"nixpkgs": "nixpkgs"
}
}
diff --git a/flake.nix b/flake.nix
index 40989bb..b2a930b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,19 +7,12 @@
};
inputs = {
- # We are pinning the commit because ultimately we want to use same commit across different projects.
- # A commit from nixpkgs 24.11 release : https://github.com/NixOS/nixpkgs/tree/release-24.11
+ # Pinned commit from nixpkgs 24.11 release (provides Nim 2.2.4).
+ # https://github.com/NixOS/nixpkgs/tree/release-24.11
nixpkgs.url = "github:NixOS/nixpkgs?rev=0ef228213045d2cdb5a169a95d63ded38670b293";
- # Used only for its pinned Nim compiler package.
- # The build system itself (Makefiles, env.sh) is NOT used — we call nimble directly.
- # WARNING: Remember to update commit and use 'nix flake update' to update flake.lock.
- nimbusBuildSystem = {
- url = "git+file:./vendor/nimbus-build-system?submodules=1";
- inputs.nixpkgs.follows = "nixpkgs";
- };
};
- outputs = { self, nixpkgs, nimbusBuildSystem }:
+ outputs = { self, nixpkgs }:
let
stableSystems = [
"x86_64-linux" "aarch64-linux"
@@ -49,10 +42,9 @@
in rec {
packages = forAllSystems (system: let
pkgs = pkgsFor.${system};
- nim = nimbusBuildSystem.packages.${system}.nim;
buildTargets = pkgs.callPackage ./nix/default.nix {
- inherit stableSystems nim;
+ inherit stableSystems;
src = self;
};
@@ -76,8 +68,18 @@
}) targets));
devShells = forAllSystems (system: {
- default = pkgsFor.${system}.callPackage ./nix/shell.nix {
- inherit (nimbusBuildSystem.packages.${system}) nim;
+ default = pkgsFor.${system}.callPackage ./nix/shell.nix {};
+ });
+
+ # nix run '.#clean' — garbage-collect the Nix store
+ apps = forAllSystems (system: {
+ clean = {
+ type = "app";
+ program = toString (pkgsFor.${system}.writeShellScript "nix-clean" ''
+ echo "Removing old Nix generations and unreferenced packages..."
+ nix-collect-garbage -d
+ echo "Done."
+ '');
};
});
};
diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system
deleted file mode 160000
index 0e7a764..0000000
--- a/vendor/nimbus-build-system
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0e7a764edae92b224326b3700f062702489ce2b4