Skip to content

Commit 3e50b9d

Browse files
Merge pull request #9 from randomizedcoder/2024_08_06_1000
commit
2 parents d6b4d66 + e93a3c5 commit 3e50b9d

File tree

12 files changed

+565
-10
lines changed

12 files changed

+565
-10
lines changed

t/configuration.nix

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
./hosts.nix
2929
./firewall.nix
3030
#./systemdSystem.nix
31-
./systemPackages.nix
31+
#./systemPackages.nix
3232
./home-manager.nix
3333
./nodeExporter.nix
3434
./prometheus.nix
@@ -78,19 +78,73 @@
7878
# Set your time zone.
7979
time.timeZone = "America/Los_Angeles";
8080

81-
# Enable the X11 windowing system.
82-
services.xserver.enable = true;
81+
# this option doesn't exist
82+
# hardware.graphics.enable = true;
8383

84-
# Enable the GNOME Desktop Environment.
85-
services.xserver.displayManager.gdm.enable = true;
86-
services.xserver.desktopManager.gnome.enable = true;
84+
# Enable OpenGL
85+
hardware.opengl = {
86+
enable = true;
87+
};
88+
89+
# https://nixos.wiki/wiki/Nvidia
90+
hardware.nvidia = {
91+
92+
# Modesetting is required.
93+
modesetting.enable = true;
94+
95+
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
96+
# Enable this if you have graphical corruption issues or application crashes after waking
97+
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
98+
# of just the bare essentials.
99+
powerManagement.enable = false;
100+
101+
# Fine-grained power management. Turns off GPU when not in use.
102+
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
103+
powerManagement.finegrained = false;
104+
105+
# Use the NVidia open source kernel module (not to be confused with the
106+
# independent third-party "nouveau" open source driver).
107+
# Support is limited to the Turing and later architectures. Full list of
108+
# supported GPUs is at:
109+
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
110+
# Only available from driver 515.43.04+
111+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
112+
open = true;
113+
#open = false;
114+
115+
# Enable the Nvidia settings menu,
116+
# accessible via `nvidia-settings`.
117+
nvidiaSettings = true;
118+
119+
# Optionally, you may need to select the appropriate driver version for your specific GPU.
120+
# package = config.boot.kernelPackages.nvidiaPackages.stable;
121+
package = config.boot.kernelPackages.nvidiaPackages.stable;
122+
};
87123

88-
# Configure keymap in X11
89124
services.xserver = {
125+
# Enable the X11 windowing system
126+
enable = true;
127+
# Load nvidia driver for Xorg and Wayland
128+
videoDrivers = ["nvidia-open"];
129+
# Display Managers are responsible for handling user login
130+
displayManager = {
131+
gdm.enable = true;
132+
};
133+
# Enable the GNOME Desktop Environment.
134+
desktopManager = {
135+
gnome.enable = true;
136+
plasma5.enable = false;
137+
xterm.enable = false;
138+
};
139+
# https://discourse.nixos.org/t/help-with-setting-up-a-different-desktop-environment-window-manager/15025/6
140+
141+
# Configure keymap in X11
90142
xkb.layout = "us";
91143
xkb.variant = "";
92144
};
93145

146+
services.udev.packages = [ pkgs.gnome.gnome-settings-daemon ];
147+
94148
systemd.services.modem-manager.enable = false;
95149
systemd.services."dbus-org.freedesktop.ModemManager1".enable = false;
96150

@@ -125,8 +179,14 @@
125179
wget
126180
tcpdump
127181
iproute2
182+
nftables
183+
iptables
184+
pciutils
185+
usbutils
128186
pciutils
129187
virt-manager
188+
cudatoolkit
189+
pkgs.gnomeExtensions.appindicator
130190
];
131191

132192
# Some programs need SUID wrappers, can be configured further or are

t/home-manager.nix

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@
9696
golangci-lint
9797
golangci-lint-langserver
9898
trunk-io
99+
# https://github.com/go-delve/delve
100+
delve
101+
# https://github.com/aarzilli/gdlv
102+
gdlv
99103
buf
100104
buf-language-server
101105
#
@@ -127,6 +131,8 @@
127131
gnome.gnome-tweaks
128132
gnome.simple-scan
129133
gnomeExtensions.appindicator
134+
gnomeExtensions.settingscenter
135+
gnomeExtensions.system-monitor
130136
gnomeExtensions.dash-to-dock
131137
gnomeExtensions.just-perfection
132138
gnomeExtensions.logo-menu
@@ -146,7 +152,8 @@
146152
hunspell
147153
hunspellDicts.en_AU
148154
#hunspellDicts.en_US
149-
gnomeExtensions.system-monitor
155+
#
156+
evince
150157
# https://nixos.wiki/wiki/Firefox
151158
firefox
152159
# https://nixos.wiki/wiki/Chromium
@@ -280,18 +287,24 @@
280287
font-antialiasing = "grayscale";
281288
font-hinting = "slight";
282289
gtk-theme = "Nordic";
283-
toolkit-accessibility = true;
290+
# toolkit-accessibility = true;
291+
toolkit-accessibility = false;
284292
};
285293
"org/gnome/shell" = {
294+
disable-user-extensions = false;
286295
favorite-apps = [
287296
"firefox.desktop"
297+
"google-chrome-stable.desktop"
288298
"code.desktop"
289299
"chromium.desktop"
290300
"alacritty.desktop"
291301
"kitty.desktop"
292302
"slack.desktop"
293303
];
294-
disable-user-extensions = false;
304+
enabled-extensions = with pkgs.gnomeExtensions; [
305+
blur-my-shell.extensionUuid
306+
gsconnect.extensionUuid
307+
];
295308
};
296309
};
297310

