generated from Patagia/template-nix
This commit is contained in:
parent
8e99ab4555
commit
90d7c9092a
12 changed files with 721 additions and 18 deletions
52
flake.nix
52
flake.nix
|
@ -38,6 +38,9 @@
|
|||
"rust-analyzer"
|
||||
"rust-src"
|
||||
];
|
||||
targets = [
|
||||
"x86_64-unknown-linux-gnu"
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
|
@ -55,22 +58,29 @@
|
|||
];
|
||||
};
|
||||
|
||||
cleanSrc = craneLib.cleanCargoSource ../.;
|
||||
|
||||
commonArgs = {
|
||||
inherit src;
|
||||
inherit src cleanSrc;
|
||||
|
||||
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
|
||||
strictDeps = true;
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
clang
|
||||
mold-wrapped
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
BuildInputs = with pkgs; [
|
||||
openssl
|
||||
];
|
||||
|
||||
CARGO_BUILD_TARGET = "x86_64-unknown-linux-gnu";
|
||||
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
|
||||
OPENSSL_STATIC = "true";
|
||||
OPENSSL_DIR = "${pkgs.openssl.dev}";
|
||||
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
|
||||
OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include/";
|
||||
};
|
||||
|
||||
buildCrate =
|
||||
|
@ -85,11 +95,40 @@
|
|||
|
||||
patagia-agent = buildCrate "patagia-agent" ./agent;
|
||||
patagia-controller = buildCrate "patagia-controller" ./controller;
|
||||
hostd = buildCrate "hostd" ./hostd;
|
||||
xtask = buildCrate "xtask" ./xtask;
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
inherit patagia-agent patagia-controller xtask;
|
||||
inherit
|
||||
hostd
|
||||
patagia-agent
|
||||
patagia-controller
|
||||
xtask
|
||||
;
|
||||
|
||||
hostd-service =
|
||||
let
|
||||
hostd-service = pkgs.writeText "hostd.service" ''
|
||||
[Unit]
|
||||
Description=Patagia Hostd
|
||||
|
||||
[Service]
|
||||
Environment=RUST_LOG=debug
|
||||
ExecStart=${hostd}/bin/hostd
|
||||
Restart=always
|
||||
RestartSec=30s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
'';
|
||||
in
|
||||
pkgs.portableService {
|
||||
pname = "hostd";
|
||||
version = "v0.0.1";
|
||||
units = [ hostd-service ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
checks = {
|
||||
|
@ -147,8 +186,7 @@
|
|||
sqls
|
||||
sqlx-cli
|
||||
watchexec
|
||||
]
|
||||
++ commonArgs.buildInputs;
|
||||
];
|
||||
RUST_BACKTRACE = 1;
|
||||
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; # Required for rust-analyzer
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue