veloren/nix/common.nix
Ludvig Böklin 3f498522db flake-compat (unify flake and non-flake build process/environment)
The only user-facing changes is the process for version pinning, which will be
slightly less convenient without access to the `nix flake` feature. This is
justified by it rarely being necessary, for the benefit of relying on an
upcoming built-in nix feature rather than a non-standard third-party tool.

- deprecate `niv` for version pinning
- legacy nix now uses the flake via `flake-compat`
  - remove `sources.{nix,json}` (versions now pinned in `flake.lock`)
  - move contents of `nix/default.nix` to `nix/veloren.nix`
  - make `nix-build nix/default.nix` produce the same output as `flake build`
  - move contents of `nix/shell.nix` into `nix/devShell.nix`
  - make `nix-shell nix/shell.nix` produce the same environment as `flake develop`
- Move `tag` parameter into `sourceInfo`
- Tidy up and autoformat with `nixpkgs-fmt`
- update README to reflect new usage
- revert input versions to match those previously specified in nix/sources.json
2020-12-11 12:00:04 +00:00

57 lines
1.3 KiB
Nix

{ nixpkgs, sources, system }:
let
rustChannel = import ./rustPkgs.nix {
pkgs = import nixpkgs { inherit system; };
inherit (sources) nixpkgsMoz;
};
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
rustc = rustChannel.rust;
crate2nix = prev.callPackage sources.crate2nix { pkgs = prev; };
nixGL = prev.callPackage sources.nixGL { pkgs = prev; };
})
];
};
in
with pkgs;
let
# deps that crates need (for compiling)
crateDeps = {
libudev-sys = {
buildInputs = [ libudev ];
nativeBuildInputs = [ pkg-config ];
};
alsa-sys = {
buildInputs = [ alsaLib ];
nativeBuildInputs = [ pkg-config ];
};
veloren-network = {
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
};
veloren-voxygen = {
buildInputs = [ xorg.libxcb ];
nativeBuildInputs = [ ];
};
};
# deps that voxygen needs to function
# FIXME: Wayland doesn't work (adding libxkbcommon, wayland and wayland-protocols results in a panic)
voxygenNeededLibs = (with xorg; [ libX11 libXcursor libXrandr libXi ])
++ [ libGL ];
gitLfsCheckFile = ../assets/voxygen/background/bg_main.png;
in
{
inherit
crateDeps
gitLfsCheckFile
pkgs
voxygenNeededLibs
;
}