···8383 release based on GTK+3 and Python 3.
8484 </para>
8585 </listitem>
8686+ <listitem>
8787+ <para>
8888+ The <literal>writers.writePython2</literal> and corresponding
8989+ <literal>writers.writePython2Bin</literal> convenience
9090+ functions to create executable Python 2 scripts in the store
9191+ were removed in preparation of removal of the Python 2
9292+ interpreter. Scripts have to be converted to Python 3 for use
9393+ with <literal>writers.writePython3</literal> or
9494+ <literal>writers.writePyPy2</literal> needs to be used.
9595+ </para>
9696+ </listitem>
8697 </itemizedlist>
8798 </section>
8899 <section xml:id="sec-release-22.05-notable-changes">
89100 <title>Other Notable Changes</title>
9090- <itemizedlist spacing="compact">
101101+ <itemizedlist>
91102 <listitem>
92103 <para>
93104 The option
···111122 are only accessible by default to the members of the Unix
112123 group <literal>redis-${serverName}</literal> through the Unix
113124 socket <literal>/run/redis-${serverName}/redis.sock</literal>.
125125+ </para>
126126+ </listitem>
127127+ <listitem>
128128+ <para>
129129+ The
130130+ <literal>writers.writePyPy2</literal>/<literal>writers.writePyPy3</literal>
131131+ and corresponding
132132+ <literal>writers.writePyPy2Bin</literal>/<literal>writers.writePyPy3Bin</literal>
133133+ convenience functions to create executable Python 2/3 scripts
134134+ using the PyPy interpreter were added.
114135 </para>
115136 </listitem>
116137 </itemizedlist>
+5
nixos/doc/manual/release-notes/rl-2205.section.md
···3434- `pkgs.claws-mail-gtk2`, representing Claws Mail's older release version three, was removed in order to get rid of Python 2.
3535 Please switch to `claws-mail`, which is Claws Mail's latest release based on GTK+3 and Python 3.
36363737+- The `writers.writePython2` and corresponding `writers.writePython2Bin` convenience functions to create executable Python 2 scripts in the store were removed in preparation of removal of the Python 2 interpreter.
3838+ Scripts have to be converted to Python 3 for use with `writers.writePython3` or `writers.writePyPy2` needs to be used.
3939+3740## Other Notable Changes {#sec-release-22.05-notable-changes}
38413942- The option [services.redis.servers](#opt-services.redis.servers) was added
···5154 are only accessible by default
5255 to the members of the Unix group `redis-${serverName}`
5356 through the Unix socket `/run/redis-${serverName}/redis.sock`.
5757+5858+- The `writers.writePyPy2`/`writers.writePyPy3` and corresponding `writers.writePyPy2Bin`/`writers.writePyPy3Bin` convenience functions to create executable Python 2/3 scripts using the PyPy interpreter were added.
+35
pkgs/build-support/writers/aliases.nix
···11+lib: prev:
22+33+let
44+ # Removing recurseForDerivation prevents derivations of aliased attribute
55+ # set to appear while listing all the packages available.
66+ removeRecurseForDerivations = alias: with lib;
77+ if alias.recurseForDerivations or false then
88+ removeAttrs alias ["recurseForDerivations"]
99+ else alias;
1010+1111+ # Disabling distribution prevents top-level aliases for non-recursed package
1212+ # sets from building on Hydra.
1313+ removeDistribute = alias: with lib;
1414+ if isDerivation alias then
1515+ dontDistribute alias
1616+ else alias;
1717+1818+ # Make sure that we are not shadowing something from
1919+ # writers.
2020+ checkInPkgs = n: alias: if builtins.hasAttr n prev
2121+ then throw "Alias ${n} is still in writers"
2222+ else alias;
2323+2424+ mapAliases = aliases:
2525+ lib.mapAttrs (n: alias: removeDistribute
2626+ (removeRecurseForDerivations
2727+ (checkInPkgs n alias)))
2828+ aliases;
2929+3030+in
3131+mapAliases ({
3232+ /* Cleanup before 22.05, Added 2021-12-11 */
3333+ writePython2 = "Python 2 is EOL and the use of writers.writePython2 is deprecated.";
3434+ writePython2Bin = "Python 2 is EOL and the use of writers.writePython2Bin is deprecated.";
3535+})
+33-10
pkgs/build-support/writers/default.nix
···11-{ pkgs, buildPackages, lib, stdenv, libiconv, gawk, gnused, gixy }:
11+{ pkgs, config, buildPackages, lib, stdenv, libiconv, gawk, gnused, gixy }:
2233-with lib;
44-rec {
33+let
44+ aliases = if (config.allowAliases or true) then (import ./aliases.nix lib) else prev: {};
55+66+ writers = with lib; rec {
57 # Base implementation for non-compiled executables.
68 # Takes an interpreter, for example `${pkgs.bash}/bin/bash`
79 #
···245247 '');
246248 } name;
247249248248- # writePython2 takes a name an attributeset with libraries and some python2 sourcecode and
250250+ # writePyPy2 takes a name an attributeset with libraries and some pypy2 sourcecode and
249251 # returns an executable
250252 #
251253 # Example:
252252- # writePython2 "test_python2" { libraries = [ pkgs.python2Packages.enum ]; } ''
254254+ # writePyPy2 "test_pypy2" { libraries = [ pkgs.pypy2Packages.enum ]; } ''
253255 # from enum import Enum
254256 #
255257 # class Test(Enum):
···257259 #
258260 # print Test.a
259261 # ''
260260- writePython2 = makePythonWriter pkgs.python2 pkgs.python2Packages;
262262+ writePyPy2 = makePythonWriter pkgs.pypy2 pkgs.pypy2Packages;
261263262262- # writePython2Bin takes the same arguments as writePython2 but outputs a directory (like writeScriptBin)
263263- writePython2Bin = name:
264264- writePython2 "/bin/${name}";
264264+ # writePyPy2Bin takes the same arguments as writePyPy2 but outputs a directory (like writeScriptBin)
265265+ writePyPy2Bin = name:
266266+ writePyPy2 "/bin/${name}";
265267266268 # writePython3 takes a name an attributeset with libraries and some python3 sourcecode and
267269 # returns an executable
···280282 # writePython3Bin takes the same arguments as writePython3 but outputs a directory (like writeScriptBin)
281283 writePython3Bin = name:
282284 writePython3 "/bin/${name}";
283283-}
285285+286286+ # writePyPy3 takes a name an attributeset with libraries and some pypy3 sourcecode and
287287+ # returns an executable
288288+ #
289289+ # Example:
290290+ # writePyPy3 "test_pypy3" { libraries = [ pkgs.pypy3Packages.pyyaml ]; } ''
291291+ # import yaml
292292+ #
293293+ # y = yaml.load("""
294294+ # - test: success
295295+ # """)
296296+ # print(y[0]['test'])
297297+ # ''
298298+ writePyPy3 = makePythonWriter pkgs.pypy3 pkgs.pypy3Packages;
299299+300300+ # writePyPy3Bin takes the same arguments as writePyPy3 but outputs a directory (like writeScriptBin)
301301+ writePyPy3Bin = name:
302302+ writePyPy3 "/bin/${name}";
303303+304304+};
305305+in
306306+writers // (aliases writers)