This commit is contained in:
Hamcha 2023-11-27 13:33:52 +01:00
parent 589f43e52e
commit 1cda4fd866
3 changed files with 82 additions and 0 deletions

19
default.nix Normal file
View File

@ -0,0 +1,19 @@
{ naersk
, version
, pkgs
, ...
}:
naersk.buildPackage {
name = "staxman";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [
clang
mold
];
buildInputs = with pkgs; [ ];
}

61
flake.nix Normal file
View File

@ -0,0 +1,61 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
nix-naersk.url = "github:nix-community/naersk";
nixpkgs-mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
};
outputs =
{ self
, nixpkgs
, flake-utils
, nix-naersk
, nixpkgs-mozilla
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import nixpkgs-mozilla)
];
};
toolchain = (pkgs.rustChannelOf {
rustToolchain = ./rust-toolchain.toml;
sha256 = "sha256-ks0nMEGGXKrHnfv4Fku+vhQ7gx76ruv6Ij4fKZR3l78=";
}).rust;
naersk = pkgs.callPackage nix-naersk {
cargo = toolchain;
rustc = toolchain;
};
in
{
packages = rec {
default = staxman;
staxman = import ./package.nix {
inherit naersk pkgs;
version = self.rev or "dirty";
};
};
apps.default = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
exePath = "/bin/staxman";
};
formatter = pkgs.nixpkgs-fmt;
shell = pkgs.mkShell {
buildInputs = with pkgs; [
arion
docker-client
];
};
});
}

2
rust-toolchain.toml Normal file
View File

@ -0,0 +1,2 @@
[toolchain]
channel = "1.73"