79 Commits

Author SHA1 Message Date
Tom Alexander
e900dc4199 Add secret for homepage-staging. 2026-05-05 22:43:45 -04:00
Tom Alexander
df2299d214 Add a secret for the harbor webhooks to flux. 2026-05-05 22:43:45 -04:00
Tom Alexander
8f0a273ee3 Update flux and install the image automation controller. 2026-05-05 22:43:45 -04:00
Tom Alexander
2a41b6c16e Add IP addresses to worker certs for the metrics server. 2026-05-05 22:43:45 -04:00
Tom Alexander
e537825c54 Delete images after 24 hours of being unused. 2026-05-05 22:43:45 -04:00
Tom Alexander
6c4075e279 Set up containerd use harbor.fizz.buzz. 2026-05-05 22:43:44 -04:00
Tom Alexander
785f28a351 Add secrets for archive-box, webhook-bridge, and tekton. 2026-05-05 22:43:44 -04:00
Tom Alexander
5cfb2c3b6a Allow node-to-node communication. 2026-05-05 22:43:44 -04:00
Tom Alexander
2fdf0a0f63 Use numbers for folder order. 2026-05-05 22:43:44 -04:00
Tom Alexander
d7c889a2d7 Add harbor secrets. 2026-05-05 22:43:44 -04:00
Tom Alexander
d2c01c1223 Switch to the experimental gateway CRDs for TCPRoute support. 2026-05-05 22:43:44 -04:00
Tom Alexander
f62f6bed00 Add oauth2 proxy secrets. 2026-05-05 22:43:43 -04:00
Tom Alexander
efc4d0f12e Add dex secrets. 2026-05-05 22:43:43 -04:00
Tom Alexander
f0e539f5ef Enable the firewall. 2026-05-05 22:43:43 -04:00
Tom Alexander
abd795d8ae Add gitea secrets. 2026-05-05 22:43:43 -04:00
Tom Alexander
2d3c03e042 Add generation for in-repo secrets. 2026-05-05 22:43:43 -04:00
Tom Alexander
a44e972701 Enforce cilium network policies. 2026-05-05 22:43:43 -04:00
Tom Alexander
7619c482ef Downgrade to gateway 1.4.1.
1.5 came out recently, so no gateway providers support it.
2026-05-05 22:43:42 -04:00
Tom Alexander
3ea1b59d59 Update packages in kubernetes/keys. 2026-05-05 22:43:42 -04:00
Tom Alexander
4457d35a63 Fix network for updated nix. 2026-05-05 22:43:42 -04:00
Tom Alexander
dddf80273a Fix proxy auth tls 2026-05-05 22:43:42 -04:00
Tom Alexander
9751784e76 Generate certificates for the aggregation layer. 2026-05-05 22:43:42 -04:00
Tom Alexander
1195bf2aa5 Add a note for the cilium connectivity test. 2026-05-05 22:43:42 -04:00
Tom Alexander
b6b5d5bd0f Temporarily disable the firewall for debugging. 2026-05-05 22:43:41 -04:00
Tom Alexander
893922959a Enable gateway support. 2026-05-05 22:43:41 -04:00
Tom Alexander
1fc4dd8f72 Enable hubble. 2026-05-05 22:43:41 -04:00
Tom Alexander
4b1a5c56ab Temporarily drop flux interval to 1 minute during early development.
This is to reduce waiting time.
2026-05-05 22:43:41 -04:00
Tom Alexander
af478c9731 Install deferred manifests. 2026-05-05 22:43:41 -04:00
Tom Alexander
81e9386b9b Add a custom nftables firewall config. 2026-05-05 22:43:41 -04:00
Tom Alexander
c89b5031c7 Enable the firewall.
Now that we have networking working, I can enable the firewall and confirm nothing breaks.
2026-05-05 22:43:41 -04:00
Tom Alexander
9378bc3343 Fix CoreDNS IPv4 connectivity. 2026-05-05 22:43:40 -04:00
Tom Alexander
61cd0acc5e Increase timeout for coredns cache. 2026-05-05 22:43:40 -04:00
Tom Alexander
646fc44d8f More changes to try to fix coredns. 2026-05-05 22:43:40 -04:00
Tom Alexander
5d094246de Move the kubelet yaml config into nix. 2026-05-05 22:43:40 -04:00
Tom Alexander
8158b06e2d Implement a generic helm templater package. 2026-05-05 22:43:40 -04:00
Tom Alexander
423d429d0e Switch to generating the coredns manifests via nix. 2026-05-05 22:43:40 -04:00
Tom Alexander
de5f2ec54d Use CoreDNS for in-cluster DNS requests and caching. 2026-05-05 22:43:39 -04:00
Tom Alexander
5871c72491 Enable native routing. 2026-05-05 22:43:39 -04:00
Tom Alexander
ab179f2f49 Build the cilium manifest automatically in nix. 2026-05-05 22:43:39 -04:00
Tom Alexander
91cfb2a9c4 Allow pods to directly speak to the public internet on their own public IPv6 addresses. 2026-05-05 22:43:39 -04:00
Tom Alexander
dfd43da93a Enable ipv4 and tunnel routing. 2026-05-05 22:43:39 -04:00
Tom Alexander
8a54291834 Switch to kubernetes ipam mode. 2026-05-05 22:43:39 -04:00
Tom Alexander
ed786cf926 Fix service cluster ip range.
Kubernetes only allows a /112 for service ip range.
2026-05-05 22:43:38 -04:00
Tom Alexander
0f09d38212 Fix trailing line break in kubernetes encryption config. 2026-05-05 22:43:38 -04:00
Tom Alexander
0215812ee9 Move the yaml functions to their own file. 2026-05-05 22:43:38 -04:00
Tom Alexander
d26b3d5ebf Introduce functions to generate yaml.
The toYAML function is just an alias to toJSON which is technically fine since YAML is a superset of JSON, but these new functions will generate actual YAML.
2026-05-05 22:43:38 -04:00
Tom Alexander
2861fddf6f Add missing cidr declarations. 2026-05-05 22:43:38 -04:00
Tom Alexander
0e8393762d Fix DNS resolution. 2026-05-05 22:43:38 -04:00
Tom Alexander
45cc48b3b5 Apply the git repo to the cluster. 2026-05-05 22:43:38 -04:00
Tom Alexander
0a112a931a Trust flux's ssh key in the yaml git repo. 2026-05-05 22:43:37 -04:00
Tom Alexander
3b3f27bd59 Generic secrets for ssh keys. 2026-05-05 22:43:37 -04:00
Tom Alexander
f19d018a34 Generic secrets for pgp keys. 2026-05-05 22:43:37 -04:00
Tom Alexander
d277ca5634 Generate kubernetes secrets for ssh keys. 2026-05-05 22:43:37 -04:00
Tom Alexander
1f02259850 Install CoreDNS. 2026-05-05 22:43:37 -04:00
Tom Alexander
9382057b47 Generate pgp keys for sops. 2026-05-05 22:43:37 -04:00
Tom Alexander
586198586b Generate ssh keys for flux bootstrap. 2026-05-05 22:43:36 -04:00
Tom Alexander
2efe37993a Move the cluster bootstrap into the keys flake.
Bootstrapping the cluster needs access to secrets, so I am moving it into the keys flake.
2026-05-05 22:43:36 -04:00
Tom Alexander
61583f9eff Set up flux. 2026-05-05 22:43:36 -04:00
Tom Alexander
54782da612 Add a bootstrap role. 2026-05-05 22:43:36 -04:00
Tom Alexander
4d499c0210 Add a bootstrap role to load manifests into the cluster. 2026-05-05 22:43:36 -04:00
Tom Alexander
365566bf75 Fix launching of containers. 2026-05-05 22:43:36 -04:00
Tom Alexander
37de518169 Create a debugging role. 2026-05-05 22:43:35 -04:00
Tom Alexander
2bd134ab12 Some networking fixes. 2026-05-05 22:43:35 -04:00
Tom Alexander
827ef15c90 Add cilium bootstrap. 2026-05-05 22:43:35 -04:00
Tom Alexander
f7d463947d Installing the cni plugins. 2026-05-05 22:43:35 -04:00
Tom Alexander
a389547117 Add kube-proxy. 2026-05-05 22:43:35 -04:00
Tom Alexander
3cb65e76c0 Add kubelet. 2026-05-05 22:43:35 -04:00
Tom Alexander
6c05320380 Add worker nodes. 2026-05-05 22:43:34 -04:00
Tom Alexander
d302ac96e2 Add kube-scheduler. 2026-05-05 22:43:34 -04:00
Tom Alexander
23ee194a84 Add kube-controller-manager. 2026-05-05 22:43:34 -04:00
Tom Alexander
0e111b500b Fix launching kube-apiserver. 2026-05-05 22:43:34 -04:00
Tom Alexander
df9f526f9e Move the encryption config into a package. 2026-05-05 22:43:34 -04:00
Tom Alexander
d8b7319348 Switch to generating certs with openssl. 2026-05-05 22:43:34 -04:00
Tom Alexander
2ac3cff2a1 Add controller proxy certs. 2026-05-05 22:43:33 -04:00
Tom Alexander
f31260eb00 Add requestheader-client-ca. 2026-05-05 22:43:33 -04:00
Tom Alexander
38f6d3abf9 Add service account. 2026-05-05 22:43:33 -04:00
Tom Alexander
2522803300 Install kubernetes. 2026-05-05 22:43:33 -04:00
Tom Alexander
f8a40ca20e Add additional controllers. 2026-05-05 22:43:33 -04:00
Tom Alexander
9fc2e682f4 Add configs for a new kubernetes cluster on NixOS. 2026-05-05 22:43:32 -04:00
28 changed files with 161 additions and 575 deletions

