Merge branch 'main' of ssh://git.trex-halfbeak.ts.net/don/NixOS-Configs

This commit is contained in:
Don Harper 2025-10-19 20:04:41 -05:00
commit 72ca769b5a
8 changed files with 157 additions and 170 deletions

61
home/common/pi-server.nix Normal file
View file

@ -0,0 +1,61 @@
{
pkgs,
inputs,
osConfig,
...
}: {
imports = [
./bash.nix
./btop.nix
./catppuccin.nix
./git.nix
./gnupg.nix
./liquidprompt.nix
./ssh.nix
./topgrade.nix
];
home.packages = with pkgs; [
inputs.naviterm.packages.${pkgs.system}.default
figlet
file
fzf
gnupg
gping
htop
iftop
iw
jq
keychain
keyutils
links2
liquidprompt
moreutils
ncdu
nmap
pinentry
pipx
ps_mem
psmisc
sqlite
trippy
unzip
wget
zip
];
services = {
gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
};
programs.keychain = {
enable = true;
enableBashIntegration = true;
keys = "id_aur id_dsa id_ed25519 git C7E41C9F79C846984163693FCCD8E76F07EA701B";
};
home.file.".links/links.cfg".source = files/links.cfg;
xdg.configFile."nix/nix.conf".text = ''
extra-experimental-features = flakes nix-command
'';
}

33
home/pi-server.nix Normal file
View file

@ -0,0 +1,33 @@
{
inputs,
outputs,
pkgs,
pkgs-stable,
...
}: {
imports = [inputs.home-manager.nixosModules.home-manager];
home-manager.extraSpecialArgs = {
pkgs-stable = import pkgs-stable {config.allowUnfree = true;};
inherit inputs outputs;
};
home-manager = {
useUserPackages = true;
backupFileExtension = "home-manager-backup";
users = {
don = {
imports = [
inputs.catppuccin.homeModules.catppuccin
./common/pi-server.nix
];
home = {
username = "don";
homeDirectory = "/home/don";
stateVersion = "23.05";
};
programs = {
home-manager = {enable = true;};
};
};
};
};
}

View file

@ -6,15 +6,12 @@
pkgs,
...
}: {
# environment.systemPackages = with pkgs; [ cog ];
environment.systemPackages = with pkgs; [firefox];
environment.systemPackages = with pkgs; [kdePackages.falkon cage];
services.cage = {
enable = true;
user = "don";
extraArguments = ["-d"];
program =
# "${pkgs.cog}/bin/cog --scale=1.4 http://homeassistant.home.duckland.org:8123/dashboard-pi/0";
"${pkgs.firefox}/bin/firefox --kiosk http://harper2.home.duckland.org:8123/dashboard-pi/0";
program = "${pkgs.kdePackages.falkon}/bin/falkon --fullscreen http://harper2.home.duckland.org:8123/dashboard-pi/0";
};
}

View file

@ -1,4 +1,11 @@
{ inputs, outputs, lib, config, pkgs, ... }: {
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
imports = [
inputs.nixos-hardware.nixosModules.framework-amd-ai-300-series
./hardware-configuration.nix
@ -6,7 +13,6 @@
../workstation
];
networking.hostName = "loki";
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
variables.address = "100.72.0.1";
variables.swayScale = "1.2";
@ -20,5 +26,5 @@
gnome-calendar.enable = true;
};
primary.enable = true;
wm = { sway.enable = true; };
wm = {sway.enable = true;};
}

View file

