qclk/flake.nix

41 lines
961 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
];
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;
withRootdir = f: mkMerge [
(import f)
{ devenv.root = rootdirOpt; }
];
in
{
devenv.shells = {
mcu = withRootdir mcu/devenv.nix;
};
};
};
}