-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathflake.nix
More file actions
103 lines (89 loc) · 2.81 KB
/
flake.nix
File metadata and controls
103 lines (89 loc) · 2.81 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
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
{
description = "Ferrite - a fast, lightweight text editor";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
]
(
system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
linuxBuildInputs = with pkgs; [
gtk3
libxkbcommon
wayland
vulkan-loader
libGL
libx11
libxcursor
libxi
libxrandr
libxcb
];
darwinFrameworks = with pkgs.darwin.apple_sdk.frameworks; [
AppKit
Cocoa
CoreFoundation
CoreGraphics
CoreServices
Foundation
Metal
QuartzCore
];
ferrite = pkgs.rustPlatform.buildRustPackage {
pname = "ferrite";
version = cargoToml.package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ]
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.wrapGAppsHook3 ];
buildInputs = lib.optionals pkgs.stdenv.hostPlatform.isLinux linuxBuildInputs
++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin darwinFrameworks;
doCheck = false;
meta = with lib; {
description = "A fast, lightweight text editor for Markdown, JSON, and more";
homepage = "https://github.com/OlaProeis/Ferrite";
license = licenses.mit;
mainProgram = "ferrite";
platforms = platforms.linux ++ platforms.darwin;
};
};
in
{
packages = {
default = ferrite;
ferrite = ferrite;
};
apps.default = {
type = "app";
program = "${ferrite}/bin/ferrite";
};
devShells.default = pkgs.mkShell {
packages = [
pkgs.rustc
pkgs.cargo
pkgs.rustfmt
pkgs.clippy
pkgs.rust-analyzer
pkgs.pkg-config
]
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux linuxBuildInputs
++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin darwinFrameworks;
shellHook = ''
echo "Ferrite Nix dev shell ready."
echo "Run cargo commands normally, e.g. cargo build --release"
'';
};
checks.default = ferrite;
}
);
}