-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
104 lines (93 loc) · 3.16 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
{
description = "NixOS WSL Configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, nixos-wsl, home-manager, nixvim, ... }: {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
({ pkgs, ... }: {
users.defaultUserShell = pkgs.zsh;
programs.zsh.enable = true;
# Enable Docker
virtualisation.docker = {
enable = true;
# Optional: Enable docker daemon on startup
enableOnBoot = true;
# Add your user to docker group
autoPrune.enable = true;
};
# Add your user to docker group
users.users.johanhanses = {
isNormalUser = true;
extraGroups = [ "docker" "wheel" ]; # wheel group for sudo access
};
# System-wide packages
environment.systemPackages = with pkgs; [
wget
# Add nodejs for VSCode remote server compatibility
nodejs_18
docker-compose
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
# VSCode remote server compatibility
system.activationScripts = {
vscode-remote-workaround = {
text = ''
# Check if VSCode server is installed
if [ -d "$HOME/.vscode-server/bin" ]; then
for i in "$HOME"/.vscode-server/bin/*; do
if [ -e "$i/node" ]; then
echo "Fixing vscode-server in $i..."
# Replace with a compatible Node.js binary
ln -sf ${pkgs.nodejs_18}/bin/node "$i/node"
fi
done
fi
'';
deps = ["users"];
};
};
# Additional configuration to help with binary compatibility
programs.nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
libraries = with pkgs; [
stdenv.cc.cc
openssl
# Add other libraries if needed
];
};
})
nixos-wsl.nixosModules.default
{
system.stateVersion = "24.05";
wsl.enable = true;
wsl.defaultUser = "johanhanses";
}
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.johanhanses = import ./home.nix;
# Pass nixvim to home-manager
home-manager.extraSpecialArgs = {
inherit nixvim;
};
}
];
};
};
};
}