init
Some checks failed
build-server / build (push) Failing after 54s

This commit is contained in:
2025-09-05 21:52:36 +00:00
commit a63c87b2f8
10 changed files with 1043 additions and 0 deletions

116
flake.nix Normal file
View File

@@ -0,0 +1,116 @@
{
description = "Paws thingy";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
crane,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
overlays = [ (import rust-overlay) ];
inherit system;
};
inherit (pkgs) lib;
craneLib = (crane.mkLib pkgs).overrideToolchain (
p:
p.rust-bin.nightly.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
}
);
commonArgs = {
# inherit (craneLib.crateNameFromCargoToml { cargoToml = ./crates/client/Cargo.toml; }) version;
src =
let
# Only keeps markdown files
htmlFilter = path: _type: builtins.match ".*html$" path != null;
htmlOrCargo = path: type: (htmlFilter path type) || (craneLib.filterCargoSources path type);
in
lib.cleanSourceWith {
src = ./.;
filter = htmlOrCargo;
name = "source"; # Be reproducible, regardless of the directory name
}
;
strictDeps = true;
doCheck = false;
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs);
server = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
postInstall = ''
${pkgs.upx}/bin/upx --lzma --best $out/bin/server
'';
}
);
server-docker = pkgs.dockerTools.buildLayeredImage {
contents = [
server
pkgs.bash
pkgs.coreutils
];
name = "deadlockmm-backend";
config = {
Cmd = [
"${server}/bin/server"
];
};
};
in
rec {
checks = {
inherit server;
};
packages = {
default = server;
inherit
server
server-docker
;
docker_push = import ./deploy.nix {
inherit pkgs;
inherit server-docker;
};
};
devShells.default = craneLib.devShell rec {
checks = self.checks.${system};
packages = [
pkgs.cargo-watch
pkgs.mold
pkgs.llvmPackages.clang
];
RUSTFLAGS = "-Clinker=clang -Clink-arg=-fuse-ld=mold";
};
}
);
}