Skip to content

Commit 18c20ac

Browse files
Merge pull request #12 from randomizedcoder/2025_01_26
2025 01 26
2 parents 3b0a581 + b1e8ac9 commit 18c20ac

File tree

123 files changed

+1346
-4053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1346
-4053
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ hosts:
2424
cp ./modules/hosts.nix ./laptops/t14/hosts.nix
2525

2626
cp ./modules/hosts.nix ./arm/pi5-1-os/hosts.nix
27+
cp ./modules/hosts.nix ./chromebox/chromebox3/hosts.nix
2728

2829
#all: hp0 hp1 hp2 hp3 hp4 hp5
2930

chromebox/chromebox3/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# nixos/chromebox/chromebox3/Makefile
3+
#
4+
EXPECTED_HOSTNAME := chromebox3
5+
6+
ACTUAL_HOSTNAME := $(shell hostname)
7+
8+
all: check_hostname rebuild
9+
10+
check_hostname:
11+
ifeq ($(ACTUAL_HOSTNAME),$(EXPECTED_HOSTNAME))
12+
@echo "Hostnames match: $(ACTUAL_HOSTNAME)"
13+
else
14+
@echo "Error: Hostname does not match. Expected: $(EXPECTED_HOSTNAME), Got: $(ACTUAL_HOSTNAME)"
15+
@exit 1
16+
endif
17+
18+
rebuild:
19+
#sudo cp /home/das/nixos/modules/* /etc/nixos/
20+
#sudo cp ./*.nix /etc/nixos/
21+
#sudo nix-channel --update
22+
#sudo nixos-rebuild switch
23+
sudo nix flake update;
24+
sudo nix-channel --update;
25+
sudo nixos-rebuild switch --flake .
26+
27+
try:
28+
nix run github:nix-community/nixos-anywhere -- --flake '.#chromebox3' --target-host [email protected]
29+
#nix run github:nix-community/nixos-anywhere -- --flake '.#chromebox3' --target-host root@chromebox3
30+
31+
gen_hardware:
32+
nix run github:numtide/nixos-anywhere -- -f '.#chromebox3' --generate-hardware-config nixos-generate-config ./hardware-configuration.nix
33+
34+
# minutes 10:58
35+
# https://www.youtube.com/watch?v=U_UwzMhixr8
36+
vmtest:
37+
sudo nix flake update;
38+
sudo nix flake lock;
39+
#nix run github:numtide/nixos-anywhere -- -f '.#chromebox3' --vm-test --generate-hardware-config nixos-generate-config ./hardware-configuration.nix
40+
nix run github:numtide/nixos-anywhere -- -f '.#chromebox3' --vm-test

