qclk/flake.nix

43 lines
955 B
Nix

{
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
rootdir = {
url = "file+file:///dev/null";
flake = false;
};
};
outputs = inputs@{ nixpkgs, flake-parts, devenv, rootdir, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
devenv.flakeModule
./mcu
./firmware
];
systems = [ "x86_64-linux" ];
perSystem = { inputs', system, lib, pkgs, config, ... }:
let
inherit (lib) mkMerge;
rootdirOpt =
let
rootFileContent = builtins.readFile rootdir.outPath;
in
pkgs.lib.mkIf (rootFileContent != "") rootFileContent;
in
{
_module.args.libMy = {
withRootdir = c: mkMerge [
c
{ devenv.root = rootdirOpt; }
];
};
};
};
}