Compare commits
8 commits
0add03034e
...
61784db467
Author | SHA1 | Date | |
---|---|---|---|
![]() |
61784db467 | ||
![]() |
4de4db324e | ||
![]() |
e7c4000fbf | ||
![]() |
66af534edc | ||
![]() |
1cc85f8237 | ||
![]() |
52365bc4f2 | ||
![]() |
71b0b70bee | ||
![]() |
55d9a9e9f9 |
|
@ -105,14 +105,17 @@
|
||||||
|
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
users.users.sondell = {
|
users.users.sondell = {
|
||||||
|
home = "/home/sondell";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "sondell";
|
description = "sondell";
|
||||||
extraGroups = ["networkmanager" "wheel"];
|
extraGroups = ["networkmanager" "wheel" "backup"];
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
firefox
|
firefox
|
||||||
# thunderbird
|
# thunderbird
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
users.groups."backup".gid = 1337;
|
||||||
|
|
||||||
|
|
||||||
users.users.root = {
|
users.users.root = {
|
||||||
isNormalUser = false;
|
isNormalUser = false;
|
||||||
|
@ -127,6 +130,7 @@
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||||
# wget
|
# wget
|
||||||
|
restic
|
||||||
htop
|
htop
|
||||||
cloudflared
|
cloudflared
|
||||||
filebrowser
|
filebrowser
|
||||||
|
@ -143,18 +147,20 @@
|
||||||
programs = {
|
programs = {
|
||||||
ssh.startAgent = true;
|
ssh.startAgent = true;
|
||||||
fish = {
|
fish = {
|
||||||
enable = true;
|
enable = false;
|
||||||
shellInit = "starship init fish | source";
|
shellInit = "starship init fish | source";
|
||||||
};
|
};
|
||||||
starship.enable = true;
|
starship = {
|
||||||
starship.settings = {
|
enable = false;
|
||||||
|
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.
|
||||||
|
|
83
flake.lock
83
flake.lock
|
@ -71,6 +71,26 @@
|
||||||
"url": "https://git.sondell.org/glennwso/home.git"
|
"url": "https://git.sondell.org/glennwso/home.git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716847642,
|
||||||
|
"narHash": "sha256-rjEswRV0o23eBBils8lJXyIGha+l/VjV73IPg+ztxgk=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "10c7c219b7dae5795fb67f465a0d86cbe29f25fa",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixos-mailserver": {
|
"nixos-mailserver": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"blobs": "blobs",
|
"blobs": "blobs",
|
||||||
|
@ -78,14 +98,14 @@
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"utils": "utils"
|
"nixpkgs-24_05": "nixpkgs-24_05"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710449465,
|
"lastModified": 1718697807,
|
||||||
"narHash": "sha256-2orO8nfplp6uQJBFqKkj1iyNMC6TysmwbWwbb4osTag=",
|
"narHash": "sha256-Enla61WFisytTYbWygPynEbu8vozjeGc6Obkj2GRj7o=",
|
||||||
"owner": "simple-nixos-mailserver",
|
"owner": "simple-nixos-mailserver",
|
||||||
"repo": "nixos-mailserver",
|
"repo": "nixos-mailserver",
|
||||||
"rev": "79c8cfcd5873a85559da6201b116fb38b490d030",
|
"rev": "290a995de5c3d3f08468fa548f0d55ab2efc7b6b",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -96,11 +116,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711703276,
|
"lastModified": 1716509168,
|
||||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
"narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
"rev": "bfb7a882678e518398ce9a31a881538679f6f092",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -110,9 +130,25 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-24_05": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1717144377,
|
||||||
|
"narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "805a384895c696f802a9bf5bf4720f37385df547",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home": "home",
|
"home": "home",
|
||||||
|
"home-manager": "home-manager",
|
||||||
"nixos-mailserver": "nixos-mailserver",
|
"nixos-mailserver": "nixos-mailserver",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
@ -131,39 +167,6 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1709126324,
|
|
||||||
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
32
flake.nix
32
flake.nix
|
@ -1,17 +1,37 @@
|
||||||
{
|
{
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
inputs = {
|
||||||
inputs.home.url = "git+https://git.sondell.org/glennwso/home.git";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
inputs.home.inputs.nixpkgs.follows = "nixpkgs";
|
home = {
|
||||||
inputs.nixos-mailserver = {
|
url = "git+https://git.sondell.org/glennwso/home.git";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
nixos-mailserver = {
|
||||||
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
|
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, home, nixos-mailserver}@attrs:
|
outputs = { self, nixpkgs, home, nixos-mailserver, home-manager}@attrs:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
homepage = home.packages.${system}.default;
|
homepage = home.packages.${system}.default;
|
||||||
mailserver = nixos-mailserver.nixosModules.default;
|
mailserver = nixos-mailserver.nixosModules.default;
|
||||||
|
|
||||||
|
homeSettings = {
|
||||||
|
home-manager = {
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
users.sondell = import ./home/sondell.nix;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
homeModules = [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
homeSettings
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# replace 'joes-desktop' with your hostname here.
|
# replace 'joes-desktop' with your hostname here.
|
||||||
|
@ -33,7 +53,7 @@
|
||||||
./vaultwarden.nix
|
./vaultwarden.nix
|
||||||
(import ./mail.nix {inherit mailserver;})
|
(import ./mail.nix {inherit mailserver;})
|
||||||
(import ./homepage.nix {inherit homepage;})
|
(import ./homepage.nix {inherit homepage;})
|
||||||
];
|
] ++ homeModules;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
30
home/sondell.nix
Normal file
30
home/sondell.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
# pkgs,
|
||||||
|
# config,
|
||||||
|
# lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
# Home Manager needs a bit of information about you and the
|
||||||
|
# paths it should manage.
|
||||||
|
home.username = "sondell";
|
||||||
|
home.homeDirectory = "/home/sondell";
|
||||||
|
programs.ssh.addKeysToAgent = "yes";
|
||||||
|
programs.ssh.enable = true;
|
||||||
|
programs.ssh.matchBlocks."*".identityFile = [
|
||||||
|
"/home/sondell/.ssh/tulpan"
|
||||||
|
];
|
||||||
|
|
||||||
|
# This value determines the Home Manager release that your
|
||||||
|
# configuration is compatible with. This helps avoid breakage
|
||||||
|
# when a new Home Manager release introduces backwards
|
||||||
|
# incompatible changes.
|
||||||
|
#
|
||||||
|
# You can update Home Manager without changing this value. See
|
||||||
|
# the Home Manager release notes for a list of state version
|
||||||
|
# changes in each release.
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
|
@ -8,20 +8,21 @@ in
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
nextcloud
|
nextcloud
|
||||||
];
|
];
|
||||||
systemd.timers."nextcloud-backup" = {
|
systemd.timers."nextcloud-db-backup" = {
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
# OnBootSec = "5m";
|
# OnBootSec = "5m";
|
||||||
# OnUnitActiveSec = "5m";
|
# OnUnitActiveSec = "5m";
|
||||||
OnCalendar="*-*-* 2:00:00";
|
OnCalendar="*-*-* 2:00:00";
|
||||||
Unit = "nextcloud-backup.service";
|
Unit = "nextcloud-db-backup.service";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."nextcloud-backup" = {
|
systemd.services."nextcloud-db-backup" = {
|
||||||
script = with pkgs; ''
|
script = with pkgs; ''
|
||||||
set -eu
|
set -eu
|
||||||
${postgresql}/bin/pg_dump "nextcloud" | ${openssh}/bin/ssh -i /etc/nixos/.secrets/tulpan Glenn@nas "cat - > back/nextcloud/dump.sql"
|
date=$(date --iso-8601)
|
||||||
|
${postgresql}/bin/pg_dump "nextcloud" | ${openssh}/bin/ssh -i /etc/nixos/.secrets/tulpan Glenn@nas "cat - > back/nextcloud/sqldump/$date.sql"
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
|
@ -29,7 +30,27 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
restic.backups = {
|
||||||
|
"nextcloud" = {
|
||||||
|
passwordFile = "/etc/nixos/.secrets/restic_pw";
|
||||||
|
repository = "sftp:Glenn@nas:/home/back/nextcloud/restic-repo";
|
||||||
|
paths = [
|
||||||
|
"/pool/var/lib/nextcloud"
|
||||||
|
];
|
||||||
|
user = "sondell";
|
||||||
|
timerConfig.OnCalendar = "02:05";
|
||||||
|
pruneOpts = [
|
||||||
|
"--keep-daily 10"
|
||||||
|
"--keep-weekly 5"
|
||||||
|
"--keep-monthly 12"
|
||||||
|
"--keep-yearly 75"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
nginx.virtualHosts = {
|
nginx.virtualHosts = {
|
||||||
${domain} = {
|
${domain} = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
|
@ -48,6 +69,8 @@ in
|
||||||
# Let NixOS install and configure the database automatically.
|
# Let NixOS install and configure the database automatically.
|
||||||
database.createLocally = true;
|
database.createLocally = true;
|
||||||
# Increase the maximum file upload size.
|
# Increase the maximum file upload size.
|
||||||
|
datadir="/pool/var/lib/nextcloud";
|
||||||
|
|
||||||
maxUploadSize = "16G";
|
maxUploadSize = "16G";
|
||||||
https = true;
|
https = true;
|
||||||
autoUpdateApps.enable = true;
|
autoUpdateApps.enable = true;
|
||||||
|
|
Loading…
Reference in a new issue