aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 4511b2fd074877138e049b1068520ccf5cdea1b5 (plain) (blame)
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
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs =
    {
      self,
      nixpkgs,
      flake-utils,
      ...
    }:
    let
      shell =
        { pkgs }:
        pkgs.mkShell rec {
          buildInputs = with pkgs; [
            pkgs.pkgsCross.avr.buildPackages.gcc
            pkgs.pkgsCross.avr.avrlibc
            avrdude

            # dev
            openocd
            clang-tools
            unixtools.xxd
            just
            pkg-config
          ];

          AVR_LIBC = "${pkgs.pkgsCross.avr.avrlibc}";
          LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
        };
    in
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      {
        devShells.default = shell { inherit pkgs; };
      }
    );
}