···30 Whether to run the exporter as the local 'postgres' super user.
31 '';
32 };
00000000000000000000000000000000000033 };
34 serviceOpts = {
35 environment.DATA_SOURCE_NAME = cfg.dataSourceName;
36 serviceConfig = {
37 DynamicUser = false;
38 User = mkIf cfg.runAsLocalSuperUser (mkForce "postgres");
039 ExecStart = ''
40 ${pkgs.prometheus-postgres-exporter}/bin/postgres_exporter \
41 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
···30 Whether to run the exporter as the local 'postgres' super user.
31 '';
32 };
33+34+ # TODO perhaps LoadCredential would be more appropriate
35+ environmentFile = mkOption {
36+ type = types.nullOr types.path;
37+ default = null;
38+ example = "/root/prometheus-postgres-exporter.env";
39+ description = ''
40+ Environment file as defined in <citerefentry>
41+ <refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum>
42+ </citerefentry>.
43+44+ Secrets may be passed to the service without adding them to the
45+ world-readable Nix store, by specifying placeholder variables as
46+ the option value in Nix and setting these variables accordingly in the
47+ environment file.
48+49+ Environment variables from this file will be interpolated into the
50+ config file using envsubst with this syntax:
51+ <literal>$ENVIRONMENT ''${VARIABLE}</literal>
52+53+ The main use is to set the DATA_SOURCE_NAME that contains the
54+ postgres password
55+56+ note that contents from this file will override dataSourceName
57+ if you have set it from nix.
58+59+ <programlisting>
60+ # Content of the environment file
61+ DATA_SOURCE_NAME=postgresql://username:password@localhost:5432/postgres?sslmode=disable
62+ </programlisting>
63+64+ Note that this file needs to be available on the host on which
65+ this exporter is running.
66+ '';
67+ };
68+69 };
70 serviceOpts = {
71 environment.DATA_SOURCE_NAME = cfg.dataSourceName;
72 serviceConfig = {
73 DynamicUser = false;
74 User = mkIf cfg.runAsLocalSuperUser (mkForce "postgres");
75+ EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
76 ExecStart = ''
77 ${pkgs.prometheus-postgres-exporter}/bin/postgres_exporter \
78 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
···1+{ config, lib, pkgs, ... }:
2+3+with lib;
4+5+let
6+ cfg = config.services.bookstack;
7+ bookstack = pkgs.bookstack.override {
8+ dataDir = cfg.dataDir;
9+ };
10+ db = cfg.database;
11+ mail = cfg.mail;
12+13+ user = cfg.user;
14+ group = cfg.group;
15+16+ # shell script for local administration
17+ artisan = pkgs.writeScriptBin "bookstack" ''
18+ #! ${pkgs.runtimeShell}
19+ cd ${bookstack}
20+ sudo=exec
21+ if [[ "$USER" != ${user} ]]; then
22+ sudo='exec /run/wrappers/bin/sudo -u ${user}'
23+ fi
24+ $sudo ${pkgs.php}/bin/php artisan $*
25+ '';
26+27+28+in {
29+ options.services.bookstack = {
30+31+ enable = mkEnableOption "BookStack";
32+33+ user = mkOption {
34+ default = "bookstack";
35+ description = "User bookstack runs as.";
36+ type = types.str;
37+ };
38+39+ group = mkOption {
40+ default = "bookstack";
41+ description = "Group bookstack runs as.";
42+ type = types.str;
43+ };
44+45+ appKeyFile = mkOption {
46+ description = ''
47+ A file containing the AppKey.
48+ Used for encryption where needed. Can be generated with <code>head -c 32 /dev/urandom| base64</code> and must be prefixed with <literal>base64:</literal>.
49+ '';
50+ example = "/run/keys/bookstack-appkey";
51+ type = types.path;
52+ };
53+54+ appURL = mkOption {
55+ description = ''
56+ The root URL that you want to host BookStack on. All URLs in BookStack will be generated using this value.
57+ If you change this in the future you may need to run a command to update stored URLs in the database. Command example: <code>php artisan bookstack:update-url https://old.example.com https://new.example.com</code>
58+ '';
59+ example = "https://example.com";
60+ type = types.str;
61+ };
62+63+ cacheDir = mkOption {
64+ description = "BookStack cache directory";
65+ default = "/var/cache/bookstack";
66+ type = types.path;
67+ };
68+69+ dataDir = mkOption {
70+ description = "BookStack data directory";
71+ default = "/var/lib/bookstack";
72+ type = types.path;
73+ };
74+75+ database = {
76+ host = mkOption {
77+ type = types.str;
78+ default = "localhost";
79+ description = "Database host address.";
80+ };
81+ port = mkOption {
82+ type = types.port;
83+ default = 3306;
84+ description = "Database host port.";
85+ };
86+ name = mkOption {
87+ type = types.str;
88+ default = "bookstack";
89+ description = "Database name.";
90+ };
91+ user = mkOption {
92+ type = types.str;
93+ default = user;
94+ defaultText = "\${user}";
95+ description = "Database username.";
96+ };
97+ passwordFile = mkOption {
98+ type = with types; nullOr path;
99+ default = null;
100+ example = "/run/keys/bookstack-dbpassword";
101+ description = ''
102+ A file containing the password corresponding to
103+ <option>database.user</option>.
104+ '';
105+ };
106+ createLocally = mkOption {
107+ type = types.bool;
108+ default = false;
109+ description = "Create the database and database user locally.";
110+ };
111+ };
112+113+ mail = {
114+ driver = mkOption {
115+ type = types.enum [ "smtp" "sendmail" ];
116+ default = "smtp";
117+ description = "Mail driver to use.";
118+ };
119+ host = mkOption {
120+ type = types.str;
121+ default = "localhost";
122+ description = "Mail host address.";
123+ };
124+ port = mkOption {
125+ type = types.port;
126+ default = 1025;
127+ description = "Mail host port.";
128+ };
129+ fromName = mkOption {
130+ type = types.str;
131+ default = "BookStack";
132+ description = "Mail \"from\" name.";
133+ };
134+ from = mkOption {
135+ type = types.str;
136+ default = "mail@bookstackapp.com";
137+ description = "Mail \"from\" email.";
138+ };
139+ user = mkOption {
140+ type = with types; nullOr str;
141+ default = null;
142+ example = "bookstack";
143+ description = "Mail username.";
144+ };
145+ passwordFile = mkOption {
146+ type = with types; nullOr path;
147+ default = null;
148+ example = "/run/keys/bookstack-mailpassword";
149+ description = ''
150+ A file containing the password corresponding to
151+ <option>mail.user</option>.
152+ '';
153+ };
154+ encryption = mkOption {
155+ type = with types; nullOr (enum [ "tls" ]);
156+ default = null;
157+ description = "SMTP encryption mechanism to use.";
158+ };
159+ };
160+161+ maxUploadSize = mkOption {
162+ type = types.str;
163+ default = "18M";
164+ example = "1G";
165+ description = "The maximum size for uploads (e.g. images).";
166+ };
167+168+ poolConfig = mkOption {
169+ type = with types; attrsOf (oneOf [ str int bool ]);
170+ default = {
171+ "pm" = "dynamic";
172+ "pm.max_children" = 32;
173+ "pm.start_servers" = 2;
174+ "pm.min_spare_servers" = 2;
175+ "pm.max_spare_servers" = 4;
176+ "pm.max_requests" = 500;
177+ };
178+ description = ''
179+ Options for the bookstack PHP pool. See the documentation on <literal>php-fpm.conf</literal>
180+ for details on configuration directives.
181+ '';
182+ };
183+184+ nginx = mkOption {
185+ type = types.submodule (
186+ recursiveUpdate
187+ (import ../web-servers/nginx/vhost-options.nix { inherit config lib; }) {}
188+ );
189+ default = {};
190+ example = {
191+ serverAliases = [
192+ "bookstack.\${config.networking.domain}"
193+ ];
194+ # To enable encryption and let let's encrypt take care of certificate
195+ forceSSL = true;
196+ enableACME = true;
197+ };
198+ description = ''
199+ With this option, you can customize the nginx virtualHost settings.
200+ '';
201+ };
202+203+ extraConfig = mkOption {
204+ type = types.nullOr types.lines;
205+ default = null;
206+ example = ''
207+ ALLOWED_IFRAME_HOSTS="https://example.com"
208+ WKHTMLTOPDF=/home/user/bins/wkhtmltopdf
209+ '';
210+ description = ''
211+ Lines to be appended verbatim to the BookStack configuration.
212+ Refer to <link xlink:href="https://www.bookstackapp.com/docs/"/> for details on supported values.
213+ '';
214+ };
215+216+ };
217+218+ config = mkIf cfg.enable {
219+220+ assertions = [
221+ { assertion = db.createLocally -> db.user == user;
222+ message = "services.bookstack.database.user must be set to ${user} if services.mediawiki.database.createLocally is set true.";
223+ }
224+ { assertion = db.createLocally -> db.passwordFile == null;
225+ message = "services.bookstack.database.passwordFile cannot be specified if services.bookstack.database.createLocally is set to true.";
226+ }
227+ ];
228+229+ environment.systemPackages = [ artisan ];
230+231+ services.mysql = mkIf db.createLocally {
232+ enable = true;
233+ package = mkDefault pkgs.mariadb;
234+ ensureDatabases = [ db.name ];
235+ ensureUsers = [
236+ { name = db.user;
237+ ensurePermissions = { "${db.name}.*" = "ALL PRIVILEGES"; };
238+ }
239+ ];
240+ };
241+242+ services.phpfpm.pools.bookstack = {
243+ inherit user;
244+ inherit group;
245+ phpOptions = ''
246+ log_errors = on
247+ post_max_size = ${cfg.maxUploadSize}
248+ upload_max_filesize = ${cfg.maxUploadSize}
249+ '';
250+ settings = {
251+ "listen.mode" = "0660";
252+ "listen.owner" = user;
253+ "listen.group" = group;
254+ } // cfg.poolConfig;
255+ };
256+257+ services.nginx = {
258+ enable = mkDefault true;
259+ virtualHosts.bookstack = mkMerge [ cfg.nginx {
260+ root = mkForce "${bookstack}/public";
261+ extraConfig = optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "fastcgi_param HTTPS on;";
262+ locations = {
263+ "/" = {
264+ index = "index.php";
265+ extraConfig = ''try_files $uri $uri/ /index.php?$query_string;'';
266+ };
267+ "~ \.php$" = {
268+ extraConfig = ''
269+ try_files $uri $uri/ /index.php?$query_string;
270+ include ${pkgs.nginx}/conf/fastcgi_params;
271+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
272+ fastcgi_param REDIRECT_STATUS 200;
273+ fastcgi_pass unix:${config.services.phpfpm.pools."bookstack".socket};
274+ ${optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "fastcgi_param HTTPS on;"}
275+ '';
276+ };
277+ "~ \.(js|css|gif|png|ico|jpg|jpeg)$" = {
278+ extraConfig = "expires 365d;";
279+ };
280+ };
281+ }];
282+ };
283+284+ systemd.services.bookstack-setup = {
285+ description = "Preperation tasks for BookStack";
286+ before = [ "phpfpm-bookstack.service" ];
287+ after = optional db.createLocally "mysql.service";
288+ wantedBy = [ "multi-user.target" ];
289+ serviceConfig = {
290+ Type = "oneshot";
291+ User = user;
292+ WorkingDirectory = "${bookstack}";
293+ };
294+ script = ''
295+ # create .env file
296+ echo "
297+ APP_KEY=base64:$(head -n1 ${cfg.appKeyFile})
298+ APP_URL=${cfg.appURL}
299+ DB_HOST=${db.host}
300+ DB_PORT=${toString db.port}
301+ DB_DATABASE=${db.name}
302+ DB_USERNAME=${db.user}
303+ MAIL_DRIVER=${mail.driver}
304+ MAIL_FROM_NAME=\"${mail.fromName}\"
305+ MAIL_FROM=${mail.from}
306+ MAIL_HOST=${mail.host}
307+ MAIL_PORT=${toString mail.port}
308+ ${optionalString (mail.user != null) "MAIL_USERNAME=${mail.user};"}
309+ ${optionalString (mail.encryption != null) "MAIL_ENCRYPTION=${mail.encryption};"}
310+ ${optionalString (db.passwordFile != null) "DB_PASSWORD=$(head -n1 ${db.passwordFile})"}
311+ ${optionalString (mail.passwordFile != null) "MAIL_PASSWORD=$(head -n1 ${mail.passwordFile})"}
312+ APP_SERVICES_CACHE=${cfg.cacheDir}/services.php
313+ APP_PACKAGES_CACHE=${cfg.cacheDir}/packages.php
314+ APP_CONFIG_CACHE=${cfg.cacheDir}/config.php
315+ APP_ROUTES_CACHE=${cfg.cacheDir}/routes-v7.php
316+ APP_EVENTS_CACHE=${cfg.cacheDir}/events.php
317+ ${optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "SESSION_SECURE_COOKIE=true"}
318+ ${toString cfg.extraConfig}
319+ " > "${cfg.dataDir}/.env"
320+ # set permissions
321+ chmod 700 "${cfg.dataDir}/.env"
322+323+ # migrate db
324+ ${pkgs.php}/bin/php artisan migrate --force
325+326+ # create caches
327+ ${pkgs.php}/bin/php artisan config:cache
328+ ${pkgs.php}/bin/php artisan route:cache
329+ ${pkgs.php}/bin/php artisan view:cache
330+ '';
331+ };
332+333+ systemd.tmpfiles.rules = [
334+ "d ${cfg.cacheDir} 0700 ${user} ${group} - -"
335+ "d ${cfg.dataDir} 0710 ${user} ${group} - -"
336+ "d ${cfg.dataDir}/public 0750 ${user} ${group} - -"
337+ "d ${cfg.dataDir}/public/uploads 0750 ${user} ${group} - -"
338+ "d ${cfg.dataDir}/storage 0700 ${user} ${group} - -"
339+ "d ${cfg.dataDir}/storage/app 0700 ${user} ${group} - -"
340+ "d ${cfg.dataDir}/storage/fonts 0700 ${user} ${group} - -"
341+ "d ${cfg.dataDir}/storage/framework 0700 ${user} ${group} - -"
342+ "d ${cfg.dataDir}/storage/framework/cache 0700 ${user} ${group} - -"
343+ "d ${cfg.dataDir}/storage/framework/sessions 0700 ${user} ${group} - -"
344+ "d ${cfg.dataDir}/storage/framework/views 0700 ${user} ${group} - -"
345+ "d ${cfg.dataDir}/storage/logs 0700 ${user} ${group} - -"
346+ "d ${cfg.dataDir}/storage/uploads 0700 ${user} ${group} - -"
347+ ];
348+349+ users = {
350+ users = mkIf (user == "bookstack") {
351+ bookstack = {
352+ inherit group;
353+ isSystemUser = true;
354+ };
355+ "${config.services.nginx.user}".extraGroups = [ group ];
356+ };
357+ groups = mkIf (group == "bookstack") {
358+ bookstack = {};
359+ };
360+ };
361+362+ };
363+364+ meta.maintainers = with maintainers; [ ymarkus ];
365+}
+12-1
nixos/modules/system/boot/systemd-lib.nix
···182 # upstream unit.
183 for i in ${toString (mapAttrsToList (n: v: v.unit) units)}; do
184 fn=$(basename $i/*)
185- if [ -e $out/$fn ]; then
00000000000186 if [ "$(readlink -f $i/$fn)" = /dev/null ]; then
187 ln -sfn /dev/null $out/$fn
188 else
···182 # upstream unit.
183 for i in ${toString (mapAttrsToList (n: v: v.unit) units)}; do
184 fn=$(basename $i/*)
185+186+ case $fn in
187+ # if file name is a template specialization, use the template's name
188+ *@?*.service)
189+ # remove @foo.service and replace it with @.service
190+ ofn="''${fn%@*.service}@.service"
191+ ;;
192+ *)
193+ ofn="$fn"
194+ esac
195+196+ if [ -e $out/$ofn ]; then
197 if [ "$(readlink -f $i/$fn)" = /dev/null ]; then
198 ln -sfn /dev/null $out/$fn
199 else
···82 echo "Adding runtime dependencies to RPATH of Node module $mod"
83 patchelf --set-rpath "$runtime_rpath:$mod_rpath" "$mod"
84 done;
0000085 '';
8687 meta = with lib; {
···82 echo "Adding runtime dependencies to RPATH of Node module $mod"
83 patchelf --set-rpath "$runtime_rpath:$mod_rpath" "$mod"
84 done;
85+86+ # fix for https://docs.microsoft.com/en-us/answers/questions/298724/open-teams-meeting-link-on-linux-doens39t-work.html?childToView=309406#comment-309406
87+ # while we create the wrapper ourselves, gappsWrapperArgs leads to the same issue
88+ # another option would be to introduce gappsWrapperAppendedArgs, to allow control of positioning
89+ substituteInPlace "$out/bin/teams" --replace '.teams-wrapped" --disable-namespace-sandbox --disable-setuid-sandbox "$@"' '.teams-wrapped" "$@" --disable-namespace-sandbox --disable-setuid-sandbox'
90 '';
9192 meta = with lib; {
···85 description = "A completely decentralised P2P filesharing client based on the Bittorrent protocol";
86 license = licenses.lgpl21;
87 platforms = platforms.linux;
088 };
89}
···85 description = "A completely decentralised P2P filesharing client based on the Bittorrent protocol";
86 license = licenses.lgpl21;
87 platforms = platforms.linux;
88+ broken = true; # 2021-03-17 see https://github.com/NixOS/nixpkgs/issues/93053
89 };
90}
+3-3
pkgs/applications/networking/pcloud/default.nix
···21 # Runtime dependencies;
22 # A few additional ones (e.g. Node) are already shipped together with the
23 # AppImage, so we don't have to duplicate them here.
24- alsaLib, dbus-glib, fuse, gnome3, libdbusmenu-gtk2, udev, nss
25}:
2627let
···56 alsaLib
57 dbus-glib
58 fuse
59- gnome3.gtk
60 libdbusmenu-gtk2
61 nss
62 udev
···9293 # This is required for the file picker dialog - otherwise pcloud just
94 # crashes
95- export XDG_DATA_DIRS="${gnome3.gsettings-desktop-schemas}/share/gsettings-schemas/${gnome3.gsettings-desktop-schemas.name}:${gnome3.gtk}/share/gsettings-schemas/${gnome3.gtk.name}:$XDG_DATA_DIRS"
9697 exec "$out/app/pcloud"
98 EOF
···21 # Runtime dependencies;
22 # A few additional ones (e.g. Node) are already shipped together with the
23 # AppImage, so we don't have to duplicate them here.
24+ alsaLib, dbus-glib, fuse, gnome3, gtk3, libdbusmenu-gtk2, udev, nss
25}:
2627let
···56 alsaLib
57 dbus-glib
58 fuse
59+ gtk3
60 libdbusmenu-gtk2
61 nss
62 udev
···9293 # This is required for the file picker dialog - otherwise pcloud just
94 # crashes
95+ export XDG_DATA_DIRS="${gnome3.gsettings-desktop-schemas}/share/gsettings-schemas/${gnome3.gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS"
9697 exec "$out/app/pcloud"
98 EOF
···1+{ lib
2+, stdenv
3+, fetchFromGitHub
4+, cmake
5+, pkg-config
6+}:
7+8+stdenv.mkDerivation rec {
9+ pname = "md4c";
10+ version = "0.4.7";
11+12+ src = fetchFromGitHub {
13+ owner = "mity";
14+ repo = pname;
15+ rev = "release-${version}";
16+ hash = "sha256-nfMXUP1wu3ifn1QVTO/+XcfFRsThG8PlmYRv+b8AYlQ=";
17+ };
18+19+ nativeBuildInputs = [
20+ cmake
21+ pkg-config
22+ ];
23+24+ meta = with lib; {
25+ homepage = "https://github.com/mity/md4c";
26+ description = "Markdown parser made in C";
27+ longDescription = ''
28+ MD4C is Markdown parser implementation in C, with the following features:
29+30+ - Compliance: Generally, MD4C aims to be compliant to the latest version
31+ of CommonMark specification. Currently, we are fully compliant to
32+ CommonMark 0.29.
33+ - Extensions: MD4C supports some commonly requested and accepted
34+ extensions. See below.
35+ - Performance: MD4C is very fast.
36+ - Compactness: MD4C parser is implemented in one source file and one
37+ header file. There are no dependencies other than standard C library.
38+ - Embedding: MD4C parser is easy to reuse in other projects, its API is
39+ very straightforward: There is actually just one function, md_parse().
40+ - Push model: MD4C parses the complete document and calls few callback
41+ functions provided by the application to inform it about a start/end of
42+ every block, a start/end of every span, and with any textual contents.
43+ - Portability: MD4C builds and works on Windows and POSIX-compliant
44+ OSes. (It should be simple to make it run also on most other platforms,
45+ at least as long as the platform provides C standard library, including
46+ a heap memory management.)
47+ - Encoding: MD4C by default expects UTF-8 encoding of the input
48+ document. But it can be compiled to recognize ASCII-only control
49+ characters (i.e. to disable all Unicode-specific code), or (on Windows)
50+ to expect UTF-16 (i.e. what is on Windows commonly called just
51+ "Unicode"). See more details below.
52+ - Permissive license: MD4C is available under the MIT license.
53+ '';
54+ license = licenses.mit;
55+ maintainers = with maintainers; [ AndersonTorres ];
56+ platforms = platforms.all;
57+ };
58+}
59+# TODO: enable tests (needs Python)
···8, cudatoolkit
9, fetchurl
10, addOpenGLRunpath
0000000011}:
1213stdenv.mkDerivation {
···23 nativeBuildInputs = [ addOpenGLRunpath ];
2425 installPhase = ''
0026 function fixRunPath {
27 p=$(patchelf --print-rpath $1)
28 patchelf --set-rpath "''${p:+$p:}${lib.makeLibraryPath [ stdenv.cc.cc ]}:\$ORIGIN/" $1
···35 mkdir -p $out
36 cp -a include $out/include
37 cp -a lib64 $out/lib64
000038 '';
3940 # Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
···8, cudatoolkit
9, fetchurl
10, addOpenGLRunpath
11+, # The distributed version of CUDNN includes both dynamically liked .so files,
12+ # as well as statically linked .a files. However, CUDNN is quite large
13+ # (multiple gigabytes), so you can save some space in your nix store by
14+ # removing the statically linked libraries if you are not using them.
15+ #
16+ # Setting this to true removes the statically linked .a files.
17+ # Setting this to false keeps these statically linked .a files.
18+ removeStatic ? false
19}:
2021stdenv.mkDerivation {
···31 nativeBuildInputs = [ addOpenGLRunpath ];
3233 installPhase = ''
34+ runHook preInstall
35+36 function fixRunPath {
37 p=$(patchelf --print-rpath $1)
38 patchelf --set-rpath "''${p:+$p:}${lib.makeLibraryPath [ stdenv.cc.cc ]}:\$ORIGIN/" $1
···45 mkdir -p $out
46 cp -a include $out/include
47 cp -a lib64 $out/lib64
48+ '' + lib.optionalString removeStatic ''
49+ rm -f $out/lib64/*.a
50+ '' + ''
51+ runHook postInstall
52 '';
5354 # Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
···1+{ lib
2+, buildPythonPackage
3+, fetchPypi
4+, nose
5+}:
67buildPythonPackage rec {
8 pname = "yapf";
9+ version = "0.31.0";
1011 src = fetchPypi {
12 inherit pname version;
13+ hash = "sha256-QI+5orJUwwL0nbg8WfmqC0sP0OwlvjpcURgTJ5Iv9j0=";
14 };
1516+ checkInputs = [
17+ nose
18+ ];
19+20 meta = with lib; {
21+ homepage = "https://github.com/google/yapf";
22+ description = "Yet Another Python Formatter";
23+ longDescription = ''
24+ Most of the current formatters for Python --- e.g., autopep8, and pep8ify
25+ --- are made to remove lint errors from code. This has some obvious
26+ limitations. For instance, code that conforms to the PEP 8 guidelines may
27+ not be reformatted. But it doesn't mean that the code looks good.
28+29+ YAPF takes a different approach. It's based off of 'clang-format',
30+ developed by Daniel Jasper. In essence, the algorithm takes the code and
31+ reformats it to the best formatting that conforms to the style guide, even
32+ if the original code didn't violate the style guide. The idea is also
33+ similar to the 'gofmt' tool for the Go programming language: end all holy
34+ wars about formatting - if the whole codebase of a project is simply piped
35+ through YAPF whenever modifications are made, the style remains consistent
36+ throughout the project and there's no point arguing about style in every
37+ code review.
38+39+ The ultimate goal is that the code YAPF produces is as good as the code
40+ that a programmer would write if they were following the style guide. It
41+ takes away some of the drudgery of maintaining your code.
42+ '';
43+ license = licenses.asl20;
44+ maintainers = with maintainers; [ AndersonTorres siddharthist ];
45 };
046}
···1-{ lib, stdenv, binutils-unwrapped, cctools, llvm }:
23# Make sure both underlying packages claim to have prepended their binaries
4# with the same targetPrefix.
···49 ln -sv "$path" "$dest_path"
50 done
51 done
00000000052 '';
005354 passthru = {
55 inherit targetPrefix;
···1+{ lib, stdenv, makeWrapper, binutils-unwrapped, cctools, llvm, clang-unwrapped }:
23# Make sure both underlying packages claim to have prepended their binaries
4# with the same targetPrefix.
···49 ln -sv "$path" "$dest_path"
50 done
51 done
52+ ''
53+ # On aarch64-darwin we must use clang, because "as" from cctools just doesn't
54+ # handle the arch. Proxying calls to clang produces quite a bit of warnings,
55+ # and using clang directly here is a better option than relying on cctools.
56+ # On x86_64-darwin the Clang version is too old to support this mode.
57+ + lib.optionalString stdenv.isAarch64 ''
58+ rm $out/bin/as
59+ makeWrapper "${clang-unwrapped}/bin/clang" "$out/bin/as" \
60+ --add-flags "-x assembler -integrated-as -c"
61 '';
62+63+ nativeBuildInputs = lib.optionals stdenv.isAarch64 [ makeWrapper ];
6465 passthru = {
66 inherit targetPrefix;
···18 # The websites youtube-dl deals with are a very moving target. That means that
19 # downloads break constantly. Because of that, updates should always be backported
20 # to the latest stable release.
21- version = "2021.03.03";
2223 src = fetchurl {
24 url = "https://yt-dl.org/downloads/${version}/${pname}-${version}.tar.gz";
25- sha256 = "11z2v8mdii0bl13850mc6hgz80d0kgzb4hdxyikc3wa4jqfwrq7f";
26 };
2728 nativeBuildInputs = [ installShellFiles makeWrapper ];
···18 # The websites youtube-dl deals with are a very moving target. That means that
19 # downloads break constantly. Because of that, updates should always be backported
20 # to the latest stable release.
21+ version = "2021.03.14";
2223 src = fetchurl {
24 url = "https://yt-dl.org/downloads/${version}/${pname}-${version}.tar.gz";
25+ sha256 = "1bh74f9q6dv17ah5x8zcxw03dq6jbh959xd39kw374cf9ifrgnd3";
26 };
2728 nativeBuildInputs = [ installShellFiles makeWrapper ];
+4-3
pkgs/tools/networking/dnsperf/default.nix
···1{ lib, stdenv, fetchurl, fetchFromGitHub, autoreconfHook, pkg-config
2-, openssl, ldns
3}:
45stdenv.mkDerivation rec {
6 pname = "dnsperf";
7- version = "2.4.0";
89 # The same as the initial commit of the new GitHub repo (only readme changed).
10 src = fetchFromGitHub {
11 owner = "DNS-OARC";
12 repo = "dnsperf";
13 rev = "v${version}";
14- sha256 = "0q7zmzhhx71v41wf6rhyvpil43ch4a9sx21x47wgcg362lca3cbz";
15 };
1617 outputs = [ "out" "man" "doc" ];
···21 buildInputs = [
22 openssl
23 ldns # optional for DDNS (but cheap anyway)
024 ];
2526 doCheck = true;
···1+{ lib
2+, buildPythonApplication
3+, fetchFromGitHub
4+, lxml
5+, six
6+}:
7+8+buildPythonApplication rec {
9+ pname = "xmldiff";
10+ version = "2.4";
11+12+ src = fetchFromGitHub {
13+ owner = "Shoobx";
14+ repo = pname;
15+ rev = version;
16+ hash = "sha256-xqudHYfwOce2C0pcFzId0JDIIC6R5bllmVKsH+CvTdE=";
17+ };
18+19+ buildInputs = [
20+ lxml
21+ six
22+ ];
23+24+ meta = with lib; {
25+ homepage = "https://xmldiff.readthedocs.io/en/stable/";
26+ description = "A library and command line utility for diffing xml";
27+ longDescription = ''
28+ xmldiff is a library and a command-line utility for making diffs out of
29+ XML. This may seem like something that doesn't need a dedicated utility,
30+ but change detection in hierarchical data is very different from change
31+ detection in flat data. XML type formats are also not only used for
32+ computer readable data, it is also often used as a format for hierarchical
33+ data that can be rendered into human readable formats. A traditional diff
34+ on such a format would tell you line by line the differences, but this
35+ would not be be readable by a human. xmldiff provides tools to make human
36+ readable diffs in those situations.
37+ '';
38+ license = licenses.mit;
39+ maintainers = with maintainers; [ AndersonTorres ];
40+ };
41+}