SFT-6061: nix devshell working, sim commands and flash recipe need work
What changed, and why it matters
This commit updates the project's Nix development environment files. It adds a lock file, adjusts package names, adds build dependencies, and tweaks compiler flags for a local developer tool called 'cosign'. There is no change to the firmware that runs on the Passport device, no change to cryptographic code, and no indication of a security bug or fix.
No security action required. Treat as routine build/development-environment maintenance. Reviewers may optionally verify the pinned nixpkgs/fenix revisions and the new toolchain SHA256 match expected upstream values, but this is supply-chain hygiene rather than a vulnerability response.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is entirely within Nix flake configuration. flake.lock pins nixpkgs, fenix, and rust-analyzer-src revisions. flake.nix refactors package sets, adds runtime library paths for SDL/Wayland simulation, disables ‘fortify’ hardening in the dev shell, switches to gcc13/gcc-arm-embedded-13, and adds Python/virtualenv tooling. nix/cosign.nix rewrites the cosign derivation to build from the Passport board directory with -Wno-error=int-conversion and installs to $out/bin/cosign. nix/rust-toolchain.nix replaces a fake SHA256 with a real one. None of this alters firmware source, signing logic, or runtime security behavior.
Changed components
Nix flake configuration (flake.nix, flake.lock)Nix cosign derivation (nix/cosign.nix)Nix Rust toolchain derivation (nix/rust-toolchain.nix)Inspect captured patch +154 / −33
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..ba36745
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,66 @@
+{
+ "nodes": {
+ "fenix": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "rust-analyzer-src": "rust-analyzer-src"
+ },
+ "locked": {
+ "lastModified": 1771917501,
+ "narHash": "sha256-pyjD5s19JzH/aw6OnjyxYddoQWD/F1ygj9bku9td+MI=",
+ "owner": "nix-community",
+ "repo": "fenix",
+ "rev": "1d6ea44fd28bd5ad7cfd4bb39a7a225225484593",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "fenix",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1771848320,
+ "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "2fc6539b481e1d2569f25f8799236694180c0993",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "fenix": "fenix",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "rust-analyzer-src": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1771830288,
+ "narHash": "sha256-Key/V7kjPYdPFeAw6cPS9M//6hGb6l1pLJroy7aUcfU=",
+ "owner": "rust-lang",
+ "repo": "rust-analyzer",
+ "rev": "05da4cf3c4dfb8aa3430343f41e73c4cfad46bd5",
+ "type": "github"
+ },
+ "original": {
+ "owner": "rust-lang",
+ "ref": "nightly",
+ "repo": "rust-analyzer",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
index f091df4..0c4aadf 100644
--- a/flake.nix
+++ b/flake.nix
@@ -36,11 +36,15 @@
pkgs = import nixpkgs {
inherit system;
};
- ci-pkgs = with pkgs; {
- inherit just reuse python313Packages.pycodestyle;
+ ciPkgs = {
+ inherit (pkgs)
+ just
+ reuse
+ ;
+ pycodestyle = pkgs.python313Packages.pycodestyle;
};
in
- ci-pkgs
+ ciPkgs
// import ./nix/rust-toolchain.nix {
inherit
self
@@ -57,40 +61,89 @@
let
pkgs = import nixpkgs {
inherit system;
- config = {
- allowUnfree = true;
- };
+ config.allowUnfree = true;
};
customPackages = self.packages.${system};
+ runtimeLibPath = pkgs.lib.makeLibraryPath [
+ pkgs.stdenv.cc.cc.lib
+ pkgs.glib
+ pkgs.wayland
+ pkgs.libdecor
+ pkgs.libglvnd
+ pkgs.libx11
+ pkgs.libxau
+ pkgs.libxcb
+ pkgs.libxdmcp
+ pkgs.libxext
+ pkgs.libxkbcommon
+ pkgs.SDL2
+ pkgs.sdl3
+ pkgs.zlib
+ ];
+ mkShell = packages:
+ pkgs.mkShell {
+ inherit packages;
+ hardeningDisable = [ "fortify" ];
+ shellHook = ''
+ repo_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
+ export CC=${pkgs.gcc13}/bin/gcc
+ export CXX=${pkgs.gcc13}/bin/g++
+ if [ -n "''${LD_LIBRARY_PATH:-}" ]; then
+ export LD_LIBRARY_PATH=''${LD_LIBRARY_PATH}:${runtimeLibPath}
+ else
+ export LD_LIBRARY_PATH=${runtimeLibPath}
+ fi
+ if [ -n "''${WAYLAND_DISPLAY:-}" ] && [ -z "''${SDL_VIDEODRIVER:-}" ]; then
+ export SDL_VIDEODRIVER=wayland
+ fi
+ if [ -n "''${WAYLAND_DISPLAY:-}" ] && [ -z "''${SDL_VIDEO_WAYLAND_PREFER_LIBDECOR:-}" ]; then
+ export SDL_VIDEO_WAYLAND_PREFER_LIBDECOR=1
+ fi
+ if [ -z "''${SDL_RENDER_DRIVER:-}" ]; then
+ export SDL_RENDER_DRIVER=software
+ fi
+ export MPY_CROSS="$repo_root/mpy-cross/mpy-cross"
+ if [ ! -x "$MPY_CROSS" ]; then
+ make -C "$repo_root/mpy-cross"
+ fi
+ '';
+ };
buildPackages =
with pkgs;
[
- # cmake
+ autoconf
+ automake
curl
- gcc-arm-embedded
+ gcc13
+ gcc-arm-embedded-13
git
gnumake
just
+ libffi
+ libtool
+ libusb1
openssl
pkg-config
+ python3
+ python3Packages.pip
+ python3Packages.virtualenv
reuse
- autoconf
- automake
- pkg-config
- cbindgen
- # unixtools.xxd
+ rust-cbindgen
+ xterm
]
- ++ (with customPackages; [
- cosign
- ]);
+ ++ [
+ customPackages.cosign
+ customPackages.rust-core
+ ];
devPackages =
buildPackages
++ (with pkgs; [
+ fontmiscmisc
minicom
- sdl2
openocd
+ SDL2
]);
diff --git a/nix/cosign.nix b/nix/cosign.nix
index 7c14f5b..11414e8 100644
--- a/nix/cosign.nix
+++ b/nix/cosign.nix
@@ -2,27 +2,29 @@
# SPDX-License-Identifier: GPL-3.0-or-later
{
self,
- system,
pkgs,
-}: let
- src = pkgs.stdenv.mkDerivation {
- name = "cosign-src";
- src = self + "/ports/stm32/boards/Passport/tools/cosign";
- # TODO: account for darwin and arm architectures
+ ...
+}: {
+ cosign = pkgs.stdenv.mkDerivation {
+ pname = "passport-cosign";
+ version = "0.1.0";
+ src = self + "/ports/stm32/boards/Passport";
+ nativeBuildInputs = [ pkgs.pkg-config ];
+ buildInputs = [ pkgs.openssl ];
+ dontConfigure = true;
+ NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion";
buildPhase = ''
- make
+ runHook preBuild
+ make -C tools/cosign
+ runHook postBuild
'';
installPhase = ''
- cp x86/release/cosign $out
+ runHook preInstall
+ mkdir -p $out/bin
+ cp tools/cosign/x86/release/cosign $out/bin/cosign
+ runHook postInstall
'';
- outputHash = "sha256-6GEfi9zx7+RLpIbxdT6K2uMRyJ1V78aVebM+vWZmwQY=";
- outputHashMode = "recursive";
- };
-in {
- cosign = pkgs.stdenv.mkDerivation {
- pname = "cosign";
- inherit src;
};
}
diff --git a/nix/rust-toolchain.nix b/nix/rust-toolchain.nix
index 1ee9611..c9e711c 100644
--- a/nix/rust-toolchain.nix
+++ b/nix/rust-toolchain.nix
@@ -6,7 +6,7 @@
pkgs,
fenix,
}: let
- toolchainSha256 = lib.fakeSha256;
+ toolchainSha256 = "sha256-3St/9/UKo/6lz2Kfq2VmlzHyufduALpiIKaaKX4Pq0g=";
baseToolchain = fenix.packages.${system}.fromToolchainFile {
file = self + "/extmod/foundation-rust/rust-toolchain.toml";
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.