-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
78 lines (63 loc) · 2.59 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
74
75
76
77
78
{
description = "ExpidusOS Calculator";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
systems.url = "github:nix-systems/default-linux";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, systems, flake-utils }:
let
inherit (nixpkgs) lib;
in
flake-utils.lib.eachSystem (import systems) (system:
let
pkgs = nixpkgs.legacyPackages.${system};
deps = builtins.fromJSON (lib.readFile ./deps.json);
shortRev = self.shortRev or (lib.substring 7 7 lib.fakeHash);
shortRevCodes = lib.map lib.strings.charToInt (lib.stringToCharacters shortRev);
buildCode = lib.foldr (a: b: "${toString a}${toString b}") "" shortRevCodes;
shortVersion = "1.0.0";
version = "${shortVersion}+${buildCode}";
in {
packages.default = pkgs.flutter.buildFlutterApplication {
pname = "expidus-calculator";
version = "${shortVersion}+git-${shortRev}";
src = lib.cleanSource self;
flutterBuildFlags = [
"--dart-define=COMMIT_HASH=${shortRev}"
];
pubspecLock = lib.importJSON ./pubspec.lock.json;
gitHashes = {
expidus = "sha256-gJUi3SKksEzdC14jh5g0L9Q/rnoZporoNuFJwPBgxgs=";
};
postInstall = ''
rm $out/bin/calculator
ln -s $out/app/calculator $out/bin/expidus-calculator
mkdir -p $out/share/applications
mv $out/app/data/com.expidusos.calculator.desktop $out/share/applications
mkdir -p $out/share/icons
mv $out/app/data/com.expidusos.calculator.png $out/share/icons
mkdir -p $out/share/metainfo
mv $out/app/data/com.expidusos.calculator.metainfo.xml $out/share/metainfo
substituteInPlace "$out/share/applications/com.expidusos.calculator.desktop" \
--replace "Exec=calculator" "Exec=$out/bin/expidus-calculator" \
--replace "Icon=com.expidusos.calculator" "Icon=$out/share/icons/com.expidusos.calculator.png"
'';
meta = {
description = "ExpidusOS Calculator";
homepage = "https://expidusos.com";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ RossComputerGuy ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
};
devShells.default = pkgs.mkShell {
inherit (self.packages.${system}.default) pname version name;
packages = with pkgs; [
flutter
pkg-config
gtk3
];
};
});
}