fork/nix-index

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

Benno Fünfstückchore(version): bump to 0.1.6a8ceb75

v0.1.6
2.6 KiB79 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.6";
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        preUnpack = ''
32          mkdir tmp
33          cp -pr -L --reflink=auto -- "$cargoDeps" "tmp/$(stripHash "$cargoDeps")"
34          chmod -R a+w "tmp/$(stripHash "$cargoDeps")"
35          export cargoDeps="$(pwd)/tmp/$(stripHash "$cargoDeps")"
36        '';
37
38        postInstall = ''
39          mkdir -p $out/etc/profile.d
40          cp ${./command-not-found.sh} $out/etc/profile.d/command-not-found.sh
41          substituteInPlace $out/etc/profile.d/command-not-found.sh \
42            --replace "@out@" "$out"
43        '';
44
45        meta = with lib; {
46          description = "A files database for nixpkgs";
47          homepage = https://github.com/bennofs/nix-index;
48          license = with licenses; [ bsd3 ];
49          maintainers = [ maintainers.bennofs ];
50          platforms = platforms.all;
51        };
52      };
53    });
54    checks = forAllSystems (system: {
55      nix-index = self.packages.nix-index.${system};
56    });
57    devShell = forAllSystems (system: with nixpkgsFor.${system}; stdenv.mkDerivation {
58      name = "nix-index";
59
60      RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
61
62      nativeBuildInputs = [ rustc cargo pkg-config clippy rustfmt ];
63      buildInputs = [ openssl curl sqlite ]
64          ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security;
65      enableParallelBuilding = true;
66    });
67    apps = forAllSystems (system: {
68      nix-index = {
69        type = "app";
70        program = "${self.packages.${system}.default}/bin/nix-index";
71      };
72      nix-locate = {
73        type = "app";
74        program = "${self.packages.${system}.default}/bin/nix-locate";
75      };
76      default = self.apps.${system}.nix-locate;
77    });
78  };
79}