bootstrap/flake.nix

62 lines
1.8 KiB
Nix
Raw Normal View History

2023-11-22 17:43:05 +00:00
{
description = ''
CLI for initializing new projects deterministically with flakes.
2023-11-22 17:43:05 +00:00
'';
inputs = {
2023-11-26 19:56:13 +00:00
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
2023-11-22 17:43:05 +00:00
flake-utils.url = "github:numtide/flake-utils";
2023-11-26 19:56:13 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2023-11-22 17:43:05 +00:00
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
codelldb = pkgs.writeShellScriptBin "codelldb" ''
2023-11-22 20:43:34 +00:00
exec ${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb "$@"
2023-11-22 17:43:05 +00:00
'';
in
{
packages = {
2023-11-26 15:57:58 +00:00
release = pkgs.stdenv.mkDerivation {
pname = "bootstrap";
src = ./.;
2023-12-13 16:27:11 +00:00
version = "0.1.3";
2023-12-21 21:50:32 +00:00
nativeBuildInputs = with pkgs; [ cmake ];
buildPhase = ''
cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build .
'';
installPhase = ''
mkdir -p $out/bin
cp ./bootstrap $out/bin
'';
};
2023-11-26 15:57:58 +00:00
default = pkgs.writeShellScriptBin "bootstrap" ''
if [ -z "$BOOTSTRAP_ROOT_DIR" ]; then
export BOOTSTRAP_ROOT_DIR="${./specs}"
fi
exec ${self.packages.${system}.release}/bootstrap "$@"
'';
};
2023-11-22 18:15:12 +00:00
devShells.default = pkgs.mkShell.override {
# https://nixos.wiki/wiki/Using_Clang_instead_of_GCC
stdenv = pkgs.clangStdenv;
} {
2023-11-22 17:43:05 +00:00
packages = with pkgs; [
clang-tools
2023-12-19 23:58:19 +00:00
cmake
2023-11-22 17:43:05 +00:00
codelldb
doxygen
2023-11-22 17:43:05 +00:00
];
2023-11-22 20:43:34 +00:00
shellHook = ''
2023-11-23 18:02:40 +00:00
export BOOTSTRAP_ROOT_DIR="${./specs}"
2023-11-22 20:43:34 +00:00
'';
2023-11-22 17:43:05 +00:00
};
}
);
}