veloren/flake.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

69 lines
1.8 KiB
Nix

{
description = "Flake providing Veloren, a multiplayer voxel RPG written in Rust.";
inputs = {
crate2nix = {
url = "github:kolloch/crate2nix?rev=3701179c8aef0677dab1915457ca0f367f2dc523";
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgsMoz = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
nixGL = {
url = "github:guibou/nixGL?rev=7d6bc1b21316bab6cf4a6520c2639a11c25a220e";
flake = false;
};
nixpkgs.url = "github:NixOS/nixpkgs?rev=c00959877fb06b09468562518b408acda886c79e";
};
outputs = inputs: with inputs;
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = inputs.nixpkgs.legacyPackages."${system}";
sources = {
inherit
crate2nix
nixGL
nixpkgs
nixpkgsMoz
;
};
veloren = import ./nix/veloren.nix {
inherit
nixpkgs
sources
system
;
sourceInfo =
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;
} else (throw "Can't get revision because the git tree is dirty");
};
in
with flake-utils; rec {
apps = builtins.mapAttrs
(name: value: lib.mkApp { inherit name; drv = value; })
packages;
defaultApp = apps.veloren-voxygen;
packages = veloren;
defaultPackage = packages.veloren-voxygen;
devShell = import ./nix/devShell.nix {
inherit
nixpkgs
sources
system
;
};
}
);
}