View File

@@ -54,7 +54,6 @@ in
./roles/iso_mount
./roles/jujutsu
./roles/kanshi
./roles/kernel
./roles/kodi
./roles/kubernetes
./roles/latex
@@ -138,15 +137,14 @@ in
nix.settings.keep-derivations = true;
# Automatic garbage collection
nix.gc = lib.mkIf (!config.me.buildingPortable) {
# Runs nix-collect-garbage --delete-older-than 5d
# nix.gc = lib.mkIf (!config.me.buildingPortable) {
# # Runs nix-collect-garbage --delete-older-than 5d
# automatic = true;
automatic = false;
persistent = true;
dates = "monthly";
# randomizedDelaySec = "14m";
options = "--delete-older-than 30d";
};
# persistent = true;
# dates = "monthly";
# # randomizedDelaySec = "14m";
# options = "--delete-older-than 30d";
# };
nix.settings.auto-optimise-store = !config.me.buildingPortable;
environment.systemPackages = [
@@ -236,30 +234,20 @@ in
);
in
[
(disableTests "coreutils")
(disableTests "coreutils-full")
(disableTests "deno") # Tests use too much disk space
(disableOptimizations "libtpms")
(disableTests "libuv")
(final: prev: {
inherit (final.unoptimized)
libtpms
libjxl
ddrescueview
deno
mesa
;
})
(disableOptimizationsPython3 "scipy")
(disableOptimizations "assimp")
(disableOptimizations "gsl")
(final: prev: {
rpcs3 = prev.rpcs3.override {
glew = (final.glew.override { enableEGL = false; });
};
})
(final: prev: {
fwupd = prev.fwupd.overrideAttrs (
finalAttrs: prevAttrs: {
version = "2.1.5";
src = final.fetchFromGitHub {
owner = "fwupd";
repo = "fwupd";
tag = finalAttrs.version;
hash = "sha256-DzQ+N99ZmFRqZc2rN6PSqmoIMXUyrE8Kkn+KnT/AWPc=";
};
}
);
})
# Works but probably sets python2's scipy to be python3:
#
# (final: prev: {

View File

@@ -22,11 +22,11 @@
]
},
"locked": {
"lastModified": 1780894562,
"narHash": "sha256-c3430xwxwhHipl3jigUGMMBfpaMylDqytW/kdmB3ZGs=",
"lastModified": 1776613567,
"narHash": "sha256-gC9Cp5ibBmGD5awCA9z7xy6MW6iJufhazTYJOiGlCUI=",
"owner": "nix-community",
"repo": "disko",
"rev": "24fed06cac83bcc44ac8efbb57cab1a82fa0bedc",
"rev": "32f4236bfc141ae930b5ba2fb604f561fed5219d",
"type": "github"
},
"original": {
@@ -164,11 +164,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1780749050,
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
"lastModified": 1777268161,
"narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
"rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76",
"type": "github"
},
"original": {
@@ -178,22 +178,6 @@
"type": "github"
}
},
"nixpkgs-google": {
"locked": {
"lastModified": 1779893571,
"narHash": "sha256-wiwMyVCtmjRjlFCe2zaumCE6LRV9GzzN0ZH25NQkbAU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "45f6cfaa4605b706c870e75bd74bdb5e97eee11e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "45f6cfaa4605b706c870e75bd74bdb5e97eee11e",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1730741070,
@@ -242,8 +226,7 @@
"disko": "disko",
"impermanence": "impermanence",
"lanzaboote": "lanzaboote",
"nixpkgs": "nixpkgs",
"nixpkgs-google": "nixpkgs-google"
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {

View File

@@ -20,7 +20,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-google.url = "github:NixOS/nixpkgs/45f6cfaa4605b706c870e75bd74bdb5e97eee11e";
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.2";
inputs.nixpkgs.follows = "nixpkgs";
@@ -35,7 +34,6 @@
{
self,
nixpkgs,
nixpkgs-google,
disko,
impermanence,
lanzaboote,
@@ -94,9 +92,6 @@
hostPlatform.gcc.arch = "default";
hostPlatform.gcc.tune = "default";
};
google = import nixpkgs-google {
system = prev.stdenv.hostPlatform.system;
};
})
];
};

