-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
41 lines (37 loc) · 1.42 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
# icloud-biff flake
{
description = "Scan a public iCloud Shared Photo library, and send an email summary if new content is available.";
outputs = { self, nixpkgs }:
let
# Admin
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
name = cargoToml.package.name;
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system:
let pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
}; in f pkgs);
in
{
# Overlay and default build artefacts
overlay = final: prev: { "${name}" = final.callPackage ./. { }; };
packages = forAllSystems (pkgs: { "${name}" = pkgs."${name}"; });
defaultPackage = forAllSystems (pkgs: pkgs."${name}");
# NixOS module
nixosModule = import ./module.nix;
# Development environment
devShell = forAllSystems (pkgs: import ./shell.nix { inherit pkgs; });
# Basic CI checks
checks = forAllSystems (pkgs: {
"${name}" = pkgs."${name}";
format = pkgs.runCommand "check-format"
{ buildInputs = [ pkgs.cargo pkgs.rustfmt pkgs.nixpkgs-fmt ]; }
''
${pkgs.cargo}/bin/cargo fmt --manifest-path ${./.}/Cargo.toml -- --check
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}
touch $out # success
'';
});
};
}