From 31bbf5fd33405146070057775c73293c26a9fa7b Mon Sep 17 00:00:00 2001 From: Michael Lindman Date: Sun, 9 Feb 2020 12:06:02 +0000 Subject: [PATCH] updated to recent config --- hardware-configuration.nix | 28 +++++++++++++------------- networking.nix | 6 +++--- services.nix | 40 ++++++++++++++++++++++++++++++++++++++ users.nix | 21 +++++++++++++------- 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 78e6fbb..17f88e4 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -5,24 +5,27 @@ { imports = - [ + [ ]; boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/5f03569f-83a4-45a6-b316-bb792c758ac2"; - fsType = "btrfs"; - options = [ "subvol=nixos" ]; + { device = "/dev/disk/by-uuid/f0f39014-5f8e-43b7-ab87-168c6e667be6"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F08B-A699"; + fsType = "vfat"; }; fileSystems."/home" = - { device = "/dev/disk/by-uuid/5f03569f-83a4-45a6-b316-bb792c758ac2"; - fsType = "btrfs"; - options = [ "subvol=home" ]; + { device = "/dev/disk/by-uuid/fc010f8a-c955-4d23-8a37-98338ab81e00"; + fsType = "ext4"; }; fileSystems."/mnt/storage" = @@ -30,15 +33,10 @@ fsType = "ext4"; }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/A649-113E"; - fsType = "vfat"; - }; - swapDevices = - [ { device = "/dev/disk/by-uuid/d3b1291d-2f47-460a-b39b-3aafcd7b1e89"; } + [ { device = "/dev/disk/by-uuid/d6c2d119-73f4-4322-9b55-69406667228b"; } ]; nix.maxJobs = lib.mkDefault 2; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; } diff --git a/networking.nix b/networking.nix index e6f69d0..bc2bbf2 100644 --- a/networking.nix +++ b/networking.nix @@ -8,12 +8,12 @@ nat = { enable = true; - externalInterface = "enp2s0"; + externalInterface = "enp3s0f1"; internalInterfaces = [ "wg0" ]; }; interfaces = { - enp2s0 = { + enp3s0f1 = { ipv4.addresses = [ { address = "10.0.20.28"; prefixLength = 24; @@ -61,7 +61,7 @@ ]; extraCommands = '' - iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o enp2s0 -j MASQUERADE + iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o enp3s0f1 -j MASQUERADE ''; }; }; diff --git a/services.nix b/services.nix index ae0fa66..9ffd245 100644 --- a/services.nix +++ b/services.nix @@ -19,7 +19,47 @@ /mnt/storage 10.0.1.5(rw,nohide,no_root_squash,no_subtree_check) ''; }; + + postgresql = { + enable = true; + port = 5432; + dataDir = "/mnt/storage/srv/postgresql"; + + ensureDatabases = [ "nextcloud" ]; + ensureUsers = [ + { + name = "nextcloud"; + ensurePermissions = { + "DATABASE nextcloud" = "ALL PRIVILEGES"; + }; + }{ + name = "superuser"; + ensurePermissions = { + "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES"; + }; + } + ]; + }; + + nextcloud = { + enable = true; + nginx.enable = true; + home = "/mnt/storage/srv/nextcloud"; + hostName = "nextcloud.0cd.xyz"; + + config = { + adminuser = "michael"; + adminpassFile = "/home/michael/nextcloud/admin_passwd.txt"; + + dbtype = "pgsql"; + dbhost = "/run/postgresql"; + dbname = "nextcloud"; + dbuser = "nextcloud"; + #dbpassFile = "/home/michael/nextcloud/passwd.txt"; + }; + }; }; + /*systemd = { services.ocd = { description = "0cd.xyz-go web server"; diff --git a/users.nix b/users.nix index f9e9abb..ef3d4fc 100644 --- a/users.nix +++ b/users.nix @@ -1,12 +1,19 @@ { config, pkgs, ... }: { - users.users.michael = { - isNormalUser = true; - home = "/home/michael"; - description = "Michael"; - extraGroups = [ "wheel" "michael" ]; - shell = pkgs.zsh; - uid = 1000; + users.users = { + michael = { + isNormalUser = true; + home = "/home/michael"; + description = "Michael"; + extraGroups = [ "wheel" "michael" ]; + shell = pkgs.zsh; + uid = 1000; + }; + + nextcloud = { + isNormalUser = false; + passwordFile = "/home/michael/nextcloud/passwd.txt"; + }; }; }