Disabling SSE and SSE2 instruction in a devshell

What about something like this?

$ cat shell.nix 
{ }:

let
  nixpkgs = builtins.getFlake "github:nixos/nixpkgs";
  pkgs = import nixpkgs {
    config.replaceStdenv = { pkgs }:
      (pkgs.stdenvAdapters.withCFlags "-mno-sse -mno-sse2" pkgs.stdenv);
  };
in pkgs.mkShell { packages = with pkgs; [ hello ]; }

Do you have a block of code we can use as a reference?

1 Like