Merge branch 'main' of github.personal:Polensky/nixos
This commit is contained in:
commit
1fb5194d10
4 changed files with 104 additions and 37 deletions
2
Makefile
2
Makefile
|
|
@ -3,7 +3,7 @@ build-pi-image:
|
||||||
|
|
||||||
# Doest work yet
|
# Doest work yet
|
||||||
rebuild-pi:
|
rebuild-pi:
|
||||||
nixos-rebuild switch --flake .#pi --target-host polen@192.168.1.241 --use-remote-sudo
|
NIX_SSHOPTS="-o IdentitiesOnly=yes -i ~/.ssh/id_rsa" nixos-rebuild switch --flake .#pi --target-host pi --build-host server --use-remote-sudo
|
||||||
|
|
||||||
deploy-server:
|
deploy-server:
|
||||||
nixos-rebuild switch --flake .#server --target-host server --build-host server --use-remote-sudo
|
nixos-rebuild switch --flake .#server --target-host server --build-host server --use-remote-sudo
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
{ inputs, config, pkgs, lib, ... }:
|
{
|
||||||
|
inputs,
|
||||||
let
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
user = "polen";
|
user = "polen";
|
||||||
hostname = "pi";
|
hostname = "pi";
|
||||||
in {
|
in {
|
||||||
boot = {
|
boot = {
|
||||||
kernelPackages = pkgs.linuxKernel.packages.linux_rpi3;
|
kernelPackages = pkgs.linuxKernel.packages.linux_rpi3;
|
||||||
initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ];
|
initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage"];
|
||||||
loader = {
|
loader = {
|
||||||
grub.enable = false;
|
grub.enable = false;
|
||||||
generic-extlinux-compatible.enable = true;
|
generic-extlinux-compatible.enable = true;
|
||||||
|
|
@ -17,51 +21,59 @@ in {
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "/dev/disk/by-label/NIXOS_SD";
|
device = "/dev/disk/by-label/NIXOS_SD";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
options = [ "noatime" ];
|
options = ["noatime"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#sops.defaultSopsFile = ../../secrets/secrets.yaml;
|
swapDevices = [
|
||||||
#sops.defaultSopsFormat = "yaml";
|
{
|
||||||
#sops.age.keyFile = "/home/polen/.config/sops/age/keys.txt";
|
device = "/var/lib/swapfile";
|
||||||
#sops.secrets.pi_user_pass.neededForUsers = true;
|
size = 10 * 1024;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
#sops.defaultSopsFile = ../../secrets/secrets.yaml;
|
||||||
|
#sops.defaultSopsFormat = "yaml";
|
||||||
|
#sops.age.keyFile = "/home/polen/.config/sops/age/keys.txt";
|
||||||
|
#sops.secrets.pi_user_pass.neededForUsers = true;
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
wireless.enable = false;
|
wireless.enable = false;
|
||||||
hostName = hostname;
|
hostName = hostname;
|
||||||
firewall.allowedTCPPorts = [ 80 443 ];
|
firewall.allowedTCPPorts = [80 443];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."mealie.polensky.me".extraConfig = ''
|
virtualHosts."mealie.polensky.me".extraConfig = ''
|
||||||
reverse_proxy http://localhost:9925
|
reverse_proxy http://192.168.1.242:9000
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings.trusted-users = [ user ];
|
services.prometheus.exporters = {
|
||||||
|
node.enable = true;
|
||||||
|
node.openFirewall = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
nix.settings.trusted-users = [user];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
htop-vim
|
htop-vim
|
||||||
neovim
|
neovim
|
||||||
tmux
|
curl
|
||||||
curl
|
wget
|
||||||
wget
|
ranger
|
||||||
git
|
];
|
||||||
ranger
|
|
||||||
];
|
|
||||||
|
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
virtualisation.docker.enable = true;
|
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
users."${user}" = {
|
users."${user}" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
#hashedPasswordFile = config.sops.secrets.pi_user_pass.path;
|
#hashedPasswordFile = config.sops.secrets.pi_user_pass.path;
|
||||||
extraGroups = [ "wheel" "docker" ];
|
extraGroups = ["wheel" "docker"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,49 @@ in {
|
||||||
};
|
};
|
||||||
#boot.kernelModules = ["msr"];
|
#boot.kernelModules = ["msr"];
|
||||||
|
|
||||||
|
boot.binfmt.emulatedSystems = ["aarch64-linux"];
|
||||||
|
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
# observability
|
||||||
|
services = {
|
||||||
|
grafana = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
http_addr = "0.0.0.0";
|
||||||
|
http_port = 3000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
prometheus = {
|
||||||
|
enable = true;
|
||||||
|
exporters = {
|
||||||
|
node.enable = true;
|
||||||
|
};
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = "node-exporters-lan";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = ["192.168.1.241:9100"];
|
||||||
|
labels = {
|
||||||
|
instance = "pi";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
targets = ["127.0.0.1:9100"];
|
||||||
|
labels = {
|
||||||
|
instance = "server";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# media
|
||||||
services = {
|
services = {
|
||||||
jellyfin = {
|
jellyfin = {
|
||||||
inherit user;
|
inherit user;
|
||||||
|
|
@ -34,23 +75,37 @@ in {
|
||||||
taskchampion-sync-server = {
|
taskchampion-sync-server = {
|
||||||
inherit user;
|
inherit user;
|
||||||
enable = true;
|
enable = true;
|
||||||
|
host = "0.0.0.0";
|
||||||
|
};
|
||||||
|
mealie = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
ALLOW_SIGNUP = "false";
|
||||||
|
PUID = 1000;
|
||||||
|
PGID = 1000;
|
||||||
|
TZ = "Canada/Eastern";
|
||||||
|
MAX_WORKERS = 1;
|
||||||
|
WEB_CONCURRENCY = 1;
|
||||||
|
#BASE_URL = "https://mealie.polensky.me";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "server";
|
hostName = "server";
|
||||||
firewall.allowedTCPPorts = [
|
firewall.allowedTCPPorts = [
|
||||||
|
9090 # prometheus
|
||||||
|
3000 # grafana
|
||||||
8096 # jellyfin
|
8096 # jellyfin
|
||||||
9091 # transmission
|
9091 # transmission
|
||||||
|
9000 # mealie
|
||||||
10222 # taskchampion-sync-server
|
10222 # taskchampion-sync-server
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
time.timeZone = "America/Toronto";
|
time.timeZone = "America/Toronto";
|
||||||
|
|
||||||
users.users.user = {
|
users.users."${user}" = {
|
||||||
isNormalUser = true;
|
|
||||||
description = user;
|
|
||||||
extraGroups = ["wheel" "transmission" "jellyfin"];
|
extraGroups = ["wheel" "transmission" "jellyfin"];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@
|
||||||
nix = {
|
nix = {
|
||||||
settings.experimental-features = ["nix-command" "flakes"];
|
settings.experimental-features = ["nix-command" "flakes"];
|
||||||
settings.trusted-users = ["polen"];
|
settings.trusted-users = ["polen"];
|
||||||
# settings.extra-platforms = config.boot.binfmt.emulatedSystems;
|
settings.extra-platforms = config.boot.binfmt.emulatedSystems;
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = "weekly";
|
dates = "weekly";
|
||||||
options = "--delete-older-than 15d";
|
options = "--delete-older-than 15d";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# boot.binfmt.emulatedSystems = ["aarch64-linux"];
|
boot.binfmt.emulatedSystems = ["aarch64-linux"];
|
||||||
|
|
||||||
# Configure network proxy if necessary
|
# Configure network proxy if necessary
|
||||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue