-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathflake.nix
More file actions
79 lines (73 loc) · 2.06 KB
/
Copy pathflake.nix
File metadata and controls
79 lines (73 loc) · 2.06 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, systems, treefmt-nix, ... }:
let
pname = "m8c";
version = "2.2.3";
m8c-package =
{ stdenv
, cmake
, copyDesktopItems
, pkg-config
, sdl3
, libserialport
}:
stdenv.mkDerivation {
inherit pname version;
src = ./.;
nativeBuildInputs = [ cmake copyDesktopItems pkg-config ];
buildInputs = [ sdl3 libserialport ];
};
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f
(import nixpkgs { inherit system; })
);
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs (_: {
projectRootFile = "flake.nix";
programs = {
clang-format.enable = false; # TODO(pope): Enable and format C code
deadnix.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
}));
in
{
packages = eachSystem (pkgs: rec {
m8c = pkgs.callPackage m8c-package { };
default = m8c;
});
overlays.default = final: _prev: {
inherit (self.packages.${final.system}) m8c;
};
apps = eachSystem (pkgs: rec {
m8c = {
type = "app";
program = "${self.packages.${pkgs.system}.m8c}/bin/m8c";
};
default = m8c;
});
devShells = eachSystem (pkgs: with pkgs; {
default = mkShell {
packages = [
cmake
gnumake
nix-prefetch-github
treefmtEval.${system}.config.build.wrapper
];
inputsFrom = [ self.packages.${system}.m8c ];
};
});
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
};
}