-
Notifications
You must be signed in to change notification settings - Fork 43
/
flake.nix
85 lines (75 loc) · 2.56 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
mozillapkgs = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
# borked: https://github.com/nix-community/fenix/issues/20
# fenix = {
# url = "github:nix-community/fenix";
# inputs.nixpkgs.follows = "nixpkgs";
# };
naersk = {
url = "github:dpc/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, naersk, nixpkgs, flake-utils, flake-compat, mozillapkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
# Get a specific rust version
mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {};
channel = (mozilla.rustChannelOf {
# date = "2020-01-01"; # get the current date with `date -I`
channel = "stable";
sha256 = "KXx+ID0y4mg2B3LHp7IyaiMrdexF6octADnAtFIOjrY=";
});
rust = channel.rust;
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
in rec {
# packages.rdedup-lib = naersk-lib.buildPackage {
# pname = "rdedup-lib";
# root = ./.;
# cargoBuildOptions = x: x ++ [ "-p" "rdedup-lib" ];
# cargoTestOptions = x: x ++ [ "-p" "rdedup-lib" ];
# };
# packages.rdedup = naersk-lib.buildPackage {
# # pname = "rdedup";
# root = ./.;
# # buildInputs = [ self.packages.${system}.rdedup-lib ];
# };
packages.rdedup = naersk-lib.buildPackage ./.;
defaultPackage = self.packages.${system}.rdedup;
defaultApp = self.packages.${system}.rdedup;
# `nix develop`
devShell = pkgs.mkShell
{
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = [ pkgs.libsodium pkgs.lzma pkgs.openssl ];
nativeBuildInputs = (with pkgs;
[
pkgconfig
rust-analyzer
rustup
]);
RUST_SRC_PATH = "${channel.rust-src}/lib/rustlib/src/rust/library";
};
# devShell =
# # pkgs.mkShell { buildInputs = [ self.packages.${system}.rdedup ]; };
# pkgs.mkShell {
# nativeBuildInputs = [ fenix.packages.${system}.stable.rustc ];
# buildInputs = with pkgs; [ pkgconfig libsodium lzma openssl fenix.packages.x86_64-linux.rust-analyzer ];
# };
});
}