packages: add vm

This commit is contained in:
2025-05-02 11:14:22 +08:00
parent 2637c4a513
commit 5af7d027b7
7 changed files with 59 additions and 0 deletions

View File

@@ -55,4 +55,11 @@
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
hardeningDisable = [ "all" ];
};
vm = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
{
inputsFrom = [ pkgs.localPackages.vm ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
hardeningDisable = [ "all" ];
};
}

View File

@@ -130,6 +130,7 @@ inputs: rec
blog = inputs.pkgs.callPackage inputs.topInputs.blog { inherit (inputs.topInputs) hextra; };
phono3py = inputs.pkgs.python3Packages.callPackage ./phono3py.nix { src = inputs.topInputs.phono3py; };
lumerical = inputs.pkgs.callPackage ./lumerical.nix { src = inputs.topInputs.self.src.lumerical.lumerical; };
vm = inputs.pkgs.callPackage ./vm { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
fromYaml = content: builtins.fromJSON (builtins.readFile
(inputs.pkgs.runCommand "toJSON" {}

1
packages/vm/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake .#vm

View File

@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.14)
project(vm VERSION 0.0.0 LANGUAGES CXX)
enable_testing()
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
find_package(biu REQUIRED)
add_executable(vm src/main.cpp)
target_compile_features(vm PUBLIC cxx_std_23)
target_link_libraries(vm PRIVATE biu::biu)
if(VM_CONFIG)
target_compile_definitions(vm PRIVATE VM_CONFIG="${VMCONFIG}")
endif()
install(TARGETS vm RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("Imported targets: ${ImportedTargets}")
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")

8
packages/vm/default.nix Normal file
View File

@@ -0,0 +1,8 @@
{ lib, stdenv, cmake, pkg-config, vmConfig ? null, biu }: stdenv.mkDerivation
{
name = "vm";
src = ./.;
buildInputs = [ biu ];
nativeBuildInputs = [ cmake pkg-config ];
cmakeFlags = lib.optional (vmConfig != null) [ "-DVM_CONFIG=${vmConfig}" ];
}

1
packages/vm/src/main.cpp Normal file
View File

@@ -0,0 +1 @@
int main() {}

16
packages/vm/vm.yaml Normal file
View File

@@ -0,0 +1,16 @@
Program:
VaspCpu:
Queue:
- Name: localhost
Recommended:
Mpi: 4
Openmp: 4
Memory: 64
VaspGpu:
Queue:
- Name: localhost
Gpu: [ "4060" ]
Mumax3:
Queue:
- Name: localhost
Gpu: [ "4060" ]