hp3/configuration.nix renamed to chromebox/chromebox3/configuration.nix

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,75 @@
1616
{
1717
# https://nixos.wiki/wiki/NixOS_modules
1818
imports =
19-
[ # Include the results of the hardware scan.
20-
./hardware-configuration.nix
21-
# sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
22-
# sudo nix-channel --update
23-
<home-manager/nixos>
24-
#
19+
[
20+
./disko-chromebox3.nix
2521
./sysctl.nix
26-
./wireless.nix
27-
./hosts.nix
28-
./firewall.nix
2922
./il8n.nix
30-
#./systemdSystem.nix
3123
./systemPackages.nix
32-
./home-manager.nix
24+
./hosts.nix
3325
./nodeExporter.nix
34-
./prometheus.nix
35-
./grafana.nix
3626
./docker-daemon.nix
27+
#./k8s_master.nix
28+
./k3s_master.nix
29+
#./k3s_node.nix
3730
];
3831

39-
# Bootloader.
40-
boot.loader.systemd-boot.enable = true;
41-
boot.loader.efi.canTouchEfiVariables = true;
32+
boot.loader.grub = {
33+
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
34+
# devices = [ ];
35+
efiSupport = true;
36+
efiInstallAsRemovable = true;
37+
};
38+
39+
#boot.loader.efi.canTouchEfiVariables = true;
4240

4341
# https://nixos.wiki/wiki/Linux_kernel
44-
boot.kernelPackages = pkgs.linuxPackages_latest;
45-
#boot.kernelPackages = pkgs.linuxPackages_rpi4
42+
boot.kernelPackages = pkgs.linuxPackages;
43+
#boot.kernelPackages = pkgs.linuxPackages_latest;
44+
45+
nix = {
46+
gc = {
47+
automatic = true; # Enable automatic execution of the task
48+
dates = "weekly"; # Schedule the task to run weekly
49+
options = "--delete-older-than 10d"; # Specify options for the task: delete files older than 10 days
50+
randomizedDelaySec = "14m"; # Introduce a randomized delay of up to 14 minutes before executing the task
51+
};
52+
settings = {
53+
auto-optimise-store = true;
54+
experimental-features = [ "nix-command" "flakes" ];
55+
};
56+
};
4657

4758
# https://nixos.wiki/wiki/Networking
4859
# https://nlewo.github.io/nixos-manual-sphinx/configuration/ipv4-config.xml.html
49-
networking.hostName = "hp3";
60+
networking.hostName = "chromebox3";
61+
62+
services.lldpd.enable = true;
5063

5164
# Configure network proxy if necessary
5265
# networking.proxy.default = "http://user:password@proxy:port/";
5366
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
5467

5568
networking.networkmanager.enable = false;
5669

57-
networking.interfaces.enp1s0f0.useDHCP = false;
58-
networking.interfaces.enp1s0f1.useDHCP = false;
59-
boot.kernel.sysctl."net.ipv6.conf.enp1s0f0.disable_ipv6" = true;
60-
boot.kernel.sysctl."net.ipv6.conf.enp1s0f1.disable_ipv6" = true;
61-
62-
services.lldpd.enable = true;
63-
6470
# Set your time zone.
6571
time.timeZone = "America/Los_Angeles";
6672

6773
# Enable touchpad support (enabled default in most desktopManager).
6874
# services.xserver.libinput.enable = true;
6975

76+
environment.sessionVariables = {
77+
TERM = "xterm-256color";
78+
#MY_VARIABLE = "my-value";
79+
#ANOTHER_VARIABLE = "another-value";
80+
};
81+
7082
# Define a user account. Don't forget to set a password with ‘passwd’.
7183
users.users.das = {
7284
isNormalUser = true;
7385
description = "das";
74-
extraGroups = [ "wheel" "networkmanager" "libvirtd" "docker" ];
86+
password = "admin123";
87+
extraGroups = [ "wheel" "libvirtd" "docker" "kubernetes" ];
7588
packages = with pkgs; [
7689
];
7790
# https://nixos.wiki/wiki/SSH_public_key_authentication
@@ -94,13 +107,17 @@
94107

95108
services.openssh.enable = true;
96109

110+
services.timesyncd.enable = true;
111+
112+
services.fstrim.enable = true;
113+
97114
# This value determines the NixOS release from which the default
98115
# settings for stateful data, like file locations and database versions
99116
# on your system were taken. It‘s perfectly fine and recommended to leave
100117
# this value at the release version of the first install of this system.
101118
# Before changing this value read the documentation for this option
102119
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
103-
system.stateVersion = "24.05"; # Did you read the comment?
120+
system.stateVersion = "24.11"; # Did you read the comment?
104121

105122
# virtualisation.libvirtd.enable = true;
106123
# programs.virt-manager.enable = true;
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#
2+
# nixos/chromebox/chromebox3
3+
#
4+
# Starting point was:
5+
# https://github.com/nix-community/disko/blob/master/example/lvm-sizes-sort.nix
6+
#
7+
# swap
8+
# https://github.com/nix-community/disko/blob/master/example/swap.nix
9+
#
10+
# tmpfs
11+
# https://github.com/nix-community/disko/blob/master/example/tmpfs.nix
12+
#
13+
# Other templates
14+
# https://github.com/nix-community/disko-templates/blob/main/zfs-impermanence/disko-config.nix
15+
16+
{
17+
disko.devices = {
18+
disk = {
19+
one = {
20+
type = "disk";
21+
#device = "/dev/vdb"; # --vm-test
22+
device = "/dev/sda"; # real
23+
content = {
24+
type = "gpt";
25+
partitions = {
26+
boot = {
27+
size = "1M";
28+
type = "EF02"; # for grub MBR
29+
};
30+
ESP = {
31+
name = "ESP";
32+
size = "512M";
33+
type = "EF00";
34+
content = {
35+
type = "filesystem";
36+
format = "vfat";
37+
mountpoint = "/boot";
38+
mountOptions = [ "umask=0077" ];
39+
};
40+
};
41+
primary = {
42+
size = "100%";
43+
content = {
44+
type = "lvm_pv";
45+
vg = "pool";
46+
};
47+
};
48+
};
49+
};
50+
};
51+
};
52+
lvm_vg = {
53+
pool = {
54+
type = "lvm_vg";
55+
lvs = {
56+
swap = {
57+
#size = "10%"; # --vm-test
58+
size = "32G";
59+
content = {
60+
type ="swap";
61+
#discardPolicy = "both";
62+
resumeDevice = true; # resume from hiberation from this device
63+
};
64+
};
65+
atsCache = {
66+
#size = "10%"; # --vm-test
67+
size = "100G";
68+
};
69+
sftp = {
70+
#size = "10%"; # --vm-test
71+
size = "20G";
72+
content = {
73+
type = "filesystem";
74+
format = "xfs";
75+
mountpoint = "/tftp";
76+
mountOptions = [ "defaults" ];
77+
};
78+
};
79+
root = {
80+
size = "90%";
81+
content = {
82+
type = "filesystem";
83+
format = "xfs"; # <---------- xfs!
84+
mountpoint = "/";
85+
mountOptions = [ "defaults" ];
86+
#mountOptions = [ "defaults" "pquota" ];
87+
};
88+
};
89+
};
90+
};
91+
};
92+
# nodev = {
93+
# "/tmp" = {
94+
# fsType = "tmpfs";
95+
# mountOptions = [ "size=200M" ];
96+
# };
97+
# };
98+
};
99+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
{ config, pkgs, ... }:
3+
4+
{
5+
# https://nixos.wiki/wiki/Docker
6+
# https://search.nixos.org/options?from=0&size=50&sort=alpha_asc&query=virtualisation.docker
7+
# https://search.nixos.org/options?channel=24.05&show=virtualisation.docker.extraOptions&from=0&size=50&sort=alpha_asc&type=packages&query=virtualisation.docker
8+
# https://github.com/NixOS/nixpkgs/issues/68349
9+
virtualisation.docker.enable = true;
10+
virtualisation.docker.daemon.settings = {
11+
data-root = "/home/das/docker/";
12+
userland-proxy = false;
13+
experimental = true;
14+
ipv6 = true;
15+
fixed-cidr-v6 = "fd00::/80";
16+
metrics-addr = "0.0.0.0:9323";
17+
# log-driver = "json-file";
18+
# log-opts.max-size = "10m";
19+
# log-opts.max-file = "10";
20+
};
21+
#this doesn't work
22+
#virtualisation.docker.daemon.settings.log-opts.max-size = "10m";
23+
# https://docs.docker.com/reference/cli/dockerd/
24+
#virtualisation.docker.extraOptions = "--userland-proxy=false";
25+
#virtualisation.docker.extraOptions = "--log-opt=max-size=10m";
26+
#virtualisation.docker.extraOptions = "--ipv6";
27+
}

chromebox/chromebox3/flake.lock

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)