View File

@@ -110,7 +110,6 @@
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
me.jujutsu.enable = true;
me.kanshi.enable = false;
me.kernel.enable = true;
me.kubernetes.enable = true;
me.latex.enable = true;
me.launch_keyboard.enable = true;

View File

@@ -111,7 +111,6 @@
me.iso_mount.enable = true;
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
me.jujutsu.enable = true;
me.kernel.enable = true;
me.latex.enable = true;
me.launch_keyboard.enable = true;
me.lvfs.enable = true;

View File

@@ -104,7 +104,6 @@
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
me.jujutsu.enable = true;
me.kanshi.enable = false;
me.kernel.enable = true;
me.kubernetes.enable = true;
me.latex.enable = true;
me.launch_keyboard.enable = true;

View File

@@ -14,12 +14,6 @@ let
cleanup_temporary_files = (
patchScriptBin "cleanup_temporary_files" (builtins.readFile ./files/cleanup_temporary_files.bash)
);
decode_jwt = (patchScriptBin "decode_jwt" (builtins.readFile ./files/decode_jwt.bash));
git_find_merged_branches = (
patchScriptBin "git_find_merged_branches" (builtins.readFile ./files/git_find_merged_branches.bash)
);
git_fix_author = (patchScriptBin "git_fix_author" (builtins.readFile ./files/git_fix_author.bash));
rsync_clone = (patchScriptBin "rsync_clone" (builtins.readFile ./files/rsync_clone.bash));
alias_rga = pkgs.writeShellScriptBin "rga" ''
exec ${pkgs.ripgrep}/bin/rg -uuu "''${@}"
'';
@@ -65,12 +59,8 @@ in
nix-output-monitor # For better view into nixos-rebuild
# nix-serve-ng # Serve nix store over http
cleanup_temporary_files
decode_jwt
jq
inetutils # For whois
git_find_merged_branches
git_fix_author
rsync_clone
];
};
}

