summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@internetsafetylabs.org>2025-08-14 14:16:56 -0700
committerIrene Knapp <ireneista@internetsafetylabs.org>2025-08-14 14:16:56 -0700
commit89e48b600b01b21c2fae9c6414ddf66e0c38d7a6 (patch)
treec9496b87c281aa5905c7ece0323284994fab56f7 /flake.nix
parent20243027e12efb2563d628868f962867dee160dd (diff)
create a project skeleton with a nix flake and a Rust executable
I also took the liberty of adding some Rust libraries that I know will
be useful

Change-Id: Id5d98d86cdce653f6706903b75e285c72f2ba4b4
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..2c67d17
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,37 @@
+{
+  inputs = {
+    nixpkgs = {
+      type = "github";
+      owner = "NixOS";
+      repo = "nixpkgs";
+      ref = "nixos-25.05";
+    };
+
+    crane = {
+      type = "github";
+      owner = "ipetkov";
+      repo = "crane";
+    };
+  };
+
+  outputs = { self, nixpkgs, crane }:
+  let supportedSystems = [ "aarch64-linux" "x86_64-linux" ];
+      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
+      nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
+  in {
+    packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in {
+      default = (crane.mkLib pkgs).buildPackage {
+        src = ./.;
+      };
+    });
+
+    devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in {
+      default = pkgs.mkShell {
+        nativeBuildInputs = with pkgs; [
+          cargo
+          rustc
+        ];
+      };
+    });
+  };
+}