-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
93 lines (85 loc) · 2.9 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.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";
inputs.gitignore = {
url = "github:hercules-ci/gitignore.nix";
# Use the same nixpkgs
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, gitignore }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells = {
backend = pkgs.mkShell {
packages = with pkgs; [
rustup
rust-analyzer
protobuf
sea-orm-cli
podman
podman-compose
llvmPackages.libclang
clang
llvmPackages.clangUseLLVM
rust-bindgen
lld
llvm
mysql
sqlite
diesel-cli
];
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = (builtins.map (a: ''-I"${a}/include"'') [
# add dev libraries here (e.g. pkgs.libvmi.dev)
pkgs.glibc.dev
])
# Includes with special directory paths
++ [
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
''-I"${pkgs.glib.dev}/include/glib-2.0"''
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
];
};
frontend = pkgs.mkShell {
packages = with pkgs; [
yarn
nodejs_21
yarn2nix
];
};
};
packages =
rec {
# articleman-backend = { };
# articleman-backend-docker = pkgs.dockerTools.buildLayeredImage {
# name = "am-backend";
# };
# THANK YOU OMG
# https://github.com/knarkzel/sveltekit-nix/blob/master/flake.nix
frontend =
let
packageJSON = pkgs.lib.importJSON ./frontend/package.json;
gitignoreSource = gitignore.lib.gitignoreSource;
in
pkgs.mkYarnPackage rec {
name = "${packageJSON.name}-${version}";
version = packageJSON.version;
src = gitignoreSource ./frontend;
packageJson = "${src}/package.json";
yarnLock = "${src}/yarn.lock";
buildPhase = ''
yarn --offline build
'';
distPhase = "true";
installPhase = ''
mkdir -p $out/frontend
mv ./deps/${packageJSON.name}/build $out/frontend
'';
};
};
}
);
}