Hamcha
3326f286fd
All checks were successful
Build and push Docker image / build-and-publish (push) Successful in 12m15s
86 lines
2.2 KiB
Nix
86 lines
2.2 KiB
Nix
{
|
|
description = "staxman";
|
|
|
|
inputs = {
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
rust-crate2nix = {
|
|
url = "github:nix-community/crate2nix";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
inputs @ { self
|
|
, nixpkgs
|
|
, flake-parts
|
|
, rust-overlay
|
|
, rust-crate2nix
|
|
, ...
|
|
}: flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [
|
|
"x86_64-linux"
|
|
];
|
|
flake = {
|
|
nixosModules.default = import ./nixos.nix self;
|
|
};
|
|
perSystem = { system, pkgs, ... }:
|
|
let
|
|
overlays = [
|
|
(import rust-overlay)
|
|
(self: super:
|
|
let
|
|
toolchain = super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
in
|
|
{
|
|
rustc = toolchain;
|
|
})
|
|
];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
|
|
project =
|
|
let
|
|
crateTools = pkgs.callPackage "${rust-crate2nix}/tools.nix" { inherit pkgs; };
|
|
in
|
|
import
|
|
(crateTools.generatedCargoNix {
|
|
name = "staxman";
|
|
src = ./.;
|
|
})
|
|
{
|
|
inherit pkgs;
|
|
};
|
|
|
|
# Package with runtime dependencies and environment variable
|
|
wrappedPackage = pkgs.stdenv.mkDerivation {
|
|
name = "staxman";
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
|
|
phases = [ "installPhase" ];
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp ${project.rootCrate.build}/bin/* $out/bin
|
|
wrapProgram $out/bin/staxman \
|
|
--set STAX_ARION_BIN "${pkgs.arion}/bin/arion" \
|
|
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.arion pkgs.docker-client pkgs.nix ]}
|
|
'';
|
|
};
|
|
in
|
|
rec {
|
|
packages = {
|
|
staxman = wrappedPackage;
|
|
default = packages.staxman;
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
rustc
|
|
cargo-watch
|
|
clang
|
|
arion
|
|
docker-client
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|