-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
74 lines (68 loc) · 1.9 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
{
description = "Development environment for Ship";
# 1) You need the `kvm` kernel module for virtualization to work.
# Choose either `kvm-intel` or `kvm-amd` depending on your CPU.
# Make sure you have virtualization enabled in your BIOS.
# ```
# boot.kernelModules = [ ... "kvm-intel" ... ];
# ```
#
# 2) Enable `libvirtd`
# ```
# virtualisation.libvirtd.enable = true;
# ```
#
# 3) Add the user to the `docker` and `libvirtd` groups:
# ```nix
# users.users.my_username = {
# ...
# extraGroups = [ ... "docker" "libvirtd" ... ];
# ...
# };
# ```
#
# 4) After rebooting your machine, run:
# ```
# nix develop
# ```
inputs = {
nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
pkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
devShells = forAllSystems (system: {
default =
pkgsFor.${system}.mkShell.override {
stdenv = pkgsFor.${system}.gcc14Stdenv;
} {
name = "ship-dev-shell";
hardeningDisable = ["all"];
buildInputs = with pkgsFor.${system}; [
libgcc
boost
];
packages = with pkgsFor.${system}; [
tmux
aria2
docker
croc
distrobox
cloud-init
qemu_kvm
lynx
];
shellHook = ''
echo "Enabling default network for the vm"
sudo virsh net-start default 2>/dev/null || true
'';
};
});
};
}