{ inputs = { nixpkgs = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; utils.url = "github:numtide/flake-utils"; haskellNix.url = "github:input-output-hk/haskell.nix"; }; outputs = inputs: inputs.utils.lib.eachDefaultSystem ( system: let pkgs = import inputs.nixpkgs { localSystem = system; overlays = [ inputs.haskellNix.overlay (_: prev: { riscv-formal = prev.callPackage ( { haskell-nix, qemu, }: haskell-nix.hix.project { compiler-nix-name = "ghc966"; src = builtins.path { path = ./.; name = "riscv-formal-source"; }; shell = let riscv64-linux = prev.pkgsCross.riscv64-embedded.__splicedPackages; # Everything here builds and runs without needing the below crossSystem #riscv64-linux = (import prev.pkgs.path { # localSystem = system; # crossSystem = { # config = "riscv64-none-elf"; # libc = "newlib"; # gcc = { # # Both sets work to build and run hello_world # # This matches what is in the makefile # #arch = "rv64ima"; # #abi = "lp64"; # # This matches what you asked for on matrix # #arch = "rv64g"; # #abi = "lp64d"; # }; # }; #}).__splicedPackages; in { tools = { cabal = { }; hlint = { }; }; nativeBuildInputs = [ qemu riscv64-linux.gcc riscv64-linux.binutils ]; buildInputs = [ riscv64-linux.glibc ]; shellHook = '' export CROSS_PREFIX="riscv64-none-elf" ''; }; } ) { }; }) ]; }; flake = pkgs.riscv-formal.flake { }; in flake ); nixConfig = { # https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html#setting-up-the-binary-cache extra-substituters = [ "https://cache.iog.io" ]; extra-trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; allow-import-from-derivation = true; }; }