mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
暂存
This commit is contained in:
@@ -199,8 +199,9 @@
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
winjob =
|
||||
let inherit (pkgs) clang-tools_18; in let inherit (inputs.self.packages.x86_64-w64-mingw32) pkgs winjob;
|
||||
in pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
let inherit (pkgs) clang-tools_18 mkShell;
|
||||
in let inherit (inputs.self.packages.x86_64-w64-mingw32) pkgs winjob;
|
||||
in mkShell.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
{
|
||||
inputsFrom = [ winjob ];
|
||||
packages = [ clang-tools_18 ];
|
||||
|
||||
@@ -13,6 +13,7 @@ endif()
|
||||
set(WINJOB_VERSION "unknown" CACHE STRING "Version of the winjob")
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS headers filesystem)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
|
||||
add_executable(winjob src/winjob.cpp src/windows.cpp)
|
||||
# target_compile_features(winjob PRIVATE cxx_std_26)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
stdenv, cmake, pkg-config, version ? null, lib,
|
||||
boost
|
||||
boost, nlohmann_json
|
||||
}: stdenv.mkDerivation
|
||||
{
|
||||
name = "winjob";
|
||||
src = ./.;
|
||||
buildInputs = [ boost ];
|
||||
buildInputs = [ boost nlohmann_json ];
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
cmakeFlags = lib.optionals (version != null) [ "-DWINJOB_VERSION=${version}" ];
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
int main()
|
||||
{
|
||||
boost::asio::io_context io_context;
|
||||
boost::asio::local::stream_protocol::endpoint ep("winjobd.sock");
|
||||
boost::asio::local::stream_protocol::endpoint ep(R"(C:\ProgramData\winjob\winjobd.sock)");
|
||||
// send a message to the server
|
||||
boost::asio::local::stream_protocol::socket socket(io_context);
|
||||
socket.connect(ep);
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
# include <boost/asio.hpp>
|
||||
# include <iostream>
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
// clear temp files
|
||||
std::filesystem::create_directories(R"(C:\ProgramData\winjob)");
|
||||
if (std::filesystem::exists(R"(C:\ProgramData\winjob\winjobd.sock)"))
|
||||
std::filesystem::remove(R"(C:\ProgramData\winjob\winjobd.sock)");
|
||||
if (std::filesystem::exists(R"(C:\ProgramData\winjob\auth)"))
|
||||
std::filesystem::remove(R"(C:\ProgramData\winjob\auth)");
|
||||
std::filesystem::create_directories(R"(C:\ProgramData\winjob\auth)");
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
boost::asio::io_context io_context;
|
||||
boost::asio::local::stream_protocol::endpoint ep("winjobd.sock");
|
||||
boost::asio::local::stream_protocol::endpoint ep(R"(C:\ProgramData\winjob\winjobd.sock)");
|
||||
boost::asio::local::stream_protocol::acceptor acceptor(io_context, ep, false);
|
||||
std::function<void(const boost::system::error_code&, boost::asio::local::stream_protocol::socket)> func =
|
||||
[&](const boost::system::error_code& ec, boost::asio::local::stream_protocol::socket socket)
|
||||
|
||||
Reference in New Issue
Block a user