mirror of
https://github.com/Noratrieb/nixos.git
synced 2026-07-12 09:57:46 +02:00
Compare commits
3 commits
f5c958e96f
...
11d958c8b2
| Author | SHA1 | Date | |
|---|---|---|---|
| 11d958c8b2 | |||
| 8ed10881f8 | |||
| 29119bf74f |
4 changed files with 105 additions and 49 deletions
|
|
@ -356,7 +356,7 @@ binds {
|
||||||
|
|
||||||
// Suggested binds for running programs: terminal, app launcher, screen locker.
|
// Suggested binds for running programs: terminal, app launcher, screen locker.
|
||||||
Mod+T { spawn "alacritty"; }
|
Mod+T { spawn "alacritty"; }
|
||||||
Mod+D { spawn "fuzzel"; }
|
Mod+D { spawn "fuzzel-in-niri"; }
|
||||||
Super+Alt+L { spawn "lock-and-power-off-screen"; }
|
Super+Alt+L { spawn "lock-and-power-off-screen"; }
|
||||||
|
|
||||||
// You can also use a shell. Do this if you need pipes, multiple commands, etc.
|
// You can also use a shell. Do this if you need pipes, multiple commands, etc.
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,27 @@
|
||||||
|
|
||||||
{ pkgs
|
{ pkgs
|
||||||
, inputs
|
, inputs
|
||||||
|
, lib
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
customPkgs = import ../custom-pkgs/default.nix pkgs;
|
customPkgs = import ../custom-pkgs/default.nix pkgs;
|
||||||
|
fuzzel-launch-prefix = (pkgs.writeShellApplication {
|
||||||
|
name = "fuzzel-launch-prefix";
|
||||||
|
text = ''
|
||||||
|
name=$(basename "$1")
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/13043344/search-and-replace-in-bash-using-regular-expressions
|
||||||
|
# https://github.com/niri-wm/niri/blob/f717ae030fe56fc52522ebef69f17f3f09064ac4/src/utils/spawning.rs#L429
|
||||||
|
re='(.*)[^a-zA-Z0-9:_\.]+(.*)'
|
||||||
|
while [[ $name =~ $re ]]; do
|
||||||
|
# niri doesn't just yeet it out but encode it but that's too complicated for us
|
||||||
|
name="$${BASH_REMATCH[1]}$${BASH_REMATCH[2]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
exec systemd-run --scope --user --unit "app-$name" "$@"
|
||||||
|
'';
|
||||||
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# You can import other home-manager modules here
|
# You can import other home-manager modules here
|
||||||
|
|
@ -67,6 +84,12 @@ in
|
||||||
exec swaylock
|
exec swaylock
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "fuzzel-in-niri";
|
||||||
|
text = ''
|
||||||
|
${lib.getExe pkgs.fuzzel} --launch-prefix "${lib.getExe fuzzel-launch-prefix}"
|
||||||
|
'';
|
||||||
|
})
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "shell.nix";
|
name = "shell.nix";
|
||||||
text = ''
|
text = ''
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
{ pkgs, config, ... }: {
|
{ pkgs, config, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./desktop-hardware-configuration.nix
|
./desktop-hardware-configuration.nix
|
||||||
./paperless.nix
|
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -43,6 +42,82 @@
|
||||||
|
|
||||||
programs.coolercontrol.enable = true;
|
programs.coolercontrol.enable = true;
|
||||||
|
|
||||||
|
# it would be cool if this didnt use up so many different ports...
|
||||||
|
# maybe a network namespace and bridge or something??
|
||||||
|
# unix sockets dont appear to be supported sadly
|
||||||
|
services.victoriametrics.enable = true;
|
||||||
|
services.vmagent = {
|
||||||
|
enable = true;
|
||||||
|
remoteWrite.url = "http://127.0.0.1:8428/api/v1/write";
|
||||||
|
prometheusConfig = {
|
||||||
|
scrape_configs = [
|
||||||
|
{
|
||||||
|
job_name = "node-exporter";
|
||||||
|
static_configs = [{ targets = [ "127.0.0.1:9100" ]; }];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "cadvisor";
|
||||||
|
static_configs = [{ targets = [ "127.0.0.1:8080" ]; }];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "systemd";
|
||||||
|
static_configs = [{ targets = [ "127.0.0.1:9558" ]; }];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "coolercontrol";
|
||||||
|
authorization = {
|
||||||
|
type = "Bearer";
|
||||||
|
credentials = "cc_5fed8f3b7bd44424b7ffc67cce940e55";
|
||||||
|
};
|
||||||
|
static_configs = [{ targets = [ "127.0.0.1:11987" ]; }];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.prometheus.exporters = {
|
||||||
|
node.enable = true;
|
||||||
|
systemd.enable = true;
|
||||||
|
};
|
||||||
|
services.cadvisor = {
|
||||||
|
enable = true;
|
||||||
|
extraOptions = [
|
||||||
|
# significantly decreases CPU usage (https://github.com/google/cadvisor/issues/2523)
|
||||||
|
"--housekeeping_interval=30s"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
services.grafana = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
security = {
|
||||||
|
# here are my secrets, use them while they're hot
|
||||||
|
admin_user = "admin";
|
||||||
|
admin_password = "admin";
|
||||||
|
secret_key = "SW2YcwTIb9zpOOhoPsMm";
|
||||||
|
};
|
||||||
|
server.http_port = 4444;
|
||||||
|
};
|
||||||
|
|
||||||
|
declarativePlugins = [
|
||||||
|
pkgs.grafanaPlugins.victoriametrics-metrics-datasource
|
||||||
|
];
|
||||||
|
|
||||||
|
provision = {
|
||||||
|
enable = true;
|
||||||
|
datasources.settings = {
|
||||||
|
apiVersion = 1;
|
||||||
|
datasources = [
|
||||||
|
{
|
||||||
|
name = "victoriametrics";
|
||||||
|
type = "victoriametrics-metrics-datasource";
|
||||||
|
access = "proxy";
|
||||||
|
url = "http://127.0.0.1:8428";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
useRoutingFeatures = "both";
|
useRoutingFeatures = "both";
|
||||||
|
|
@ -80,7 +155,11 @@
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
trustedInterfaces = [ "tailscale0" ];
|
trustedInterfaces = [ "tailscale0" ];
|
||||||
allowedUDPPorts = [ config.services.tailscale.port ];
|
allowedUDPPorts = [ config.services.tailscale.port ];
|
||||||
allowedTCPPorts = [ /*SSH*/ 22 ];
|
allowedTCPPorts = [
|
||||||
|
/*SSH*/
|
||||||
|
22
|
||||||
|
11434
|
||||||
|
];
|
||||||
|
|
||||||
# https://github.com/tailscale/tailscale/issues/4432#issuecomment-1112819111
|
# https://github.com/tailscale/tailscale/issues/4432#issuecomment-1112819111
|
||||||
checkReversePath = "loose";
|
checkReversePath = "loose";
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
let localDir = "/home/nora/.local/share/paperless-ngx"; nasDir = "/mnt/nas/HEY/_Nora/paperless"; in {
|
|
||||||
services.paperless = {
|
|
||||||
enable = true;
|
|
||||||
dataDir = "${localDir}/data";
|
|
||||||
mediaDir = "${localDir}/media";
|
|
||||||
consumptionDir = "${nasDir}/consume";
|
|
||||||
address = "0.0.0.0";
|
|
||||||
port = 8010;
|
|
||||||
user = "nora";
|
|
||||||
environmentFile = "${localDir}/secrets-environment";
|
|
||||||
settings = {
|
|
||||||
PAPERLESS_TIME_ZONE = "Europe/Zurich";
|
|
||||||
PAPERLESS_ADMIN_USER = "nora";
|
|
||||||
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
|
||||||
};
|
|
||||||
exporter = {
|
|
||||||
enable = true;
|
|
||||||
directory = "${nasDir}/export";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
systemd.services.paperless-ngx-backup = {
|
|
||||||
description = "paperless-ngx data backup to NAS";
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
User = "nora";
|
|
||||||
ExecStart = ''
|
|
||||||
${lib.getExe pkgs.rsync} -a -v --delete --exclude=redis ${localDir}/ ${nasDir}/backup
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
systemd.timers.paperless-ngx-backup = {
|
|
||||||
description = "paperless-ngx data backup to NAS";
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
after = [ "mnt-nas.mount" ];
|
|
||||||
timerConfig = {
|
|
||||||
Unit = "paperless-ngx-backup.service";
|
|
||||||
OnCalendar = "daily UTC";
|
|
||||||
RandomizedDelaySec = 1800;
|
|
||||||
FixedRandomDelay = true;
|
|
||||||
Persistent = true; # ensure it still runs if the computer was down at the timer of trigger
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue