From 1fc16ab33b9b812407df392d74c36c796bc8d358 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 15 May 2025 09:38:40 +0200 Subject: [PATCH 1/3] chore: added `flake.nix` build with ``` nix build ``` run like ``` result/bin/ic-repl --help ``` --- flake.lock | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fd1211c --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1747179050, + "narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1747190175, + "narHash": "sha256-s33mQ2s5L/2nyllhRTywgECNZyCqyF4MJeM3vG/GaRo=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "58160be7abad81f6f8cb53120d5b88c16e01c06d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d4a2faa --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { + self, + nixpkgs, + rust-overlay, + }: let + system = "aarch64-darwin"; + pkgs = import nixpkgs { + inherit system; + overlays = [rust-overlay.overlays.default]; + }; + toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + manifest = (pkgs.lib.importTOML ./Cargo.toml).package; + in { + devShells.${system}.default = pkgs.mkShell { + packages = [ + toolchain + ]; + + nativeBuildInputs = [ + pkgs.clang_19 + pkgs.cmake + ]; + + CXXFLAGS_aarch64_apple_darwin = "--target=aarch64-apple-darwin"; + + }; + + packages.${system}.default = pkgs.rustPlatform.buildRustPackage rec { + pname = manifest.name; + inherit (manifest) version; + cargoLock.lockFile = ./Cargo.lock; + src = pkgs.lib.cleanSource ./.; + cargoLock = { + outputHashes = { + }; + }; + }; + }; +} + From e44730a5511fb4c2a1f22f19cf7b19511b0ca018 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 15 May 2025 11:45:46 +0200 Subject: [PATCH 2/3] simplify --- flake.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index d4a2faa..9b9af4e 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,8 @@ ]; nativeBuildInputs = [ - pkgs.clang_19 - pkgs.cmake + #pkgs.clang_19 + #pkgs.cmake ]; CXXFLAGS_aarch64_apple_darwin = "--target=aarch64-apple-darwin"; @@ -36,11 +36,6 @@ inherit (manifest) version; cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; - cargoLock = { - outputHashes = { - }; - }; }; }; } - From 680f450c9ba6fa319f82615c2856022bc37e88c8 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 16 May 2025 11:18:34 +0200 Subject: [PATCH 3/3] there is no `rust-toolchain.toml` a.t.m., so leave this out for now --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 9b9af4e..384ed7a 100644 --- a/flake.nix +++ b/flake.nix @@ -14,12 +14,12 @@ inherit system; overlays = [rust-overlay.overlays.default]; }; - toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + #toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; manifest = (pkgs.lib.importTOML ./Cargo.toml).package; in { devShells.${system}.default = pkgs.mkShell { packages = [ - toolchain + #toolchain ]; nativeBuildInputs = [