-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
114 lines (104 loc) · 3.38 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
description = "twenty-twenty-twenty";
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-compat.url = "github:edolstra/flake-compat";
};
outputs =
{ self, nixpkgs, ... }:
let
version = "nix-${self.shortRev or self.dirtyShortRev or "unknown-dirty"}";
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
apps = forAllSystems (system: {
default = {
type = "app";
program =
let
inherit (self.packages.${system}) twenty-twenty-twenty;
in
if (system == "aarch64-darwin" || system == "x86_64-darwin") then
"${twenty-twenty-twenty}/Applications/TwentyTwentyTwenty.app/Contents/MacOS/TwentyTwentyTwenty"
else
nixpkgs.lib.getExe twenty-twenty-twenty;
};
});
packages = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = self.packages.${system}.twenty-twenty-twenty;
twenty-twenty-twenty = pkgs.callPackage ./twenty-twenty-twenty.nix { inherit version; };
twenty-twenty-twenty-no-sound = self.packages.${system}.twenty-twenty-twenty.override {
withSound = false;
};
twenty-twenty-twenty-no-systray = self.packages.${system}.twenty-twenty-twenty.override {
withSystray = false;
};
twenty-twenty-twenty-minimal = self.packages.${system}.twenty-twenty-twenty.override {
withSound = false;
withSystray = false;
};
twenty-twenty-twenty-static = pkgs.pkgsStatic.callPackage ./twenty-twenty-twenty.nix {
inherit version;
withStatic = true;
};
twenty-twenty-twenty-aarch64-linux-static =
pkgs.pkgsCross.aarch64-multiplatform.pkgsStatic.callPackage ./twenty-twenty-twenty.nix
{
inherit version;
withStatic = true;
};
}
);
formatter = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
pkgs.nixfmt-rfc-style
);
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
name = "twenty-twenty-twenty";
packages =
with pkgs;
[
gnumake
go
gopls
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
gcc
pkg-config
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk_11_0.frameworks.Cocoa
darwin.apple_sdk_11_0.frameworks.MetalKit
darwin.apple_sdk_11_0.frameworks.UserNotifications
];
# Keep the current user shell (e.g.: zsh instead of bash)
shellHook = "exec $SHELL";
};
}
);
};
}