View File

@@ -1,7 +1,4 @@
#!/usr/bin/env bash
#
# Delete temporary files on entire disk
set -euo pipefail
IFS=$'\n\t'
exec find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null
find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
#
# Decode the contents of a JWT
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec jq -R 'split(".") | .[0],.[1] | gsub("-"; "+") | gsub("_"; "/") | gsub("%3D"; "=")| @base64d | fromjson'

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
#
# Find local branches that have been merged
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
: ${MAIN_BRANCH:="main"}
git checkout -q ${MAIN_BRANCH} && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base ${MAIN_BRANCH} $branch) && [[ $(git cherry ${MAIN_BRANCH} $(git commit-tree $(git rev-parse "$branch^{tree}") -p $mergeBase -m _)) == "-"* ]] && echo "$branch"; done

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
#
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
git filter-branch --env-filter '
WRONG_EMAIL="old@email.foo"
NEW_NAME="New Name"
NEW_EMAIL="new@email.bar"
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat --commit-filter 'git commit-tree -S "$@";' -- --branches --tags

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
#
# Wrapper to set rsync flags for cloning a folder preserving attributes
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec rsync -aHAXS "$@"

View File

@@ -24,16 +24,7 @@
networking.firewall.allowedUDPPorts = [
5353 # mDNS
];
# networking.firewall.enable = true;
# networking.nftables.enable = true;
# Or disable the firewall altogether.
networking.firewall.enable = false;
# Debugging
# networking.firewall.logRefusedConnections = true;
# networking.firewall.logRefusedPackets = true;
# networking.firewall.logReversePathDrops = true;
# networking.firewall.enable = false;
};
}

View File

