forked from nix-community/nix-index
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
59 lines (53 loc) · 1.98 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
{
description = "A files database for nixpkgs";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, flake-compat }: let
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in {
packages = forAllSystems (system: {
nix-index = with nixpkgsFor.${system}; rustPlatform.buildRustPackage {
pname = "nix-index";
version = "0.1.3";
src = self;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl curl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security libiconv ];
cargoLock = {
lockFile = ./Cargo.lock;
};
postInstall = ''
mkdir -p $out/etc/profile.d
cp ${./command-not-found.sh} $out/etc/profile.d/command-not-found.sh
substituteInPlace $out/etc/profile.d/command-not-found.sh \
--replace "@out@" "$out"
'';
meta = with lib; {
description = "A files database for nixpkgs";
homepage = https://github.com/bennofs/nix-index;
license = with licenses; [ bsd3 ];
maintainers = [ maintainers.bennofs ];
platforms = platforms.all;
};
};
});
checks = forAllSystems (system: {
nix-index = self.packages.nix-index.${system};
});
defaultPackage = forAllSystems (system: self.packages.${system}.nix-index);
devShell = forAllSystems (system: with nixpkgsFor.${system}; stdenv.mkDerivation {
name = "nix-index";
nativeBuildInputs = [ rustc cargo pkg-config ];
buildInputs = [ openssl curl ]
++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security;
enableParallelBuilding = true;
});
};
}