-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
55 lines (55 loc) · 1.51 KB
/
flake.nix
File metadata and controls
55 lines (55 loc) · 1.51 KB
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
# SPDX-FileCopyrightText: © 2021 Caleb Maclennan <caleb@alerque.com>
# SPDX-License-Identifier: GPL-3.0-only
{
description = "Rust library and CLI utility to reset file timestamps to repo state";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
naersk,
}:
let
cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
pkgsFor = forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
}
);
in
{
overlays.default = final: prev: {
"${cargoToml.package.name}" = final.callPackage ./. { inherit naersk; };
};
packages = forAllSystems (system: {
default = pkgsFor.${system}.${cargoToml.package.name};
${cargoToml.package.name} = pkgsFor.${system}.${cargoToml.package.name};
});
devShells = forAllSystems (
system:
let
pkgs = pkgsFor.${system};
in
{
default = pkgs.mkShell {
inputsFrom = [ pkgs.${cargoToml.package.name} ];
buildInputs = with pkgs; [
libgit2
];
};
}
);
};
}