···751751 t' = opt.options.type;
752752 mergedType = t.typeMerge t'.functor;
753753 typesMergeable = mergedType != null;
754754- typeSet = if (bothHave "type") && typesMergeable
755755- then { type = mergedType; }
756756- else {};
754754+755755+ # TODO: Remove this when all downstream reliances of internals: 'functor.wrapped' are sufficiently migrated.
756756+ # A function that adds the deprecated wrapped message to a type.
757757+ addDeprecatedWrapped = t:
758758+ t // {
759759+ functor = t.functor // {
760760+ wrapped = t.functor.wrappedDeprecationMessage {
761761+ inherit loc;
762762+ };
763763+ };
764764+ };
765765+766766+ typeSet =
767767+ if opt.options ? type then
768768+ if res ? type then
769769+ if typesMergeable then
770770+ {
771771+ type =
772772+ if mergedType ? functor.wrappedDeprecationMessage then
773773+ addDeprecatedWrapped mergedType
774774+ else
775775+ mergedType;
776776+ }
777777+ else
778778+ # Keep in sync with the same error below!
779779+ throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
780780+ else if opt.options.type ? functor.wrappedDeprecationMessage then
781781+ { type = addDeprecatedWrapped opt.options.type; }
782782+ else
783783+ {}
784784+ else
785785+ {};
786786+757787 bothHave = k: opt.options ? ${k} && res ? ${k};
758788 in
759789 if bothHave "default" ||
760790 bothHave "example" ||
761791 bothHave "description" ||
762762- bothHave "apply" ||
763763- (bothHave "type" && (! typesMergeable))
792792+ bothHave "apply"
764793 then
794794+ # Keep in sync with the same error above!
765795 throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
766796 else
767797 let
+9
lib/tests/modules.sh
···386386checkConfigOutput '^false$' config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
387387checkConfigOutput '^"empty"$' config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
388388389389+# Check attrsWith type merging
390390+checkConfigError 'The option `mergedLazyNonLazy'\'' in `.*'\'' is already declared in `.*'\''\.' options.mergedLazyNonLazy ./lazy-attrsWith.nix
391391+checkConfigOutput '^11$' config.lazyResult ./lazy-attrsWith.nix
392392+checkConfigError 'infinite recursion encountered' config.nonLazyResult ./lazy-attrsWith.nix
393393+394394+# Test the attrsOf functor.wrapped warning
395395+# shellcheck disable=2016
396396+NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `type.functor.wrapped` attribute of the option `mergedLazyLazy` is accessed, use `nestedTypes.elemType` instead.' options.mergedLazyLazy.type.functor.wrapped ./lazy-attrsWith.nix
389397390398# Even with multiple assignments, a type error should be thrown if any of them aren't valid
391399checkConfigError 'A definition for option .* is not of type .*' \
···574582checkConfigOutput '^38|27$' options.submoduleLine38.declarationPositions.1.line ./declaration-positions.nix
575583# nested options work
576584checkConfigOutput '^34$' options.nested.nestedLine34.declarationPositions.0.line ./declaration-positions.nix
585585+577586578587cat <<EOF
579588====== module tests ======
···50505151- `zammad` has had its support for MySQL removed, since it was never working correctly and is now deprecated upstream. Check the [migration guide](https://docs.zammad.org/en/latest/appendix/migrate-to-postgresql.html) for how to convert your database to PostgreSQL.
52525353+- The behavior of the `networking.nat.externalIP` and `networking.nat.externalIPv6` options has been changed. `networking.nat.forwardPorts` now only forwards packets destined for the specified IP addresses.
5454+5355- `kanata` was updated to v1.7.0, which introduces several breaking changes.
5456 See the release notes of
5557 [v1.7.0](https://github.com/jtroo/kanata/releases/tag/v1.7.0)
···6365 suffix and any whitespaces trimmed.
64666567- `gkraken` software and `hardware.gkraken.enable` option have been removed, use `coolercontrol` via `programs.coolercontrol.enable` option instead.
6868+6969+- `containerd` has been updated to v2, which contains breaking changes. See the [containerd
7070+ 2.0](https://github.com/containerd/containerd/blob/main/docs/containerd-2.0.md) documentation for more
7171+ details.
66726773- the notmuch vim plugin now lives in a separate output of the `notmuch`
6874 package. Installing `notmuch` will not bring the notmuch vim package anymore,
···2020 type = types.bool;
2121 default = false;
2222 description = ''
2323- Whether to enable Network Address Translation (NAT).
2323+ Whether to enable Network Address Translation (NAT). A
2424+ properly configured firewall or a trusted L2 on all network
2525+ interfaces is required to prevent unauthorized access to
2626+ the internal network.
2427 '';
2528 };
2629···8285 The public IP address to which packets from the local
8386 network are to be rewritten. If this is left empty, the
8487 IP address associated with the external interface will be
8585- used.
8888+ used. Only connections made to this IP address will be
8989+ forwarded to the internal network when using forwardPorts.
8690 '';
8791 };
8892···9498 The public IPv6 address to which packets from the local
9599 network are to be rewritten. If this is left empty, the
96100 IP address associated with the external interface will be
9797- used.
101101+ used. Only connections made to this IP address will be
102102+ forwarded to the internal network when using forwardPorts.
98103 '';
99104 };
100105
···11-# This is a simple distributed test involving a topology with two
22-# separate virtual networks - the "inside" and the "outside" - with a
33-# client on the inside network, a server on the outside network, and a
44-# router connected to both that performs Network Address Translation
55-# for the client.
66-import ./make-test-python.nix ({ pkgs, lib, withFirewall, nftables ? false, ... }:
11+# This is a distributed test of the Network Address Translation involving a topology
22+# with a router inbetween three separate virtual networks:
33+# - "external" -- i.e. the internet,
44+# - "internal" -- i.e. an office LAN,
55+#
66+# This test puts one server on each of those networks and its primary goal is to ensure that:
77+# - server (named client in the code) in internal network can reach server (named server in the code) on the external network,
88+# - server in external network can not reach server in internal network (skipped in some cases),
99+# - when using externalIP, only the specified IP is used for NAT,
1010+# - port forwarding functionality behaves correctly
1111+#
1212+# The client is behind the nat (read: protected by the nat) and the server is on the external network, attempting to access services behind the NAT.
1313+1414+import ./make-test-python.nix ({ pkgs, lib, withFirewall ? false, nftables ? false, ... }:
715 let
816 unit = if nftables then "nftables" else (if withFirewall then "firewall" else "nat");
1717+1818+ routerAlternativeExternalIp = "192.168.2.234";
1919+2020+ makeNginxConfig = hostname: {
2121+ enable = true;
2222+ virtualHosts."${hostname}" = {
2323+ root = "/etc";
2424+ locations."/".index = "hostname";
2525+ listen = [
2626+ {
2727+ addr = "0.0.0.0";
2828+ port = 80;
2929+ }
3030+ {
3131+ addr = "0.0.0.0";
3232+ port = 8080;
3333+ }
3434+ ];
3535+ };
3636+ };
3737+3838+ makeCommonConfig = hostname: {
3939+ services.nginx = makeNginxConfig hostname;
4040+ services.vsftpd = {
4141+ enable = true;
4242+ anonymousUser = true;
4343+ localRoot = "/etc/";
4444+ extraConfig = ''
4545+ pasv_min_port=51000
4646+ pasv_max_port=51999
4747+ '';
4848+ };
4949+5050+ # Disable eth0 autoconfiguration
5151+ networking.useDHCP = false;
5252+5353+ environment.systemPackages = [
5454+ (pkgs.writeScriptBin "check-connection"
5555+ ''
5656+ #!/usr/bin/env bash
5757+5858+ set -e
5959+6060+ if [[ "$2" == "" || "$3" == "" || "$1" == "--help" || "$1" == "-h" ]];
6161+ then
6262+ echo "check-connection <target-address> <target-hostname> <[expect-success|expect-failure]>"
6363+ exit 1
6464+ fi
6565+6666+ ADDRESS="$1"
6767+ HOSTNAME="$2"
6868+6969+ function test_icmp() { timeout 3 ping -c 1 $ADDRESS; }
7070+ function test_http() { [[ `timeout 3 curl $ADDRESS` == "$HOSTNAME" ]]; }
7171+ function test_ftp() { timeout 3 curl ftp://$ADDRESS; }
7272+7373+ if [[ "$3" == "expect-success" ]];
7474+ then
7575+ test_icmp; test_http; test_ftp
7676+ else
7777+ ! test_icmp; ! test_http; ! test_ftp
7878+ fi
7979+ ''
8080+ )
8181+ (pkgs.writeScriptBin "check-last-clients-ip"
8282+ ''
8383+ #!/usr/bin/env bash
8484+ set -e
8585+8686+ [[ `cat /var/log/nginx/access.log | tail -n1 | awk '{print $1}'` == "$1" ]]
8787+ ''
8888+ )
8989+ ];
9090+ };
9191+9292+ # VLANS:
9393+ # 1 -- simulates the internal network
9494+ # 2 -- simulates the external network
995 in
1096 {
1197 name = "nat" + (lib.optionalString nftables "Nftables")
1298 + (if withFirewall then "WithFirewall" else "Standalone");
1399 meta = with pkgs.lib.maintainers; {
1414- maintainers = [ rob ];
100100+ maintainers = [ tne rob ];
15101 };
1610217103 nodes =
1818- {
1919- client = { lib, nodes, ... }: {
2020- virtualisation.vlans = [ 1 ];
2121- networking.defaultGateway =
2222- (lib.head nodes.router.networking.interfaces.eth2.ipv4.addresses).address;
2323- networking.nftables.enable = nftables;
2424- };
104104+ { client =
105105+ { pkgs, nodes, ... }:
106106+ lib.mkMerge [
107107+ ( makeCommonConfig "client" )
108108+ { virtualisation.vlans = [ 1 ];
109109+ networking.defaultGateway =
110110+ (pkgs.lib.head nodes.router.networking.interfaces.eth1.ipv4.addresses).address;
111111+ networking.nftables.enable = nftables;
112112+ networking.firewall.enable = false;
113113+ }
114114+ ];
251152626- router = { lib, ... }: {
2727- virtualisation.vlans = [ 2 1 ];
2828- networking.firewall.enable = withFirewall;
2929- networking.firewall.filterForward = nftables;
3030- networking.nftables.enable = nftables;
3131- networking.nat.enable = true;
3232- networking.nat.internalIPs = [ "192.168.1.0/24" ];
3333- networking.nat.externalInterface = "eth1";
116116+ router =
117117+ { nodes, ... }: lib.mkMerge [
118118+ ( makeCommonConfig "router" )
119119+ { virtualisation.vlans = [ 1 2 ];
120120+ networking.firewall = {
121121+ enable = withFirewall;
122122+ filterForward = nftables;
123123+ allowedTCPPorts = [ 21 80 8080 ];
124124+ # For FTP passive mode
125125+ allowedTCPPortRanges = [ { from = 51000; to = 51999; } ];
126126+ };
127127+ networking.nftables.enable = nftables;
128128+ networking.nat =
129129+ let
130130+ clientIp = (pkgs.lib.head nodes.client.networking.interfaces.eth1.ipv4.addresses).address;
131131+ serverIp = (pkgs.lib.head nodes.router.networking.interfaces.eth2.ipv4.addresses).address;
132132+ in
133133+ {
134134+ enable = true;
135135+ internalIPs = [ "${clientIp}/24" ];
136136+ # internalInterfaces = [ "eth1" ];
137137+ externalInterface = "eth2";
138138+ externalIP = serverIp;
341393535- specialisation.no-nat.configuration = {
3636- networking.nat.enable = lib.mkForce false;
3737- };
3838- };
140140+ forwardPorts = [
141141+ {
142142+ destination = "${clientIp}:8080";
143143+ proto = "tcp";
144144+ sourcePort = 8080;
145145+146146+ loopbackIPs = [ serverIp ];
147147+ }
148148+ ];
149149+ };
150150+151151+ networking.interfaces.eth2.ipv4.addresses =
152152+ lib.mkOrder 10000 [ { address = routerAlternativeExternalIp; prefixLength = 24; } ];
153153+154154+ services.nginx.virtualHosts.router.listen = lib.mkOrder (-1) [ {
155155+ addr = routerAlternativeExternalIp;
156156+ port = 8080;
157157+ } ];
158158+159159+ specialisation.no-nat.configuration = {
160160+ networking.nat.enable = lib.mkForce false;
161161+ };
162162+ }
163163+ ];
3916440165 server =
4141- { ... }:
4242- { virtualisation.vlans = [ 2 ];
4343- networking.firewall.enable = false;
4444- services.httpd.enable = true;
4545- services.httpd.adminAddr = "foo@example.org";
4646- services.vsftpd.enable = true;
4747- services.vsftpd.anonymousUser = true;
4848- };
166166+ { nodes, ... }: lib.mkMerge [
167167+ ( makeCommonConfig "server" )
168168+ { virtualisation.vlans = [ 2 ];
169169+ networking.firewall.enable = false;
170170+171171+ networking.defaultGateway =
172172+ (pkgs.lib.head nodes.router.networking.interfaces.eth2.ipv4.addresses).address;
173173+ }
174174+ ];
49175 };
501765151- testScript = ''
177177+ testScript =
178178+ { nodes, ... }: let
179179+ clientIp = (pkgs.lib.head nodes.client.networking.interfaces.eth1.ipv4.addresses).address;
180180+ serverIp = (pkgs.lib.head nodes.server.networking.interfaces.eth1.ipv4.addresses).address;
181181+ routerIp = (pkgs.lib.head nodes.router.networking.interfaces.eth2.ipv4.addresses).address;
182182+ in ''
183183+ def wait_for_machine(m):
184184+ m.wait_for_unit("network.target")
185185+ m.wait_for_unit("nginx.service")
186186+52187 client.start()
53188 router.start()
54189 server.start()
551905656- # The router should have access to the server.
5757- server.wait_for_unit("network.target")
5858- server.wait_for_unit("httpd")
5959- router.wait_for_unit("network.target")
6060- router.succeed("curl -4 --fail http://server/ >&2")
191191+ wait_for_machine(router)
192192+ wait_for_machine(client)
193193+ wait_for_machine(server)
611946262- # The client should be also able to connect via the NAT router.
6363- router.wait_for_unit("${unit}")
6464- client.wait_for_unit("network.target")
6565- client.succeed("curl --fail http://server/ >&2")
6666- client.succeed("ping -4 -c 1 server >&2")
195195+ # We assume we are isolated from layer 2 attacks or are securely configured (like disabling forwarding by default)
196196+ # Relevant moby issue describing the problem allowing bypassing of NAT: https://github.com/moby/moby/issues/14041
197197+ ${lib.optionalString (!nftables) ''
198198+ router.succeed("iptables -P FORWARD DROP")
199199+ ''}
672006868- # Test whether passive FTP works.
6969- server.wait_for_unit("vsftpd")
7070- server.succeed("echo Hello World > /home/ftp/foo.txt")
7171- client.succeed("curl -v ftp://server/foo.txt >&2")
201201+ # Sanity checks.
202202+ ## The router should have direct access to the server
203203+ router.succeed("check-connection ${serverIp} server expect-success")
204204+ ## The server should have direct access to the router
205205+ server.succeed("check-connection ${routerIp} router expect-success")
722067373- # Test whether active FTP works.
7474- client.fail("curl -v -P - ftp://server/foo.txt >&2")
207207+ # The client should be also able to connect via the NAT router...
208208+ client.succeed("check-connection ${serverIp} server expect-success")
209209+ # ... but its IP should be rewritten to be that of the router.
210210+ server.succeed("check-last-clients-ip ${routerIp}")
211211+212212+ # Active FTP (where the FTP server connects back to us via a random port) should work directly...
213213+ router.succeed("timeout 3 curl -P eth2:51000-51999 ftp://${serverIp}")
214214+ # ... but not from behind NAT.
215215+ client.fail("timeout 3 curl -P eth1:51000-51999 ftp://${serverIp};")
216216+217217+ # If using nftables without firewall, filterForward can't be used and L2 security can't easily be simulated like with iptables, skipping.
218218+ # See moby github issue mentioned above.
219219+ ${lib.optionalString (nftables && withFirewall) ''
220220+ # The server should not be able to reach the client directly...
221221+ server.succeed("check-connection ${clientIp} client expect-failure")
222222+ ''}
223223+ # ... but the server should be able to reach a port forwarded address of the client
224224+ server.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "client" ]]')
225225+ # The IP address the client sees should not be rewritten to be that of the router (#277016)
226226+ client.succeed("check-last-clients-ip ${serverIp}")
752277676- # Test ICMP.
7777- client.succeed("ping -4 -c 1 router >&2")
7878- router.succeed("ping -4 -c 1 client >&2")
228228+ # But this forwarded port shouldn't intercept communication with
229229+ # other IPs than externalIp.
230230+ server.succeed('[[ `timeout 3 curl http://${routerAlternativeExternalIp}:8080` == "router" ]]')
231231+232232+ # The loopback should allow the router itself to access the forwarded port
233233+ # Note: The reason we use routerIp here is because only routerIp is listed for reflection in networking.nat.forwardPorts.loopbackIPs
234234+ # The purpose of loopbackIPs is to allow things inside of the NAT to for example access their own public domain when a service has to make a request
235235+ # to itself/another service on the same NAT through a public address
236236+ router.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "client" ]]')
237237+ # The loopback should also allow the client to access its own forwarded port
238238+ client.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "client" ]]')
792398080- # If we turn off NAT, the client shouldn't be able to reach the server.
240240+ # If we turn off NAT, nothing should work
81241 router.succeed(
8282- "/run/booted-system/specialisation/no-nat/bin/switch-to-configuration test 2>&1"
242242+ "systemctl stop ${unit}.service"
83243 )
8484- client.fail("curl -4 --fail --connect-timeout 5 http://server/ >&2")
8585- client.fail("ping -4 -c 1 server >&2")
862448787- # And make sure that reloading the NAT job works.
245245+ # If using nftables and firewall, this makes no sense. We deactivated the firewall after all,
246246+ # so we are once again affected by the same issue as the moby github issue mentioned above.
247247+ # If using nftables without firewall, filterForward can't be used and L2 security can't easily be simulated like with iptables, skipping.
248248+ # See moby github issue mentioned above.
249249+ ${lib.optionalString (!nftables) ''
250250+ client.succeed("check-connection ${serverIp} server expect-failure")
251251+ server.succeed("check-connection ${clientIp} client expect-failure")
252252+ ''}
253253+ # These should revert to their pre-NATed versions
254254+ server.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "router" ]]')
255255+ router.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "router" ]]')
256256+257257+ # Reverse the effect of nat stop
258258+ router.succeed(
259259+ "systemctl start ${unit}.service"
260260+ )
261261+262262+ # Switch to a config without NAT at all, again nothing should work
88263 router.succeed(
8989- "/run/booted-system/bin/switch-to-configuration test 2>&1"
264264+ "/run/booted-system/specialisation/no-nat/bin/switch-to-configuration test 2>&1"
90265 )
9191- # FIXME: this should not be necessary, but nat.service is not started because
9292- # network.target is not triggered
9393- # (https://github.com/NixOS/nixpkgs/issues/16230#issuecomment-226408359)
9494- ${lib.optionalString (!withFirewall && !nftables) ''
9595- router.succeed("systemctl start nat.service")
266266+267267+ # If using nftables without firewall, filterForward can't be used and L2 security can't easily be simulated like with iptables, skipping.
268268+ # See moby github issue mentioned above.
269269+ ${lib.optionalString (nftables && withFirewall) ''
270270+ client.succeed("check-connection ${serverIp} server expect-failure")
271271+ server.succeed("check-connection ${clientIp} client expect-failure")
96272 ''}
9797- client.succeed("curl -4 --fail http://server/ >&2")
9898- client.succeed("ping -4 -c 1 server >&2")
273273+274274+ # These should revert to their pre-NATed versions
275275+ server.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "router" ]]')
276276+ router.succeed('[[ `timeout 3 curl http://${routerIp}:8080` == "router" ]]')
99277 '';
100278})
+13-1
nixos/tests/networking/networkd-and-scripted.nix
···660660 assert "02:de:ad:be:ef:01" in machine.succeed("ip link show dev tap0")
661661 '' # network-addresses-* only exist in scripted networking
662662 + lib.optionalString (!networkd) ''
663663- with subtest("Test interfaces clean up"):
663663+ with subtest("Test interfaces' addresses clean up"):
664664 machine.succeed("systemctl stop network-addresses-tap0")
665665 machine.sleep(10)
666666 machine.succeed("systemctl stop network-addresses-tun0")
667667+ machine.sleep(10)
668668+ residue = machine.succeed("ip tuntap list | sort").strip()
669669+ assert (
670670+ residue == targetList
671671+ ), "Some virtual interface has been removed:\n{}".format(residue)
672672+ assert "192.168.1.1" not in machine.succeed("ip address show dev tap0"), "tap0 interface address has not been removed"
673673+ assert "192.168.1.2" not in machine.succeed("ip address show dev tun0"), "tun0 interface address has not been removed"
674674+675675+ with subtest("Test interfaces clean up"):
676676+ machine.succeed("systemctl stop tap0-netdev")
677677+ machine.sleep(10)
678678+ machine.succeed("systemctl stop tun0-netdev")
667679 machine.sleep(10)
668680 residue = machine.succeed("ip tuntap list")
669681 assert (
···11# tests available at pkgs/test/vim
22-{ lib, stdenv, vim, vimPlugins, buildEnv, writeText
33-, runCommand, makeWrapper
44-, python3
55-, callPackage, makeSetupHook
66-, linkFarm
77-, config
22+{
33+ lib,
44+ stdenv,
55+ vim,
66+ vimPlugins,
77+ buildEnv,
88+ writeText,
99+ runCommand,
1010+ makeWrapper,
1111+ python3,
1212+ callPackage,
1313+ makeSetupHook,
1414+ linkFarm,
1515+ config,
816}:
9171018/*
1919+ USAGE EXAMPLE
2020+ =============
11211212-USAGE EXAMPLE
1313-=============
2222+ Install Vim like this eg using nixos option environment.systemPackages which will provide
2323+ vim-with-plugins in PATH:
14241515-Install Vim like this eg using nixos option environment.systemPackages which will provide
1616-vim-with-plugins in PATH:
2525+ vim-full.customize {
2626+ name = "vim-with-plugins"; # optional
17271818- vim-full.customize {
1919- name = "vim-with-plugins"; # optional
2828+ # add custom .vimrc lines like this:
2929+ vimrcConfig.customRC = ''
3030+ set hidden
3131+ '';
20322121- # add custom .vimrc lines like this:
2222- vimrcConfig.customRC = ''
2323- set hidden
2424- '';
2525-2626- # store your plugins in Vim packages
2727- vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
2828- # loaded on launch
2929- start = [ youcompleteme fugitive ];
3030- # manually loadable by calling `:packadd $plugin-name`
3131- opt = [ phpCompletion elm-vim ];
3232- # To automatically load a plugin when opening a filetype, add vimrc lines like:
3333- # autocmd FileType php :packadd phpCompletion
3333+ # store your plugins in Vim packages
3434+ vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
3535+ # loaded on launch
3636+ start = [ youcompleteme fugitive ];
3737+ # manually loadable by calling `:packadd $plugin-name`
3838+ opt = [ phpCompletion elm-vim ];
3939+ # To automatically load a plugin when opening a filetype, add vimrc lines like:
4040+ # autocmd FileType php :packadd phpCompletion
4141+ };
3442 };
3535- };
36433737-WHAT IS A VIM PLUGIN?
3838-=====================
3939-Typical plugin files:
4444+ WHAT IS A VIM PLUGIN?
4545+ =====================
4646+ Typical plugin files:
40474141- plugin/P1.vim
4242- autoload/P1.vim
4343- ftplugin/xyz.vim
4444- doc/plugin-documentation.txt (traditional documentation)
4545- README(.md) (nowadays thanks to github)
4848+ plugin/P1.vim
4949+ autoload/P1.vim
5050+ ftplugin/xyz.vim
5151+ doc/plugin-documentation.txt (traditional documentation)
5252+ README(.md) (nowadays thanks to github)
46535454+ Vim offers the :h rtp setting which works for most plugins. Thus adding
5555+ this to your .vimrc should make most plugins work:
47564848-Vim offers the :h rtp setting which works for most plugins. Thus adding
4949-this to your .vimrc should make most plugins work:
5757+ set rtp+=~/.nix-profile/share/vim-plugins/youcompleteme
5858+ " or for p in ["youcompleteme"] | exec 'set rtp+=~/.nix-profile/share/vim-plugins/'.p | endfor
50595151- set rtp+=~/.nix-profile/share/vim-plugins/youcompleteme
5252- " or for p in ["youcompleteme"] | exec 'set rtp+=~/.nix-profile/share/vim-plugins/'.p | endfor
6060+ Learn about about plugin Vim plugin mm managers at
6161+ http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html.
53625454-Learn about about plugin Vim plugin mm managers at
5555-http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html.
6363+ The documentation can be accessed by Vim's :help command if it was tagged.
6464+ See vimHelpTags sample code below.
56655757-The documentation can be accessed by Vim's :help command if it was tagged.
5858-See vimHelpTags sample code below.
6666+ CONTRIBUTING AND CUSTOMIZING
6767+ ============================
6868+ The example file pkgs/applications/editors/vim/plugins/default.nix provides
6969+ both:
7070+ * manually mantained plugins
7171+ * plugins created by VAM's nix#ExportPluginsForNix implementation
59726060-CONTRIBUTING AND CUSTOMIZING
6161-============================
6262-The example file pkgs/applications/editors/vim/plugins/default.nix provides
6363-both:
6464-* manually mantained plugins
6565-* plugins created by VAM's nix#ExportPluginsForNix implementation
7373+ I highly recommend to lookup vim plugin attribute names at the [vim-pi] project
7474+ which is a database containing all plugins from
7575+ vim.org and quite a lot of found at github and similar sources. vim-pi's documented purpose
7676+ is to associate vim.org script ids to human readable names so that dependencies
7777+ can be describe easily.
66786767-I highly recommend to lookup vim plugin attribute names at the [vim-pi] project
6868- which is a database containing all plugins from
6969-vim.org and quite a lot of found at github and similar sources. vim-pi's documented purpose
7070-is to associate vim.org script ids to human readable names so that dependencies
7171-can be describe easily.
7979+ How to find a name?
8080+ * http://vam.mawercer.de/ or VAM's
8181+ * grep vim-pi
8282+ * use VAM's completion or :AddonsInfo command
72837373-How to find a name?
7474- * http://vam.mawercer.de/ or VAM's
7575- * grep vim-pi
7676- * use VAM's completion or :AddonsInfo command
8484+ It might happen than a plugin is not known by vim-pi yet. We encourage you to
8585+ contribute to vim-pi so that plugins can be updated automatically.
77867878-It might happen than a plugin is not known by vim-pi yet. We encourage you to
7979-contribute to vim-pi so that plugins can be updated automatically.
8787+ CREATING DERIVATIONS AUTOMATICALLY BY PLUGIN NAME
8888+ ==================================================
8989+ Most convenient is to use a ~/.vim-scripts file putting a plugin name into each line
9090+ as documented by [VAM]'s README.md
9191+ It is the same format you pass to vimrcConfig.vam.pluginDictionaries from the
9292+ usage example above.
80939494+ Then create a temp vim file and insert:
81958282-CREATING DERIVATIONS AUTOMATICALLY BY PLUGIN NAME
8383-==================================================
8484-Most convenient is to use a ~/.vim-scripts file putting a plugin name into each line
8585-as documented by [VAM]'s README.md
8686-It is the same format you pass to vimrcConfig.vam.pluginDictionaries from the
8787-usage example above.
9696+ let opts = {}
9797+ let opts.path_to_nixpkgs = '/etc/nixos/nixpkgs'
9898+ let opts.cache_file = '/tmp/export-vim-plugin-for-nix-cache-file'
9999+ let opts.plugin_dictionaries = map(readfile("vim-plugins"), 'eval(v:val)')
100100+ " add more files
101101+ " let opts.plugin_dictionaries += map(.. other file )
102102+ call nix#ExportPluginsForNix(opts)
881038989-Then create a temp vim file and insert:
104104+ Then ":source %" it.
901059191- let opts = {}
9292- let opts.path_to_nixpkgs = '/etc/nixos/nixpkgs'
9393- let opts.cache_file = '/tmp/export-vim-plugin-for-nix-cache-file'
9494- let opts.plugin_dictionaries = map(readfile("vim-plugins"), 'eval(v:val)')
9595- " add more files
9696- " let opts.plugin_dictionaries += map(.. other file )
9797- call nix#ExportPluginsForNix(opts)
106106+ nix#ExportPluginsForNix is provided by ./vim2nix
981079999-Then ":source %" it.
108108+ A buffer will open containing the plugin derivation lines as well list
109109+ fitting the vimrcConfig.vam.pluginDictionaries option.
100110101101-nix#ExportPluginsForNix is provided by ./vim2nix
111111+ Thus the most simple usage would be:
102112103103-A buffer will open containing the plugin derivation lines as well list
104104-fitting the vimrcConfig.vam.pluginDictionaries option.
113113+ vim_with_plugins =
114114+ let vim = vim-full;
115115+ inherit (vimUtil.override {inherit vim}) rtpPath addRtp buildVimPlugin vimHelpTags;
116116+ vimPlugins = [
117117+ # the derivation list from the buffer created by nix#ExportPluginsForNix
118118+ # don't set which will default to pkgs.vimPlugins
119119+ ];
120120+ in vim.customize {
121121+ name = "vim-with-plugins";
105122106106-Thus the most simple usage would be:
123123+ vimrcConfig.customRC = '' .. '';
107124108108- vim_with_plugins =
109109- let vim = vim-full;
110110- inherit (vimUtil.override {inherit vim}) rtpPath addRtp buildVimPlugin vimHelpTags;
111111- vimPlugins = [
112112- # the derivation list from the buffer created by nix#ExportPluginsForNix
113113- # don't set which will default to pkgs.vimPlugins
125125+ vimrcConfig.vam.knownPlugins = vimPlugins;
126126+ vimrcConfig.vam.pluginDictionaries = [
127127+ # the plugin list form ~/.vim-scripts turned into nix format added to
128128+ # the buffer created by the nix#ExportPluginsForNix
114129 ];
115115- in vim.customize {
116116- name = "vim-with-plugins";
117117-118118- vimrcConfig.customRC = '' .. '';
130130+ }
119131120120- vimrcConfig.vam.knownPlugins = vimPlugins;
121121- vimrcConfig.vam.pluginDictionaries = [
122122- # the plugin list form ~/.vim-scripts turned into nix format added to
123123- # the buffer created by the nix#ExportPluginsForNix
124124- ];
125125- }
132132+ vim_with_plugins can be installed like any other application within Nix.
126133127127-vim_with_plugins can be installed like any other application within Nix.
128128-129129-[VAM] https://github.com/MarcWeber/vim-addon-manager
130130-[vim-pi] https://bitbucket.org/vimcommunity/vim-pi
134134+ [VAM] https://github.com/MarcWeber/vim-addon-manager
135135+ [vim-pi] https://bitbucket.org/vimcommunity/vim-pi
131136*/
132132-133137134138let
135139 inherit lib;
···137141 # make sure a plugin is a derivation and its dependencies are derivations. If
138142 # plugin already is a derivation, this is a no-op. If it is a string, it is
139143 # looked up in knownPlugins.
140140- pluginToDrv = knownPlugins: plugin:
141141- let
142142- drv =
143143- if builtins.isString plugin then
144144- # make sure `pname` is set to that we are able to convert the derivation
145145- # back to a string.
146146- ( knownPlugins.${plugin} // { pname = plugin; })
147147- else
148148- plugin;
149149- in
144144+ pluginToDrv =
145145+ knownPlugins: plugin:
146146+ let
147147+ drv =
148148+ if builtins.isString plugin then
149149+ # make sure `pname` is set to that we are able to convert the derivation
150150+ # back to a string.
151151+ (knownPlugins.${plugin} // { pname = plugin; })
152152+ else
153153+ plugin;
154154+ in
150155 # make sure all the dependencies of the plugin are also derivations
151151- drv // { dependencies = map (pluginToDrv knownPlugins) (drv.dependencies or []); };
156156+ drv // { dependencies = map (pluginToDrv knownPlugins) (drv.dependencies or [ ]); };
152157153158 # transitive closure of plugin dependencies (plugin needs to be a derivation)
154154- transitiveClosure = plugin:
155155- [ plugin ] ++ (
156156- lib.unique (builtins.concatLists (map transitiveClosure plugin.dependencies or []))
157157- );
159159+ transitiveClosure =
160160+ plugin:
161161+ [ plugin ]
162162+ ++ (lib.unique (builtins.concatLists (map transitiveClosure plugin.dependencies or [ ])));
158163159164 findDependenciesRecursively = plugins: lib.concatMap transitiveClosure plugins;
160165161161- vamDictToNames = x:
162162- if builtins.isString x then [x]
163163- else (lib.optional (x ? name) x.name)
164164- ++ (x.names or []);
166166+ vamDictToNames =
167167+ x: if builtins.isString x then [ x ] else (lib.optional (x ? name) x.name) ++ (x.names or [ ]);
165168166169 rtpPath = ".";
167170168168- vimFarm = prefix: name: drvs:
169169- let mkEntryFromDrv = drv: { name = "${prefix}/${lib.getName drv}"; path = drv; };
170170- in linkFarm name (map mkEntryFromDrv drvs);
171171+ vimFarm =
172172+ prefix: name: drvs:
173173+ let
174174+ mkEntryFromDrv = drv: {
175175+ name = "${prefix}/${lib.getName drv}";
176176+ path = drv;
177177+ };
178178+ in
179179+ linkFarm name (map mkEntryFromDrv drvs);
171180172172- /* Generates a packpath folder as expected by vim
173173- Example:
174174- packDir (myVimPackage.{ start = [ vimPlugins.vim-fugitive ]; opt = [] })
175175- => "/nix/store/xxxxx-pack-dir"
181181+ /*
182182+ Generates a packpath folder as expected by vim
183183+ Example:
184184+ packDir (myVimPackage.{ start = [ vimPlugins.vim-fugitive ]; opt = [] })
185185+ => "/nix/store/xxxxx-pack-dir"
176186 */
177177- packDir = packages:
178178- let
179179- packageLinks = packageName: {start ? [], opt ? []}:
187187+ packDir =
188188+ packages:
180189 let
181181- # `nativeImpl` expects packages to be derivations, not strings (as
182182- # opposed to older implementations that have to maintain backwards
183183- # compatibility). Therefore we don't need to deal with "knownPlugins"
184184- # and can simply pass `null`.
185185- depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt);
186186- startWithDeps = findDependenciesRecursively start;
187187- allPlugins = lib.unique (startWithDeps ++ depsOfOptionalPlugins);
188188- allPython3Dependencies = ps:
189189- lib.flatten (builtins.map (plugin: (plugin.python3Dependencies or (_: [])) ps) allPlugins);
190190- python3Env = python3.withPackages allPython3Dependencies;
190190+ packageLinks =
191191+ packageName:
192192+ {
193193+ start ? [ ],
194194+ opt ? [ ],
195195+ }:
196196+ let
197197+ # `nativeImpl` expects packages to be derivations, not strings (as
198198+ # opposed to older implementations that have to maintain backwards
199199+ # compatibility). Therefore we don't need to deal with "knownPlugins"
200200+ # and can simply pass `null`.
201201+ depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt);
202202+ startWithDeps = findDependenciesRecursively start;
203203+ allPlugins = lib.unique (startWithDeps ++ depsOfOptionalPlugins);
204204+ allPython3Dependencies =
205205+ ps: lib.flatten (builtins.map (plugin: (plugin.python3Dependencies or (_: [ ])) ps) allPlugins);
206206+ python3Env = python3.withPackages allPython3Dependencies;
191207192192- packdirStart = vimFarm "pack/${packageName}/start" "packdir-start" allPlugins;
193193- packdirOpt = vimFarm "pack/${packageName}/opt" "packdir-opt" opt;
194194- # Assemble all python3 dependencies into a single `site-packages` to avoid doing recursive dependency collection
195195- # for each plugin.
196196- # This directory is only for python import search path, and will not slow down the startup time.
197197- # see :help python3-directory for more details
198198- python3link = runCommand "vim-python3-deps" {} ''
199199- mkdir -p $out/pack/${packageName}/start/__python3_dependencies
200200- ln -s ${python3Env}/${python3Env.sitePackages} $out/pack/${packageName}/start/__python3_dependencies/python3
201201- '';
208208+ packdirStart = vimFarm "pack/${packageName}/start" "packdir-start" allPlugins;
209209+ packdirOpt = vimFarm "pack/${packageName}/opt" "packdir-opt" opt;
210210+ # Assemble all python3 dependencies into a single `site-packages` to avoid doing recursive dependency collection
211211+ # for each plugin.
212212+ # This directory is only for python import search path, and will not slow down the startup time.
213213+ # see :help python3-directory for more details
214214+ python3link = runCommand "vim-python3-deps" { } ''
215215+ mkdir -p $out/pack/${packageName}/start/__python3_dependencies
216216+ ln -s ${python3Env}/${python3Env.sitePackages} $out/pack/${packageName}/start/__python3_dependencies/python3
217217+ '';
218218+ in
219219+ [
220220+ packdirStart
221221+ packdirOpt
222222+ ]
223223+ ++ lib.optional (allPython3Dependencies python3.pkgs != [ ]) python3link;
202224 in
203203- [ packdirStart packdirOpt ] ++ lib.optional (allPython3Dependencies python3.pkgs != []) python3link;
204204- in
205225 buildEnv {
206226 name = "vim-pack-dir";
207227 paths = (lib.flatten (lib.mapAttrsToList packageLinks packages));
208228 };
209229210210- nativeImpl = packages:
211211- ''
230230+ nativeImpl = packages: ''
212231 set packpath^=${packDir packages}
213232 set runtimepath^=${packDir packages}
214233 '';
215234216216- /* Generates a vimrc string
235235+ /*
236236+ Generates a vimrc string
217237218238 packages is an attrset with {name: { start = [ vim derivations ]; opt = [ vim derivations ]; }
219239 Example:
···224244 customRC = ''let mapleader = " "'';
225245226246 };
227227- */
228228- vimrcContent = {
229229- packages ? null,
230230- vam ? null, # deprecated
231231- pathogen ? null, # deprecated
232232- plug ? null,
233233- beforePlugins ? ''
234234- " configuration generated by NIX
235235- set nocompatible
236236- '',
237237- customRC ? null
238238- }:
247247+ */
248248+ vimrcContent =
249249+ {
250250+ packages ? null,
251251+ vam ? null, # deprecated
252252+ pathogen ? null, # deprecated
253253+ plug ? null,
254254+ beforePlugins ? ''
255255+ " configuration generated by NIX
256256+ set nocompatible
257257+ '',
258258+ customRC ? null,
259259+ }:
239260240261 let
241241- /* vim-plug is an extremely popular vim plugin manager.
242242- */
262262+ # vim-plug is an extremely popular vim plugin manager.
243263 plugImpl =
244244- ''
245245- source ${vimPlugins.vim-plug}/plug.vim
246246- silent! call plug#begin('/dev/null')
264264+ ''
265265+ source ${vimPlugins.vim-plug}/plug.vim
266266+ silent! call plug#begin('/dev/null')
247267248248- '' + (lib.concatMapStringsSep "\n" (pkg: "Plug '${pkg}'") plug.plugins) + ''
268268+ ''
269269+ + (lib.concatMapStringsSep "\n" (pkg: "Plug '${pkg}'") plug.plugins)
270270+ + ''
249271250250- call plug#end()
251251- '';
272272+ call plug#end()
273273+ '';
252274253253- # vim-addon-manager = VAM (deprecated)
275275+ # vim-addon-manager = VAM (deprecated)
254276 vamImpl =
255255- let
256256- knownPlugins = vam.knownPlugins or vimPlugins;
277277+ let
278278+ knownPlugins = vam.knownPlugins or vimPlugins;
257279258258- # plugins specified by the user
259259- specifiedPlugins = map (pluginToDrv knownPlugins) (lib.concatMap vamDictToNames vam.pluginDictionaries);
260260- # plugins with dependencies
261261- plugins = findDependenciesRecursively specifiedPlugins;
262262- vamPackages.vam = {
263263- start = plugins;
264264- };
265265- in
280280+ # plugins specified by the user
281281+ specifiedPlugins = map (pluginToDrv knownPlugins) (
282282+ lib.concatMap vamDictToNames vam.pluginDictionaries
283283+ );
284284+ # plugins with dependencies
285285+ plugins = findDependenciesRecursively specifiedPlugins;
286286+ vamPackages.vam = {
287287+ start = plugins;
288288+ };
289289+ in
266290 nativeImpl vamPackages;
267291268268- entries = [
269269- beforePlugins
270270- ]
271271- ++ lib.optional (vam != null) (lib.warn "'vam' attribute is deprecated. Use 'packages' instead in your vim configuration" vamImpl)
272272- ++ lib.optional (packages != null && packages != []) (nativeImpl packages)
273273- ++ lib.optional (pathogen != null) (throw "pathogen is now unsupported, replace `pathogen = {}` with `packages.home = { start = []; }`")
274274- ++ lib.optional (plug != null) plugImpl
275275- ++ [ customRC ];
292292+ entries =
293293+ [
294294+ beforePlugins
295295+ ]
296296+ ++ lib.optional (vam != null) (
297297+ lib.warn "'vam' attribute is deprecated. Use 'packages' instead in your vim configuration" vamImpl
298298+ )
299299+ ++ lib.optional (packages != null && packages != [ ]) (nativeImpl packages)
300300+ ++ lib.optional (pathogen != null) (
301301+ throw "pathogen is now unsupported, replace `pathogen = {}` with `packages.home = { start = []; }`"
302302+ )
303303+ ++ lib.optional (plug != null) plugImpl
304304+ ++ [ customRC ];
276305277306 in
278278- lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
307307+ lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
279308280309 vimrcFile = settings: writeText "vimrc" (vimrcContent settings);
281310···286315 inherit vimrcContent;
287316 inherit packDir;
288317289289- makeCustomizable = let
290290- mkVimrcFile = vimrcFile; # avoid conflict with argument name
291291- in vim: vim // {
292292- # Returns a customized vim that uses the specified vimrc configuration.
293293- customize =
294294- { # The name of the derivation.
295295- name ? "vim"
296296- , # A shell word used to specify the names of the customized executables.
297297- # The shell variable $exe can be used to refer to the wrapped executable's name.
298298- # Examples: "my-$exe", "$exe-with-plugins", "\${exe/vim/v1m}"
299299- executableName ?
300300- if lib.hasInfix "vim" name then
301301- lib.replaceStrings [ "vim" ] [ "$exe" ] name
302302- else
303303- "\${exe/vim/${lib.escapeShellArg name}}"
304304- , # A custom vimrc configuration, treated as an argument to vimrcContent (see the documentation in this file).
305305- vimrcConfig ? null
306306- , # A custom vimrc file.
307307- vimrcFile ? null
308308- , # A custom gvimrc file.
309309- gvimrcFile ? null
310310- , # If set to true, return the *vim wrappers only.
311311- # If set to false, overlay the wrappers on top of the original vim derivation.
312312- # This ensures that things like man pages and .desktop files are available.
313313- standalone ? name != "vim" && wrapManual != true
318318+ makeCustomizable =
319319+ let
320320+ mkVimrcFile = vimrcFile; # avoid conflict with argument name
321321+ in
322322+ vim:
323323+ vim
324324+ // {
325325+ # Returns a customized vim that uses the specified vimrc configuration.
326326+ customize =
327327+ {
328328+ # The name of the derivation.
329329+ name ? "vim",
330330+ # A shell word used to specify the names of the customized executables.
331331+ # The shell variable $exe can be used to refer to the wrapped executable's name.
332332+ # Examples: "my-$exe", "$exe-with-plugins", "\${exe/vim/v1m}"
333333+ executableName ?
334334+ if lib.hasInfix "vim" name then
335335+ lib.replaceStrings [ "vim" ] [ "$exe" ] name
336336+ else
337337+ "\${exe/vim/${lib.escapeShellArg name}}",
338338+ # A custom vimrc configuration, treated as an argument to vimrcContent (see the documentation in this file).
339339+ vimrcConfig ? null,
340340+ # A custom vimrc file.
341341+ vimrcFile ? null,
342342+ # A custom gvimrc file.
343343+ gvimrcFile ? null,
344344+ # If set to true, return the *vim wrappers only.
345345+ # If set to false, overlay the wrappers on top of the original vim derivation.
346346+ # This ensures that things like man pages and .desktop files are available.
347347+ standalone ? name != "vim" && wrapManual != true,
314348315315- , # deprecated arguments (TODO: remove eventually)
316316- wrapManual ? null, wrapGui ? null, vimExecutableName ? null, gvimExecutableName ? null,
317317- }:
318318- lib.warnIf (wrapManual != null) ''
319319- vim.customize: wrapManual is deprecated: the manual is now included by default if `name == "vim"`.
320320- ${if wrapManual == true && name != "vim" then "Set `standalone = false` to include the manual."
321321- else lib.optionalString (wrapManual == false && name == "vim") "Set `standalone = true` to get the *vim wrappers only."
322322- }''
323323- lib.warnIf (wrapGui != null)
324324- "vim.customize: wrapGui is deprecated: gvim is now automatically included if present"
325325- lib.throwIfNot (vimExecutableName == null && gvimExecutableName == null)
326326- "vim.customize: (g)vimExecutableName is deprecated: use executableName instead (see source code for examples)"
327327- (let
328328- vimrc =
329329- if vimrcFile != null then vimrcFile
330330- else if vimrcConfig != null then mkVimrcFile vimrcConfig
331331- else throw "at least one of vimrcConfig and vimrcFile must be specified";
332332- bin = runCommand "${name}-bin" { nativeBuildInputs = [ makeWrapper ]; } ''
333333- vimrc=${lib.escapeShellArg vimrc}
334334- gvimrc=${lib.optionalString (gvimrcFile != null) (lib.escapeShellArg gvimrcFile)}
349349+ # deprecated arguments (TODO: remove eventually)
350350+ wrapManual ? null,
351351+ wrapGui ? null,
352352+ vimExecutableName ? null,
353353+ gvimExecutableName ? null,
354354+ }:
355355+ lib.warnIf (wrapManual != null)
356356+ ''
357357+ vim.customize: wrapManual is deprecated: the manual is now included by default if `name == "vim"`.
358358+ ${
359359+ if wrapManual == true && name != "vim" then
360360+ "Set `standalone = false` to include the manual."
361361+ else
362362+ lib.optionalString (
363363+ wrapManual == false && name == "vim"
364364+ ) "Set `standalone = true` to get the *vim wrappers only."
365365+ }''
366366+ lib.warnIf
367367+ (wrapGui != null)
368368+ "vim.customize: wrapGui is deprecated: gvim is now automatically included if present"
369369+ lib.throwIfNot
370370+ (vimExecutableName == null && gvimExecutableName == null)
371371+ "vim.customize: (g)vimExecutableName is deprecated: use executableName instead (see source code for examples)"
372372+ (
373373+ let
374374+ vimrc =
375375+ if vimrcFile != null then
376376+ vimrcFile
377377+ else if vimrcConfig != null then
378378+ mkVimrcFile vimrcConfig
379379+ else
380380+ throw "at least one of vimrcConfig and vimrcFile must be specified";
381381+ bin = runCommand "${name}-bin" { nativeBuildInputs = [ makeWrapper ]; } ''
382382+ vimrc=${lib.escapeShellArg vimrc}
383383+ gvimrc=${lib.optionalString (gvimrcFile != null) (lib.escapeShellArg gvimrcFile)}
335384336336- mkdir -p "$out/bin"
337337- for exe in ${
338338- if standalone then "{,g,r,rg,e}vim {,g}vimdiff vi"
339339- else "{,g,r,rg,e}{vim,view} {,g}vimdiff ex vi"
340340- }; do
341341- if [[ -e ${vim}/bin/$exe ]]; then
342342- dest="$out/bin/${executableName}"
343343- if [[ -e $dest ]]; then
344344- echo "ambiguous executableName: ''${dest##*/} already exists"
345345- continue
346346- fi
347347- makeWrapper ${vim}/bin/"$exe" "$dest" \
348348- --add-flags "-u ''${vimrc@Q} ''${gvimrc:+-U ''${gvimrc@Q}}"
349349- fi
350350- done
351351- '';
352352- in if standalone then bin else
353353- buildEnv {
354354- inherit name;
355355- paths = [ (lib.lowPrio vim) bin ];
356356- });
385385+ mkdir -p "$out/bin"
386386+ for exe in ${
387387+ if standalone then "{,g,r,rg,e}vim {,g}vimdiff vi" else "{,g,r,rg,e}{vim,view} {,g}vimdiff ex vi"
388388+ }; do
389389+ if [[ -e ${vim}/bin/$exe ]]; then
390390+ dest="$out/bin/${executableName}"
391391+ if [[ -e $dest ]]; then
392392+ echo "ambiguous executableName: ''${dest##*/} already exists"
393393+ continue
394394+ fi
395395+ makeWrapper ${vim}/bin/"$exe" "$dest" \
396396+ --add-flags "-u ''${vimrc@Q} ''${gvimrc:+-U ''${gvimrc@Q}}"
397397+ fi
398398+ done
399399+ '';
400400+ in
401401+ if standalone then
402402+ bin
403403+ else
404404+ buildEnv {
405405+ inherit name;
406406+ paths = [
407407+ (lib.lowPrio vim)
408408+ bin
409409+ ];
410410+ }
411411+ );
357412358358- override = f: makeCustomizable (vim.override f);
359359- overrideAttrs = f: makeCustomizable (vim.overrideAttrs f);
360360- };
413413+ override = f: makeCustomizable (vim.override f);
414414+ overrideAttrs = f: makeCustomizable (vim.overrideAttrs f);
415415+ };
361416362362- vimGenDocHook = callPackage ({ vim }:
417417+ vimGenDocHook = callPackage (
418418+ { vim }:
363419 makeSetupHook {
364420 name = "vim-gen-doc-hook";
365421 propagatedBuildInputs = [ vim ];
···367423 vimBinary = "${vim}/bin/vim";
368424 inherit rtpPath;
369425 };
370370- } ./vim-gen-doc-hook.sh) {};
426426+ } ./vim-gen-doc-hook.sh
427427+ ) { };
371428372372- vimCommandCheckHook = callPackage ({ neovim-unwrapped }:
429429+ vimCommandCheckHook = callPackage (
430430+ { neovim-unwrapped }:
373431 makeSetupHook {
374432 name = "vim-command-check-hook";
375433 propagatedBuildInputs = [ neovim-unwrapped ];
···377435 vimBinary = "${neovim-unwrapped}/bin/nvim";
378436 inherit rtpPath;
379437 };
380380- } ./vim-command-check-hook.sh) {};
438438+ } ./vim-command-check-hook.sh
439439+ ) { };
381440382382- neovimRequireCheckHook = callPackage ({ neovim-unwrapped }:
441441+ neovimRequireCheckHook = callPackage (
442442+ { neovim-unwrapped }:
383443 makeSetupHook {
384444 name = "neovim-require-check-hook";
385445 propagatedBuildInputs = [ neovim-unwrapped ];
···387447 nvimBinary = "${neovim-unwrapped}/bin/nvim";
388448 inherit rtpPath;
389449 };
390390- } ./neovim-require-check-hook.sh) {};
450450+ } ./neovim-require-check-hook.sh
451451+ ) { };
391452392392- inherit (import ./build-vim-plugin.nix {
393393- inherit lib stdenv rtpPath toVimPlugin;
394394- }) buildVimPlugin;
453453+ inherit
454454+ (import ./build-vim-plugin.nix {
455455+ inherit
456456+ lib
457457+ stdenv
458458+ rtpPath
459459+ toVimPlugin
460460+ ;
461461+ })
462462+ buildVimPlugin
463463+ ;
395464396465 buildVimPluginFrom2Nix = lib.warn "buildVimPluginFrom2Nix is deprecated: use buildVimPlugin instead" buildVimPlugin;
397466398467 # used to figure out which python dependencies etc. neovim needs
399399- requiredPlugins = {
400400- packages ? {},
401401- plug ? null, ...
402402- }:
468468+ requiredPlugins =
469469+ {
470470+ packages ? { },
471471+ plug ? null,
472472+ ...
473473+ }:
403474 let
404475 nativePluginsConfigs = lib.attrsets.attrValues packages;
405476 nonNativePlugins = (lib.optionals (plug != null) plug.plugins);
406477 nativePlugins = lib.concatMap (requiredPluginsForPackage) nativePluginsConfigs;
407478 in
408408- nativePlugins ++ nonNativePlugins;
409409-479479+ nativePlugins ++ nonNativePlugins;
410480411481 # figures out which python dependencies etc. is needed for one vim package
412412- requiredPluginsForPackage = { start ? [], opt ? []}:
482482+ requiredPluginsForPackage =
483483+ {
484484+ start ? [ ],
485485+ opt ? [ ],
486486+ }:
413487 start ++ opt;
414488415415- toVimPlugin = drv:
416416- drv.overrideAttrs(oldAttrs: {
489489+ toVimPlugin =
490490+ drv:
491491+ drv.overrideAttrs (oldAttrs: {
417492 name = "vimplugin-${oldAttrs.name}";
418493 # dont move the "doc" folder since vim expects it
419419- forceShare = [ "man" "info" ];
494494+ forceShare = [
495495+ "man"
496496+ "info"
497497+ ];
420498421421- nativeBuildInputs = oldAttrs.nativeBuildInputs or []
422422- ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
423423- vimCommandCheckHook vimGenDocHook
424424- # many neovim plugins keep using buildVimPlugin
425425- neovimRequireCheckHook
426426- ];
499499+ nativeBuildInputs =
500500+ oldAttrs.nativeBuildInputs or [ ]
501501+ ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
502502+ vimCommandCheckHook
503503+ vimGenDocHook
504504+ # many neovim plugins keep using buildVimPlugin
505505+ neovimRequireCheckHook
506506+ ];
427507428428- passthru = (oldAttrs.passthru or {}) // {
508508+ passthru = (oldAttrs.passthru or { }) // {
429509 vimPlugin = true;
430510 };
431511 });
432432-} // lib.optionalAttrs config.allowAliases {
512512+}
513513+// lib.optionalAttrs config.allowAliases {
433514 vimWithRC = throw "vimWithRC was removed, please use vim.customize instead";
434515}
···11{ lib
22, stdenv
33, substituteAll
44+, git
45, fetchFromGitLab
56, buildGoModule
67, wrapQtAppsHook
88+, python3
79, python3Packages
810, pkg-config
911, openvpn
···3032 owner = "leap";
3133 repo = "bitmask-vpn";
3234 rev = "8b3ac473f64b6de0262fbf945ff25af8029134f1";
3333- sha256 = "sha256-nYMfO091w6H7LyY1+aYubFppg4/3GiZZm4e+0m9Gb3k=";
3535+ leaveDotGit = true;
3636+ sha256 = "sha256-XUgCVHnTLZXFU+r0s1yuYryWNBJRgQrFlf3g1iRrLWs=";
3437 };
35383639 # bitmask-root is only used on GNU/Linux
···105108106109 nativeBuildInputs = [
107110 cmake
111111+ git
108112 pkg-config
113113+ python3
109114 python3Packages.wrapPython
110115 which
111116 wrapQtAppsHook
···130135 # gui/build.sh will build Go modules into lib/libgoshim.a
131136 buildPhase = ''
132137 runHook preBuild
138138+139139+ make vendor
133140134141 # TODO: this is a hack that copies the qrc file that should by built by qmlcachegen
135142 # qmlcachegen is in qtdeclarative/libexec, but qmake is in qtbase/bin
+1-7
pkgs/tools/package-management/nix/default.nix
···172172 enableParallelChecking = false;
173173 };
174174175175- nix_2_18 = common {
176176- version = "2.18.9";
177177- hash = "sha256-RrOFlDGmRXcVRV2p2HqHGqvzGNyWoD0Dado/BNlJ1SI=";
178178- self_attribute_name = "nix_2_18";
179179- };
180180-181175 nix_2_24 = common {
182176 version = "2.24.10";
183177 hash = "sha256-XdeVy1/d6DEIYb3nOA6JIYF4fwMKNxtwJMgT3pHi+ko=";
···230224 attr = "nix_2_${toString minor}";
231225 in
232226 lib.nameValuePair attr (throw "${attr} has been removed")
233233- ) (lib.range 4 17))
227227+ ) (lib.range 4 23))
234228 // {
235229 unstable = throw "nixVersions.unstable has been removed. For bleeding edge (Nix master, roughly weekly updated) use nixVersions.git, otherwise use nixVersions.latest.";
236230 }
+1
pkgs/top-level/aliases.nix
···780780 ### M ###
781781782782 ma1sd = throw "ma1sd was dropped as it is unmaintained"; # Added 2024-07-10
783783+ mac = monkeysAudio; # Added 2024-11-30
783784 MACS2 = macs2; # Added 2023-06-12
784785 mailctl = throw "mailctl has been renamed to oama"; # Added 2024-08-19
785786 mailman-rss = throw "The mailman-rss package was dropped since it was unmaintained."; # Added 2024-06-21