-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
67 lines (67 loc) · 2.48 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
{
description = "Dev shell flake for fdroid-build";
inputs.fcitx5-android.url = "github:fcitx5-android/fcitx5-android";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
inputs.plugin-scaffold = {
url = "github:fcitx5-android/plugin-scaffold";
inputs.nixpkgs.follows = "fcitx5-android/nixpkgs";
inputs.flake-utils.follows = "fcitx5-android/flake-utils";
};
outputs = { self, fcitx5-android, flake-utils, plugin-scaffold, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
nixpkgs = fcitx5-android.inputs.nixpkgs;
pkgs = import nixpkgs {
inherit system;
config.android_sdk.accept_license = true;
config.allowUnfree = true;
overlays = [ fcitx5-android.overlays.default ];
};
sdk = pkgs.fcitx5-android.sdk;
plugin-scaffold-exe = plugin-scaffold.packages.${system}.default;
fdroid-builder = pkgs.haskell.lib.overrideCabal
(pkgs.haskellPackages.callPackage ./nix { }) (drv: {
buildTools = drv.buildTools or [ ] ++ [ pkgs.makeWrapper ];
postInstall = with pkgs;
drv.postInstall or "" + ''
wrapProgram $out/bin/fdroid-build \
--prefix PATH ":" "${
lib.makeBinPath [
plugin-scaffold-exe
nvchecker
unzip
rsync
]
}"
'';
});
fdroid-builder-shell-f = inCI:
with pkgs;
(haskell.lib.addBuildTools fdroid-builder ([ cabal-install ]
++ (if !inCI then [
haskell-language-server
cabal2nix
] else
[ ]))).env;
ourShell = inCI:
with pkgs;
let fdroid-builder-shell = fdroid-builder-shell-f inCI;
in (sdk.shell.override {
androidStudio = null;
generateLocalProperties = false;
}).overrideAttrs (old: {
buildInputs = old.buildInputs
++ [ plugin-scaffold-exe nvchecker unzip rsync ]
++ fdroid-builder-shell.buildInputs;
nativeBuildInputs = old.nativeBuildInputs
++ fdroid-builder-shell.nativeBuildInputs;
});
in with pkgs; {
devShells.default = ourShell false;
devShells.ci = ourShell true;
packages.default = haskell.lib.justStaticExecutables fdroid-builder;
});
}