diff --git a/overlays/default.nix b/overlays/default.nix index fe4ab47..39265ff 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -8,4 +8,15 @@ self: super: hash = "sha256-oX5EeK0+rEsMvJ+3vg26J1g5O6LTtqgrMHT/BTWGxfU="; }; }); + + vscode-extensions = self.lib.recursiveUpdate super.vscode-extensions { + dzhavat.bracket-pair-toggler = self.vscode-utils.extensionFromVscodeMarketplace { + name = "bracket-pair-toggler"; + publisher = "dzhavat"; + version = "0.0.2"; + sha256 = "sha256-2u+bdXU9nU1C8X3hpi7FfI2en4mlgWRPIVzcZrgGzPo="; + }; + }; + + protoc-gen-openapiv2 = super.callPackage ./protoc-gen-openapiv2 { }; } diff --git a/overlays/protoc-gen-openapiv2/default.nix b/overlays/protoc-gen-openapiv2/default.nix new file mode 100644 index 0000000..29abaa3 --- /dev/null +++ b/overlays/protoc-gen-openapiv2/default.nix @@ -0,0 +1,24 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "protoc-gen-openapiv2"; + version = "2.12.0"; + + src = fetchFromGitHub { + owner = "grpc-ecosystem"; + repo = "grpc-gateway"; + rev = "v${version}"; + sha256 = "sha256-OthyGEMVQnK0jN9svlfAZUl52lt19jtLd1Oj3cuirx4="; + }; + + vendorSha256 = "sha256-UjwpFjHVaQT4irhbt2GGlYeNhDs9Dv73PcHKhMrQfQs="; + + subPackages = [ "protoc-gen-openapiv2" ]; + + meta = with lib; { + description = "OpenAPI v2 support for Google's protocol buffers"; + homepage = "https://grpc-ecosystem.github.io/grpc-gateway/"; + license = licenses.bsd3; + maintainers = with maintainers; [ tboerger ]; + }; +} diff --git a/profiles/thomas/programs/vscode.nix b/profiles/thomas/programs/vscode.nix index 172236c..ffd5a09 100644 --- a/profiles/thomas/programs/vscode.nix +++ b/profiles/thomas/programs/vscode.nix @@ -38,7 +38,7 @@ in }; extensions = with pkgs.vscode-extensions; [ - coenraads.bracket-pair-colorizer-2 + dzhavat.bracket-pair-toggler editorconfig.editorconfig golang.go hashicorp.terraform diff --git a/scripts/niflheim-partitions b/scripts/niflheim-partitions index 8453dd5..a9a3f25 100755 --- a/scripts/niflheim-partitions +++ b/scripts/niflheim-partitions @@ -33,21 +33,21 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d" done echo "----> Drop existing partitions" -sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-1.0 -sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-1.0 -sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-2.0 -sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-2.0 -# sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 -# sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 -# sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 -# sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 +sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 +sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 +sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 +sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 +sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-5.0 +sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-5.0 +sgdisk --zap-all /dev/disk/by-path/pci-0000:00:1f.2-ata-6.0 +sgdisk -og /dev/disk/by-path/pci-0000:00:1f.2-ata-6.0 echo "-----> Wait for cleanup" sleep 3 sync echo "-----> Create sda partitions" -parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-1.0 \ +parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 \ mklabel gpt \ mkpart primary fat32 0% 1GiB \ mkpart primary 1GiB 100% \ @@ -57,7 +57,7 @@ parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-1.0 \ name 2 tank1 echo "-----> Create sdb partitions" -parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-2.0 \ +parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 \ mklabel gpt \ mkpart primary fat32 0% 1GiB \ mkpart primary 1GiB 100% \ @@ -66,35 +66,38 @@ parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-2.0 \ set 2 lvm on \ name 2 tank2 -echo "-----> Create raid1 volume" -echo yes | mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/disk/by-partlabel/tank1 /dev/disk/by-partlabel/tank2 +echo "-----> Create sdc partitions" +parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-5.0 \ + mklabel gpt \ + mkpart primary fat32 0% 1GiB \ + mkpart primary 1GiB 100% \ + set 1 esp on \ + name 1 boot3 \ + set 2 lvm on \ + name 2 tank3 -# echo "-----> Create sdc partitions" -# parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 \ -# mklabel gpt \ -# mkpart primary 0 100% \ -# set 1 lvm on \ -# name 1 tank3 +echo "-----> Create sdd partitions" +parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-6.0 \ + mklabel gpt \ + mkpart primary fat32 0% 1GiB \ + mkpart primary 1GiB 100% \ + set 1 esp on \ + name 1 boot4 \ + set 2 lvm on \ + name 2 tank4 -# echo "-----> Create sdd partitions" -# parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 \ -# mklabel gpt \ -# mkpart primary 0 100% \ -# set 1 lvm on \ -# name 1 tank4 - -# echo "-----> Create raid2 volume" -# echo yes | mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4 +echo "-----> Create raid10 volume" +echo yes | mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/disk/by-partlabel/tank1 /dev/disk/by-partlabel/tank2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4 echo "-----> Wait for partitions" sleep 3 sync echo "-----> Create data pv" -pvcreate /dev/md0 # /dev/md1 +pvcreate /dev/md0 echo "-----> Create data vg" -vgcreate system /dev/md0 # /dev/md1 +vgcreate system /dev/md0 echo "-----> Create swap volume" lvcreate -y --size $(cat /proc/meminfo | grep MemTotal | cut -d':' -f2 | sed 's/ //g') --name swap system @@ -139,3 +142,43 @@ mkfs.vfat -F32 -n boot1 /dev/disk/by-partlabel/boot1 echo "-----> Mount boot filesystem" mkdir -p /mnt/boot mount /dev/disk/by-label/boot1 /mnt/boot + +echo "-----> Create movies volume" +lvcreate -y --size 2000G --name movies system + +echo "-----> Create movies filesystem" +mkfs.ext4 -L movies /dev/system/movies + +echo "-----> Mount movies filesystem" +mkdir -p /mnt/var/lib/movies +mount -t ext4 /dev/system/movies /mnt/var/lib/movies + +echo "-----> Create shows volume" +lvcreate -y --size 2000G --name shows system + +echo "-----> Create shows filesystem" +mkfs.ext4 -L shows /dev/system/shows + +echo "-----> Mount shows filesystem" +mkdir -p /mnt/var/lib/shows +mount -t ext4 /dev/system/shows /mnt/var/lib/shows + +echo "-----> Create books volume" +lvcreate -y --size 100G --name books system + +echo "-----> Create books filesystem" +mkfs.ext4 -L books /dev/system/books + +echo "-----> Mount books filesystem" +mkdir -p /mnt/var/lib/books +mount -t ext4 /dev/system/books /mnt/var/lib/books + +echo "-----> Create music volume" +lvcreate -y --size 100G --name music system + +echo "-----> Create music filesystem" +mkfs.ext4 -L music /dev/system/music + +echo "-----> Mount music filesystem" +mkdir -p /mnt/var/lib/music +mount -t ext4 /dev/system/music /mnt/var/lib/music diff --git a/servers/niflheim/default.nix b/servers/niflheim/default.nix index 329cde6..2a3370b 100644 --- a/servers/niflheim/default.nix +++ b/servers/niflheim/default.nix @@ -14,21 +14,6 @@ personal = { services = { - authentik = { - enable = config.personal.services.enable; - }; - dst = { - enable = config.personal.services.enable; - }; - mediang = { - enable = config.personal.services.enable; - }; - minecraft = { - enable = config.personal.services.enable; - }; - owncloud = { - enable = config.personal.services.enable; - }; tailscale = { enable = config.personal.services.enable; }; diff --git a/shared/services/default.nix b/shared/services/default.nix index 16778d4..553b6b6 100644 --- a/shared/services/default.nix +++ b/shared/services/default.nix @@ -16,9 +16,9 @@ with lib; ./media ./mediang ./minecraft + ./nextcloud ./nixbuild ./openssh - ./owncloud ./shares ./tailscale ./timesyncd diff --git a/shared/services/nextcloud/arion.nix b/shared/services/nextcloud/arion.nix new file mode 100644 index 0000000..171602b --- /dev/null +++ b/shared/services/nextcloud/arion.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, config, options, ... }: + +{ + config = { + services = { + nextcloud = { + nixos = { + configuration = { + services = { + nextcloud = { + enable = true; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/shared/services/nextcloud/default.nix b/shared/services/nextcloud/default.nix new file mode 100644 index 0000000..3972a85 --- /dev/null +++ b/shared/services/nextcloud/default.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, config, options, fetchurl, ... }: +with lib; + +let + cfg = config.personal.services.nextcloud; + +in +{ + options = { + personal = { + services = { + nextcloud = { + enable = mkEnableOption "Nextcloud"; + }; + }; + }; + }; + + config = mkIf cfg.enable { + virtualisation.arion.projects.prometheus.settings = { + imports = [ + (import ./arion.nix) + ]; + }; + }; +} diff --git a/shared/services/owncloud/arion.nix b/shared/services/owncloud/arion.nix deleted file mode 100644 index cb1c80d..0000000 --- a/shared/services/owncloud/arion.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, lib, config, options, ... }: -with lib; - -{ } diff --git a/shared/services/owncloud/default.nix b/shared/services/owncloud/default.nix deleted file mode 100644 index ed56f78..0000000 --- a/shared/services/owncloud/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, lib, config, options, fetchurl, ... }: -with lib; - -let - cfg = config.personal.services.owncloud; - -in -{ - options = { - personal = { - services = { - owncloud = { - enable = mkEnableOption "ownCloud"; - }; - }; - }; - }; - - config = mkIf cfg.enable { }; -}