add flake

This commit is contained in:
Aliez Ren 2026-04-10 22:21:52 +09:00
parent 279c920a69
commit ad0d363df5
3 changed files with 47 additions and 0 deletions

19
.direnv/bin/nix-direnv-reload Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
if [[ ! -d "/home/rzh/Projects/ktransformers" ]]; then
echo "Cannot find source directory; Did you move it?"
echo "(Looking for "/home/rzh/Projects/ktransformers")"
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
exit 1
fi
# rebuild the cache forcefully
_nix_direnv_force_reload=1 direnv exec "/home/rzh/Projects/ktransformers" true
# Update the mtime for .envrc.
# This will cause direnv to reload again - but without re-building.
touch "/home/rzh/Projects/ktransformers/.envrc"
# Also update the timestamp of whatever profile_rc we have.
# This makes sure that we know we are up to date.
touch -r "/home/rzh/Projects/ktransformers/.envrc" "/home/rzh/Projects/ktransformers/.direnv"/*.rc

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

27
flake.nix Normal file
View file

@ -0,0 +1,27 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
};
in {
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
conda
cmake
];
};
}
);
}