2025-01-04 19:02:30 -05:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
osConfig,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib) mkIf;
|
2025-01-23 19:34:25 -05:00
|
|
|
inherit (pkgs.writers) writeJSON;
|
2025-01-04 19:02:30 -05:00
|
|
|
|
|
|
|
cfg = osConfig.roles.desktop;
|
2025-01-23 19:34:25 -05:00
|
|
|
|
|
|
|
clangdConf = writeJSON "clangd-hypr-conf" {
|
|
|
|
CompileFlags.Add = ["-D__cpp_concepts=202002L"];
|
|
|
|
};
|
2025-01-04 19:02:30 -05:00
|
|
|
in {
|
2025-01-23 19:34:25 -05:00
|
|
|
# https://wiki.hyprland.org/Contributing-and-Debugging/#lsp-and-formatting
|
2025-01-04 19:02:30 -05:00
|
|
|
config = mkIf cfg.enable {
|
2024-08-02 22:32:29 -04:00
|
|
|
home.packages = [
|
2025-01-23 19:34:25 -05:00
|
|
|
(pkgs.writeShellApplication {
|
|
|
|
name = "setupDev";
|
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.cmake
|
|
|
|
osConfig.programs.direnv.nix-direnv.package
|
|
|
|
osConfig.programs.git.package
|
|
|
|
];
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
if [[ $# -gt 0 ]]; then
|
|
|
|
project="$1"
|
|
|
|
subproject="''${2:-"."}"
|
|
|
|
|
|
|
|
cd "$HOME/git/$project/$subproject" || return
|
|
|
|
fi
|
|
|
|
|
|
|
|
chmod +w -fR ./{.cache,build} || true
|
|
|
|
git clean -xdf
|
|
|
|
|
|
|
|
if [ -e .envrc ] || [ -e ../.envrc ]; then
|
|
|
|
if [[ $# -gt 0 ]]; then
|
|
|
|
nix develop -c echo "load shellHook"
|
|
|
|
else
|
|
|
|
direnv reload
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e CMakeLists.txt ] || [ -e ../CMakeLists.txt ]; then
|
|
|
|
nix develop -c cmake -S . -B build/ -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat ${clangdConf} > .clangd
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
|
2024-11-14 20:18:59 -05:00
|
|
|
(pkgs.writeShellApplication {
|
|
|
|
name = "testChanges";
|
2025-01-23 19:34:25 -05:00
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.cmake
|
|
|
|
osConfig.programs.direnv.nix-direnv.package
|
|
|
|
osConfig.programs.git.package
|
|
|
|
];
|
|
|
|
|
2024-11-14 20:18:59 -05:00
|
|
|
text = ''
|
2025-01-23 19:34:25 -05:00
|
|
|
project="$1"
|
|
|
|
subproject="''${2:-"."}"
|
|
|
|
|
|
|
|
cd "$HOME/git/$project/$subproject" || return
|
|
|
|
|
|
|
|
chmod +w -fR ./{.cache,build} || true
|
|
|
|
git clean -xdf
|
|
|
|
|
|
|
|
cd "$FLAKE" || return
|
2024-11-14 20:18:59 -05:00
|
|
|
nix flake update "$1"
|
|
|
|
nh os switch
|
2025-01-23 19:34:25 -05:00
|
|
|
|
|
|
|
setupDev "$project" "$subproject"
|
2024-11-14 20:18:59 -05:00
|
|
|
'';
|
|
|
|
})
|
2024-08-02 22:32:29 -04:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# For accurate stack trace
|
|
|
|
_file = ./dev.nix;
|
|
|
|
}
|