-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
89 lines (75 loc) · 2.63 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
{
description = "repo for Yuan's blog";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
dream2nix.url = "github:nix-community/dream2nix";
flake-root.url = "github:srid/flake-root";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
devenv.url = "github:cachix/devenv";
};
outputs = inputs@{ self, nixpkgs, flake-parts, dream2nix, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" ];
imports = [
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule
inputs.devenv.flakeModule
./mechanical-meridian/flake-module.nix
];
perSystem = { self', lib, config, pkgs, ... }:
{
packages.nodejs = pkgs.nodejs_22;
packages.dream-blog = dream2nix.lib.evalModules {
packageSets.nixpkgs = pkgs;
modules = [
{
imports = [
dream2nix.modules.dream2nix.nodejs-devshell-v3
# dream2nix.modules.dream2nix.nodejs-package-lock-v3
# dream2nix.modules.dream2nix.nodejs-granular-v3
];
mkDerivation = {
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; src = ./mechanical-meridian;
};
deps = { nixpkgs, ... }: {
inherit
(nixpkgs)
fetchFromGitHub
stdenv
mkShell
rsync
cacert
;
};
name = "dream-blog";
version = "0.1.0";
}
{
paths.projectRoot = ./.;
# can be changed to ".git" or "flake.nix" to get rid of .project-root
paths.projectRootFile = "flake.nix";
paths.package = ./.;
}
];
};
treefmt.config = {
inherit (config.flake-root) projectRootFile;
package = pkgs.treefmt;
programs.nixpkgs-fmt.enable = true;
};
devenv.shells.default = {
# https://devenv.sh/reference/options/
packages = [
config.treefmt.build.wrapper
config.packages.nodejs
];
scripts.preview.exec = ''
npx http-server ${config.packages.blog}
'';
};
packages.default = config.packages.blog;
};
};
}