-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
145 lines (131 loc) · 5.31 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
{
inputs = {
# Principle inputs (updated by `nix run .#update`)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-unified.url = "github:srid/nixos-unified";
};
outputs = inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "aarch64-darwin" ];
imports = [ inputs.nixos-unified.flakeModule ];
flake =
let
myUserName = "zhen";
myHome = "/Users/${myUserName}";
in
{
# Configurations for macOS machines
# replace `MacBookPro` with your `hostname -s`; it is the same host name as in your nix-darwin configuration
darwinConfigurations."MacBookPro" = self.nixos-unified.lib.mkMacosSystem
{ home-manager = true; }
{
nixpkgs.hostPlatform = "aarch64-darwin";
nixpkgs.config.allowUnfree = true;
services.nix-daemon.enable = true;
users.users.${myUserName}.home = myHome;
imports = [
({ pkgs, ... }: {
security.pam.enableSudoTouchIdAuth = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
})
# Setup home-manager in nix-darwin config
{
home-manager.users.${myUserName} = {
imports = [ self.homeModules.default ];
home.stateVersion = "25.05";
home.homeDirectory = myHome;
};
}
];
};
# home-manager configuration goes here.
homeModules.default = { pkgs, ... }: {
imports = [ ];
home.packages = with pkgs; [
jdk21
nodejs
];
programs.git.enable = true;
programs.starship.enable = true;
programs.zsh = {
enable = true;
# As of 22-07-2024, the PATH config is still need; nixos-flake might make it work out of the box later.
envExtra = ''
export PATH=/etc/profiles/per-user/$USER/bin:/nix/var/nix/profiles/system/sw/bin:/usr/local/bin:$PATH
'';
};
programs.vscode = {
enable = true;
# package = pkgs.vscodium; #pkgs.vscode.fhs;
userSettings = {
"editor.cursorStyle" = "line";
"editor.cursorWidth" = 4;
"window.zoomLevel" = 1;
"git.autofetch" = false;
"diffEditor.ignoreTrimWhitespace" = true;
"gitlens.views.lineHistory.enabled" = true;
"gitlens.advanced.messages" = {
"suppressFileNotUnderSourceControlWarning" = true;
};
"files.exclude" = {
"**/.classpath" = true;
"**/.project" = true;
"**/.settings" = true;
"**/.factorypath" = true;
};
"files.watcherExclude" = {
"**/.bloop" = true;
"**/.metals" = true;
"**/.ammonite" = true;
};
# "remote.SSH.defaultExtensions" =
# [ "eamodio.gitlens" "scalameta.metals" "ms-python.python" ];
"metals.javaHome" = "${myHome}/.nix-profile";
"java.semanticHighlighting.enabled" = true;
# "python.jediEnabled" = true;
# "python.linting.pylintEnabled" = false;
# "python.linting.enabled" = true;
# "python.linting.flake8Enabled" = false;
};
extensions = with pkgs.vscode-extensions;
[
bbenoist.nix
# ms-python.python
rust-lang.rust-analyzer
# scala-lang.scala
# scalameta.metals
# ms-vsliveshare.vsliveshare
ms-vscode-remote.remote-ssh
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
# {
# name = "Nix";
# publisher = "bbenoist";
# version = "1.0.1";
# sha256 = "0zd0n9f5z1f0ckzfjr38xw2zzmcxg1gjrava7yahg5cvdcw6l35b";
# }
{
name = "metals";
publisher = "scalameta";
version = "1.37.0";
sha256 =
"QNXaqm5VnKJCLkLWfx3hC69cu0mRBpeuICup9jgpziw="; # 0000000000000000000000000000000000000000000000000000
}
{
name = "scala";
publisher = "scala-lang";
version = "0.5.7";
sha256 = "cjMrUgp2+zyqT7iTdtMeii81X0HSly//+gGPOh/Mfn4=";
}
];
};
};
};
};
}