-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
85 lines (72 loc) · 3.07 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
{
description = "Tauri Javascript App";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils, fenix }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};
toolchain = pkgs.fenix.complete;
buildInputs = with pkgs; [
# js
yarn
# rust
(with toolchain; [
cargo
rustc
rust-src
clippy
rustfmt
])
pkg-config
openssl
# tauri
webkitgtk
dbus
# github
act
];
in
rec {
# Executed by `nix build`
packages.default = pkgs.mkYarnPackage rec {
inherit buildInputs;
name = "template";
src = ./.;
buildPhase = "yarn build";
installPhase = ''
mkdir -p $out/bin
cp src-tauri/target/release/${name} $out/bin/${name}
'';
};
# Executed by `nix run`
apps.default = utils.lib.mkApp {
drv = packages.default;
};
# Used by `nix develop`
devShell = pkgs.mkShell {
inherit buildInputs;
XDG_DATA_DIRS = let
base = pkgs.lib.concatMapStringsSep ":" (x: "${x}/share") [
pkgs.gnome.adwaita-icon-theme
pkgs.shared-mime-info
];
gsettings_schema = pkgs.lib.concatMapStringsSep ":" (x: "${x}/share/gsettings-schemas/${x.name}") [
pkgs.glib
pkgs.gsettings-desktop-schemas
pkgs.gtk3
];
in "${base}:${gsettings_schema}";
# Specify the rust-src path (many editors rely on this)
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
});
}