From 097981466ee3279ad2278c36176af6ee2ef374b7 Mon Sep 17 00:00:00 2001 From: derped Date: Sun, 14 Apr 2019 18:35:37 +0200 Subject: [PATCH] Replaced 'builtins.readFile' with 'lib.fileContents'. --- config/nix.nix | 4 ++-- configuration.nix | 3 +-- services/mailserver.nix | 2 +- services/mariaDB.nix | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/config/nix.nix b/config/nix.nix index 53ba475..11774dc 100644 --- a/config/nix.nix +++ b/config/nix.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: { nix = { @@ -9,7 +9,7 @@ extraOptions = '' build-timeout = 86400 # 24 hours ''; - binaryCachePublicKeys = [ (builtins.readFile /secret/hydra_cache.pub) ]; + binaryCachePublicKeys = [ (lib.fileContents /secret/hydra_cache.pub) ]; trustedBinaryCaches = [ "https://cache.nixos.org" "https://cache.ophanim.de" diff --git a/configuration.nix b/configuration.nix index ec382c3..3f0093b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,9 +2,8 @@ with lib; -# hint: use 'echo -n' so there is no newline char in the hostName file let - machinePath = (builtins.toPath ("/etc/nixos/machines/" + (builtins.readFile /secret/hostName))); + machinePath = (builtins.toPath ("/etc/nixos/machines/" + (fileContents /secret/hostName))); machineConf = machinePath + "/configuration.nix"; machineOpts = machinePath + "/options.nix"; in { diff --git a/services/mailserver.nix b/services/mailserver.nix index 54ca0f0..5b960b3 100644 --- a/services/mailserver.nix +++ b/services/mailserver.nix @@ -9,7 +9,7 @@ mkIf (elem "mailserver" config.machine.services) { domains = [ config.machine.domain ]; loginAccounts = { "derped@${config.machine.domain}" = { - hashedPassword = (builtins.readFile /secret/derped.mail); + hashedPassword = (fileContents /secret/derped.mail); }; }; # Use Let's Encrypt certificates. Note that this needs to set up a stripped diff --git a/services/mariaDB.nix b/services/mariaDB.nix index f5c4c81..3015d85 100644 --- a/services/mariaDB.nix +++ b/services/mariaDB.nix @@ -3,7 +3,7 @@ with lib; let - giteapwd = if config.services.gitea.enable then (builtins.readFile /secret/gitea) else ""; + giteapwd = if config.services.gitea.enable then (fileContents /secret/gitea) else ""; in mkIf (elem "mariaDB" config.machine.services) { services.mysql = { enable = true;