qclk/flake.nix

41 lines
961 B
Nix
Raw Normal View History

2024-05-09 20:29:14 +01:00
{
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" ];
2024-08-04 20:15:24 +01:00
perSystem = { inputs', system, lib, pkgs, config, ... }:
2024-05-09 20:29:14 +01:00
let
2024-08-04 20:15:24 +01:00
inherit (lib) mkMerge;
2024-05-09 20:29:14 +01:00
rootdirOpt =
let
rootFileContent = builtins.readFile rootdir.outPath;
in
pkgs.lib.mkIf (rootFileContent != "") rootFileContent;
2024-08-04 20:15:24 +01:00
withRootdir = f: mkMerge [
(import f)
{ devenv.root = rootdirOpt; }
];
2024-05-09 20:29:14 +01:00
in
{
2024-08-04 20:15:24 +01:00
devenv.shells = {
mcu = withRootdir mcu/devenv.nix;
2024-05-09 20:29:14 +01:00
};
};
};
}