veloren/flake.nix

62 lines
1.8 KiB
Nix
Raw Normal View History

{
description = "Flake providing Veloren, a multiplayer voxel RPG written in Rust.";
inputs = {
2021-03-23 13:02:47 +00:00
naersk = {
url = "github:yusdacra/naersk/veloren";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-03-23 13:02:47 +00:00
flakeUtils.url = "github:numtide/flake-utils";
rustOverlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-03-23 13:02:47 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
2021-03-23 13:02:47 +00:00
outputs = inputs: with inputs; with flakeUtils.lib;
eachSystem [ "x86_64-linux" ] (system:
let
2021-03-23 13:02:47 +00:00
common = import ./nix/common.nix {
sources = {
inherit
naersk
nixpkgs
rustOverlay
;
};
inherit system;
};
2021-03-23 13:02:47 +00:00
mkPackage = crateName: import ./nix/build.nix {
inherit common;
crateToBuild = crateName;
sourceInfo =
2021-03-23 13:02:47 +00:00
if self.sourceInfo ? rev
then self.sourceInfo // {
# Tag would have to be set manually for stable releases flake
# because there's currently no way to get the tag via the interface.
# tag = v0.8.0;
2021-03-23 13:02:47 +00:00
}
else (throw "Can't get revision because the git tree is dirty");
};
2021-03-23 13:02:47 +00:00
cratesToPackage = [ "veloren-voxygen" "veloren-server-cli" ];
2021-03-23 13:02:47 +00:00
genAttrs = names: f:
builtins.listToAttrs (map (n: { name = n; value = f n; }) names);
in
rec {
packages = genAttrs cratesToPackage mkPackage;
defaultPackage = packages.veloren-voxygen;
2021-03-23 13:02:47 +00:00
apps = builtins.mapAttrs (n: v: mkApp { name = n; drv = v; }) packages;
defaultApp = apps.veloren-voxygen;
devShell = import ./nix/devShell.nix {
2021-03-23 13:02:47 +00:00
inherit common;
};
}
);
}