Compare commits

..
3 Commits
Author SHA1 Message Date
hektor 7f5d7914c4 refactor(common): modularize common host module
check / lint (push) Successful in 14s
2026-10-11 17:34:29 +02:00
hektor deeffb8b8b fix(eetion): configure 'hardware.deviceTree' 2026-10-11 17:34:29 +02:00
hektor 14c6a27b21 fix(git): degrade gracefully without 'nvim' 2026-10-11 17:34:29 +02:00
15 changed files with 208 additions and 166 deletions

No files matched your search

+82 -85
View File
@@ -70,100 +70,97 @@ in
}; };
} }
// { // {
assertions = [ warnings = lib.optional (
{ !config.nvim.enable
assertion = config.nvim.enable; ) "'git.enable' is enabled without 'nvim.enable' (not using 'nvimdiff')";
message = "git module requires 'nvim' module (`nvimdiff`)";
}
];
xdg.configFile."git/ignore".source = ./global.gitignore; xdg.configFile."git/ignore".source = ./global.gitignore;
programs.git = { programs.git = {
enable = true; enable = true;
settings = { settings = lib.mkMerge [
core.editor = "nvim"; {
user = { user = {
name = "Hektor Misplon"; name = "Hektor Misplon";
username = "hektor"; username = "hektor";
signingKey = "AEB98353B8D72E465C4236435151AF79E723F21C"; signingKey = "AEB98353B8D72E465C4236435151AF79E723F21C";
};
alias = {
d = "diff";
ds = "diff --staged";
a = "add";
ap = "add -p";
c = "commit";
cm = "commit -m";
cam = "commit --amend";
l = ''log --pretty=format:(%an)\ \ %h\ \ %ad\ \ %s --date=short'';
s = "status --short";
sv = "status --verbose";
co = "checkout";
cob = "checkout -b";
pullr = "pull --rebase --autostash";
pushf = "push --force-with-lease";
al = "!git config -l | grep alias | cut -c 7-";
alf = "!git config -l | grep alias | cut -c 7- | fzf";
"al-" =
''!git config --local --unset $(git config -l | grep alias | cut --delimiter="=" --fields=1 | fzf)'';
rs = "restore --staged";
rb = "rebase";
rbi = "rebase -i";
wt = "worktree";
wtc = ''config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'';
};
color = {
ui = "auto";
diff = {
meta = "yellow bold";
commit = "green bold";
frag = "magenta bold";
old = "red bold";
new = "green bold";
whitespace = "red reverse";
}; };
"diff-highlight" = { alias = {
oldNormal = "red bold"; d = "diff";
oldHighlight = "red bold 52"; ds = "diff --staged";
newNormal = "green bold"; a = "add";
newHighlight = "green bold 22"; ap = "add -p";
c = "commit";
cm = "commit -m";
cam = "commit --amend";
l = ''log --pretty=format:(%an)\ \ %h\ \ %ad\ \ %s --date=short'';
s = "status --short";
sv = "status --verbose";
co = "checkout";
cob = "checkout -b";
pullr = "pull --rebase --autostash";
pushf = "push --force-with-lease";
al = "!git config -l | grep alias | cut -c 7-";
alf = "!git config -l | grep alias | cut -c 7- | fzf";
"al-" =
''!git config --local --unset $(git config -l | grep alias | cut --delimiter="=" --fields=1 | fzf)'';
rs = "restore --staged";
rb = "rebase";
rbi = "rebase -i";
wt = "worktree";
wtc = ''config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'';
}; };
branch = { color = {
current = "normal bold"; ui = "auto";
local = "normal"; diff = {
remote = "normal italic"; meta = "yellow bold";
commit = "green bold";
frag = "magenta bold";
old = "red bold";
new = "green bold";
whitespace = "red reverse";
};
"diff-highlight" = {
oldNormal = "red bold";
oldHighlight = "red bold 52";
newNormal = "green bold";
newHighlight = "green bold 22";
};
branch = {
current = "normal bold";
local = "normal";
remote = "normal italic";
};
status = {
added = "green";
changed = "yellow";
untracked = "normal italic";
};
}; };
status = { credential.helper = "cache --timeout=3600";
added = "green"; init.defaultBranch = "main";
changed = "yellow"; log = {
untracked = "normal italic"; date = "relative";
abbrevCommit = true;
}; };
}; merge.conflictStyle = "diff3";
credential.helper = "cache --timeout=3600"; diff.colorMoved = "zebra";
init.defaultBranch = "main"; commit.gpgSign = false;
log = { interactive.singleKey = true;
date = "relative"; pull.rebase = true;
abbrevCommit = true; rerere.enabled = true;
}; }
merge = { (lib.mkIf config.nvim.enable {
tool = "nvimdiff"; core.editor = "nvim";
conflictStyle = "diff3"; diff.tool = "nvimdiff";
}; merge.tool = "nvimdiff";
diff = { difftool.prompt = false;
colorMoved = "zebra"; mergetool = {
tool = "nvimdiff"; prompt = false;
}; keepBackup = false;
difftool.prompt = false; };
mergetool = { })
prompt = false; ];
keepBackup = false;
};
commit.gpgSign = false;
interactive.singleKey = true;
pull.rebase = true;
rerere.enabled = true;
};
includes = [ includes = [
{ path = personalEmail; } { path = personalEmail; }
+1 -1
View File
@@ -1,8 +1,8 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "desktop";
tags = [ "personal" ]; tags = [ "personal" ];
host = { host = {
role = "desktop";
username = "h"; username = "h";
highRam = true; highRam = true;
admin = true; admin = true;
+1 -1
View File
@@ -1,8 +1,8 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "laptop";
tags = [ "personal" ]; tags = [ "personal" ];
host = { host = {
role = "laptop";
username = "h"; username = "h";
highRam = true; highRam = true;
admin = true; admin = true;
+1 -1
View File
@@ -1,8 +1,8 @@
{ {
system = "aarch64-linux"; system = "aarch64-linux";
role = "embedded";
tags = [ "lab" ]; tags = [ "lab" ];
host = { host = {
role = "embedded";
username = "h"; username = "h";
}; };
} }
+2
View File
@@ -22,6 +22,8 @@ in
generic-extlinux-compatible.enable = true; generic-extlinux-compatible.enable = true;
}; };
hardware.deviceTree.name = "allwinner/sun50i-h616-orangepi-zero2.dtb";
networking = { networking = {
hostName = config.host.name; hostName = config.host.name;
networkmanager.enable = true; networkmanager.enable = true;
+1 -1
View File
@@ -1,8 +1,8 @@
{ {
system = "aarch64-linux"; system = "aarch64-linux";
role = "embedded";
tags = [ "lab" ]; tags = [ "lab" ];
host = { host = {
role = "embedded";
username = "h"; username = "h";
}; };
} }
+1 -1
View File
@@ -1,9 +1,9 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "server";
tags = [ "lab" ]; tags = [ "lab" ];
deploy.autoRollback = true; deploy.autoRollback = true;
host = { host = {
role = "server";
username = "h"; username = "h";
}; };
} }
+1 -1
View File
@@ -1,8 +1,8 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "vm";
tags = [ "lab" ]; tags = [ "lab" ];
host = { host = {
role = "vm";
username = "h"; username = "h";
}; };
} }
+6 -75
View File
@@ -1,92 +1,23 @@
{ { lib, ... }:
inputs,
outputs,
dotsPath,
myUtils,
config,
...
}:
let
inherit (inputs.nixpkgs) lib;
homeDir = ../../home/hosts + "/${config.host.name}";
in
{ {
imports = [ imports = [
inputs.home-manager.nixosModules.default ./embedded.nix
./home-manager.nix
./host.nix ./host.nix
./nix.nix
./nixpkgs.nix
./upgrades.nix
]; ];
options.nixpkgs.allowedUnfree = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
config = { config = {
system.stateVersion = lib.mkDefault "25.05"; system.stateVersion = lib.mkDefault "25.05";
boot.zfs.forceImportRoot = lib.mkDefault false; boot.zfs.forceImportRoot = lib.mkDefault false;
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md
optimise = {
automatic = true;
dates = [ "05:00" ];
};
gc = {
automatic = true;
dates = "weekly";
options = lib.mkDefault "--delete-older-than 30d";
};
settings.experimental-features = [
"nix-command"
"flakes"
];
settings.trusted-public-keys = [
"nix-signing-key:M6ouQRFl/bZ5QQrceQUyar6P7o8qg4wwVkxD1SSLL2k="
];
};
system.autoUpgrade = {
enable = true;
flags = [
"--recreate-lock-file"
"--commit-lock-file"
"--print-build-logs"
"--refresh"
];
dates = "05:00";
randomizedDelaySec = "45min";
allowReboot = false;
};
nixpkgs.config.allowUnfreePredicate =
pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree;
environment.defaultPackages = lib.mkForce [ ]; environment.defaultPackages = lib.mkForce [ ];
environment.pathsToLink = [ environment.pathsToLink = [
"/share/applications" "/share/applications"
"/share/xdg-desktop-portal" "/share/xdg-desktop-portal"
]; ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit
inputs
outputs
dotsPath
myUtils
;
};
sharedModules = [
{
host.username = lib.mkDefault config.host.username;
}
];
users = lib.optionalAttrs (builtins.pathExists homeDir) {
${config.host.username} = import homeDir;
};
};
}; };
} }
+15
View File
@@ -0,0 +1,15 @@
{ lib, config, ... }:
{
config = lib.mkIf (config.host.role == "embedded") {
system.autoUpgrade.enable = false;
nix.settings.max-jobs = 0;
zramSwap = {
enable = true;
memoryPercent = 100;
};
services.journald.settings.Journal.SystemMaxUse = "100M";
};
}
+37
View File
@@ -0,0 +1,37 @@
{
inputs,
outputs,
dotsPath,
myUtils,
config,
lib,
...
}:
let
homeDir = ../../home/hosts + "/${config.host.name}";
in
{
imports = [ inputs.home-manager.nixosModules.default ];
config.home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit
inputs
outputs
dotsPath
myUtils
;
};
sharedModules = [
{
host.username = lib.mkDefault config.host.username;
}
];
users = lib.optionalAttrs (builtins.pathExists homeDir) {
${config.host.username} = import homeDir;
};
};
}
+10
View File
@@ -10,6 +10,16 @@
type = lib.types.str; type = lib.types.str;
}; };
role = lib.mkOption {
type = lib.types.enum [
"desktop"
"embedded"
"laptop"
"server"
"vm"
];
};
tags = lib.mkOption { tags = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
+23
View File
@@ -0,0 +1,23 @@
{ inputs, lib, ... }:
{
config.nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md
optimise = {
automatic = true;
dates = [ "05:00" ];
};
gc = {
automatic = true;
dates = "weekly";
options = lib.mkDefault "--delete-older-than 30d";
};
settings.experimental-features = [
"nix-command"
"flakes"
];
settings.trusted-public-keys = [
"nix-signing-key:M6ouQRFl/bZ5QQrceQUyar6P7o8qg4wwVkxD1SSLL2k="
];
};
}
+11
View File
@@ -0,0 +1,11 @@
{ lib, config, ... }:
{
options.nixpkgs.allowedUnfree = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
config.nixpkgs.config.allowUnfreePredicate =
pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree;
}
+16
View File
@@ -0,0 +1,16 @@
{ lib, ... }:
{
config.system.autoUpgrade = {
enable = lib.mkDefault true;
flags = [
"--recreate-lock-file"
"--commit-lock-file"
"--print-build-logs"
"--refresh"
];
dates = "05:00";
randomizedDelaySec = "45min";
allowReboot = false;
};
}