lion icon indicating copy to clipboard operation
lion copied to clipboard

Nixify

Open harryprayiv opened this issue 2 years ago • 1 comments

I took the liberty of non-destructively nixifying this incredibly cool project (as is my signature move).

harryprayiv avatar Apr 14 '23 13:04 harryprayiv

It would be nice to be able to build a full soc binaries using Nix, not just a Haskell libraries.

Haskell libs are easy to build using just cabal2Nix (no need to introduce haskell-nix and hix)

My default.nix from a like a year ago (currently seems to fail building clash-prelude)

{ pkgs ? import <nixpkgs> {} }:
let
  src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;

  lion = pkgs.haskellPackages.callCabal2nix "lion" src { };
  lion-soc = pkgs.haskellPackages.callCabal2nix "lion-soc" "${src}/lion-soc" { inherit lion; };
in
  { inherit lion lion-soc; }

but more importantly a shell.nix that's quite useful

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  packages = with pkgs; [
    yosys
    nextpnr
    icestorm
    pkgsCross.riscv64-embedded.stdenv.cc
    cabal-install
  ];

  inputsFrom = [  ];

  shellHook = ''
    echo "Lion SoC shell"
    echo ""
    echo "Build using"
    echo "# cd lion-soc"
    echo "# cabal run soc"
  '';
}

I didn't create a PR of this because I wanted to be able to nix-build a full SoC binary and got stuck somewhere.

sorki avatar Oct 04 '23 09:10 sorki