Compare commits

...

10 commits

Author SHA1 Message Date
glenn 0add03034e working sql dump over ssh 2024-05-05 21:54:47 +02:00
glenn dda65cd17e init nextcloud backup 2024-05-05 21:19:42 +02:00
glenn 2d8b2e985a added nas hostname 2024-05-05 20:53:16 +02:00
admin 642d297710 fix pw 2024-05-03 07:39:16 +02:00
admin e26f86fd85 moved forgejo data dir 2024-04-30 10:37:55 +02:00
admin 8f25ae8b4c chore: moved media files 2024-04-29 21:20:27 +02:00
admin bb579bde4e chore: moved database to a bigger drive 2024-04-29 19:28:46 +02:00
admin fb83b50dec enable big drives as a pool 2024-04-29 14:58:47 +02:00
admin c54a18e3b3 cfg some utils 2024-04-26 12:43:43 +02:00
admin 35dacb96f3 bump: homepage 2024-04-23 15:58:05 +02:00
8 changed files with 102 additions and 43 deletions

View file

@ -1,24 +1,29 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{ {
imports = config,
[ # Include the results of the hardware scan. pkgs,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; services.postgresql = {
dataDir = "/pool/var/lib/postgresql/${config.services.postgresql.package.psqlSchema}";
};
nix.settings.experimental-features = ["nix-command" "flakes"];
powerManagement.enable = false; powerManagement.enable = false;
# Bootloader. # Bootloader.
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sdc"; boot.loader.grub.device = "/dev/sdc";
boot.loader.grub.useOSProber = true; boot.loader.grub.useOSProber = true;
networking = {
networking.hostName = "nixos"; # Define your hostname. hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
@ -26,7 +31,15 @@
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking # Enable networking
networking.networkmanager.enable = true; networkmanager.enable = true;
# Open ports in the firewall.
firewall.allowedTCPPorts = [80 443];
extraHosts = ''
192.168.1.88 nas
'';
};
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Stockholm"; time.timeZone = "Europe/Stockholm";
@ -94,7 +107,7 @@
users.users.sondell = { users.users.sondell = {
isNormalUser = true; isNormalUser = true;
description = "sondell"; description = "sondell";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = ["networkmanager" "wheel"];
packages = with pkgs; [ packages = with pkgs; [
firefox firefox
# thunderbird # thunderbird
@ -106,7 +119,6 @@
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMYGJCpFIiWqzy8YbfWh7+i52XVwyhUu+P0rUglVR5uV gws@nixos"]; openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMYGJCpFIiWqzy8YbfWh7+i52XVwyhUu+P0rUglVR5uV gws@nixos"];
}; };
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -126,20 +138,23 @@
nil nil
starship starship
tailscale tailscale
alejandra
]; ];
programs = {
programs.fish= { ssh.startAgent = true;
enable=true; fish = {
enable = true;
shellInit = "starship init fish | source"; shellInit = "starship init fish | source";
}; };
programs.starship.enable = true; starship.enable = true;
programs.starship.settings = { starship.settings = {
shell = { shell = {
disabled = false; disabled = false;
fish_indicator = ""; fish_indicator = "";
bash_indicator = "BASH"; bash_indicator = "BASH";
}; };
}; };
};
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
@ -165,9 +180,6 @@
environmentFile = "/etc/nixos/.secrets/cloudflare_dns_tokend"; environmentFile = "/etc/nixos/.secrets/cloudflare_dns_tokend";
}; };
}; };
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 80 443 ];
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
@ -180,5 +192,4 @@
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (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?
} }

View file

@ -12,7 +12,7 @@ in
After="network-online.target"; After="network-online.target";
}; };
serviceConfig = { serviceConfig = {
ExecStart = "${filebrowser}/bin/filebrowser -r /mnt/movie_drive -d /var/lib/filebrowser/filebrowser.db"; ExecStart = "${filebrowser}/bin/filebrowser -r /pool/media/ -d /var/lib/filebrowser/filebrowser.db";
User= "jellyfin"; User= "jellyfin";
Type= "simple"; Type= "simple";
}; };

View file

@ -58,11 +58,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1712745070, "lastModified": 1713880523,
"narHash": "sha256-75kSMjyCD5/IliSPkBcBSBamwPYF30Ddr8Ef2XxDfiE=", "narHash": "sha256-/dMwfs3toYi2SzrItwpTLKWMSIquAptdCClC2FB608Y=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "c2650ecab1c7b9b2e10d690b40e82817d257b53a", "rev": "5e986b284d6a7b81fd437822f6279dd915494c54",
"revCount": 28, "revCount": 29,
"type": "git", "type": "git",
"url": "https://git.sondell.org/glennwso/home.git" "url": "https://git.sondell.org/glennwso/home.git"
}, },

View file

@ -30,6 +30,7 @@
./tail.nix ./tail.nix
./matrix.nix ./matrix.nix
./coturn.nix ./coturn.nix
./vaultwarden.nix
(import ./mail.nix {inherit mailserver;}) (import ./mail.nix {inherit mailserver;})
(import ./homepage.nix {inherit homepage;}) (import ./homepage.nix {inherit homepage;})
]; ];

View file

@ -7,6 +7,7 @@ in
{ {
services.forgejo = { services.forgejo = {
enable = true; enable = true;
stateDir = "/pool/var/lib/forgejo";
settings = { settings = {
service = { service = {
# DISABLE_REGISTRATION = true; # DISABLE_REGISTRATION = true;

View file

@ -21,7 +21,10 @@
{ device = "/dev/disk/by-uuid/f3463885-fde8-4488-9442-37ced2b2c8f3"; { device = "/dev/disk/by-uuid/f3463885-fde8-4488-9442-37ced2b2c8f3";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/pool" = {
device = "/dev/pool1/vol1";
fsType = "ext4";
};
swapDevices = [ ]; swapDevices = [ ];

View file

@ -8,6 +8,27 @@ in
environment.systemPackages = [ environment.systemPackages = [
nextcloud nextcloud
]; ];
systemd.timers."nextcloud-backup" = {
wantedBy = [ "timers.target" ];
timerConfig = {
# OnBootSec = "5m";
# OnUnitActiveSec = "5m";
OnCalendar="*-*-* 2:00:00";
Unit = "nextcloud-backup.service";
};
};
systemd.services."nextcloud-backup" = {
script = with pkgs; ''
set -eu
${postgresql}/bin/pg_dump "nextcloud" | ${openssh}/bin/ssh -i /etc/nixos/.secrets/tulpan Glenn@nas "cat - > back/nextcloud/dump.sql"
'';
serviceConfig = {
Type = "oneshot";
User = "postgres";
};
};
services = { services = {
nginx.virtualHosts = { nginx.virtualHosts = {
${domain} = { ${domain} = {

22
vaultwarden.nix Normal file
View file

@ -0,0 +1,22 @@
{ ... }:
let
domain = "pw.sondell.org";
port = "8222";
in
{
#
services.vaultwarden = {
enable = true;
};
services.nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${port}/";
};
};
}