summaryrefslogtreecommitdiff
path: root/nix/flake.nix
blob: dbc4e2d1e32932adc946fee15f3d7d9da7e86c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  outputs = { self, nixpkgs }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
  in {
    devShells."${system}" = with pkgs; {
      default = mkShell {
        buildInputs = [
          ncurses
          openssl
          SDL2
        ];

        nativeBuildInputs = [
          binutils
          gcc
          gcc-arm-embedded
          gdb
          gnumake
          gtkwave
          pkg-config
          (python39.withPackages (py: [ py.numpy py.pillow py.matplotlib ]))
          (quartus-prime-lite.override { supportedDevices = [ "Cyclone V" ]; })
          verilator
        ];

        shellHook = ''
          export MAKEFLAGS="AR=gcc-ar"
          export CXXFLAGS="-O3 -flto $(pkg-config --cflags sdl2 ncursesw)"
          export LDFLAGS="-O3 -flto $(pkg-config --libs sdl2 ncursesw)"

          # <https://discourse.nixos.org/t/fonts-in-nix-installed-packages-on-a-non-nixos-system/5871/7>
          export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
          export FONTCONFIG_FILE="${fontconfig.out}/etc/fonts/fonts.conf"
        '';
      };

      kbuild = mkShell {
        buildInputs = [
          ncurses
        ];

        nativeBuildInputs = [
          bc
          bison
          flex
          gcc
          gcc-arm-embedded
          gnumake
          openssl # Splash de u-boot
          ubootTools
        ];

        shellHook = ''
          export CROSS_COMPILE=arm-none-eabi-
          export MAKEFLAGS="ARCH=arm O=build/taller LOADADDR=0x8000"
        '';
      };
    };
  };
}