-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
73 lines (67 loc) · 1.77 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
{
description = "A very simple Git prompt written in Rust";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: let
inherit (inputs.nixpkgs) lib;
defaultSystems = lib.systems.flakeExposed;
argsForSystem = system: {
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
(import inputs.rust-overlay)
];
config = {};
};
};
allArgs = lib.genAttrs defaultSystems argsForSystem;
eachSystem = fn: lib.genAttrs defaultSystems (system: fn allArgs."${system}");
gitpromptPkg = {
lib,
callPackage,
stdenv,
pkg-config,
installShellFiles,
udev,
}: let
naersk = callPackage inputs.naersk {};
in
naersk.buildPackage {
src = ./.;
};
in {
formatter = eachSystem ({pkgs, ...}:
pkgs.writeShellScriptBin "formatter" ''
${pkgs.alejandra}/bin/alejandra flake.nix
'');
devShells = eachSystem ({pkgs, ...}: {
default = pkgs.mkShell {
name = "gitprompt-rs";
inputsFrom = [inputs.self.packages."${pkgs.system}".default];
nativeBuildInputs = [
(pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-analyzer"
"rust-src"
];
})
];
};
});
packages = eachSystem ({pkgs, ...}: {
default = pkgs.callPackage gitpromptPkg {};
});
overlays.default = final: prev: {
gitprompt-rs = final.callPackage gitpromptPkg {};
};
};
}