1
0
Fork 0
nix-system-configurations/nix-on-droid/flake-module.nix

59 lines
1.7 KiB
Nix

# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
#
# SPDX-License-Identifier: MIT
{
config,
flake-parts-lib,
inputs,
lib,
...
}:
let
entries = builtins.attrNames (builtins.readDir ./.);
modules = builtins.filter (dir: builtins.pathExists (./. + "/${dir}/flake-module.nix")) entries;
in
{
imports = builtins.map (
module-name:
flake-parts-lib.importApply (./. + "/${module-name}/flake-module.nix") { inherit module-name; }
) modules;
perSystem =
{ pkgs, system, ... }:
{
devshells.default = {
commands = [
# {
# help = "󰘥 show nix-darwin documentation";
# name = "man-darwin";
# command = "darwin-help";
# category = " nix-darwin";
# }
]
++ builtins.concatMap (
name:
if config.devices.${name}.enable && config.devices.${name}.system == system then
[
{
help = " `nix-on-droid switch` for ${name}";
name = "droid-${name}";
command = "${
inputs.nix-on-droid.packages.${system}.nix-on-droid
}/bin/nix-on-droid switch --flake .#${name}";
category = " ${name}";
}
{
help = " 󰸨 `nix-on-droid switch` for ${name} with backup";
name = "droid-${name}-backup";
command = "${
inputs.nix-on-droid.packages.${system}.nix-on-droid
}/bin/nix-on-droid switch --flake .#${name} -b backup";
category = " ${name}";
}
]
else
[ ]
) modules;
};
};
}