-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
63 lines (56 loc) · 1.66 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
let
inherit (builtins) fromTOML readFile;
dexiosCargoToml = fromTOML (readFile ./dexios/Cargo.toml);
mkDexios = { lib, rustPlatform, ... }: rustPlatform.buildRustPackage {
inherit (dexiosCargoToml.package) name version;
src = lib.cleanSource ./.;
doCheck = true;
cargoLock.lockFile = ./Cargo.lock;
};
in
{
overlays = rec {
dexios = final: prev: {
dexios = prev.callPackage mkDexios { };
};
default = dexios;
};
}
//
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
dexios = pkgs.callPackage mkDexios { };
in
{
# Executes by `nix build .#<name>`
packages = {
inherit dexios;
default = dexios;
};
# the same but deprecated in Nix 2.7
defaultPackage = self.packages.${system}.default;
# Executes by `nix run .#<name> -- <args?>`
apps = {
dexios = {
type = "app";
program = "${dexios}/bin/dexios";
};
default = self.apps.${system}.dexios;
};
# Executes by `nix run . -- <args?>`
# the same but deprecated in Nix 2.7
defaultApp = self.apps.${system}.default;
# Used by `nix develop`
devShell = with pkgs; mkShell {
packages = [ cargo rustc rustfmt clippy rust-analyzer ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
}