From 417a9393a6fca2d7f246276cf2a24f7810de8140 Mon Sep 17 00:00:00 2001 From: inexcode Date: Tue, 26 Jul 2022 15:39:59 +0300 Subject: [PATCH] Add volumes --- configuration.nix | 2 +- variables-module.nix | 10 ++++++++++ variables.nix | 1 + volumes.nix | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 volumes.nix diff --git a/configuration.nix b/configuration.nix index d69cc2f..12db91a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: let - url-overlay = "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo/archive/master.tar.gz"; + url-overlay = "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo/archive/graphql.tar.gz"; nix-overlay = (import (builtins.fetchTarball url-overlay)); in { diff --git a/variables-module.nix b/variables-module.nix index 2b0a7ea..0a41a39 100644 --- a/variables-module.nix +++ b/variables-module.nix @@ -163,5 +163,15 @@ in type = types.nullOr (types.listOf (types.attrsOf types.anything)); default = [ ]; }; + ############## + # Volumes # + ############## + volumes = mkOption { + description = '' + Volumes that will be created on the server + ''; + type = types.nullOr (types.listOf (types.attrsOf types.anything)); + default = [ ]; + }; }; } diff --git a/variables.nix b/variables.nix index 32bd57c..a1f2c22 100644 --- a/variables.nix +++ b/variables.nix @@ -45,5 +45,6 @@ in passwordAuthentication = lib.attrsets.attrByPath [ "ssh" "passwordAuthentication" ] true jsonData; }; users = lib.attrsets.attrByPath [ "users" ] [ ] jsonData; + volumes = lib.attrsets.attrByPath [ "volumes" ] [ ] jsonData; }; } diff --git a/volumes.nix b/volumes.nix new file mode 100644 index 0000000..3ab8b2c --- /dev/null +++ b/volumes.nix @@ -0,0 +1,17 @@ +{ pkgs, config, ... }: +let + cfg = config.services.userdata; +in +{ + fileSystems = { + builtins.listToAttrs (builtins.map + (volume: { + name: "${volume.mountPoint}"; + value: { + device = "${volume.device}"; + fsType = "${volume.fsType}"; + }; + }) + cfg.volumes); + } +}