94 lines
2.2 KiB
Nix
94 lines
2.2 KiB
Nix
{
|
|
description = "damocles-daemon - Matrix chat presence for Damocles";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
treefmt-nix = {
|
|
url = "github:numtide/treefmt-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
treefmt-nix,
|
|
...
|
|
}:
|
|
let
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
forAllSystems =
|
|
f:
|
|
nixpkgs.lib.genAttrs systems (
|
|
system:
|
|
f {
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
treefmt-eval = treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} treefmt-config;
|
|
}
|
|
);
|
|
treefmt-config = {
|
|
projectRootFile = "flake.nix";
|
|
programs.nixfmt.enable = true;
|
|
programs.rustfmt.enable = true;
|
|
programs.taplo.enable = true;
|
|
};
|
|
in
|
|
{
|
|
packages = forAllSystems (
|
|
{ pkgs, ... }:
|
|
{
|
|
default = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "damocles-daemon";
|
|
version = "0.1.0";
|
|
src = nixpkgs.lib.cleanSource ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
|
buildInputs = with pkgs; [
|
|
openssl
|
|
sqlite
|
|
];
|
|
|
|
meta = {
|
|
description = "Matrix chat daemon for Damocles";
|
|
mainProgram = "damocles-daemon";
|
|
platforms = nixpkgs.lib.platforms.linux;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
devShells = forAllSystems (
|
|
{ pkgs, ... }:
|
|
{
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
cargo
|
|
rustc
|
|
rust-analyzer
|
|
clippy
|
|
rustfmt
|
|
pkg-config
|
|
openssl
|
|
sqlite
|
|
];
|
|
};
|
|
}
|
|
);
|
|
|
|
formatter = forAllSystems ({ treefmt-eval, ... }: treefmt-eval.config.build.wrapper);
|
|
|
|
checks = forAllSystems (
|
|
{ pkgs, treefmt-eval, ... }:
|
|
{
|
|
formatting = treefmt-eval.config.build.check self;
|
|
build = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
}
|
|
);
|
|
};
|
|
}
|