@ -5,17 +5,7 @@
config,
pkgs,
...
}: let
my-python-packages = python-packages:
with python-packages; [
pip
pipx
python-dateutil
setuptools
requests
];
python-with-my-packages = pkgs.python313.withPackages my-python-packages;
in {
}: {
nix = {
settings = {
experimental-features = ["nix-command" "flakes"];
@ -30,7 +20,7 @@ in {
};
};
imports = [
../../home
../../home/pi-server.nix
./services.nix
./systemd.nix
../vars.nix
@ -62,16 +52,6 @@ in {
# Bootloader.
boot = {
kernelPackages = pkgs.linuxPackages_rpi4;
kernelParams = ["consoleblank=60"];
#loader = {
#systemd-boot = {
#enable = true;
#};
#efi = {
#canTouchEfiVariables = true;
#efiSysMountPoint = "/boot";
#};
#};
plymouth = {enable = true;};
kernel = {sysctl = {"vm.swappiness" = 10;};};
};
@ -92,16 +72,8 @@ in {
};
services = {
pcscd = {enable = true;};
beszel-agent = {enable = true;};
avahi = {
enable = true;
nssmdns4 = true;
};
printing = {enable = true;};
udisks2 = {enable = true;};
nscd = {enableNsncd = true;};
tailscale = {enable = true;};
locate = {
enable = true;
package = pkgs.mlocate;
@ -151,42 +123,22 @@ in {
memoryPercent = 25;
memoryMax = 2147483648;
};
#nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
# python-with-my-packages
python313
aspell
aspellDicts.en
base16-schemes
bash-completion
btop
colmena
dmidecode
docker-compose
git-crypt
gitFull
home-manager
hunspell
hunspellDicts.en_US
isync
just
lazydocker
lsb-release
lsof
nix-bash-completions
nixfmt-classic
pkg-config
podman
poppler_utils
ruby
sops
udiskie
];
programs = {
dconf = {enable = true;};
mtr = {enable = true;};
gnupg = {
agent = {
enable = true;
@ -196,57 +148,12 @@ in {
};
};
nixpkgs.overlays = [
(final: super: {
khal = super.khal.overridePythonAttrs (_: {doCheck = false;});
})
];
# Open ports in the firewall.
networking.firewall = {
enable = true;
# always allow traffic from your Tailscale network
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
# allow the Tailscale UDP port through the firewall
allowedUDPPorts = [config.services.tailscale.port];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
# allow you to SSH in over the public internet
allowedTCPPorts = [22];
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leavecatenate(variables, "bootdev", bootdev)
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
programs.msmtp = {
enable = true;
accounts = {
default = {
auth = true;
tls = true;
port = 587;
from = "duck@duckland.org";
host = "smtp.gmail.com";
user = "duckunix@gmail.com";
passwordeval = "cat /home/don/.smtp_password.txt";
};
};
};
}

View file

@ -1,45 +1,14 @@
{ pkgs, ... }:
let
readlink = "${pkgs.coreutils}/bin/readlink";
notify-send = "${pkgs.libnotify}/bin/notify-send";
in {
{pkgs, ...}: {
systemd = {
services = {
clean-keychain = {
description = "Clean up .keychain on boot";
wantedBy = [ "multi-user.target" ];
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils-full}/bin/rm -rf /home/don/.keychain";
};
};
};
user = {
services = {
detect-reboot-for-upgrade = {
script = ''
set -eu -o pipefail
booted="$(${readlink} /run/booted-system/{initrd,kernel,kernel-modules})"
built="$(${readlink} /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
if [[ "''${booted}" != "''${built}" ]];
then
echo "Looks like we need a reboot!"
${notify-send} --urgency=low --icon=system-reboot "Reboot is needed for a NixOS upgrade."
fi
'';
serviceConfig = { Type = "oneshot"; };
};
};
timers = {
detect-reboot-for-upgrade = {
wantedBy = [ "timers.target" ];
partOf = [ "detect-reboot-for-upgrade.service" ];
timerConfig = {
OnCalendar = "hourly";
Unit = "detect-reboot-for-upgrade.service";
};
};
};
};
};
}

View file

@ -1,5 +1,11 @@
{ inputs, outputs, lib, config, pkgs, ... }:
let
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
my-python-packages = python-packages:
with python-packages; [
pip
@ -12,10 +18,10 @@ let
in {
nix = {
settings = {
experimental-features = [ "nix-command" "flakes" ];
experimental-features = ["nix-command" "flakes"];
warn-dirty = false;
auto-optimise-store = true;
trusted-users = [ "root" "don" ];
trusted-users = ["root" "don"];
};
gc = {
automatic = true;
@ -49,14 +55,15 @@ in {
inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-mozc fcitx5-gtk ];
fcitx5.addons = with pkgs; [fcitx5-mozc fcitx5-gtk];
};
};
# Bootloader.
boot = {
binfmt.emulatedSystems = ["aarch64-linux"];
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [ "consoleblank=60" ];
kernelParams = ["consoleblank=60"];
#loader = {
#systemd-boot = {
#enable = true;
@ -66,34 +73,36 @@ in {
#efiSysMountPoint = "/boot";
#};
#};
plymouth = { enable = true; };
kernel = { sysctl = { "vm.swappiness" = 10; }; };
plymouth = {enable = true;};
kernel = {sysctl = {"vm.swappiness" = 10;};};
};
security = {
polkit = { enable = true; };
polkit = {enable = true;};
sudo.enable = false;
doas = {
enable = true;
extraRules = [{
users = [ "don" ];
keepEnv = true;
noPass = true;
}];
extraRules = [
{
users = ["don"];
keepEnv = true;
noPass = true;
}
];
};
};
services = {
pcscd = { enable = true; };
beszel-agent = { enable = true; };
pcscd = {enable = true;};
beszel-agent = {enable = true;};
avahi = {
enable = true;
nssmdns4 = true;
};
printing = { enable = true; };
udisks2 = { enable = true; };
nscd = { enableNsncd = true; };
tailscale = { enable = true; };
printing = {enable = true;};
udisks2 = {enable = true;};
nscd = {enableNsncd = true;};
tailscale = {enable = true;};
locate = {
enable = true;
package = pkgs.mlocate;
@ -179,8 +188,8 @@ in {
];
programs = {
dconf = { enable = true; };
mtr = { enable = true; };
dconf = {enable = true;};
mtr = {enable = true;};
gnupg = {
agent = {
enable = true;
@ -192,25 +201,29 @@ in {
nixpkgs.overlays = [
(final: super: {
khal = super.khal.overridePythonAttrs (_: { doCheck = false; });
khal = super.khal.overridePythonAttrs (_: {doCheck = false;});
})
];
# Open ports in the firewall.
networking.firewall = {
enable = true;
trustedInterfaces = [ "tailscale0" ];
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
allowedUDPPorts = [ config.services.tailscale.port ];
allowedTCPPortRanges = [{
from = 1714;
to = 1764;
}];
allowedUDPPortRanges = [{
from = 1714;
to = 1764;
}];
allowedTCPPorts = [ 22 ];
allowedUDPPorts = [config.services.tailscale.port];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedTCPPorts = [22];
};
# This value determines the NixOS release from which the default

View file

@ -99,6 +99,7 @@ in {
# Bootloader.
boot = {
binfmt.emulatedSystems = ["aarch64-linux"];
# kernelPackages = pkgs.linuxPackages_latest;
kernelPackages = pkgs.linuxPackages_zen;
kernelParams = ["consoleblank=60" "mem_sleep_default=deep"];