Move devenv for mcu into subdirectory
This commit is contained in:
		
							
								
								
									
										81
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										81
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							@@ -41,11 +41,11 @@
 | 
				
			|||||||
        "pre-commit-hooks": "pre-commit-hooks"
 | 
					        "pre-commit-hooks": "pre-commit-hooks"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1715246369,
 | 
					        "lastModified": 1722605649,
 | 
				
			||||||
        "narHash": "sha256-gpdfUGNLXr64y+EAUMA3YP/sUO0wBVthrlPIm2PDJpw=",
 | 
					        "narHash": "sha256-T5dzUFRb2ocZ+LB2qBZufewdUFQs0pB4fnLKIWBLd9Y=",
 | 
				
			||||||
        "owner": "cachix",
 | 
					        "owner": "cachix",
 | 
				
			||||||
        "repo": "devenv",
 | 
					        "repo": "devenv",
 | 
				
			||||||
        "rev": "8f089ccfdef53f2ea5e0bfabe25dba4769f5390f",
 | 
					        "rev": "a07842582c030fdf2ccf07d3b1402b2a46908856",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@@ -85,27 +85,6 @@
 | 
				
			|||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "devshell": {
 | 
					 | 
				
			||||||
      "inputs": {
 | 
					 | 
				
			||||||
        "flake-utils": "flake-utils_3",
 | 
					 | 
				
			||||||
        "nixpkgs": [
 | 
					 | 
				
			||||||
          "nixpkgs"
 | 
					 | 
				
			||||||
        ]
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "locked": {
 | 
					 | 
				
			||||||
        "lastModified": 1713532798,
 | 
					 | 
				
			||||||
        "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=",
 | 
					 | 
				
			||||||
        "owner": "numtide",
 | 
					 | 
				
			||||||
        "repo": "devshell",
 | 
					 | 
				
			||||||
        "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40",
 | 
					 | 
				
			||||||
        "type": "github"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "original": {
 | 
					 | 
				
			||||||
        "owner": "numtide",
 | 
					 | 
				
			||||||
        "repo": "devshell",
 | 
					 | 
				
			||||||
        "type": "github"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "flake-compat": {
 | 
					    "flake-compat": {
 | 
				
			||||||
      "flake": false,
 | 
					      "flake": false,
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
@@ -143,11 +122,11 @@
 | 
				
			|||||||
        "nixpkgs-lib": "nixpkgs-lib"
 | 
					        "nixpkgs-lib": "nixpkgs-lib"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1714641030,
 | 
					        "lastModified": 1722555600,
 | 
				
			||||||
        "narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=",
 | 
					        "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
 | 
				
			||||||
        "owner": "hercules-ci",
 | 
					        "owner": "hercules-ci",
 | 
				
			||||||
        "repo": "flake-parts",
 | 
					        "repo": "flake-parts",
 | 
				
			||||||
        "rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e",
 | 
					        "rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@@ -192,24 +171,6 @@
 | 
				
			|||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "flake-utils_3": {
 | 
					 | 
				
			||||||
      "inputs": {
 | 
					 | 
				
			||||||
        "systems": "systems_3"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "locked": {
 | 
					 | 
				
			||||||
        "lastModified": 1701680307,
 | 
					 | 
				
			||||||
        "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
 | 
					 | 
				
			||||||
        "owner": "numtide",
 | 
					 | 
				
			||||||
        "repo": "flake-utils",
 | 
					 | 
				
			||||||
        "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
 | 
					 | 
				
			||||||
        "type": "github"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "original": {
 | 
					 | 
				
			||||||
        "owner": "numtide",
 | 
					 | 
				
			||||||
        "repo": "flake-utils",
 | 
					 | 
				
			||||||
        "type": "github"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "gitignore": {
 | 
					    "gitignore": {
 | 
				
			||||||
      "inputs": {
 | 
					      "inputs": {
 | 
				
			||||||
        "nixpkgs": [
 | 
					        "nixpkgs": [
 | 
				
			||||||
@@ -327,14 +288,14 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "nixpkgs-lib": {
 | 
					    "nixpkgs-lib": {
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1714640452,
 | 
					        "lastModified": 1722555339,
 | 
				
			||||||
        "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=",
 | 
					        "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
 | 
				
			||||||
        "type": "tarball",
 | 
					        "type": "tarball",
 | 
				
			||||||
        "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
 | 
					        "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
        "type": "tarball",
 | 
					        "type": "tarball",
 | 
				
			||||||
        "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
 | 
					        "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "nixpkgs-regression": {
 | 
					    "nixpkgs-regression": {
 | 
				
			||||||
@@ -387,11 +348,11 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "nixpkgs_2": {
 | 
					    "nixpkgs_2": {
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1715037484,
 | 
					        "lastModified": 1722640603,
 | 
				
			||||||
        "narHash": "sha256-OUt8xQFmBU96Hmm4T9tOWTu4oCswCzoVl+pxSq/kiFc=",
 | 
					        "narHash": "sha256-TcXjLVNd3VeH1qKPH335Tc4RbFDbZQX+d7rqnDUoRaY=",
 | 
				
			||||||
        "owner": "NixOS",
 | 
					        "owner": "NixOS",
 | 
				
			||||||
        "repo": "nixpkgs",
 | 
					        "repo": "nixpkgs",
 | 
				
			||||||
        "rev": "ad7efee13e0d216bf29992311536fce1d3eefbef",
 | 
					        "rev": "81610abc161d4021b29199aa464d6a1a521e0cc9",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@@ -455,7 +416,6 @@
 | 
				
			|||||||
    "root": {
 | 
					    "root": {
 | 
				
			||||||
      "inputs": {
 | 
					      "inputs": {
 | 
				
			||||||
        "devenv": "devenv",
 | 
					        "devenv": "devenv",
 | 
				
			||||||
        "devshell": "devshell",
 | 
					 | 
				
			||||||
        "flake-parts": "flake-parts",
 | 
					        "flake-parts": "flake-parts",
 | 
				
			||||||
        "nixpkgs": "nixpkgs_2",
 | 
					        "nixpkgs": "nixpkgs_2",
 | 
				
			||||||
        "rootdir": "rootdir"
 | 
					        "rootdir": "rootdir"
 | 
				
			||||||
@@ -502,21 +462,6 @@
 | 
				
			|||||||
        "repo": "default",
 | 
					        "repo": "default",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "systems_3": {
 | 
					 | 
				
			||||||
      "locked": {
 | 
					 | 
				
			||||||
        "lastModified": 1681028828,
 | 
					 | 
				
			||||||
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
 | 
					 | 
				
			||||||
        "owner": "nix-systems",
 | 
					 | 
				
			||||||
        "repo": "default",
 | 
					 | 
				
			||||||
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
 | 
					 | 
				
			||||||
        "type": "github"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "original": {
 | 
					 | 
				
			||||||
        "owner": "nix-systems",
 | 
					 | 
				
			||||||
        "repo": "default",
 | 
					 | 
				
			||||||
        "type": "github"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "root": "root",
 | 
					  "root": "root",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										51
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								flake.nix
									
									
									
									
									
								
							@@ -1,8 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  inputs = {
 | 
					  inputs = {
 | 
				
			||||||
    flake-parts.url = "github:hercules-ci/flake-parts";
 | 
					    flake-parts.url = "github:hercules-ci/flake-parts";
 | 
				
			||||||
    devshell.url = "github:numtide/devshell";
 | 
					 | 
				
			||||||
    devshell.inputs.nixpkgs.follows = "nixpkgs";
 | 
					 | 
				
			||||||
    devenv.url = "github:cachix/devenv";
 | 
					    devenv.url = "github:cachix/devenv";
 | 
				
			||||||
    devenv.inputs.nixpkgs.follows = "nixpkgs";
 | 
					    devenv.inputs.nixpkgs.follows = "nixpkgs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -19,54 +17,23 @@
 | 
				
			|||||||
      ];
 | 
					      ];
 | 
				
			||||||
      systems = [ "x86_64-linux" ];
 | 
					      systems = [ "x86_64-linux" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      perSystem = { inputs', system, pkgs, config, ... }:
 | 
					      perSystem = { inputs', system, lib, pkgs, config, ... }:
 | 
				
			||||||
      let
 | 
					      let
 | 
				
			||||||
 | 
					        inherit (lib) mkMerge;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rootdirOpt =
 | 
					        rootdirOpt =
 | 
				
			||||||
          let
 | 
					          let
 | 
				
			||||||
            rootFileContent = builtins.readFile rootdir.outPath;
 | 
					            rootFileContent = builtins.readFile rootdir.outPath;
 | 
				
			||||||
          in
 | 
					          in
 | 
				
			||||||
          pkgs.lib.mkIf (rootFileContent != "") rootFileContent;
 | 
					          pkgs.lib.mkIf (rootFileContent != "") rootFileContent;
 | 
				
			||||||
 | 
					        withRootdir = f: mkMerge [
 | 
				
			||||||
        ocdInterface = mcu/tigard-swd.cfg;
 | 
					          (import f)
 | 
				
			||||||
 | 
					          { devenv.root = rootdirOpt; }
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
      in
 | 
					      in
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        devenv.shells.mcu = {
 | 
					        devenv.shells = {
 | 
				
			||||||
          devenv.root = rootdirOpt;
 | 
					          mcu = withRootdir mcu/devenv.nix;
 | 
				
			||||||
 | 
					 | 
				
			||||||
          packages = with pkgs; [
 | 
					 | 
				
			||||||
            gnumake
 | 
					 | 
				
			||||||
            cmake
 | 
					 | 
				
			||||||
            pkgsCross.arm-embedded.buildPackages.gdb # ARM one is broken
 | 
					 | 
				
			||||||
            gcc-arm-embedded
 | 
					 | 
				
			||||||
            python3
 | 
					 | 
				
			||||||
            picotool
 | 
					 | 
				
			||||||
            openocd-rp2040
 | 
					 | 
				
			||||||
          ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          env = {
 | 
					 | 
				
			||||||
            PICO_SDK_PATH = "${pkgs.pico-sdk}/lib/pico-sdk";
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          scripts = {
 | 
					 | 
				
			||||||
            build.exec = ''
 | 
					 | 
				
			||||||
              cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D PICO_STDIO_SEMIHOSTING=1
 | 
					 | 
				
			||||||
              cmake --build build --parallel
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
            build-rel.exec = ''
 | 
					 | 
				
			||||||
              cmake -S . -B build-release -D CMAKE_BUILD_TYPE=Release
 | 
					 | 
				
			||||||
              cmake --build build-release --parallel
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
            clean.exec = ''
 | 
					 | 
				
			||||||
              rm -rf build/ build-release/
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            ocd.exec = ''
 | 
					 | 
				
			||||||
              openocd -f ${ocdInterface} -f target/rp2040.cfg
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
            gdb.exec = ''
 | 
					 | 
				
			||||||
              arm-none-eabi-gdb -x .gdbinit build/qclk.elf
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								mcu/devenv.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								mcu/devenv.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					{ pkgs, ... }: {
 | 
				
			||||||
 | 
					  packages = with pkgs; [
 | 
				
			||||||
 | 
					    gnumake
 | 
				
			||||||
 | 
					    cmake
 | 
				
			||||||
 | 
					    pkgsCross.arm-embedded.buildPackages.gdb # ARM one is broken
 | 
				
			||||||
 | 
					    gcc-arm-embedded
 | 
				
			||||||
 | 
					    python3
 | 
				
			||||||
 | 
					    picotool
 | 
				
			||||||
 | 
					    openocd-rp2040
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  env = {
 | 
				
			||||||
 | 
					    PICO_SDK_PATH = "${pkgs.pico-sdk}/lib/pico-sdk";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  scripts = {
 | 
				
			||||||
 | 
					    build.exec = ''
 | 
				
			||||||
 | 
					      cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D PICO_STDIO_SEMIHOSTING=1
 | 
				
			||||||
 | 
					      cmake --build build --parallel
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					    build-rel.exec = ''
 | 
				
			||||||
 | 
					      cmake -S . -B build-release -D CMAKE_BUILD_TYPE=Release
 | 
				
			||||||
 | 
					      cmake --build build-release --parallel
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					    clean.exec = ''
 | 
				
			||||||
 | 
					      rm -rf build/ build-release/
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ocd.exec = ''
 | 
				
			||||||
 | 
					      openocd -f ${./tigard-swd.cfg} -f target/rp2040.cfg
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					    gdb.exec = ''
 | 
				
			||||||
 | 
					      arm-none-eabi-gdb -x .gdbinit build/qclk.elf
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user