-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
90 lines (87 loc) · 2.49 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
{
description = "Just a shell for now";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
nuenv.url = "github:DeterminateSystems/nuenv";
nuenv.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, flake-utils, devshell, nuenv, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ devshell.overlays.default nuenv.overlays.default ];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
update-dependencies = pkgs.nuenv.writeScriptBin {
name = "ud";
script = ''
bun update --save
'';
};
dev_packages = with pkgs; [
nodejs_latest
nodePackages_latest.dotenv-cli
bun
# update dependencies with nix
update-dependencies
# db
surrealdb-migrations
];
modules = import ./nix/modules;
packages = import ./nix/packages { inherit pkgs; };
in
{
nixosModules = modules;
packages = packages;
overlays.default = final: prev: {
inherit (packages) megzari_com;
};
devShell = pkgs.devshell.mkShell {
packages = dev_packages;
env = [
{
name = "PUBLIC_ENVIRONMENT";
value = "development";
}
];
commands = [
{
name = "clean";
category = "dev";
help = "Clean the package manager directory and local direnv";
command = ''
direnv prune
'';
}
{
name = "dev";
category = "dev";
help = "Start dev server locally";
command = "bun run dev";
}
{
name = "deps_update";
category = "dev";
help = "update dependencies";
command = "bun update --save";
}
{
name = "build";
category = "dev";
help = "build the project for release";
command = "bun run build";
}
{
name = "preview";
category = "dev";
help = "preview the release build";
command = "npm run preview";
}
];
};
}
);
}