vms/vm3_old_nixos/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# vm:
2+
# nix-build '<nixpkgs/nixos>' -A vm -I nixpkgs=channel:nixos-24.05 -I nixos-config=./configuration.nix
3+
4+
# #
5+
# buildvm:
6+
# nix run .#nixosConfigurations.<hostname>.config.system.build.vm
7+
8+
build:
9+
#nixos-rebuild build-vm -I nixpkgs=channel:nixos-24.05 -I nixos-config=./configuration.nix
10+
nixos-rebuild build-vm -I nixos-config=./configuration.nix
11+
12+
# https://blog.patapon.info/nixos-local-vm/
13+
run:
14+
QEMU_NET_OPTS=hostfwd=tcp::2223-:22 ./result/bin/run-vm3-vm
15+
16+
ssh:
17+
ssh root@localhost -p 2223
18+
19+
nographics:
20+
QEMU_KERNEL_PARAMS=console=ttyS0 ./result/bin/run-nixos-vm -nographic; reset
21+
22+
sync:
23+
rsync -e 'ssh -p 2223' -av --exclude 'db' ./Downloads/xtcp/ localhost:/home/das/Downloads/xtcp/
24+
25+
# example
26+
# https://github.com/nh2/nixos-vm-examples/blob/master/grub-test-vm/configuration.nix
27+
# https://mattwidmann.net/notes/running-nixos-in-a-vm/
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Edit this configuration file to define what should be installed on
2+
# your system. Help is available in the configuration.nix(5) man page, on
3+
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
4+
5+
{ config, lib, pkgs, ... }:
6+
7+
{
8+
imports =
9+
[
10+
./hardware-configuration.nix
11+
./sysctl.nix
12+
./locale.nix
13+
./vm3.systemPackages.nix
14+
<home-manager/nixos>
15+
./home-manager.nix
16+
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/qemu-vm.nix <nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
17+
#<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
18+
#<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
19+
];
20+
21+
boot.loader.systemd-boot.enable = true;
22+
boot.loader.efi.canTouchEfiVariables = true;
23+
24+
# https://www.kernel.org/releases.html
25+
#boot.kernelPackages = pkgs.linuxPackages_4_19; # 4.19.319
26+
#boot.kernelPackages = pkgs.linuxPackages_5_4; # 5.4.281
27+
#boot.kernelPackages = pkgs.linuxPackages_5_15; # 5.15.164
28+
#boot.kernelPackages = pkgs.linuxPackages_6_1; # 6.1.103
29+
#boot.kernelPackages = pkgs.linuxPackages_6_8; # 6.8
30+
boot.kernelPackages = pkgs.linuxPackages_6_10; # 6.10
31+
32+
# boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_4_19.override {
33+
# argsOverride = rec {
34+
# src = pkgs.fetchurl {
35+
# url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
36+
# sha256 = "0ibayrvrnw2lw7si78vdqnr20mm1d3z0g6a0ykndvgn5vdax5x9a";
37+
# };
38+
# version = "4.19.60";
39+
# modDirVersion = "4.19.60";
40+
# };
41+
# });
42+
43+
# nix = {
44+
# gc = {
45+
# automatic = true; # Enable automatic execution of the task
46+
# dates = "weekly"; # Schedule the task to run weekly
47+
# options = "--delete-older-than 10d"; # Specify options for the task: delete files older than 10 days
48+
# randomizedDelaySec = "14m"; # Introduce a randomized delay of up to 14 minutes before executing the task
49+
# };
50+
# settings = {
51+
# auto-optimise-store = true;
52+
# experimental-features = [ "nix-command" "flakes" ];
53+
# };
54+
# };
55+
56+
# https://nixos.wiki/wiki/Networking
57+
networking.hostName = "vm3";
58+
59+
# networking.hostName = "nixos"; # Define your hostname.
60+
# Pick only one of the below networking options.
61+
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
62+
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
63+
64+
# Set your time zone.
65+
# time.timeZone = "Europe/Amsterdam";
66+
67+
users.users.root.initialHashedPassword = "$6$7KZXYg2OjRBy/KiC$T22ywYwqDQjqBTHXAnuVZ1Bl9a8osbttmRMpu2DHcRfR1BTl/Xza3WkSn7zij8pkPk5bye1u93gmJgTSeZgBY.";
68+
69+
# Allow unfree packages
70+
nixpkgs.config.allowUnfree = true;
71+
72+
# List packages installed in system profile. To search, run:
73+
# $ nix search wget
74+
environment.systemPackages = with pkgs; [
75+
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
76+
# wget
77+
vim
78+
curl
79+
wget
80+
tcpdump
81+
iproute2
82+
htop
83+
];
84+
85+
users.users.das = {
86+
isNormalUser = true;
87+
extraGroups = [ "wheel" "docker" ];
88+
#initialPassword = "test";
89+
# mkpasswd -m sha-512
90+
initialHashedPassword = "$6$Cj2ptTRUdahPwOIP$ftQnDDtv.vppfuHFc0V7tsbG5w4wqR04GHRjFUJ48F9stu199iN69xwl/Sm9lGKG50Ieq4uzbA3g/tIEKj9UJ.";
91+
# https://nixos.wiki/wiki/SSH_public_key_authentication
92+
openssh.authorizedKeys.keys = [
93+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGMCFUMSCFJX95eLfm7P9r72NBp9I1FiXwNwJ+x/HGPV das@t"
94+
];
95+
};
96+
97+
# List packages installed in system profile. To search, run:
98+
# $ nix search wget
99+
# environment.systemPackages = with pkgs; [
100+
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
101+
# wget
102+
# ];
103+
104+
services.timesyncd.enable = lib.mkDefault true;
105+
106+
services.openssh.enable = true;
107+
108+
# Open ports in the firewall.
109+
networking.firewall.allowedTCPPorts = [ 22 ];
110+
# networking.firewall.allowedTCPPorts = [ ... ];
111+
# networking.firewall.allowedUDPPorts = [ ... ];
112+
# Or disable the firewall altogether.
113+
# networking.firewall.enable = false;
114+
115+
# https://nixos.wiki/wiki/Docker
116+
# https://medium.com/thelinux/how-to-install-the-docker-in-nixos-with-simple-steps-226a7e9ef260
117+
virtualisation.docker.enable = true;
118+
virtualisation.docker.rootless = {
119+
enable = true;
120+
setSocketVariable = true;
121+
};
122+
virtualisation.docker.storageDriver = "btrfs";
123+
# https://www.qemu.org/docs/master/system/i386/microvm.html
124+
#imports = [ <nixpkgs/nixos/modules/virtualisation/qemu-vm.nix> ];
125+
#virtualisation.qemu.options = [ "-M microvm,accel=kvm:tcg,acpi=on,mem-merge=on,pcie=on,pic=off,pit=off,usb=off" ];
126+
#virtualisation.qemu.options = [ "-M microvm,accel=kvm:tcg,acpi=on,mem-merge=on,pcie=on,pic=off,pit=off" ];
127+
128+
129+
virtualisation.vmVariant = {
130+
virtualisation = {
131+
memorySize = 2048;
132+
cores = 2;
133+
diskSize = 8192;
134+
};
135+
};
136+
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/qemu-vm.nix#L240
137+
138+
# virtualisation.forwardPorts = [
139+
# { from = "host"; host.port = 8122; guest.port = 22; }
140+
# #{ from = "host"; host.port = 8180; guest.port = 80; }
141+
# ];
142+
143+
services.qemuGuest.enable = true;
144+
145+
# https://releases.nixos.org/?prefix=nixos/
146+
system.stateVersion = "25.05";
147+
148+
}
149+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Do not modify this file! It was generated by ‘nixos-generate-config’
2+
# and may be overwritten by future invocations. Please make changes
3+
# to /etc/nixos/configuration.nix instead.
4+
{ config, lib, pkgs, modulesPath, ... }:
5+
6+
{
7+
imports =
8+
[ (modulesPath + "/installer/scan/not-detected.nix")
9+
];
10+
11+
boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usbhid" "rtsx_pci_sdmmc" ];
12+
boot.initrd.kernelModules = [ ];
13+
boot.kernelModules = [ "kvm-amd" ];
14+
boot.extraModulePackages = [ ];
15+
16+
fileSystems."/" =
17+
{ device = "/dev/disk/by-uuid/adb8ae55-949c-44b3-8abe-7584d2194c17";
18+
fsType = "ext4";
19+
};
20+
21+
fileSystems."/boot" =
22+
{ device = "/dev/disk/by-uuid/A1E4-3942";
23+
fsType = "vfat";
24+
options = [ "fmask=0022" "dmask=0022" ];
25+
};
26+
27+
swapDevices =
28+
[ { device = "/dev/disk/by-uuid/1a243657-4913-4220-94da-7ef97d4c7966"; }
29+
];
30+
31+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
32+
# (the default) this is the recommended approach. When using systemd-networkd it's
33+
# still possible to use this option, but it's recommended to use it in conjunction
34+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
35+
networking.useDHCP = lib.mkDefault true;
36+
# networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true;
37+
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
38+
39+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
40+
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
41+
}

0 commit comments

Comments
 (0)