Compare commits
94 Commits
e900dc4199
...
kubernetes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
794cce9a50
|
||
|
|
01fff9b60a
|
||
|
|
70773fd4f3
|
||
|
|
407bc13bc2
|
||
|
|
9db4b0ea5c
|
||
|
|
6d44d6e6c9
|
||
|
|
87aca6ef61
|
||
|
|
b302a14893
|
||
|
|
9c8c17f028
|
||
|
|
fe5465f2d8
|
||
|
|
914d6b071e
|
||
|
|
aadcf13442
|
||
|
|
b2f9889b0c
|
||
|
|
b444e37e3c
|
||
|
|
54b097ae69
|
||
|
|
c7502af7e8
|
||
|
|
f5da063952
|
||
|
|
3b1b78c0b5
|
||
|
|
8dfd4f27f6
|
||
|
|
6d4550c93a
|
||
|
|
cf72a26942
|
||
|
|
0429f19364
|
||
|
|
2a70d24603
|
||
|
|
8054db8cfb
|
||
|
|
4b4934b4c4
|
||
|
|
d611f0fe5a
|
||
|
|
a665cae379
|
||
|
|
4c59dfd8b2
|
||
|
|
8a08714522
|
||
|
|
8c35971357
|
||
|
|
53fe030d97
|
||
|
|
724c05f03a
|
||
|
|
8b2916189b
|
||
|
|
a95f24af0d
|
||
|
|
1528ae0764
|
||
|
|
30f817dfe8
|
||
|
|
efd21f715f
|
||
|
|
23372d763f
|
||
|
|
e55ece9dad
|
||
|
|
05f1c518fd
|
||
|
|
43633597fc
|
||
|
|
90c88adb73
|
||
|
|
cd78dc4680
|
||
|
|
c37723ca81
|
||
|
|
1da8e20d5b
|
||
|
|
8584577327
|
||
|
|
a3afb104cd
|
||
|
|
d4620e8ac9
|
||
|
|
ebe4505a6f
|
||
|
|
f962c679ca
|
||
|
|
4fe58c4d6c
|
||
|
|
570424f5b1
|
||
|
|
3a5ada6049
|
||
|
|
8d572a5cce
|
||
|
|
c26fa59408
|
||
|
|
2e0c97bbf9
|
||
|
|
3197868a7b
|
||
|
|
c9f483dd98
|
||
|
|
dbeb98112b
|
||
|
|
958ae2b694
|
||
|
|
925eb99406
|
||
|
|
3cdaf980b5
|
||
|
|
c4caf5d103
|
||
|
|
eab42023a9
|
||
|
|
fe6056cee7
|
||
|
|
64ad4430bb
|
||
|
|
dd2d0b23e4
|
||
|
|
eb82e8e5e3
|
||
|
|
f1382cfbb7
|
||
|
|
43df118e4f
|
||
|
|
f3797b5c42
|
||
|
|
593929598a
|
||
|
|
3a8569b0de
|
||
|
|
84738f7266
|
||
|
|
45b7ce369e
|
||
|
|
c863bfe136
|
||
|
|
98a0d78e45
|
||
|
|
87312b19fa
|
||
|
|
cb312752ba
|
||
|
|
321d215a57
|
||
|
|
21d5002e7f
|
||
|
|
9e4c079258 | ||
|
|
3ab7a6e460 | ||
|
|
49f75408ae | ||
|
|
0fa170c57e | ||
|
|
3050cece0c | ||
|
|
6d070ddbb4 | ||
|
|
f99fa54d60 | ||
|
|
d52b5db39b | ||
|
|
003c3cc41a | ||
|
|
d83652bb9c | ||
|
|
6fd09a712e | ||
|
|
d9c4f824d2 | ||
|
|
856e4daee6 |
@@ -54,6 +54,7 @@ in
|
|||||||
./roles/iso_mount
|
./roles/iso_mount
|
||||||
./roles/jujutsu
|
./roles/jujutsu
|
||||||
./roles/kanshi
|
./roles/kanshi
|
||||||
|
./roles/kernel
|
||||||
./roles/kodi
|
./roles/kodi
|
||||||
./roles/kubernetes
|
./roles/kubernetes
|
||||||
./roles/latex
|
./roles/latex
|
||||||
@@ -137,14 +138,15 @@ in
|
|||||||
nix.settings.keep-derivations = true;
|
nix.settings.keep-derivations = true;
|
||||||
|
|
||||||
# Automatic garbage collection
|
# Automatic garbage collection
|
||||||
# nix.gc = lib.mkIf (!config.me.buildingPortable) {
|
nix.gc = lib.mkIf (!config.me.buildingPortable) {
|
||||||
# # Runs nix-collect-garbage --delete-older-than 5d
|
# Runs nix-collect-garbage --delete-older-than 5d
|
||||||
# automatic = true;
|
# automatic = true;
|
||||||
# persistent = true;
|
automatic = false;
|
||||||
# dates = "monthly";
|
persistent = true;
|
||||||
# # randomizedDelaySec = "14m";
|
dates = "monthly";
|
||||||
# options = "--delete-older-than 30d";
|
# randomizedDelaySec = "14m";
|
||||||
# };
|
options = "--delete-older-than 30d";
|
||||||
|
};
|
||||||
nix.settings.auto-optimise-store = !config.me.buildingPortable;
|
nix.settings.auto-optimise-store = !config.me.buildingPortable;
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
@@ -234,20 +236,30 @@ in
|
|||||||
);
|
);
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
(disableTests "coreutils")
|
|
||||||
(disableTests "coreutils-full")
|
|
||||||
(disableTests "deno") # Tests use too much disk space
|
(disableTests "deno") # Tests use too much disk space
|
||||||
(disableTests "libuv")
|
(disableOptimizations "libtpms")
|
||||||
(final: prev: {
|
|
||||||
inherit (final.unoptimized)
|
|
||||||
libtpms
|
|
||||||
libjxl
|
|
||||||
ddrescueview
|
|
||||||
deno
|
|
||||||
mesa
|
|
||||||
;
|
|
||||||
})
|
|
||||||
(disableOptimizationsPython3 "scipy")
|
(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:
|
# Works but probably sets python2's scipy to be python3:
|
||||||
#
|
#
|
||||||
# (final: prev: {
|
# (final: prev: {
|
||||||
|
|||||||
31
nix/configuration/flake.lock
generated
31
nix/configuration/flake.lock
generated
@@ -22,11 +22,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776613567,
|
"lastModified": 1780894562,
|
||||||
"narHash": "sha256-gC9Cp5ibBmGD5awCA9z7xy6MW6iJufhazTYJOiGlCUI=",
|
"narHash": "sha256-c3430xwxwhHipl3jigUGMMBfpaMylDqytW/kdmB3ZGs=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "32f4236bfc141ae930b5ba2fb604f561fed5219d",
|
"rev": "24fed06cac83bcc44ac8efbb57cab1a82fa0bedc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -164,11 +164,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777268161,
|
"lastModified": 1780749050,
|
||||||
"narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=",
|
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76",
|
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -178,6 +178,22 @@
|
|||||||
"type": "github"
|
"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": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730741070,
|
"lastModified": 1730741070,
|
||||||
@@ -226,7 +242,8 @@
|
|||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
"lanzaboote": "lanzaboote",
|
"lanzaboote": "lanzaboote",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-google": "nixpkgs-google"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
nixpkgs-google.url = "github:NixOS/nixpkgs/45f6cfaa4605b706c870e75bd74bdb5e97eee11e";
|
||||||
lanzaboote = {
|
lanzaboote = {
|
||||||
url = "github:nix-community/lanzaboote/v0.4.2";
|
url = "github:nix-community/lanzaboote/v0.4.2";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
nixpkgs-google,
|
||||||
disko,
|
disko,
|
||||||
impermanence,
|
impermanence,
|
||||||
lanzaboote,
|
lanzaboote,
|
||||||
@@ -92,6 +94,9 @@
|
|||||||
hostPlatform.gcc.arch = "default";
|
hostPlatform.gcc.arch = "default";
|
||||||
hostPlatform.gcc.tune = "default";
|
hostPlatform.gcc.tune = "default";
|
||||||
};
|
};
|
||||||
|
google = import nixpkgs-google {
|
||||||
|
system = prev.stdenv.hostPlatform.system;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -110,6 +110,7 @@
|
|||||||
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
|
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
|
||||||
me.jujutsu.enable = true;
|
me.jujutsu.enable = true;
|
||||||
me.kanshi.enable = false;
|
me.kanshi.enable = false;
|
||||||
|
me.kernel.enable = true;
|
||||||
me.kubernetes.enable = true;
|
me.kubernetes.enable = true;
|
||||||
me.latex.enable = true;
|
me.latex.enable = true;
|
||||||
me.launch_keyboard.enable = true;
|
me.launch_keyboard.enable = true;
|
||||||
|
|||||||
@@ -111,6 +111,7 @@
|
|||||||
me.iso_mount.enable = true;
|
me.iso_mount.enable = true;
|
||||||
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
|
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
|
||||||
me.jujutsu.enable = true;
|
me.jujutsu.enable = true;
|
||||||
|
me.kernel.enable = true;
|
||||||
me.latex.enable = true;
|
me.latex.enable = true;
|
||||||
me.launch_keyboard.enable = true;
|
me.launch_keyboard.enable = true;
|
||||||
me.lvfs.enable = true;
|
me.lvfs.enable = true;
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
|
me.jujutsu.config = ../../roles/jujutsu/files/jujutsu_config_home.toml;
|
||||||
me.jujutsu.enable = true;
|
me.jujutsu.enable = true;
|
||||||
me.kanshi.enable = false;
|
me.kanshi.enable = false;
|
||||||
|
me.kernel.enable = true;
|
||||||
me.kubernetes.enable = true;
|
me.kubernetes.enable = true;
|
||||||
me.latex.enable = true;
|
me.latex.enable = true;
|
||||||
me.launch_keyboard.enable = true;
|
me.launch_keyboard.enable = true;
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ let
|
|||||||
cleanup_temporary_files = (
|
cleanup_temporary_files = (
|
||||||
patchScriptBin "cleanup_temporary_files" (builtins.readFile ./files/cleanup_temporary_files.bash)
|
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" ''
|
alias_rga = pkgs.writeShellScriptBin "rga" ''
|
||||||
exec ${pkgs.ripgrep}/bin/rg -uuu "''${@}"
|
exec ${pkgs.ripgrep}/bin/rg -uuu "''${@}"
|
||||||
'';
|
'';
|
||||||
@@ -59,8 +65,12 @@ in
|
|||||||
nix-output-monitor # For better view into nixos-rebuild
|
nix-output-monitor # For better view into nixos-rebuild
|
||||||
# nix-serve-ng # Serve nix store over http
|
# nix-serve-ng # Serve nix store over http
|
||||||
cleanup_temporary_files
|
cleanup_temporary_files
|
||||||
|
decode_jwt
|
||||||
jq
|
jq
|
||||||
inetutils # For whois
|
inetutils # For whois
|
||||||
|
git_find_merged_branches
|
||||||
|
git_fix_author
|
||||||
|
rsync_clone
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Delete temporary files on entire disk
|
# Delete temporary files on entire disk
|
||||||
find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
exec find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null
|
||||||
|
|||||||
8
nix/configuration/roles/base/files/decode_jwt.bash
Normal file
8
nix/configuration/roles/base/files/decode_jwt.bash
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/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'
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/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
|
||||||
22
nix/configuration/roles/base/files/git_fix_author.bash
Normal file
22
nix/configuration/roles/base/files/git_fix_author.bash
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/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
|
||||||
8
nix/configuration/roles/base/files/rsync_clone.bash
Normal file
8
nix/configuration/roles/base/files/rsync_clone.bash
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/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 "$@"
|
||||||
@@ -24,7 +24,16 @@
|
|||||||
networking.firewall.allowedUDPPorts = [
|
networking.firewall.allowedUDPPorts = [
|
||||||
5353 # mDNS
|
5353 # mDNS
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# networking.firewall.enable = true;
|
||||||
|
# networking.nftables.enable = true;
|
||||||
|
|
||||||
# Or disable the firewall altogether.
|
# Or disable the firewall altogether.
|
||||||
# networking.firewall.enable = false;
|
networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Debugging
|
||||||
|
# networking.firewall.logRefusedConnections = true;
|
||||||
|
# networking.firewall.logRefusedPackets = true;
|
||||||
|
# networking.firewall.logReversePathDrops = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.me.gcloud.enable {
|
config = lib.mkIf config.me.gcloud.enable {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs.google; [
|
||||||
(google-cloud-sdk.withExtraComponents [ google-cloud-sdk.components.gke-gcloud-auth-plugin ])
|
(google-cloud-sdk.withExtraComponents [ google-cloud-sdk.components.gke-gcloud-auth-plugin ])
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
194
nix/configuration/roles/kernel/default.nix
Normal file
194
nix/configuration/roles/kernel/default.nix
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
# 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}";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
config = lib.mkIf config.me.minimal_base.enable {
|
config = lib.mkIf config.me.minimal_base.enable {
|
||||||
me.doas.enable = true;
|
me.doas.enable = true;
|
||||||
|
me.kernel.enable = true;
|
||||||
me.network.enable = true;
|
me.network.enable = true;
|
||||||
me.nvme.enable = true;
|
me.nvme.enable = true;
|
||||||
me.ssh.enable = true;
|
me.ssh.enable = true;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -49,71 +48,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
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.mkIf config.me.optimizations.enable (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = {
|
nixpkgs.hostPlatform = {
|
||||||
gcc.arch = config.me.optimizations.arch;
|
gcc.arch = config.me.optimizations.arch;
|
||||||
gcc.tune = 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
|
|
||||||
;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.me.sm64ex.enable && config.me.graphical) {
|
config = lib.mkIf (config.me.sm64ex.enable && config.me.graphical) {
|
||||||
allowedUnfree = [ "sm64ex" ];
|
allowedUnfree = [
|
||||||
|
"sm64ex"
|
||||||
|
"baserom.us.z64"
|
||||||
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
sm64ex
|
sm64ex
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
# If you want to use JACK applications, uncomment this
|
# If you want to use JACK applications, uncomment this
|
||||||
#jack.enable = true;
|
#jack.enable = true;
|
||||||
|
|
||||||
extraLv2Packages = [ pkgs.rnnoise-plugin ];
|
extraLadspaPackages = [ pkgs.rnnoise-plugin.ladspa ];
|
||||||
configPackages = [
|
configPackages = [
|
||||||
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/99-input-denoising.conf" ''
|
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/99-input-denoising.conf" ''
|
||||||
context.modules = [
|
context.modules = [
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
{
|
{
|
||||||
type = ladspa
|
type = ladspa
|
||||||
name = rnnoise
|
name = rnnoise
|
||||||
plugin = "${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so"
|
plugin = "librnnoise_ladspa"
|
||||||
label = noise_suppressor_mono
|
label = noise_suppressor_mono
|
||||||
control = {
|
control = {
|
||||||
"VAD Threshold (%)" = 50.0
|
"VAD Threshold (%)" = 50.0
|
||||||
|
|||||||
@@ -121,6 +121,12 @@ in
|
|||||||
group = "talexander";
|
group = "talexander";
|
||||||
mode = "0755";
|
mode = "0755";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
directory = ".vscode-shared";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ in
|
|||||||
|
|
||||||
boot.zfs.devNodes = "/dev/disk/by-partuuid";
|
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 = {
|
services.zfs = {
|
||||||
autoScrub = {
|
autoScrub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
./roles/firewall
|
./roles/firewall
|
||||||
./roles/image_based_appliance
|
./roles/image_based_appliance
|
||||||
./roles/iso
|
./roles/iso
|
||||||
|
./roles/kernel
|
||||||
./roles/kube_apiserver
|
./roles/kube_apiserver
|
||||||
./roles/kube_controller_manager
|
./roles/kube_controller_manager
|
||||||
./roles/kube_proxy
|
./roles/kube_proxy
|
||||||
|
|||||||
12
nix/kubernetes/flake.lock
generated
12
nix/kubernetes/flake.lock
generated
@@ -22,11 +22,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1769524058,
|
"lastModified": 1780290312,
|
||||||
"narHash": "sha256-zygdD6X1PcVNR2PsyK4ptzrVEiAdbMqLos7utrMDEWE=",
|
"narHash": "sha256-eTAlX0CwgB84Ts3GaBd944A3DRXVMzgA0EqroZBISUo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "71a3fc97d80881e91710fe721f1158d3b96ae14d",
|
"rev": "115e5211780054d8a890b41f0b7734cafad54dfe",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -164,11 +164,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1770197578,
|
"lastModified": 1780749050,
|
||||||
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
|
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
|
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -54,22 +54,23 @@ let
|
|||||||
gateway_crds_repo = fetchFromGitHub {
|
gateway_crds_repo = fetchFromGitHub {
|
||||||
owner = "kubernetes-sigs";
|
owner = "kubernetes-sigs";
|
||||||
repo = "gateway-api";
|
repo = "gateway-api";
|
||||||
rev = "v1.4.1";
|
rev = "v1.5.1";
|
||||||
sha256 = "sha256-/GHyikcC2QGDN0ndpY6/xvSEEnpSsLrNU+lFElCKBs8=";
|
sha256 = "sha256-mWMvJG6esOqDBSbhExvt7L3ZTiQUOfeRBohew/m67A0=";
|
||||||
};
|
};
|
||||||
gateway_crds = [
|
gateway_crds = [
|
||||||
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_backendtlspolicies.yaml"
|
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_backendtlspolicies.yaml"
|
||||||
"${gateway_crds_repo}/config/crd/experimental/gateway.networking.k8s.io_referencegrants.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_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.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"
|
"${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"
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
|||||||
192
nix/kubernetes/roles/kernel/default.nix
Normal file
192
nix/kubernetes/roles/kernel/default.nix
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
# 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}";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
# Kubernetes should only upgrade 1 minor version at a time, so this assert is here to prevent unwittingly jumping versions.
|
# Kubernetes should only upgrade 1 minor version at a time, so this assert is here to prevent unwittingly jumping versions.
|
||||||
assertion = lib.hasPrefix "1.35." pkgs.kubernetes.version;
|
assertion = lib.hasPrefix "1.36." pkgs.kubernetes.version;
|
||||||
message = "Unexpected Kubernetes package version: ${pkgs.kubernetes.version}";
|
message = "Unexpected Kubernetes package version: ${pkgs.kubernetes.version}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
config = lib.mkIf config.me.minimal_base.enable {
|
config = lib.mkIf config.me.minimal_base.enable {
|
||||||
me.doas.enable = true;
|
me.doas.enable = true;
|
||||||
|
me.kernel.enable = true;
|
||||||
me.network.enable = true;
|
me.network.enable = true;
|
||||||
me.nvme.enable = true;
|
me.nvme.enable = true;
|
||||||
me.ssh.enable = true;
|
me.ssh.enable = true;
|
||||||
|
|||||||
@@ -49,65 +49,29 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
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.mkIf config.me.optimizations.enable (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = {
|
nixpkgs.hostPlatform = {
|
||||||
gcc.arch = config.me.optimizations.arch;
|
gcc.arch = config.me.optimizations.arch;
|
||||||
gcc.tune = config.me.optimizations.arch;
|
gcc.tune = config.me.optimizations.arch;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
# nixpkgs.overlays = [
|
||||||
(
|
# (final: prev: {
|
||||||
final: prev:
|
# inherit (final.unoptimized)
|
||||||
let
|
# assimp
|
||||||
addConfig =
|
# binaryen
|
||||||
additionalConfig: pkg:
|
# gsl
|
||||||
pkg.override (oldconfig: {
|
# rapidjson
|
||||||
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
# ffmpeg-headless
|
||||||
});
|
# ffmpeg
|
||||||
in
|
# pipewire
|
||||||
{
|
# chromaprint
|
||||||
linux_me = addConfig {
|
# gtkmm
|
||||||
# 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
|
|
||||||
;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user