From f65c35866a57a1860318bd6cef3681b07e68c7c2 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Tue, 27 Aug 2024 20:43:09 +0200 Subject: [PATCH] nixos/services.livebook: remove `with lib;` --- .../modules/services/development/livebook.nix | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/nixos/modules/services/development/livebook.nix b/nixos/modules/services/development/livebook.nix index 859083635201..3861d18e4ab5 100644 --- a/nixos/modules/services/development/livebook.nix +++ b/nixos/modules/services/development/livebook.nix @@ -1,6 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; let cfg = config.services.livebook; in @@ -10,12 +8,12 @@ in # either has access to all the data or none at all), the decision # was made to run this as a user service. If that changes in the # future, this can be changed to a system service. - enableUserService = mkEnableOption "a user service for Livebook"; + enableUserService = lib.mkEnableOption "a user service for Livebook"; - package = mkPackageOption pkgs "livebook" { }; + package = lib.mkPackageOption pkgs "livebook" { }; - environment = mkOption { - type = with types; attrsOf (nullOr (oneOf [ bool int str ])); + environment = lib.mkOption { + type = with lib.types; attrsOf (nullOr (oneOf [ bool int str ])); default = { }; description = '' Environment variables to set. @@ -37,15 +35,15 @@ in variables specified in this option. ''; - example = literalExpression '' + example = lib.literalExpression '' { LIVEBOOK_PORT = 8080; } ''; }; - environmentFile = mkOption { - type = with types; nullOr types.path; + environmentFile = lib.mkOption { + type = with lib.types; nullOr lib.types.path; default = null; description = '' Additional dnvironment file as defined in {manpage}`systemd.exec(5)`. @@ -72,17 +70,17 @@ in example = "/var/lib/livebook.env"; }; - extraPackages = mkOption { - type = with types; listOf package; + extraPackages = lib.mkOption { + type = with lib.types; listOf package; default = [ ]; description = '' Extra packages to make available to the Livebook service. ''; - example = literalExpression "with pkgs; [ gcc gnumake ]"; + example = lib.literalExpression "with pkgs; [ gcc gnumake ]"; }; }; - config = mkIf cfg.enableUserService { + config = lib.mkIf cfg.enableUserService { systemd.user.services.livebook = { serviceConfig = { Restart = "always"; @@ -97,8 +95,8 @@ in # stuck running a `cat /dev/urandom | tr | fold` pipeline. IgnoreSIGPIPE = false; }; - environment = mapAttrs (name: value: - if isBool value then boolToString value else toString value) + environment = lib.mapAttrs (name: value: + if lib.isBool value then lib.boolToString value else toString value) cfg.environment; path = [ pkgs.bash ] ++ cfg.extraPackages; wantedBy = [ "default.target" ];