-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
100 lines (92 loc) · 2.74 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
94
95
96
97
98
99
100
{
description = "我的 Emacs 配置";
nixConfig = {
extra-substituters = [ "https://nix-community.cachix.org" ];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
# emacs-overlay = {
# url = "github:nix-community/emacs-overlay";
# inputs.nixpkgs.follows = "nixpkgs";
# inputs.nixpkgs-stable.follows = "nixpkgs-stable";
# };
};
outputs = { self, nixpkgs, flake-utils, ... }:
let
getEmacs = system: rec {
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
# overlays = [ (import emacs-overlay) ];
};
emacsWrap = import ./emacsWrap.nix { inherit pkgs; };
fontPackages = import ./font-packages.nix { inherit pkgs; };
env-vars = {
# eaf
QT_QPA_PLATFORM_PLUGIN_PATH =
"${pkgs.qt6.qtbase.outPath}/lib/qt-6/plugins";
GRASS_EMACS_ENV = "manaual";
};
};
in { }
# Nixos 使用的模块
// (let
system = "x86_64-linux";
inherit (getEmacs system) emacsWrap fontPackages env-vars;
in {
nixosModules.default = { config, ... }: {
options = { };
config = {
environment.systemPackages = [ emacsWrap ];
environment.variables =
(env-vars // { GRASS_EMACS_ENV = "nix-module"; });
fonts = {
enableDefaultPackages = true;
fontDir.enable = true;
packages = fontPackages;
};
services.emacs = {
enable = false;
package = emacsWrap;
defaultEditor = true;
};
};
};
})
# Macos 使用的模块
// (let
system = "x86_64-darwin";
inherit (getEmacs system) emacsWrap fontPackages env-vars pkgs;
in {
darwinModules.default = { config, ... }: {
options = { };
config = {
fonts = {
fontDir.enable = true;
fonts = fontPackages;
};
homebrew = {
enable = true;
taps = [ "d12frosted/emacs-plus" ];
brews = [ "emacs-plus@30" ];
};
};
};
})
# 为每个系统提供
// flake-utils.lib.eachDefaultSystem (system:
let
vars = { project_root = builtins.getEnv "PWD"; };
inherit (getEmacs system) pkgs emacsWrap packages env-vars;
in {
# devShells
devShells.default =
import ./shell.nix { inherit pkgs vars packages emacsWrap env-vars; };
})
;
}