]> git.earman.xyz Git - sensor-watch.git/commitdiff
add .envrc/flake.nix for setting up automatic build environment under NixOS (#17)
authorJeremy O'Brien <neutral@fastmail.com>
Sun, 6 Jul 2025 15:39:02 +0000 (11:39 -0400)
committerGitHub <noreply@github.com>
Sun, 6 Jul 2025 15:39:02 +0000 (11:39 -0400)
.envrc [new file with mode: 0644]
.gitignore
flake.lock [new file with mode: 0644]
flake.nix [new file with mode: 0644]

diff --git a/.envrc b/.envrc
new file mode 100644 (file)
index 0000000..a6ee435
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,5 @@
+# shellcheck shell=bash
+if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
+  source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
+fi
+use flake
index 6b2c09025a570fd6e0a84e89dd1e8270264d1940..9046cc5ba4a14e68d95c78570a64c8c523c89597 100644 (file)
@@ -25,3 +25,5 @@ _autosave*
 fp-info-cache
 .~*
 *.plan
+/.direnv
+/.emscripten_cache
diff --git a/flake.lock b/flake.lock
new file mode 100644 (file)
index 0000000..98b6cc3
--- /dev/null
@@ -0,0 +1,64 @@
+{
+  "nodes": {
+    "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": 1750811787,
+        "narHash": "sha256-rD/978c35JXz6JLAzciTIOCMenPumF6zrQOj4rVZeHE=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "992f916556fcfaa94451ebc7fc6e396134bbf5b1",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixpkgs-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs",
+        "systems": "systems"
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644 (file)
index 0000000..2cf0e74
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,31 @@
+{
+  description = "A basic flake with a shell";
+  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+  inputs.systems.url = "github:nix-systems/default";
+  inputs.flake-utils = {
+    url = "github:numtide/flake-utils";
+    inputs.systems.follows = "systems";
+  };
+
+  outputs =
+    { nixpkgs, flake-utils, ... }:
+    flake-utils.lib.eachDefaultSystem (
+      system:
+      let
+        pkgs = nixpkgs.legacyPackages.${system};
+      in
+      {
+        devShells.default = pkgs.mkShell { 
+          packages = [
+            pkgs.bashInteractive
+            pkgs.gnumake
+            pkgs.emscripten
+            pkgs.gcc-arm-embedded
+          ];
+          shellHook = ''
+            export EM_CACHE=$(pwd)/.emscripten_cache/
+          '';
+        };
+      }
+    );
+}