reworking pi display

This commit is contained in:
Don Harper 2025-10-19 20:00:28 -05:00
parent 9f0a8d314a
commit b99925ff12
5 changed files with 100 additions and 133 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, pkgs,
... ...
}: { }: {
# environment.systemPackages = with pkgs; [ cog ]; environment.systemPackages = with pkgs; [kdePackages.falkon cage];
environment.systemPackages = with pkgs; [firefox];
services.cage = { services.cage = {
enable = true; enable = true;
user = "don"; user = "don";
extraArguments = ["-d"]; extraArguments = ["-d"];
program = program = "${pkgs.kdePackages.falkon}/bin/falkon --fullscreen http://harper2.home.duckland.org:8123/dashboard-pi/0";
# "${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";
}; };
} }

View file

@ -5,17 +5,7 @@
config, config,
pkgs, 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 = { nix = {
settings = { settings = {
experimental-features = ["nix-command" "flakes"]; experimental-features = ["nix-command" "flakes"];
@ -30,7 +20,7 @@ in {
}; };
}; };
imports = [ imports = [
../../home ../../home/pi-server.nix
./services.nix ./services.nix
./systemd.nix ./systemd.nix
../vars.nix ../vars.nix
@ -62,16 +52,6 @@ in {
# Bootloader. # Bootloader.
boot = { boot = {
kernelPackages = pkgs.linuxPackages_rpi4; kernelPackages = pkgs.linuxPackages_rpi4;
kernelParams = ["consoleblank=60"];
#loader = {
#systemd-boot = {
#enable = true;
#};
#efi = {
#canTouchEfiVariables = true;
#efiSysMountPoint = "/boot";
#};
#};
plymouth = {enable = true;}; plymouth = {enable = true;};
kernel = {sysctl = {"vm.swappiness" = 10;};}; kernel = {sysctl = {"vm.swappiness" = 10;};};
}; };
@ -92,16 +72,8 @@ in {
}; };
services = { services = {
pcscd = {enable = true;};
beszel-agent = {enable = true;}; beszel-agent = {enable = true;};
avahi = {
enable = true;
nssmdns4 = true;
};
printing = {enable = true;};
udisks2 = {enable = true;};
nscd = {enableNsncd = true;}; nscd = {enableNsncd = true;};
tailscale = {enable = true;};
locate = { locate = {
enable = true; enable = true;
package = pkgs.mlocate; package = pkgs.mlocate;
@ -151,42 +123,22 @@ in {
memoryPercent = 25; memoryPercent = 25;
memoryMax = 2147483648; memoryMax = 2147483648;
}; };
#nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# python-with-my-packages
python313 python313
aspell
aspellDicts.en
base16-schemes base16-schemes
bash-completion bash-completion
btop btop
colmena
dmidecode dmidecode
docker-compose
git-crypt
gitFull
home-manager home-manager
hunspell
hunspellDicts.en_US
isync
just
lazydocker
lsb-release lsb-release
lsof lsof
nix-bash-completions nix-bash-completions
nixfmt-classic
pkg-config pkg-config
podman
poppler_utils
ruby
sops sops
udiskie
]; ];
programs = { programs = {
dconf = {enable = true;};
mtr = {enable = true;};
gnupg = { gnupg = {
agent = { agent = {
enable = true; enable = true;
@ -196,57 +148,12 @@ in {
}; };
}; };
nixpkgs.overlays = [
(final: super: {
khal = super.khal.overridePythonAttrs (_: {doCheck = false;});
})
];
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall = { networking.firewall = {
enable = true; enable = true;
# always allow traffic from your Tailscale network
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose"; 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]; 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? 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, ... }: {pkgs, ...}: {
let
readlink = "${pkgs.coreutils}/bin/readlink";
notify-send = "${pkgs.libnotify}/bin/notify-send";
in {
systemd = { systemd = {
services = { services = {
clean-keychain = { clean-keychain = {
description = "Clean up .keychain on boot"; description = "Clean up .keychain on boot";
wantedBy = [ "multi-user.target" ]; wantedBy = ["multi-user.target"];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.coreutils-full}/bin/rm -rf /home/don/.keychain"; 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";
};
};
};
};
}; };
} }