fork/nix-index

git clone https://git.julia.blue/fork/nix-index

Benno Fünfstückfeat(nix-channel-index): generate index for channel (merge PR 192)7ac9355

v0.1.4
2.3 KiB72 linesraw
1{
2  description = "A files database for nixpkgs";
3
4  inputs = {
5    nixpkgs.url = "nixpkgs/nixos-unstable";
6    flake-compat = {
7      url = "github:edolstra/flake-compat";
8      flake = false;
9    };
10  };
11
12  outputs = { self, nixpkgs, flake-compat }: let
13    systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
14    forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
15    nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
16  in {
17    packages = forAllSystems (system: {
18      default = with nixpkgsFor.${system}; rustPlatform.buildRustPackage  {
19        pname = "nix-index";
20        version = "0.1.3";
21
22        src = self;
23
24        nativeBuildInputs = [ pkg-config ];
25        buildInputs = [ openssl curl sqlite ]
26          ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security libiconv ];
27        cargoLock = {
28          lockFile = ./Cargo.lock;
29        };
30
31        postInstall = ''
32          mkdir -p $out/etc/profile.d
33          cp ${./command-not-found.sh} $out/etc/profile.d/command-not-found.sh
34          substituteInPlace $out/etc/profile.d/command-not-found.sh \
35            --replace "@out@" "$out"
36        '';
37
38        meta = with lib; {
39          description = "A files database for nixpkgs";
40          homepage = https://github.com/bennofs/nix-index;
41          license = with licenses; [ bsd3 ];
42          maintainers = [ maintainers.bennofs ];
43          platforms = platforms.all;
44        };
45      };
46    });
47    checks = forAllSystems (system: {
48      nix-index = self.packages.nix-index.${system};
49    });
50    devShell = forAllSystems (system: with nixpkgsFor.${system}; stdenv.mkDerivation {
51      name = "nix-index";
52
53      RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
54
55      nativeBuildInputs = [ rustc cargo pkg-config clippy rustfmt ];
56      buildInputs = [ openssl curl sqlite ]
57          ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security;
58      enableParallelBuilding = true;
59    });
60    apps = forAllSystems (system: {
61      nix-index = {
62        type = "app";
63        program = "${self.packages.${system}.default}/bin/nix-index";
64      };
65      nix-locate = {
66        type = "app";
67        program = "${self.packages.${system}.default}/bin/nix-locate";
68      };
69      default = self.apps.${system}.nix-locate;
70    });
71  };
72}