feat(system): professionalize system configurations
- Consolidate imperative system settings into /etc/nixos/state.json - Implement nomarchy.system options for DNS, Wifi powersave, Timezone, and hardware features - Add declarative browser policies for Chromium/Brave based on theme - Update toggles scripts to mutate system JSON and run sys-update --impure - Remove obsolete imperative browser theme and redundant system modules
This commit is contained in:
@@ -1,40 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Configure Fingerprint support declaratively for Nomarchy NixOS.
|
||||
# Configure fingerprint support declaratively for Nomarchy NixOS.
|
||||
|
||||
FEATURE_FILE="/etc/nixos/nomarchy-features/fingerprint.nix"
|
||||
STATE_FILE="/etc/nixos/state.json"
|
||||
|
||||
if [[ "--remove" == $1 ]]; then
|
||||
if [ -f "$FEATURE_FILE" ]; then
|
||||
sudo rm "$FEATURE_FILE"
|
||||
echo "Removed $FEATURE_FILE."
|
||||
echo "IMPORTANT: Remove './nomarchy-features/fingerprint.nix' from your imports and run 'sys-update'."
|
||||
else
|
||||
echo "Fingerprint support not found."
|
||||
fi
|
||||
sudo jq ".features.fingerprint = false" "$STATE_FILE" > /tmp/state.json && sudo mv /tmp/state.json "$STATE_FILE"
|
||||
echo "Fingerprint support disabled. Applying changes..."
|
||||
sudo sys-update
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$FEATURE_FILE" ]; then
|
||||
echo "Fingerprint support is already configured in $FEATURE_FILE"
|
||||
else
|
||||
sudo mkdir -p "/etc/nixos/nomarchy-features"
|
||||
cat <<EOF | sudo tee "$FEATURE_FILE" > /dev/null
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.fprintd.enable = true;
|
||||
# NixOS's fprintd module automatically configures PAM for login/sudo if enabled.
|
||||
}
|
||||
EOF
|
||||
echo "Created $FEATURE_FILE."
|
||||
echo "IMPORTANT: To finish enabling fingerprint support, add './nomarchy-features/fingerprint.nix' to your imports list in /etc/nixos/system.nix or /etc/nixos/flake.nix,"
|
||||
echo "then run 'sys-update'."
|
||||
fi
|
||||
sudo jq ".features.fingerprint = true" "$STATE_FILE" > /tmp/state.json && sudo mv /tmp/state.json "$STATE_FILE"
|
||||
echo "Fingerprint support enabled. Applying changes..."
|
||||
sudo sys-update
|
||||
|
||||
# Enrollment is still an imperative action
|
||||
if command -v fprintd-enroll &> /dev/null; then
|
||||
echo "Let's enroll your fingerprint now."
|
||||
fprintd-enroll "$USER"
|
||||
fprintd-enroll
|
||||
echo "Fingerprint enrolled."
|
||||
else
|
||||
echo "fprintd-enroll not found. Please run 'sys-update' first if you just enabled it."
|
||||
echo "fprintd not found. It will be available after the next reboot or sys-update."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user