@@ -18,7 +18,7 @@
};
config = lib.mkIf config.me.gcloud.enable {
environment.systemPackages = with pkgs.google; [
environment.systemPackages = with pkgs; [
(google-cloud-sdk.withExtraComponents [ google-cloud-sdk.components.gke-gcloud-auth-plugin ])
];

View File

@@ -1,194 +0,0 @@
# Check current config:
# nix build '/persist/machine_setup/nix/configuration#nixosConfigurations.hydra.pkgs.linux_me.configfile'
# cat $(nix eval --raw '/persist/machine_setup/nix/configuration#nixosConfigurations.hydra.pkgs.linux_me.configfile') | less
{
config,
lib,
pkgs,
...
}:
let
preemption_type = with lib.kernel; {
full = {
PREEMPT_DYNAMIC = yes;
PREEMPT = yes;
PREEMPT_VOLUNTARY = lib.mkForce no;
PREEMPT_LAZY = lib.mkForce no;
PREEMPT_NONE = no;
};
lazy = {
PREEMPT_DYNAMIC = yes;
PREEMPT = no;
PREEMPT_VOLUNTARY = lib.mkForce no;
PREEMPT_LAZY = yes;
PREEMPT_NONE = no;
};
voluntary = {
PREEMPT_DYNAMIC = no;
PREEMPT = no;
PREEMPT_VOLUNTARY = yes;
PREEMPT_LAZY = lib.mkForce no;
PREEMPT_NONE = no;
};
none = {
PREEMPT_DYNAMIC = no;
PREEMPT = no;
PREEMPT_VOLUNTARY = lib.mkForce no;
PREEMPT_LAZY = lib.mkForce no;
PREEMPT_NONE = yes;
};
};
tick_hz =
with lib.kernel;
{
"1000" = {
HZ_1000 = yes;
HZ = freeform "1000";
};
}
// lib.genAttrs [ "100" "250" "300" "500" "600" "750" ] (hz: {
HZ_1000 = no;
"HZ_${hz}" = yes;
HZ = freeform hz;
});
performance_governor = with lib.kernel; {
default = {
CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = yes;
};
performance = {
CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = no;
CPU_FREQ_DEFAULT_GOV_PERFORMANCE = yes;
};
};
tick_rate = with lib.kernel; {
# Always tick at the hz frequency.
periodic = {
NO_HZ_IDLE = no;
NO_HZ_FULL = no;
NO_HZ = no;
NO_HZ_COMMON = no;
HZ_PERIODIC = yes;
};
# Idle - Do not disturb the CPU when idle. This can save power but increase latency.
idle = {
HZ_PERIODIC = no;
NO_HZ_FULL = no;
NO_HZ_IDLE = yes;
NO_HZ = yes;
NO_HZ_COMMON = yes;
};
# Full dyntick system (tickless) - The kernel tries to shut down the tick whenever possible.
tickless = {
HZ_PERIODIC = no;
NO_HZ_IDLE = no;
NO_HZ_FULL = yes;
NO_HZ = yes;
NO_HZ_COMMON = yes;
CONTEXT_TRACKING = yes;
};
};
huge_page = with lib.kernel; {
always = {
TRANSPARENT_HUGEPAGE_MADVISE = no;
TRANSPARENT_HUGEPAGE_ALWAYS = yes;
};
madvise = {
TRANSPARENT_HUGEPAGE_ALWAYS = no;
TRANSPARENT_HUGEPAGE_MADVISE = yes;
};
};
common_config =
with lib.kernel;
{
# Google's BBRv3 TCP congestion Control
TCP_CONG_BBR = yes;
DEFAULT_BBR = yes;
};
flavors = {
server = lib.mkMerge [
preemption_type.none
tick_hz."300"
performance_governor.default
tick_rate.tickless
huge_page.madvise
];
interactive =
with lib.kernel;
lib.mkMerge [
{
# Enable RCU Lazy - Reduces power consumption when idle or lightly loaded. Useful for battery-powered devices like laptops.
RCU_LAZY = yes;
}
preemption_type.lazy
tick_hz."300"
performance_governor.default
tick_rate.tickless
huge_page.madvise
];
};
in
{
imports = [ ];
options.me = {
kernel.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install kernel.";
};
kernel.version = lib.mkOption {
type = lib.types.str;
default = "linux"; # LTS
example = "linux_6_18";
description = "What version of the kernl should we use.";
};
kernel.flavor = lib.mkOption {
type = lib.types.str;
default = "interactive";
example = "server";
description = "What type of kernel should be built.";
};
};
config = lib.mkIf config.me.kernel.enable (
lib.mkMerge [
{
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
}
(lib.mkIf (!config.me.optimizations.enable) {
nixpkgs.overlays = [
(final: prev: {
linux_me = final."${config.me.kernel.version}";
})
];
})
(lib.mkIf (config.me.optimizations.enable) {
nixpkgs.overlays = [
(
final: prev:
let
addConfig =
additionalConfig: pkg:
pkg.override (oldconfig: {
structuredExtraConfig = lib.mkMerge ([ pkg.structuredExtraConfig ] ++ additionalConfig);
# stdenv = pkgs.llvmPackages_latest.stdenv;
# stdenv = pkgs.clangStdenv;
});
in
{
linux_me = addConfig ([
common_config
flavors."${config.me.kernel.flavor}"
]) final."${config.me.kernel.version}";
}
)
];
})
]
);
}

