build(nix): add a flake
nix run github:michel/soulseek-rs/master builds the release branch and /develop the nightly. The lock is not optional: without one nix refuses a github: reference outright and hides the commit from the build, so the version stamp read +dirty.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
{
|
||||
description = "Soulseek client for the terminal, with a scriptable CLI and daemon";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
version = (lib.importTOML ./Cargo.toml).workspace.package.version;
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
in
|
||||
{
|
||||
packages = lib.genAttrs systems (system: {
|
||||
default = nixpkgs.legacyPackages.${system}.callPackage (
|
||||
{ rustPlatform, installShellFiles }:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "soulseek-rs";
|
||||
inherit version;
|
||||
src = self;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
cargoBuildFlags = [
|
||||
"--package"
|
||||
"soulseek-rs"
|
||||
];
|
||||
doCheck = false;
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
env.SOULSEEK_RS_VERSION = "${version}+git${lib.substring 0 12 self.lastModifiedDate}.${self.shortRev or "dirty"}";
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd soulseek-rs \
|
||||
--bash <($out/bin/soulseek-rs completions print bash) \
|
||||
--zsh <($out/bin/soulseek-rs completions print zsh) \
|
||||
--fish <($out/bin/soulseek-rs completions print fish)
|
||||
$out/bin/soulseek-rs man > soulseek-rs.1
|
||||
installManPage soulseek-rs.1
|
||||
'';
|
||||
meta = {
|
||||
description = "Soulseek client for the terminal, with a scriptable CLI and daemon";
|
||||
homepage = "https://re-invention.nl/soulseek-rs/";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "soulseek-rs";
|
||||
};
|
||||
}
|
||||
) { };
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user