-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathflake.nix
More file actions
125 lines (111 loc) · 3.12 KB
/
Copy pathflake.nix
File metadata and controls
125 lines (111 loc) · 3.12 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
description = "nixed gtk-rust-template";
inputs = {
# Fresh and new for testing
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
# Nix script formatter
formatter = pkgs.nixfmt-tree;
# Output package
packages.default =
let
getLibFolder = pkg: "${pkg}/lib";
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in
pkgs.stdenv.mkDerivation {
pname = manifest.name;
version = manifest.version;
src = pkgs.lib.cleanSource ./.;
cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
# Use this if you have dependencies from git instead
# of crates.io in your Cargo.toml
# outputHashes = {
# # Sha256 of the git repository, doesn't matter if it's monorepo
# "example-0.1.0" = "sha256-80EwvwMPY+rYyti8DMG4hGEpz/8Pya5TGjsbOBF0P0c=";
# };
};
# Compile time dependencies
nativeBuildInputs = with pkgs; [
git
rustc
cargo
ninja
meson
clippy
gettext
pkg-config
rust-analyzer
wrapGAppsHook4
appstream
desktop-file-utils
rustPlatform.cargoSetupHook
];
# Runtime dependencies which will be shipped
# with nix package
buildInputs = with pkgs; [
gtk4
openssl
libadwaita
gnome-desktop
adwaita-icon-theme
desktop-file-utils
rustPlatform.bindgenHook
];
# Compiler LD variables
NIX_LDFLAGS = "-L${(getLibFolder pkgs.libiconv)}";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.gcc
pkgs.libiconv
pkgs.llvmPackages.llvm
];
};
devShells.default = pkgs.mkShell {
# Compile time dependencies
packages = with pkgs; [
# Hail the Nix
nixd
statix
deadnix
nixfmt
# Rust
rustc
cargo
rustfmt
clippy
rust-analyzer
cargo-watch
openssl
# Gnome related
gtk4
meson
ninja
gettext
appstream
pkg-config
libadwaita
gnome-desktop
wrapGAppsHook4
desktop-file-utils
rustPlatform.bindgenHook
];
# Set Environment Variables
RUST_BACKTRACE = "full";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);
}