View File

@@ -19,7 +19,6 @@
config = lib.mkIf config.me.minimal_base.enable {
me.doas.enable = true;
me.kernel.enable = true;
me.network.enable = true;
me.nvme.enable = true;
me.ssh.enable = true;

View File

@@ -1,6 +1,7 @@
{
config,
lib,
pkgs,
...
}:
@@ -48,13 +49,71 @@
};
config = lib.mkMerge [
(lib.mkIf (!config.me.optimizations.enable) (
lib.mkMerge [
{
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_18;
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux;
}
]
))
(lib.mkIf config.me.optimizations.enable (
lib.mkMerge [
{
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
nixpkgs.hostPlatform = {
gcc.arch = config.me.optimizations.arch;
gcc.tune = config.me.optimizations.arch;
};
nixpkgs.overlays = [
(
final: prev:
let
addConfig =
additionalConfig: pkg:
pkg.override (oldconfig: {
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
});
in
{
linux_me = addConfig {
# Server | No preemption - Run until the next tick. Highest throughput but can cause stutter.
# PREEMPT = lib.mkOverride 60 lib.kernel.no;
# Desktop | Preempt kernel threads only at pre-defined places that call cond_resched().
PREEMPT_VOLUNTARY = lib.mkOverride 60 lib.kernel.no;
# Low-latency desktop | Full preemption - Kernel threads can be preempted unless they hold a spinlock or are in a no-preemption section.
PREEMPT = lib.mkOverride 60 lib.kernel.yes;
# RT - All kernel code is preemptible except for a few critical sections.
# Middle ground | Real-time tasks preempt immediately like FULL, normal tasks run until the next tick.
PREEMPT_LAZY = lib.mkOverride 90 lib.kernel.no;
# Google's BBRv3 TCP congestion Control
TCP_CONG_BBR = lib.kernel.yes;
DEFAULT_BBR = lib.kernel.yes;
# Preemptive Full Tickless Kernel at 300Hz
HZ = lib.kernel.freeform "300";
HZ_300 = lib.kernel.yes;
HZ_1000 = lib.kernel.no;
} prev.linux_6_18; # or prev.linux
}
)
(final: prev: {
inherit (final.unoptimized)
assimp
binaryen
gsl
rapidjson
ffmpeg-headless
ffmpeg
pipewire
chromaprint
gtkmm
;
})
];
}
]
))

View File

@@ -18,10 +18,7 @@
};
config = lib.mkIf (config.me.sm64ex.enable && config.me.graphical) {
allowedUnfree = [
"sm64ex"
"baserom.us.z64"
];
allowedUnfree = [ "sm64ex" ];
environment.systemPackages = with pkgs; [
sm64ex

View File

@@ -30,7 +30,7 @@
# If you want to use JACK applications, uncomment this
#jack.enable = true;
extraLadspaPackages = [ pkgs.rnnoise-plugin.ladspa ];
extraLv2Packages = [ pkgs.rnnoise-plugin ];
configPackages = [
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/99-input-denoising.conf" ''
context.modules = [
@@ -43,7 +43,7 @@
{
type = ladspa
name = rnnoise
plugin = "librnnoise_ladspa"
plugin = "${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so"
label = noise_suppressor_mono
control = {
"VAD Threshold (%)" = 50.0

View File

@@ -121,12 +121,6 @@ in
group = "talexander";
mode = "0755";
}
{
directory = ".vscode-shared";
user = "talexander";
group = "talexander";
mode = "0755";
}
];
};
};

View File

@@ -44,9 +44,6 @@ in
boot.zfs.devNodes = "/dev/disk/by-partuuid";
# Do not force import your root pool during boot. Force importing would be useful if the pool had been imported by a different machine most recently.
boot.zfs.forceImportRoot = false;
services.zfs = {
autoScrub = {
enable = true;

View File

@@ -17,7 +17,6 @@
./roles/firewall
./roles/image_based_appliance
./roles/iso
./roles/kernel
./roles/kube_apiserver
./roles/kube_controller_manager
./roles/kube_proxy

View File

@@ -22,11 +22,11 @@
]
},
"locked": {
"lastModified": 1780290312,
"narHash": "sha256-eTAlX0CwgB84Ts3GaBd944A3DRXVMzgA0EqroZBISUo=",
"lastModified": 1769524058,
"narHash": "sha256-zygdD6X1PcVNR2PsyK4ptzrVEiAdbMqLos7utrMDEWE=",
"owner": "nix-community",
"repo": "disko",
"rev": "115e5211780054d8a890b41f0b7734cafad54dfe",
"rev": "71a3fc97d80881e91710fe721f1158d3b96ae14d",
"type": "github"
},
"original": {
@@ -164,11 +164,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1780749050,
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
"lastModified": 1770197578,
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
"type": "github"
},
"original": {

View File

@@ -54,23 +54,22 @@ let
gateway_crds_repo = fetchFromGitHub {
owner = "kubernetes-sigs";
repo = "gateway-api";
rev = "v1.5.1";
sha256 = "sha256-mWMvJG6esOqDBSbhExvt7L3ZTiQUOfeRBohew/m67A0=";
rev = "v1.4.1";
sha256 = "sha256-/GHyikcC2QGDN0ndpY6/xvSEEnpSsLrNU+lFElCKBs8=";
};
gateway_crds = [
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_backendtlspolicies.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_listenersets.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_referencegrants.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_vap_safeupgrades.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.x-k8s.io_xbackendtrafficpolicies.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.x-k8s.io_xmeshes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.x-k8s.io_xbackendtrafficpolicies.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.x-k8s.io_xlistenersets.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml"
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml"
];
in
stdenv.mkDerivation (finalAttrs: {

View File

@@ -1,192 +0,0 @@
# Check current config:
# nix build '/persist/machine_setup/nix/configuration#nixosConfigurations.hydra.pkgs.linux_me.configfile'
# cat $(nix eval --raw '/persist/machine_setup/nix/configuration#nixosConfigurations.hydra.pkgs.linux_me.configfile') | less
{
config,
lib,
pkgs,
...
}:
let
preemption_type = with lib.kernel; {
full = {
PREEMPT_DYNAMIC = yes;
PREEMPT = yes;
PREEMPT_VOLUNTARY = lib.mkForce no;
PREEMPT_LAZY = lib.mkForce no;
PREEMPT_NONE = no;
};
lazy = {
PREEMPT_DYNAMIC = yes;
PREEMPT = no;
PREEMPT_VOLUNTARY = lib.mkForce no;
PREEMPT_LAZY = yes;
PREEMPT_NONE = no;
};
voluntary = {
PREEMPT_DYNAMIC = no;
PREEMPT = no;
PREEMPT_VOLUNTARY = yes;
PREEMPT_LAZY = lib.mkForce no;
PREEMPT_NONE = no;
};
none = {
PREEMPT_DYNAMIC = no;
PREEMPT = no;
PREEMPT_VOLUNTARY = lib.mkForce no;
PREEMPT_LAZY = lib.mkForce no;
PREEMPT_NONE = yes;
};
};
tick_hz =
with lib.kernel;
{
"1000" = {
HZ_1000 = yes;
HZ = freeform "1000";
};
}
// lib.genAttrs [ "100" "250" "300" "500" "600" "750" ] (hz: {
HZ_1000 = no;
"HZ_${hz}" = yes;
HZ = freeform hz;
});
performance_governor = with lib.kernel; {
default = {
CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = yes;
};
performance = {
CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = no;
CPU_FREQ_DEFAULT_GOV_PERFORMANCE = yes;
};
};
tick_rate = with lib.kernel; {
# Always tick at the hz frequency.
periodic = {
NO_HZ_IDLE = no;
NO_HZ_FULL = no;
NO_HZ = no;
NO_HZ_COMMON = no;
HZ_PERIODIC = yes;
};
# Idle - Do not disturb the CPU when idle. This can save power but increase latency.
idle = {
HZ_PERIODIC = no;
NO_HZ_FULL = no;
NO_HZ_IDLE = yes;
NO_HZ = yes;
NO_HZ_COMMON = yes;
};
# Full dyntick system (tickless) - The kernel tries to shut down the tick whenever possible.
tickless = {
HZ_PERIODIC = no;
NO_HZ_IDLE = no;
NO_HZ_FULL = yes;
NO_HZ = yes;
NO_HZ_COMMON = yes;
CONTEXT_TRACKING = yes;
};
};
huge_page = with lib.kernel; {
always = {
TRANSPARENT_HUGEPAGE_MADVISE = no;
TRANSPARENT_HUGEPAGE_ALWAYS = yes;
};
madvise = {
TRANSPARENT_HUGEPAGE_ALWAYS = no;
TRANSPARENT_HUGEPAGE_MADVISE = yes;
};
};
common_config = with lib.kernel; {
# Google's BBRv3 TCP congestion Control
TCP_CONG_BBR = yes;
DEFAULT_BBR = yes;
};
flavors = {
server = lib.mkMerge [
preemption_type.none
tick_hz."300"
performance_governor.default
tick_rate.tickless
huge_page.madvise
];
interactive =
with lib.kernel;
lib.mkMerge [
{
# Enable RCU Lazy - Reduces power consumption when idle or lightly loaded. Useful for battery-powered devices like laptops.
RCU_LAZY = yes;
}
preemption_type.lazy
tick_hz."300"
performance_governor.default
tick_rate.tickless
huge_page.madvise
];
};
in
{
imports = [ ];
options.me = {
kernel.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install kernel.";
};
kernel.version = lib.mkOption {
type = lib.types.str;
default = "linux"; # LTS
example = "linux_6_18";
description = "What version of the kernl should we use.";
};
kernel.flavor = lib.mkOption {
type = lib.types.str;
default = "server";
example = "interactive";
description = "What type of kernel should be built.";
};
};
config = lib.mkIf config.me.kernel.enable (
lib.mkMerge [
{
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
}
(lib.mkIf (!config.me.optimizations.enable) {
nixpkgs.overlays = [
(final: prev: {
linux_me = final."${config.me.kernel.version}";
})
];
})
(lib.mkIf (config.me.optimizations.enable) {
nixpkgs.overlays = [
(
final: prev:
let
addConfig =
additionalConfig: pkg:
pkg.override (oldconfig: {
structuredExtraConfig = lib.mkMerge ([ pkg.structuredExtraConfig ] ++ additionalConfig);
# stdenv = pkgs.llvmPackages_latest.stdenv;
# stdenv = pkgs.clangStdenv;
});
in
{
linux_me = addConfig ([
common_config
flavors."${config.me.kernel.flavor}"
]) final."${config.me.kernel.version}";
}
)
];
})
]
);
}

View File

@@ -21,7 +21,7 @@
assertions = [
{
# Kubernetes should only upgrade 1 minor version at a time, so this assert is here to prevent unwittingly jumping versions.
assertion = lib.hasPrefix "1.36." pkgs.kubernetes.version;
assertion = lib.hasPrefix "1.35." pkgs.kubernetes.version;
message = "Unexpected Kubernetes package version: ${pkgs.kubernetes.version}";
}
];

View File

@@ -19,7 +19,6 @@
config = lib.mkIf config.me.minimal_base.enable {
me.doas.enable = true;
me.kernel.enable = true;
me.network.enable = true;
me.nvme.enable = true;
me.ssh.enable = true;

View File

@@ -49,29 +49,65 @@
};
config = lib.mkMerge [
(lib.mkIf (!config.me.optimizations.enable) (
lib.mkMerge [
{
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_17;
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux;
}
]
))
(lib.mkIf config.me.optimizations.enable (
lib.mkMerge [
{
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
nixpkgs.hostPlatform = {
gcc.arch = config.me.optimizations.arch;
gcc.tune = config.me.optimizations.arch;
};
# nixpkgs.overlays = [
# (final: prev: {
# inherit (final.unoptimized)
# assimp
# binaryen
# gsl
# rapidjson
# ffmpeg-headless
# ffmpeg
# pipewire
# chromaprint
# gtkmm
# ;
# })
# ];
nixpkgs.overlays = [
(
final: prev:
let
addConfig =
additionalConfig: pkg:
pkg.override (oldconfig: {
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
});
in
{
linux_me = addConfig {
# Full preemption
PREEMPT = lib.mkOverride 60 lib.kernel.yes;
PREEMPT_VOLUNTARY = lib.mkOverride 60 lib.kernel.no;
# Google's BBRv3 TCP congestion Control
TCP_CONG_BBR = lib.kernel.yes;
DEFAULT_BBR = lib.kernel.yes;
# Preemptive Full Tickless Kernel at 300Hz
HZ = lib.kernel.freeform "300";
HZ_300 = lib.kernel.yes;
HZ_1000 = lib.kernel.no;
} prev.linux; # or prev.linux_6_17
}
)
(final: prev: {
inherit (final.unoptimized)
assimp
binaryen
gsl
rapidjson
ffmpeg-headless
ffmpeg
pipewire
chromaprint
gtkmm
;
})
];
}
]
))