diff options
author | Mathijs Kwik <mathijs@bluescreen303.nl> | 2013-01-01 14:42:43 +0100 |
---|---|---|
committer | Mathijs Kwik <mathijs@bluescreen303.nl> | 2013-01-01 14:53:54 +0100 |
commit | ebf48167174a2f3d80560f9a55750e7f304499a2 (patch) | |
tree | 37c4f1e0344298d4d0f8f43c2f6925cfa9a7c66e /modules/system/boot/systemd.nix | |
parent | 16a9bcfe815a9fe72c41348b4231c619e11da610 (diff) | |
download | nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.tar nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.tar.gz nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.tar.bz2 nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.tar.lz nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.tar.xz nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.tar.zst nixpkgs-ebf48167174a2f3d80560f9a55750e7f304499a2.zip |
systemd mount units: use 'escapeSystemdPath' from lib/utils
Diffstat (limited to 'modules/system/boot/systemd.nix')
-rw-r--r-- | modules/system/boot/systemd.nix | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index fbd28e6e836..f0e94266b17 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -1,6 +1,7 @@ -{ config, pkgs, ... }: +{ config, pkgs, utils, ... }: with pkgs.lib; +with utils; with import ./systemd-unit-options.nix { inherit config pkgs; }; let @@ -290,15 +291,6 @@ let ''; }; - # this is by no means the full escaping-logic systemd uses - # so feel free to extend this further. - mountName = path: - let escaped = replaceChars [ "-" " " "/" ] - [ "\x2d" "\x20" "-" ] (toString path); - in if (substring 0 1 escaped == "-") - then substring 1 (sub (stringLength escaped) 1) escaped - else escaped; - mountToUnit = name: def: assert def.mountConfig.What != ""; assert def.mountConfig.Where != ""; @@ -550,7 +542,7 @@ in // mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.services // mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.sockets // listToAttrs (map - (v: let n = mountName v.where; + (v: let n = escapeSystemdPath v.where; in nameValuePair "${n}.mount" (mountToUnit n v)) cfg.mounts); system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled [ |