/
flake.nix
94 lines (80 loc) · 2.48 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
perSystem = { self', lib, system, pkgs, config, ... }:
let
mkFlakeshot =
{ rustPlatform
, lib
, pkg-config
, pango
, gdk-pixbuf
, gtk4
, gtk4-layer-shell
, libadwaita
, ...
}: rustPlatform.buildRustPackage.override
{
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
}
rec {
nativeBuildInputs = [
pkg-config
pango
gdk-pixbuf
];
buildInputs = [
gtk4
gtk4-layer-shell
libadwaita
];
pname = "flakeshot";
version = "0.0.1";
src = builtins.path {
path = ./.;
};
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = "A screenshot tool for wayland and x11!";
homepage = "https://github.com/eneoli/flakeshot/";
license = lib.licenses.gpl2;
mainProgram = pname;
};
};
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = with inputs; [
rust-overlay.overlays.default
];
};
apps.default = {
type = "app";
program = lib.meta.getExe self'.packages.default;
};
packages.default = pkgs.callPackage mkFlakeshot { };
devShells.default =
let
flakeshot = self'.packages.default;
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
pkgs.mkShell.override
{
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
}
{
packages = [ rust-toolchain ] ++ flakeshot.nativeBuildInputs ++ flakeshot.buildInputs;
};
};
};
}