Skip to content

Commit f1a1883

Browse files
Merge pull request #18 from randomizedcoder/2025_10_13
2025 10 13
2 parents 8906c7c + 8764082 commit f1a1883

Some content is hidden

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

44 files changed

+2012
-83
lines changed

chromebox/chromebox1/Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# nixos/chromebox/chromebox1/Makefile
3+
#
4+
EXPECTED_HOSTNAME := chromebox1
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+
anywhere:
28+
nix run github:nix-community/nixos-anywhere -- --flake '.#chromebox1' --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 '.#chromebox1' --generate-hardware-config nixos-generate-config ./hardware-configuration.nix --target-host [email protected]
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 '.#chromebox1' --vm-test --generate-hardware-config nixos-generate-config ./hardware-configuration.nix
40+
nix run github:numtide/nixos-anywhere -- -f '.#chromebox1' --vm-test
41+
42+
sync:
43+
rsync -av /home/das/nixos/chromebox/chromebox1/ 172.16.40.179:/home/das/nixos/chromebox/chromebox1/
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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
3+
# and in the NixOS manual (accessible by running ‘nixos-help’).
4+
5+
# sudo nixos-rebuild switch
6+
# sudo nix-channel --update
7+
# nix-shell -p vim
8+
# nmcli device wifi connect MYSSID password PWORD
9+
# systemctl restart display-manager.service
10+
11+
{ config, pkgs, ... }:
12+
13+
# https://nixos.wiki/wiki/FAQ#How_can_I_install_a_package_from_unstable_while_remaining_on_the_stable_channel.3F
14+
# https://discourse.nixos.org/t/differences-between-nix-channels/13998
15+
16+
{
17+
# https://nixos.wiki/wiki/NixOS_modules
18+
imports =
19+
[
20+
./disko-chromebox1.nix
21+
#./hardware-configuration.nix
22+
./sysctl.nix
23+
./il8n.nix
24+
./systemPackages.nix
25+
./hosts.nix
26+
./nodeExporter.nix
27+
#./docker-daemon.nix
28+
#./k8s_master.nix
29+
#./k3s_master.nix
30+
#./k3s_node.nix
31+
];
32+
33+
# boot.loader.grub = {
34+
# # no need to set devices, disko will add all devices that have a EF02 partition to the list already
35+
# # devices = [ ];
36+
# efiSupport = true;
37+
# efiInstallAsRemovable = true;
38+
# };
39+
40+
# Use the systemd-boot EFI boot loader.
41+
boot.loader.systemd-boot.enable = true;
42+
boot.loader.efi.canTouchEfiVariables = true;
43+
44+
#boot.loader.efi.canTouchEfiVariables = true;
45+
46+
# https://nixos.wiki/wiki/Linux_kernel
47+
boot.kernelPackages = pkgs.linuxPackages;
48+
#boot.kernelPackages = pkgs.linuxPackages_latest;
49+
50+
nix = {
51+
gc = {
52+
automatic = true; # Enable automatic execution of the task
53+
dates = "weekly"; # Schedule the task to run weekly
54+
options = "--delete-older-than 10d"; # Specify options for the task: delete files older than 10 days
55+
randomizedDelaySec = "14m"; # Introduce a randomized delay of up to 14 minutes before executing the task
56+
};
57+
settings = {
58+
auto-optimise-store = true;
59+
experimental-features = [ "nix-command" "flakes" ];
60+
};
61+
};
62+
63+
# https://nixos.wiki/wiki/Networking
64+
# https://nlewo.github.io/nixos-manual-sphinx/configuration/ipv4-config.xml.html
65+
networking.hostName = "chromebox1";
66+
67+
services.lldpd.enable = true;
68+
69+
# Configure network proxy if necessary
70+
# networking.proxy.default = "http://user:password@proxy:port/";
71+
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
72+
73+
networking.networkmanager.enable = false;
74+
75+
# Set your time zone.
76+
time.timeZone = "America/Los_Angeles";
77+
78+
# Enable touchpad support (enabled default in most desktopManager).
79+
# services.xserver.libinput.enable = true;
80+
81+
environment.sessionVariables = {
82+
TERM = "xterm-256color";
83+
#MY_VARIABLE = "my-value";
84+
#ANOTHER_VARIABLE = "another-value";
85+
};
86+
87+
# Define a user account. Don't forget to set a password with ‘passwd’.
88+
users.users.das = {
89+
isNormalUser = true;
90+
description = "das";
91+
password = "admin123";
92+
extraGroups = [ "wheel" "libvirtd" "docker" "kubernetes" ];
93+
# packages = with pkgs; [
94+
# ];
95+
# https://nixos.wiki/wiki/SSH_public_key_authentication
96+
openssh.authorizedKeys.keys = [
97+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGMCFUMSCFJX95eLfm7P9r72NBp9I1FiXwNwJ+x/HGPV das@t"
98+
];
99+
};
100+
101+
# Some programs need SUID wrappers, can be configured further or are
102+
# started in user sessions.
103+
# programs.mtr.enable = true;
104+
# programs.gnupg.agent = {
105+
# enable = true;
106+
# enableSSHSupport = true;
107+
# };
108+
programs.gnupg.agent = {
109+
enable = true;
110+
enableSSHSupport = true;
111+
};
112+
113+
services.openssh.enable = true;
114+
115+
services.timesyncd.enable = true;
116+
117+
services.fstrim.enable = true;
118+
119+
# This value determines the NixOS release from which the default
120+
# settings for stateful data, like file locations and database versions
121+
# on your system were taken. It‘s perfectly fine and recommended to leave
122+
# this value at the release version of the first install of this system.
123+
# Before changing this value read the documentation for this option
124+
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
125+
system.stateVersion = "25.05"; # Did you read the comment?
126+
127+
# virtualisation.libvirtd.enable = true;
128+
# programs.virt-manager.enable = true;
129+
# services.qemuGuest.enable = true;
130+
131+
# https://wiki.nixos.org/wiki/Laptop
132+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#
2+
# nixos/chromebox/chromebox1
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+
root = {
66+
size = "90%";
67+
content = {
68+
type = "filesystem";
69+
format = "xfs"; # <---------- xfs!
70+
mountpoint = "/";
71+
mountOptions = [ "defaults" ];
72+
#mountOptions = [ "defaults" "pquota" ];
73+
};
74+
};
75+
};
76+
};
77+
};
78+
# nodev = {
79+
# "/tmp" = {
80+
# fsType = "tmpfs";
81+
# mountOptions = [ "size=200M" ];
82+
# };
83+
# };
84+
};
85+
}
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/chromebox1/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)