Files
eyduhverse/devshells.nix
eyduh 338d58d1f7 feat(scripts): add new-clan-service generator
Interactive bash wizard that scaffolds clan.service modules from NixOS services.
2026-09-18 20:38:23 +02:00

53 lines
1.6 KiB
Nix
Executable File

{ self, ... }:
{
perSystem =
{
pkgs,
inputs',
...
}:
let
inherit (pkgs) lib;
# Expose clan-unlock in the devshell only when the @eyduh/disk-encryption
# instance actually uses the remote role — i.e. driven by the clanService
# instantiation, not hardcoded. It stays out of any machine's system PATH.
remoteRole =
self.clanInternals.inventoryClass.inventory.instances."@eyduh/disk-encryption".roles.remote or { };
hasRemoteUnlock = (remoteRole.machines or { }) != { } || (remoteRole.tags or { }) != { };
clanUnlock = import ./clanServices/disk-encryption/clan-unlock.nix { inherit pkgs; };
newClanService = pkgs.writeScriptBin "new-clan-service" (
builtins.readFile ./scripts/new-clan-service.sh
);
in
{
devShells = {
default = pkgs.mkShellNoCC {
packages = [
inputs'.clan-core.packages.default
self.packages.${pkgs.system}.low-ram-nixos-install
newClanService
]
++ lib.optional hasRemoteUnlock clanUnlock;
shellHook = ''
# clan-dev: use the local clan-core fork at ../clan-core (for template dev)
if [ -d "$PWD/../clan-core" ]; then
alias clan-dev="nix run path:$(realpath "$PWD/../clan-core") --"
fi
'';
};
rust = pkgs.mkShell {
packages = with pkgs; [
rustc
cargo
rust-analyzer
clippy
rustfmt
pkg-config
];
};
};
};
}