summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Stachurski <jakub@wilkuu.nl>2026-08-12 15:44:19 +0200
committerJakub Stachurski <jakub@wilkuu.nl>2026-08-12 15:44:19 +0200
commit4d1cb750d5b2f26f5257cacc74a70476349d1c9e (patch)
tree7b5fc978703c6a4ecc4b065ad8860a7cd9883bc9
init
Diffstat (limited to '')
-rw-r--r--.gitignore1
-rw-r--r--Cargo.toml6
-rw-r--r--flake.lock137
-rw-r--r--flake.nix115
-rw-r--r--rust-toolchain.toml13
-rw-r--r--src/main.rs3
6 files changed, 275 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..5aca40a
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "libjmap"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..383c814
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,137 @@
+{
+ "nodes": {
+ "crane": {
+ "locked": {
+ "lastModified": 1785782307,
+ "narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=",
+ "owner": "ipetkov",
+ "repo": "crane",
+ "rev": "2c71e194474d13de031d729b729c968ddbe3507f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "ipetkov",
+ "repo": "crane",
+ "type": "github"
+ }
+ },
+ "fenix": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "rust-analyzer-src": "rust-analyzer-src"
+ },
+ "locked": {
+ "lastModified": 1786520346,
+ "narHash": "sha256-2CVNv6zvKhr/Xky1jkZXZfCTKfZpyo0gij70lR1DMTA=",
+ "owner": "nix-community",
+ "repo": "fenix",
+ "rev": "9a4f7863c93539f17a1785962d58471fdc7f5fe4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "fenix",
+ "type": "github"
+ }
+ },
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1786384358,
+ "narHash": "sha256-RzPPiWeUtuvymnpuEWsdtzli5w4kjZs49FqEs3/1u+I=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "2fcb964de67fcf60b43471c55d5d99e61a9ccb5a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "crane": "crane",
+ "fenix": "fenix",
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs",
+ "treefmt-nix": "treefmt-nix"
+ }
+ },
+ "rust-analyzer-src": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1786467811,
+ "narHash": "sha256-56LDY016VYO+KOfJ3FN98kM7S2GIE2HQSbkxgzXW6jE=",
+ "owner": "rust-lang",
+ "repo": "rust-analyzer",
+ "rev": "b2d445b22a2dd4c3469dfeddc2d5eb533c42baf6",
+ "type": "github"
+ },
+ "original": {
+ "owner": "rust-lang",
+ "ref": "nightly",
+ "repo": "rust-analyzer",
+ "type": "github"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1785945821,
+ "narHash": "sha256-NLSyTCW4K4ofhNBllt3omPasm6QpralXH1DBZOc91Dw=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "ae7910970dddc408fe6ab1c8e4b277bb21d72dc0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..10dd5d7
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,115 @@
+{
+ description = "name of your package";
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ crane.url = "github:ipetkov/crane";
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ fenix = {
+ url = "github:nix-community/fenix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+ outputs =
+ {
+ self,
+ nixpkgs,
+ flake-utils,
+ crane,
+ fenix,
+ treefmt-nix,
+ ...
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkg_name = "name";
+ pkgs = nixpkgs.legacyPackages.${system};
+ lib = pkgs.lib;
+
+ rustToolchain = fenix.packages.${system}.fromToolchainFile {
+ file = ./rust-toolchain.toml;
+ sha256 = "sha256-LAQdG4kB6olIXlVFbq610fgUl9hCTtgnYgX7kZQfE+Q=";
+ };
+
+ craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
+ src = (craneLib.cleanCargoSource ./.);
+
+ commonArgs = {
+ inherit src;
+ strictDeps = true;
+ cargoToml = ./Cargo.toml;
+
+ nativeBuildInputs = [
+ pkgs.pkg-config
+ ];
+ };
+
+ cargoArtifacts = craneLib.buildDepsOnly commonArgs;
+
+ _package = craneLib.buildPackage (
+ commonArgs
+ // {
+ inherit cargoArtifacts;
+ }
+ );
+
+ tree-fmt-eval = treefmt-nix.lib.evalModule pkgs (
+ { ... }:
+ {
+ # Used to find the project root
+ projectRootFile = "flake.nix";
+ programs.nixfmt.enable = true;
+ programs.deadnix.enable = true;
+ programs.rustfmt = {
+ enable = true;
+ package = rustToolchain;
+ };
+ }
+ );
+
+ in
+ {
+ checks = {
+ inherit _package; # Compile to test
+ str-clippy = craneLib.cargoClippy (
+ commonArgs
+ // {
+ inherit cargoArtifacts;
+ cargoClippyExtraArgs = "--all-targets -- --deny warnings";
+ }
+ );
+ formatting = tree-fmt-eval.config.build.check self;
+ };
+
+ formatter = tree-fmt-eval.config.build.wrapper;
+
+ apps.default = flake-utils.lib.mkApp {
+ drv = _package;
+ };
+ packages.${pkg_name} = _package;
+ packages.default = _package;
+
+ devShells.default = craneLib.devShell {
+ checks = self.checks.${system};
+
+ packages = with pkgs; [
+ # Put your packages for dev here
+ ];
+
+ env = {
+ "LD_LIBRARY_PATH" = lib.makeLibraryPath (
+ with pkgs;
+ [
+ stdenv.cc.cc.lib
+ ]
+ );
+ };
+ };
+ }
+ );
+}
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 0000000..22f03f3
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,13 @@
+[toolchain]
+channel = "1.97.1"
+targets = [
+ #linux
+ "x86_64-unknown-linux-gnu",
+ "aarch64-unknown-linux-gnu",
+ "x86_64-unknown-linux-musl",
+ "aarch64-unknown-linux-musl",
+
+ # WebAssembly
+ "wasm32-unknown-unknown"
+]
+components = ["rust-src", "clippy", "rustfmt","rust-analyzer", "llvm-tools"]
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..e7a11a9
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Hello, world!");
+}