Merge branch 'master' into staging

Larger rebuilds from master.
This commit is contained in:
Vladimír Čunát 2018-02-20 20:33:17 +01:00
commit 1d15dadbec
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
176 changed files with 6365 additions and 2890 deletions

View File

@ -58,6 +58,8 @@ To install crates with nix there is also an experimental project called
## Compiling Rust crates using Nix instead of Cargo ## Compiling Rust crates using Nix instead of Cargo
### Simple operation
When run, `cargo build` produces a file called `Cargo.lock`, When run, `cargo build` produces a file called `Cargo.lock`,
containing pinned versions of all dependencies. Nixpkgs contains a containing pinned versions of all dependencies. Nixpkgs contains a
tool called `carnix` (`nix-env -iA nixos.carnix`), which can be used tool called `carnix` (`nix-env -iA nixos.carnix`), which can be used
@ -153,6 +155,8 @@ Here, the `libc` crate has no `src` attribute, so `buildRustCrate`
will fetch it from [crates.io](https://crates.io). A `sha256` will fetch it from [crates.io](https://crates.io). A `sha256`
attribute is still needed for Nix purity. attribute is still needed for Nix purity.
### Handling external dependencies
Some crates require external libraries. For crates from Some crates require external libraries. For crates from
[crates.io](https://crates.io), such libraries can be specified in [crates.io](https://crates.io), such libraries can be specified in
`defaultCrateOverrides` package in nixpkgs itself. `defaultCrateOverrides` package in nixpkgs itself.
@ -210,7 +214,10 @@ with import <nixpkgs> {};
} }
``` ```
Three more parameters can be overridden: ### Options and phases configuration
Actually, the overrides introduced in the previous section are more
general. A number of other parameters can be overridden:
- The version of rustc used to compile the crate: - The version of rustc used to compile the crate:
@ -232,6 +239,30 @@ Three more parameters can be overridden:
(hello {}).override { verbose = false; }; (hello {}).override { verbose = false; };
``` ```
- Extra arguments to be passed to `rustc`:
```
(hello {}).override { extraRustcOpts = "-Z debuginfo=2"; };
```
- Phases, just like in any other derivation, can be specified using
the following attributes: `preUnpack`, `postUnpack`, `prePatch`,
`patches`, `postPatch`, `preConfigure` (in the case of a Rust crate,
this is run before calling the "build" script), `postConfigure`
(after the "build" script),`preBuild`, `postBuild`, `preInstall` and
`postInstall`. As an example, here is how to create a new module
before running the build script:
```
(hello {}).override {
preConfigure = ''
echo "pub const PATH=\"${hi.out}\";" >> src/path.rs"
'';
};
```
### Features
One can also supply features switches. For example, if we want to One can also supply features switches. For example, if we want to
compile `diesel_cli` only with the `postgres` feature, and no default compile `diesel_cli` only with the `postgres` feature, and no default
features, we would write: features, we would write:
@ -243,7 +274,7 @@ features, we would write:
} }
``` ```
Where `diesel.nix` is the file generated by Carnix, as explained above.
## Using the Rust nightlies overlay ## Using the Rust nightlies overlay

View File

@ -385,6 +385,7 @@
lheckemann = "Linus Heckemann <git@sphalerite.org>"; lheckemann = "Linus Heckemann <git@sphalerite.org>";
lhvwb = "Nathaniel Baxter <nathaniel.baxter@gmail.com>"; lhvwb = "Nathaniel Baxter <nathaniel.baxter@gmail.com>";
lihop = "Leroy Hopson <nixos@leroy.geek.nz>"; lihop = "Leroy Hopson <nixos@leroy.geek.nz>";
limeytexan = "Michael Brantley <limeytexan@gmail.com>";
linquize = "Linquize <linquize@yahoo.com.hk>"; linquize = "Linquize <linquize@yahoo.com.hk>";
linus = "Linus Arver <linusarver@gmail.com>"; linus = "Linus Arver <linusarver@gmail.com>";
lluchs = "Lukas Werling <lukas.werling@gmail.com>"; lluchs = "Lukas Werling <lukas.werling@gmail.com>";
@ -669,6 +670,7 @@
StillerHarpo = "Florian Engel <florianengel39@gmail.com>"; StillerHarpo = "Florian Engel <florianengel39@gmail.com>";
stumoss = "Stuart Moss <samoss@gmail.com>"; stumoss = "Stuart Moss <samoss@gmail.com>";
SuprDewd = "Bjarki Ágúst Guðmundsson <suprdewd@gmail.com>"; SuprDewd = "Bjarki Ágúst Guðmundsson <suprdewd@gmail.com>";
suvash = "Suvash Thapaliya <suvash+nixpkgs@gmail.com>";
swarren83 = "Shawn Warren <shawn.w.warren@gmail.com>"; swarren83 = "Shawn Warren <shawn.w.warren@gmail.com>";
swflint = "Samuel W. Flint <swflint@flintfam.org>"; swflint = "Samuel W. Flint <swflint@flintfam.org>";
swistak35 = "Rafał Łasocha <me@swistak35.com>"; swistak35 = "Rafał Łasocha <me@swistak35.com>";

View File

@ -545,6 +545,13 @@ rec {
name = "riscv-multiplatform"; name = "riscv-multiplatform";
kernelArch = "riscv"; kernelArch = "riscv";
bfdEmulation = "elf${bits}lriscv"; bfdEmulation = "elf${bits}lriscv";
kernelTarget = "vmlinux";
kernelAutoModules = true;
kernelBaseConfig = "defconfig";
kernelExtraConfig = ''
FTRACE n
SERIAL_OF_PLATFORM y
'';
}; };
selectBySystem = system: { selectBySystem = system: {

View File

@ -12,7 +12,7 @@ interfaces. However, you can configure an interface manually as
follows: follows:
<programlisting> <programlisting>
networking.interfaces.eth0.ip4 = [ { address = "192.168.1.2"; prefixLength = 24; } ]; networking.interfaces.eth0.ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
</programlisting> </programlisting>
Typically youll also want to set a default gateway and set of name Typically youll also want to set a default gateway and set of name

View File

@ -26,7 +26,7 @@ boot.kernel.sysctl."net.ipv6.conf.eth0.disable_ipv6" = true;
DHCPv6. You can configure an interface manually: DHCPv6. You can configure an interface manually:
<programlisting> <programlisting>
networking.interfaces.eth0.ip6 = [ { address = "fe00:aa:bb:cc::2"; prefixLength = 64; } ]; networking.interfaces.eth0.ipv6.addresses = [ { address = "fe00:aa:bb:cc::2"; prefixLength = 64; } ];
</programlisting> </programlisting>
</para> </para>

View File

@ -36,17 +36,6 @@ services.compton = {
<literal>environment.systemPackages</literal>. <literal>environment.systemPackages</literal>.
</para> </para>
<para>
NixOSs default <emphasis>display manager</emphasis> is SLiM.
(DM is the program that provides a graphical login prompt
and manages the X server.)
You can, for example, select KDEs
<command>sddm</command> instead:
<programlisting>
services.xserver.displayManager.sddm.enable = true;
</programlisting>
</para>
<simplesect> <simplesect>
<title>Thunar Volume Support</title> <title>Thunar Volume Support</title>

View File

@ -36,7 +36,7 @@ let
package = args.package or (lib.attrByPath path (throw "Invalid package attribute path `${toString path}'") pkgs); package = args.package or (lib.attrByPath path (throw "Invalid package attribute path `${toString path}'") pkgs);
in "<listitem>" in "<listitem>"
+ "<para><literal>pkgs.${name} (${package.meta.name})</literal>" + "<para><literal>pkgs.${name} (${package.meta.name})</literal>"
+ lib.optionalString (!package.meta.evaluates) " <emphasis>[UNAVAILABLE]</emphasis>" + lib.optionalString (!package.meta.available) " <emphasis>[UNAVAILABLE]</emphasis>"
+ ": ${package.meta.description or "???"}.</para>" + ": ${package.meta.description or "???"}.</para>"
+ lib.optionalString (args ? comment) "\n<para>${args.comment}</para>" + lib.optionalString (args ? comment) "\n<para>${args.comment}</para>"
# Lots of `longDescription's break DocBook, so we just wrap them into <programlisting> # Lots of `longDescription's break DocBook, so we just wrap them into <programlisting>

View File

@ -275,11 +275,20 @@ Enter new UNIX password: ***
Retype new UNIX password: *** Retype new UNIX password: ***
</screen> </screen>
<note>
<para>
To prevent the password prompt, set <code>users.mutableUsers = false;</code> in
<filename>configuration.nix</filename>, which allows unattended installation
necessary in automation.
</para>
</note>
</para> </para>
</listitem> </listitem>
<listitem><para>If everything went well: <listitem>
<para>If everything went well:
<screen> <screen>
# reboot</screen> # reboot</screen>

View File

@ -231,6 +231,14 @@ following incompatible changes:</para>
<literal>Option "XkbRules" "base"</literal> may result in broken keyboard layout. <literal>Option "XkbRules" "base"</literal> may result in broken keyboard layout.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The <literal>attic</literal> package was removed. A maintained fork called
<link xlink:href="https://www.borgbackup.org/">Borg</link> should be used instead.
Migration instructions can be found
<link xlink:href="http://borgbackup.readthedocs.io/en/stable/usage/upgrade.html#attic-and-borg-0-xx-to-borg-1-x">here</link>.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
@ -261,10 +269,42 @@ following incompatible changes:</para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
The option <option>services.xserver.desktopManager.default</option> is now <literal>none</literal> by default. In the module <option>networking.interfaces.&lt;name&gt;</option> the
An assertion failure is thrown if WM's and DM's default are <literal>none</literal>. following options have been removed:
To explicitly run a plain X session without and DM or WM, the newly introduced option <option>services.xserver.plainX</option> <itemizedlist>
must be set to true. <listitem>
<para><option>ipAddress</option></para>
</listitem>
<listitem>
<para><option>ipv6Address</option></para>
</listitem>
<listitem>
<para><option>prefixLength</option></para>
</listitem>
<listitem>
<para><option>ipv6PrefixLength</option></para>
</listitem>
<listitem>
<para><option>subnetMask</option></para>
</listitem>
</itemizedlist>
To assign static addresses to an interface the options
<option>ipv4.addresses</option> and <option>ipv6.addresses</option>
should be used instead.
The options <option>ip4</option> and <option>ip6</option> have been
renamed to <option>ipv4.addresses</option> <option>ipv6.addresses</option>
respectively.
The new options <option>ipv4.routes</option> and <option>ipv6.routes</option>
have been added to set up static routing.
</para>
</listitem>
<listitem>
<para>
The option <option>services.xserver.desktopManager.default</option> is now
<literal>none</literal> by default. An assertion failure is thrown if WM's
and DM's default are <literal>none</literal>.
To explicitly run a plain X session without and DM or WM, the newly
introduced option <option>services.xserver.plainX</option> must be set to true.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>

View File

@ -51,7 +51,7 @@ rec {
let let
interfacesNumbered = zipLists config.virtualisation.vlans (range 1 255); interfacesNumbered = zipLists config.virtualisation.vlans (range 1 255);
interfaces = flip map interfacesNumbered ({ fst, snd }: interfaces = flip map interfacesNumbered ({ fst, snd }:
nameValuePair "eth${toString snd}" { ip4 = nameValuePair "eth${toString snd}" { ipv4.addresses =
[ { address = "192.168.${toString fst}.${toString m.snd}"; [ { address = "192.168.${toString fst}.${toString m.snd}";
prefixLength = 24; prefixLength = 24;
} ]; } ];
@ -64,7 +64,7 @@ rec {
networking.interfaces = listToAttrs interfaces; networking.interfaces = listToAttrs interfaces;
networking.primaryIPAddress = networking.primaryIPAddress =
optionalString (interfaces != []) (head (head interfaces).value.ip4).address; optionalString (interfaces != []) (head (head interfaces).value.ipv4.addresses).address;
# Put the IP addresses of all VMs in this machine's # Put the IP addresses of all VMs in this machine's
# /etc/hosts file. If a machine has multiple # /etc/hosts file. If a machine has multiple

View File

@ -84,7 +84,7 @@ let format' = format; in let
nixpkgs = cleanSource pkgs.path; nixpkgs = cleanSource pkgs.path;
channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}" {} '' channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" {} ''
mkdir -p $out mkdir -p $out
cp -prd ${nixpkgs} $out/nixos cp -prd ${nixpkgs} $out/nixos
chmod -R u+w $out/nixos chmod -R u+w $out/nixos
@ -92,7 +92,7 @@ let format' = format; in let
ln -s . $out/nixos/nixpkgs ln -s . $out/nixos/nixpkgs
fi fi
rm -rf $out/nixos/.git rm -rf $out/nixos/.git
echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix echo -n ${config.system.nixos.versionSuffix} > $out/nixos/.version-suffix
''; '';
metaClosure = pkgs.writeText "meta" '' metaClosure = pkgs.writeText "meta" ''

View File

@ -78,7 +78,19 @@ rec {
} @ t: } @ t:
let let
testDriverName = "nixos-test-driver-${name}"; # A standard store path to the vm monitor is built like this:
# /tmp/nix-build-vm-test-run-$name.drv-0/vm-state-machine/monitor
# The max filename length of a unix domain socket is 108 bytes.
# This means $name can at most be 50 bytes long.
maxTestNameLen = 50;
testNameLen = builtins.stringLength name;
testDriverName = with builtins;
if testNameLen > maxTestNameLen then
abort ("The name of the test '${name}' must not be longer than ${toString maxTestNameLen} " +
"it's currently ${toString testNameLen} characters long.")
else
"nixos-test-driver-${name}";
nodes = buildVirtualNetwork ( nodes = buildVirtualNetwork (
t.nodes or (if t ? machine then { machine = t.machine; } else { })); t.nodes or (if t ? machine then { machine = t.machine; } else { }));

View File

@ -12,7 +12,7 @@ let
# CD. These are installed into the "nixos" channel of the root # CD. These are installed into the "nixos" channel of the root
# user, as expected by nixos-rebuild/nixos-install. FIXME: merge # user, as expected by nixos-rebuild/nixos-install. FIXME: merge
# with make-channel.nix. # with make-channel.nix.
channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}" channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}"
{ } { }
'' ''
mkdir -p $out mkdir -p $out
@ -21,7 +21,7 @@ let
if [ ! -e $out/nixos/nixpkgs ]; then if [ ! -e $out/nixos/nixpkgs ]; then
ln -s . $out/nixos/nixpkgs ln -s . $out/nixos/nixpkgs
fi fi
echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix echo -n ${config.system.nixos.versionSuffix} > $out/nixos/.version-suffix
''; '';
in in

View File

@ -16,7 +16,7 @@ with lib;
]; ];
# ISO naming. # ISO naming.
isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixosLabel}-${pkgs.stdenv.system}.iso"; isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.system}.iso";
isoImage.volumeID = substring 0 11 "NIXOS_ISO"; isoImage.volumeID = substring 0 11 "NIXOS_ISO";

View File

@ -39,31 +39,31 @@ let
DEFAULT boot DEFAULT boot
LABEL boot LABEL boot
MENU LABEL NixOS ${config.system.nixosLabel}${config.isoImage.appendToMenuLabel} MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
LINUX /boot/bzImage LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
INITRD /boot/initrd INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with 'nomodeset' # A variant to boot with 'nomodeset'
LABEL boot-nomodeset LABEL boot-nomodeset
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (nomodeset) MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (nomodeset)
LINUX /boot/bzImage LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
INITRD /boot/initrd INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with 'copytoram' # A variant to boot with 'copytoram'
LABEL boot-copytoram LABEL boot-copytoram
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (copytoram) MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (copytoram)
LINUX /boot/bzImage LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
INITRD /boot/initrd INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with verbose logging to the console # A variant to boot with verbose logging to the console
LABEL boot-nomodeset LABEL boot-nomodeset
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (debug) MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug)
LINUX /boot/bzImage LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7 APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
INITRD /boot/initrd INITRD /boot/${config.system.boot.loader.initrdFile}
''; '';
isolinuxMemtest86Entry = '' isolinuxMemtest86Entry = ''
@ -82,35 +82,35 @@ let
mkdir -p $out/loader/entries mkdir -p $out/loader/entries
cat << EOF > $out/loader/entries/nixos-iso.conf cat << EOF > $out/loader/entries/nixos-iso.conf
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
linux /boot/bzImage linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/initrd initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
EOF EOF
# A variant to boot with 'nomodeset' # A variant to boot with 'nomodeset'
cat << EOF > $out/loader/entries/nixos-iso-nomodeset.conf cat << EOF > $out/loader/entries/nixos-iso-nomodeset.conf
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
version nomodeset version nomodeset
linux /boot/bzImage linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/initrd initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
EOF EOF
# A variant to boot with 'copytoram' # A variant to boot with 'copytoram'
cat << EOF > $out/loader/entries/nixos-iso-copytoram.conf cat << EOF > $out/loader/entries/nixos-iso-copytoram.conf
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
version copytoram version copytoram
linux /boot/bzImage linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/initrd initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
EOF EOF
# A variant to boot with verbose logging to the console # A variant to boot with verbose logging to the console
cat << EOF > $out/loader/entries/nixos-iso-debug.conf cat << EOF > $out/loader/entries/nixos-iso-debug.conf
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (debug) title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug)
linux /boot/bzImage linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/initrd initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7 options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
EOF EOF
@ -127,8 +127,8 @@ let
mkdir ./contents && cd ./contents mkdir ./contents && cd ./contents
cp -rp "${efiDir}"/* . cp -rp "${efiDir}"/* .
mkdir ./boot mkdir ./boot
cp -p "${config.boot.kernelPackages.kernel}/bzImage" \ cp -p "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}" \
"${config.system.build.initialRamdisk}/initrd" ./boot/ "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}" ./boot/
touch --date=@0 ./* touch --date=@0 ./*
usage_size=$(du -sb --apparent-size . | tr -cd '[:digit:]') usage_size=$(du -sb --apparent-size . | tr -cd '[:digit:]')
@ -346,11 +346,11 @@ in
}; };
target = "/isolinux/isolinux.cfg"; target = "/isolinux/isolinux.cfg";
} }
{ source = config.boot.kernelPackages.kernel + "/bzImage"; { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
target = "/boot/bzImage"; target = "/boot/" + config.system.boot.loader.kernelFile;
} }
{ source = config.system.build.initialRamdisk + "/initrd"; { source = config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile;
target = "/boot/initrd"; target = "/boot/" + config.system.boot.loader.initrdFile;
} }
{ source = config.system.build.squashfsStore; { source = config.system.build.squashfsStore;
target = "/nix-store.squashfs"; target = "/nix-store.squashfs";
@ -361,7 +361,7 @@ in
{ source = config.isoImage.splashImage; { source = config.isoImage.splashImage;
target = "/isolinux/background.png"; target = "/isolinux/background.png";
} }
{ source = pkgs.writeText "version" config.system.nixosVersion; { source = pkgs.writeText "version" config.system.nixos.label;
target = "/version.txt"; target = "/version.txt";
} }
] ++ optionals config.isoImage.makeEfiBootable [ ] ++ optionals config.isoImage.makeEfiBootable [

View File

@ -8,7 +8,7 @@ with lib;
let let
versionFile = pkgs.writeText "nixos-version" config.system.nixosVersion; versionFile = pkgs.writeText "nixos-label" config.system.nixos.label;
in in
@ -58,8 +58,8 @@ in
# Individual files to be included on the CD, outside of the Nix # Individual files to be included on the CD, outside of the Nix
# store on the CD. # store on the CD.
tarball.contents = tarball.contents =
[ { source = config.system.build.initialRamdisk + "/initrd"; [ { source = config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile;
target = "/boot/initrd"; target = "/boot/" + config.system.boot.loader.initrdFile;
} }
{ source = versionFile; { source = versionFile;
target = "/nixos-version.txt"; target = "/nixos-version.txt";

View File

@ -625,7 +625,7 @@ $bootLoaderConfig
# compatible, in order to avoid breaking some software such as database # compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you # servers. You should change this only after NixOS release notes say you
# should. # should.
system.stateVersion = "${\(qw(@nixosRelease@))}"; # Did you read the comment? system.stateVersion = "${\(qw(@release@))}"; # Did you read the comment?
} }
EOF EOF

View File

@ -6,9 +6,9 @@ case "$1" in
exit 1 exit 1
;; ;;
--hash|--revision) --hash|--revision)
echo "@nixosRevision@" echo "@revision@"
;; ;;
*) *)
echo "@nixosVersion@ (@nixosCodeName@)" echo "@version@ (@codeName@)"
;; ;;
esac esac

View File

@ -55,7 +55,7 @@ let
src = ./nixos-generate-config.pl; src = ./nixos-generate-config.pl;
path = [ pkgs.btrfs-progs ]; path = [ pkgs.btrfs-progs ];
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl"; perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
inherit (config.system) nixosRelease; inherit (config.system.nixos) release;
}; };
nixos-option = makeProg { nixos-option = makeProg {
@ -66,7 +66,7 @@ let
nixos-version = makeProg { nixos-version = makeProg {
name = "nixos-version"; name = "nixos-version";
src = ./nixos-version.sh; src = ./nixos-version.sh;
inherit (config.system) nixosVersion nixosCodeName nixosRevision; inherit (config.system.nixos) version codeName revision;
}; };
in in

View File

@ -0,0 +1,72 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.system.nixos;
in
{
options.system = {
nixos.label = mkOption {
type = types.str;
description = ''
NixOS version name to be used in the names of generated
outputs and boot labels.
If you ever wanted to influence the labels in your GRUB menu,
this is the option for you.
The default is <option>system.nixos.tags</option> separated by
"-" + "-" + <envar>NIXOS_LABEL_VERSION</envar> environment
variable (defaults to the value of
<option>system.nixos.version</option>).
Can be overriden by setting <envar>NIXOS_LABEL</envar>.
Useful for not loosing track of configurations built from different
nixos branches/revisions, e.g.:
<screen>
#!/bin/sh
today=`date +%Y%m%d`
branch=`(cd nixpkgs ; git branch 2>/dev/null | sed -n '/^\* / { s|^\* ||; p; }')`
revision=`(cd nixpkgs ; git rev-parse HEAD)`
export NIXOS_LABEL_VERSION="$today.$branch-''${revision:0:7}"
nixos-rebuild switch</screen>
'';
};
nixos.tags = mkOption {
type = types.listOf types.str;
default = [];
example = [ "with-xen" ];
description = ''
Strings to prefix to the default
<option>system.nixos.label</option>.
Useful for not loosing track of configurations built with
different options, e.g.:
<screen>
{
system.nixos.tags = [ "with-xen" ];
virtualisation.xen.enable = true;
}
</screen>
'';
};
};
config = {
# This is set here rather than up there so that changing it would
# not rebuild the manual
system.nixos.label = mkDefault (maybeEnv "NIXOS_LABEL"
(concatStringsSep "-" (sort (x: y: x < y) cfg.tags)
+ "-" + maybeEnv "NIXOS_LABEL_VERSION" cfg.version));
};
}

View File

@ -3,7 +3,7 @@
with lib; with lib;
let let
cfg = config.system; cfg = config.system.nixos;
releaseFile = "${toString pkgs.path}/.version"; releaseFile = "${toString pkgs.path}/.version";
suffixFile = "${toString pkgs.path}/.version-suffix"; suffixFile = "${toString pkgs.path}/.version-suffix";
@ -16,9 +16,44 @@ in
options.system = { options.system = {
nixos.version = mkOption {
internal = true;
type = types.str;
description = "The full NixOS version (e.g. <literal>16.03.1160.f2d4ee1</literal>).";
};
nixos.release = mkOption {
readOnly = true;
type = types.str;
default = fileContents releaseFile;
description = "The NixOS release (e.g. <literal>16.03</literal>).";
};
nixos.versionSuffix = mkOption {
internal = true;
type = types.str;
default = if pathExists suffixFile then fileContents suffixFile else "pre-git";
description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
};
nixos.revision = mkOption {
internal = true;
type = types.str;
default = if pathIsDirectory gitRepo then commitIdFromGitRepo gitRepo
else if pathExists revisionFile then fileContents revisionFile
else "master";
description = "The Git revision from which this NixOS configuration was built.";
};
nixos.codeName = mkOption {
readOnly = true;
type = types.str;
description = "The NixOS release code name (e.g. <literal>Emu</literal>).";
};
stateVersion = mkOption { stateVersion = mkOption {
type = types.str; type = types.str;
default = cfg.nixosRelease; default = cfg.release;
description = '' description = ''
Every once in a while, a new NixOS release may change Every once in a while, a new NixOS release may change
configuration defaults in a way incompatible with stateful configuration defaults in a way incompatible with stateful
@ -32,49 +67,6 @@ in
''; '';
}; };
nixosLabel = mkOption {
type = types.str;
description = ''
Label to be used in the names of generated outputs and boot
labels.
'';
};
nixosVersion = mkOption {
internal = true;
type = types.str;
description = "The full NixOS version (e.g. <literal>16.03.1160.f2d4ee1</literal>).";
};
nixosRelease = mkOption {
readOnly = true;
type = types.str;
default = fileContents releaseFile;
description = "The NixOS release (e.g. <literal>16.03</literal>).";
};
nixosVersionSuffix = mkOption {
internal = true;
type = types.str;
default = if pathExists suffixFile then fileContents suffixFile else "pre-git";
description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
};
nixosRevision = mkOption {
internal = true;
type = types.str;
default = if pathIsDirectory gitRepo then commitIdFromGitRepo gitRepo
else if pathExists revisionFile then fileContents revisionFile
else "master";
description = "The Git revision from which this NixOS configuration was built.";
};
nixosCodeName = mkOption {
readOnly = true;
type = types.str;
description = "The NixOS release code name (e.g. <literal>Emu</literal>).";
};
defaultChannel = mkOption { defaultChannel = mkOption {
internal = true; internal = true;
type = types.str; type = types.str;
@ -86,16 +78,15 @@ in
config = { config = {
system = { system.nixos = {
# These defaults are set here rather than up there so that # These defaults are set here rather than up there so that
# changing them would not rebuild the manual # changing them would not rebuild the manual
nixosLabel = mkDefault cfg.nixosVersion; version = mkDefault (cfg.release + cfg.versionSuffix);
nixosVersion = mkDefault (cfg.nixosRelease + cfg.nixosVersionSuffix); revision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId);
nixosRevision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId); versionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId));
nixosVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId));
# Note: code names must only increase in alphabetical order. # Note: code names must only increase in alphabetical order.
nixosCodeName = "Impala"; codeName = "Impala";
}; };
# Generate /etc/os-release. See # Generate /etc/os-release. See
@ -105,10 +96,10 @@ in
'' ''
NAME=NixOS NAME=NixOS
ID=nixos ID=nixos
VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})" VERSION="${cfg.version} (${cfg.codeName})"
VERSION_CODENAME=${toLower config.system.nixosCodeName} VERSION_CODENAME=${toLower cfg.codeName}
VERSION_ID="${config.system.nixosVersion}" VERSION_ID="${cfg.version}"
PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})" PRETTY_NAME="NixOS ${cfg.version} (${cfg.codeName})"
HOME_URL="https://nixos.org/" HOME_URL="https://nixos.org/"
SUPPORT_URL="https://nixos.org/nixos/support.html" SUPPORT_URL="https://nixos.org/nixos/support.html"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"

View File

@ -60,6 +60,7 @@
./misc/extra-arguments.nix ./misc/extra-arguments.nix
./misc/ids.nix ./misc/ids.nix
./misc/lib.nix ./misc/lib.nix
./misc/label.nix
./misc/locate.nix ./misc/locate.nix
./misc/meta.nix ./misc/meta.nix
./misc/nixpkgs.nix ./misc/nixpkgs.nix
@ -156,6 +157,7 @@
./services/backup/almir.nix ./services/backup/almir.nix
./services/backup/bacula.nix ./services/backup/bacula.nix
./services/backup/crashplan.nix ./services/backup/crashplan.nix
./services/backup/crashplan-small-business.nix
./services/backup/mysql-backup.nix ./services/backup/mysql-backup.nix
./services/backup/postgresql-backup.nix ./services/backup/postgresql-backup.nix
./services/backup/rsnapshot.nix ./services/backup/rsnapshot.nix
@ -509,6 +511,7 @@
./services/networking/ngircd.nix ./services/networking/ngircd.nix
./services/networking/nghttpx/default.nix ./services/networking/nghttpx/default.nix
./services/networking/nix-serve.nix ./services/networking/nix-serve.nix
./services/networking/nixops-dns.nix
./services/networking/nntp-proxy.nix ./services/networking/nntp-proxy.nix
./services/networking/nsd.nix ./services/networking/nsd.nix
./services/networking/ntopng.nix ./services/networking/ntopng.nix

View File

@ -189,6 +189,14 @@ with lib;
# Profile splitting # Profile splitting
(mkRenamedOptionModule [ "virtualization" "growPartition" ] [ "boot" "growPartition" ]) (mkRenamedOptionModule [ "virtualization" "growPartition" ] [ "boot" "growPartition" ])
# misc/version.nix
(mkRenamedOptionModule [ "config" "system" "nixosVersion" ] [ "config" "system" "nixos" "version" ])
(mkRenamedOptionModule [ "config" "system" "nixosRelease" ] [ "config" "system" "nixos" "release" ])
(mkRenamedOptionModule [ "config" "system" "nixosVersionSuffix" ] [ "config" "system" "nixos" "versionSuffix" ])
(mkRenamedOptionModule [ "config" "system" "nixosRevision" ] [ "config" "system" "nixos" "revision" ])
(mkRenamedOptionModule [ "config" "system" "nixosCodeName" ] [ "config" "system" "nixos" "codeName" ])
(mkRenamedOptionModule [ "config" "system" "nixosLabel" ] [ "config" "system" "nixos" "label" ])
# Options that are obsolete and have no replacement. # Options that are obsolete and have no replacement.
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "") (mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
(mkRemovedOptionModule [ "programs" "bash" "enable" ] "") (mkRemovedOptionModule [ "programs" "bash" "enable" ] "")

View File

@ -0,0 +1,89 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.crashplansb;
crashplansb = pkgs.crashplansb.override { maxRam = cfg.maxRam; };
varDir = "/var/lib/crashplan";
in
with lib;
{
options = {
services.crashplansb = {
enable = mkOption {
default = false;
type = types.bool;
description = ''
Starts crashplan for small business background service.
'';
};
maxRam = mkOption {
default = "1024m";
example = "2G";
type = types.str;
description = ''
Maximum amount of that the crashplan engine should use.
'';
};
openPorts = mkOption {
description = "Open ports in the firewall for crashplan.";
default = true;
type = types.bool;
};
ports = mkOption {
# https://support.code42.com/Administrator/6/Planning_and_installing/TCP_and_UDP_ports_used_by_the_Code42_platform
# used ports can also be checked in the desktop app console using the command connection.info
description = "which ports to open.";
default = [ 4242 4243 4244 4247 ];
type = types.listOf types.int;
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ crashplansb ];
networking.firewall.allowedTCPPorts = mkIf cfg.openPorts cfg.ports;
systemd.services.crashplansb = {
description = "CrashPlan Backup Engine";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "local-fs.target" ];
preStart = ''
ensureDir() {
dir=$1
mode=$2
if ! test -e $dir; then
${pkgs.coreutils}/bin/mkdir -m $mode -p $dir
elif [ "$(${pkgs.coreutils}/bin/stat -c %a $dir)" != "$mode" ]; then
${pkgs.coreutils}/bin/chmod $mode $dir
fi
}
ensureDir ${crashplansb.vardir} 755
ensureDir ${crashplansb.vardir}/conf 700
ensureDir ${crashplansb.manifestdir} 700
ensureDir ${crashplansb.vardir}/cache 700
ensureDir ${crashplansb.vardir}/backupArchives 700
ensureDir ${crashplansb.vardir}/log 777
cp -avn ${crashplansb}/conf.template/* ${crashplansb.vardir}/conf
#for x in bin install.vars lang lib libc42archive64.so libc42core.so libjniwrap64.so libjtux64.so libleveldb64.so libnetty-tcnative.so share upgrade; do
# rm -f ${crashplansb.vardir}/$x;
# ln -sf ${crashplansb}/$x ${crashplansb.vardir}/$x;
#done
'';
serviceConfig = {
Type = "forking";
EnvironmentFile = "${crashplansb}/bin/run.conf";
ExecStart = "${crashplansb}/bin/CrashPlanEngine start";
ExecStop = "${crashplansb}/bin/CrashPlanEngine stop";
PIDFile = "${crashplansb.vardir}/CrashPlanEngine.pid";
WorkingDirectory = crashplansb;
};
};
};
}

View File

@ -4,6 +4,31 @@ with lib;
let let
cfg = config.services.buildkite-agent; cfg = config.services.buildkite-agent;
mkHookOption = { name, description, example ? null }: {
inherit name;
value = mkOption {
default = null;
inherit description;
type = types.nullOr types.lines;
} // (if example == null then {} else { inherit example; });
};
mkHookOptions = hooks: listToAttrs (map mkHookOption hooks);
hooksDir = let
mkHookEntry = name: value: ''
cat > $out/${name} <<EOF
#! ${pkgs.stdenv.shell}
set -e
${value}
EOF
chmod 755 $out/${name}
'';
in pkgs.runCommand "buildkite-agent-hooks" {} ''
mkdir $out
${concatStringsSep "\n" (mapAttrsToList mkHookEntry (filterAttrs (n: v: v != null) cfg.hooks))}
'';
in in
{ {
@ -43,25 +68,28 @@ in
name = mkOption { name = mkOption {
type = types.str; type = types.str;
default = "%hostname-%n";
description = '' description = ''
The name of the agent. The name of the agent.
''; '';
}; };
hooksPath = mkOption {
type = types.path;
default = "${pkgs.buildkite-agent}/share/hooks";
defaultText = "${pkgs.buildkite-agent}/share/hooks";
description = ''
Path to the directory storing the hooks.
'';
};
meta-data = mkOption { meta-data = mkOption {
type = types.str; type = types.str;
default = ""; default = "";
example = "queue=default,docker=true,ruby2=true";
description = '' description = ''
Meta data for the agent. Meta data for the agent. This is a comma-separated list of
<code>key=value</code> pairs.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = "debug=true";
description = ''
Extra lines to be added verbatim to the configuration file.
''; '';
}; };
@ -85,6 +113,74 @@ in
''; '';
}; };
}; };
hooks = mkHookOptions [
{ name = "checkout";
description = ''
The `checkout` hook script will replace the default checkout routine of the
bootstrap.sh script. You can use this hook to do your own SCM checkout
behaviour
''; }
{ name = "command";
description = ''
The `command` hook script will replace the default implementation of running
the build command.
''; }
{ name = "environment";
description = ''
The `environment` hook will run before all other commands, and can be used
to set up secrets, data, etc. Anything exported in hooks will be available
to the build script.
Note: the contents of this file will be copied to the world-readable
Nix store.
'';
example = ''
export SECRET_VAR=`head -1 /run/keys/secret`
''; }
{ name = "post-artifact";
description = ''
The `post-artifact` hook will run just after artifacts are uploaded
''; }
{ name = "post-checkout";
description = ''
The `post-checkout` hook will run after the bootstrap script has checked out
your projects source code.
''; }
{ name = "post-command";
description = ''
The `post-command` hook will run after the bootstrap script has run your
build commands
''; }
{ name = "pre-artifact";
description = ''
The `pre-artifact` hook will run just before artifacts are uploaded
''; }
{ name = "pre-checkout";
description = ''
The `pre-checkout` hook will run just before your projects source code is
checked out from your SCM provider
''; }
{ name = "pre-command";
description = ''
The `pre-command` hook will run just before your build command runs
''; }
{ name = "pre-exit";
description = ''
The `pre-exit` hook will run just before your build job finishes
''; }
];
hooksPath = mkOption {
type = types.path;
default = hooksDir;
defaultText = "generated from services.buildkite-agent.hooks";
description = ''
Path to the directory storing the hooks.
Consider using <option>services.buildkite-agent.hooks.&lt;name&gt;</option>
instead.
'';
};
}; };
}; };
@ -100,13 +196,10 @@ in
environment.systemPackages = [ cfg.package ]; environment.systemPackages = [ cfg.package ];
systemd.services.buildkite-agent = systemd.services.buildkite-agent =
let copy = x: target: perms:
"cp -f ${x} ${target}; ${pkgs.coreutils}/bin/chmod ${toString perms} ${target}; ";
in
{ description = "Buildkite Agent"; { description = "Buildkite Agent";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
path = cfg.runtimePackages; path = cfg.runtimePackages ++ [ pkgs.coreutils ];
environment = config.networking.proxy.envVars // { environment = config.networking.proxy.envVars // {
HOME = cfg.dataDir; HOME = cfg.dataDir;
NIX_REMOTE = "daemon"; NIX_REMOTE = "daemon";
@ -114,10 +207,14 @@ in
## NB: maximum care is taken so that secrets (ssh keys and the CI token) ## NB: maximum care is taken so that secrets (ssh keys and the CI token)
## don't end up in the Nix store. ## don't end up in the Nix store.
preStart = '' preStart = let
${pkgs.coreutils}/bin/mkdir -m 0700 -p ${cfg.dataDir}/.ssh sshDir = "${cfg.dataDir}/.ssh";
${copy (toString cfg.openssh.privateKeyPath) "${cfg.dataDir}/.ssh/id_rsa" 600} in
${copy (toString cfg.openssh.publicKeyPath) "${cfg.dataDir}/.ssh/id_rsa.pub" 600} ''
mkdir -m 0700 -p "${sshDir}"
cp -f "${toString cfg.openssh.privateKeyPath}" "${sshDir}/id_rsa"
cp -f "${toString cfg.openssh.publicKeyPath}" "${sshDir}/id_rsa.pub"
chmod 600 "${sshDir}"/id_rsa*
cat > "${cfg.dataDir}/buildkite-agent.cfg" <<EOF cat > "${cfg.dataDir}/buildkite-agent.cfg" <<EOF
token="$(cat ${toString cfg.tokenPath})" token="$(cat ${toString cfg.tokenPath})"
@ -125,7 +222,7 @@ in
meta-data="${cfg.meta-data}" meta-data="${cfg.meta-data}"
build-path="${cfg.dataDir}/builds" build-path="${cfg.dataDir}/builds"
hooks-path="${cfg.hooksPath}" hooks-path="${cfg.hooksPath}"
bootstrap-script="${pkgs.buildkite-agent}/share/bootstrap.sh" ${cfg.extraConfig}
EOF EOF
''; '';
@ -137,6 +234,15 @@ in
TimeoutSec = 10; TimeoutSec = 10;
}; };
}; };
assertions = [
{ assertion = cfg.hooksPath == hooksDir || all isNull (attrValues cfg.hooks);
message = ''
Options `services.buildkite-agent.hooksPath' and
`services.buildkite-agent.hooks.<name>' are mutually exclusive.
'';
}
];
}; };
imports = [ imports = [
(mkRenamedOptionModule [ "services" "buildkite-agent" "token" ] [ "services" "buildkite-agent" "tokenPath" ]) (mkRenamedOptionModule [ "services" "buildkite-agent" "token" ] [ "services" "buildkite-agent" "tokenPath" ])

View File

@ -16,10 +16,10 @@ let
It isn't perfect, but it seems to cover a vast majority of use cases. It isn't perfect, but it seems to cover a vast majority of use cases.
Caveat: even if the package is reached by a different means, Caveat: even if the package is reached by a different means,
the path above will be shown and not e.g. `${config.services.foo.package}`. */ the path above will be shown and not e.g. `${config.services.foo.package}`. */
manual = import ../../../doc/manual { manual = import ../../../doc/manual rec {
inherit pkgs config; inherit pkgs config;
version = config.system.nixosRelease; version = config.system.nixos.release;
revision = "release-${config.system.nixosRelease}"; revision = "release-${version}";
options = options =
let let
scrubbedEval = evalModules { scrubbedEval = evalModules {

View File

@ -12,7 +12,7 @@ let
case "$1" in case "$1" in
-i) echo "nixos";; -i) echo "nixos";;
-r) echo "${config.system.nixosVersion}";; -r) echo "${config.system.nixos.version}";;
esac esac
''; '';
in { in {

View File

@ -16,7 +16,7 @@ let
# Don't start dhcpcd on explicitly configured interfaces or on # Don't start dhcpcd on explicitly configured interfaces or on
# interfaces that are part of a bridge, bond or sit device. # interfaces that are part of a bridge, bond or sit device.
ignoredInterfaces = ignoredInterfaces =
map (i: i.name) (filter (i: if i.useDHCP != null then !i.useDHCP else i.ip4 != [ ] || i.ipAddress != null) interfaces) map (i: i.name) (filter (i: if i.useDHCP != null then !i.useDHCP else i.ipv4.addresses != [ ]) interfaces)
++ mapAttrsToList (i: _: i) config.networking.sits ++ mapAttrsToList (i: _: i) config.networking.sits
++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges)) ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges))
++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.vswitches)) ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.vswitches))
@ -156,11 +156,11 @@ in
systemd.services.dhcpcd = let systemd.services.dhcpcd = let
cfgN = config.networking; cfgN = config.networking;
hasDefaultGatewaySet = (cfgN.defaultGateway != null && cfgN.defaultGateway.address != "") hasDefaultGatewaySet = (cfgN.defaultGateway != null && cfgN.defaultGateway.address != "")
|| (cfgN.defaultGateway6 != null && cfgN.defaultGateway6.address != ""); && (!cfgN.enableIPv6 || (cfgN.defaultGateway6 != null && cfgN.defaultGateway6.address != ""));
in in
{ description = "DHCP Client"; { description = "DHCP Client";
wantedBy = optional (!hasDefaultGatewaySet) "network-online.target"; wantedBy = [ "multi-user.target" ] ++ optional (!hasDefaultGatewaySet) "network-online.target";
after = [ "network.target" ]; after = [ "network.target" ];
wants = [ "network.target" ]; wants = [ "network.target" ];

View File

@ -53,6 +53,30 @@ let
-i ${cfg.externalInterface} -p ${fwd.proto} \ -i ${cfg.externalInterface} -p ${fwd.proto} \
--dport ${builtins.toString fwd.sourcePort} \ --dport ${builtins.toString fwd.sourcePort} \
-j DNAT --to-destination ${fwd.destination} -j DNAT --to-destination ${fwd.destination}
${concatMapStrings (loopbackip:
let
m = builtins.match "([0-9.]+):([0-9-]+)" fwd.destination;
destinationIP = if (m == null) then throw "bad ip:ports `${fwd.destination}'" else elemAt m 0;
destinationPorts = if (m == null) then throw "bad ip:ports `${fwd.destination}'" else elemAt m 1;
in ''
# Allow connections to ${loopbackip}:${toString fwd.sourcePort} from the host itself
iptables -w -t nat -A OUTPUT \
-d ${loopbackip} -p ${fwd.proto} \
--dport ${builtins.toString fwd.sourcePort} \
-j DNAT --to-destination ${fwd.destination}
# Allow connections to ${loopbackip}:${toString fwd.sourcePort} from other hosts behind NAT
iptables -w -t nat -A nixos-nat-pre \
-d ${loopbackip} -p ${fwd.proto} \
--dport ${builtins.toString fwd.sourcePort} \
-j DNAT --to-destination ${fwd.destination}
iptables -w -t nat -A nixos-nat-post \
-d ${destinationIP} -p ${fwd.proto} \
--dport ${destinationPorts} \
-j SNAT --to-source ${loopbackip}
'') fwd.loopbackIPs}
'') cfg.forwardPorts} '') cfg.forwardPorts}
${optionalString (cfg.dmzHost != null) '' ${optionalString (cfg.dmzHost != null) ''
@ -152,6 +176,13 @@ in
example = "udp"; example = "udp";
description = "Protocol of forwarded connection"; description = "Protocol of forwarded connection";
}; };
loopbackIPs = mkOption {
type = types.listOf types.str;
default = [];
example = literalExample ''[ "55.1.2.3" ]'';
description = "Public IPs for NAT reflection; for connections to `loopbackip:sourcePort' from the host itself and from other hosts behind NAT";
};
}; };
}); });
default = []; default = [];

View File

@ -0,0 +1,79 @@
{ config, lib, pkgs, ... }:
with lib;
let
pkg = pkgs.nixops-dns;
cfg = config.services.nixops-dns;
in
{
options = {
services.nixops-dns = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable the nixops-dns resolution
of NixOps virtual machines via dnsmasq and fake domain name.
'';
};
user = mkOption {
type = types.str;
description = ''
The user the nixops-dns daemon should run as.
This should be the user, which is also used for nixops and
have the .nixops directory in its home.
'';
};
domain = mkOption {
type = types.str;
description = ''
Fake domain name to resolve to NixOps virtual machines.
For example "ops" will resolve "vm.ops".
'';
example = "ops";
default = "ops";
};
dnsmasq = mkOption {
type = types.bool;
default = true;
description = ''
Enable dnsmasq forwarding to nixops-dns. This allows to use
nixops-dns for `services.nixops-dns.domain` resolution
while forwarding the rest of the queries to original resolvers.
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.nixops-dns = {
description = "nixops-dns: DNS server for resolving NixOps machines";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = cfg.user;
ExecStart="${pkg}/bin/nixops-dns --domain=.${cfg.domain}";
};
};
services.dnsmasq = mkIf cfg.dnsmasq {
enable = true;
resolveLocalQueries = true;
servers = [
"/${cfg.domain}/127.0.0.1#5300"
];
extraConfig = ''
bind-interfaces
listen-address=127.0.0.1
'';
};
};
}

View File

@ -35,10 +35,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
boot.kernelModules = [ "dummy" ]; boot.kernelModules = [ "dummy" ];
networking.interfaces.dummy0 = { networking.interfaces.dummy0.ipv4.addresses = [
ipAddress = "169.254.169.254"; { address = "169.254.169.254"; prefixLength = 32; }
prefixLength = 32; ];
};
systemd.services.hologram-agent = { systemd.services.hologram-agent = {
description = "Provide EC2 instance credentials to machines outside of EC2"; description = "Provide EC2 instance credentials to machines outside of EC2";

View File

@ -64,8 +64,8 @@ in
config = { config = {
# Note: this is set here rather than up there so that changing # Note: this is set here rather than up there so that changing
# nixosLabel would not rebuild manual pages # nixos.label would not rebuild manual pages
services.mingetty.greetingLine = mkDefault ''<<< Welcome to NixOS ${config.system.nixosLabel} (\m) - \l >>>''; services.mingetty.greetingLine = mkDefault ''<<< Welcome to NixOS ${config.system.nixos.label} (\m) - \l >>>'';
systemd.services."getty@" = systemd.services."getty@" =
{ serviceConfig.ExecStart = [ { serviceConfig.ExecStart = [

View File

@ -1,9 +1,13 @@
{ config, lib, pkgs, ...}: { config, lib, pkgs, ...}:
with lib;
let let
cfg = config.services.varnish; cfg = config.services.varnish;
commandLine = "-f ${pkgs.writeText "default.vcl" cfg.config}" +
optionalString (cfg.extraModules != []) " -p vmod_path='${makeSearchPathOutput "lib" "lib/varnish/vmods" ([pkgs.varnish] ++ cfg.extraModules)}' -r vmod_path";
in in
with lib;
{ {
options = { options = {
services.varnish = { services.varnish = {
@ -69,8 +73,7 @@ with lib;
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
PermissionsStartOnly = true; PermissionsStartOnly = true;
ExecStart = "${pkgs.varnish}/sbin/varnishd -a ${cfg.http_address} -f ${pkgs.writeText "default.vcl" cfg.config} -n ${cfg.stateDir} -F ${cfg.extraCommandLine}" ExecStart = "${pkgs.varnish}/sbin/varnishd -a ${cfg.http_address} -n ${cfg.stateDir} -F ${cfg.extraCommandLine} ${commandLine}";
+ optionalString (cfg.extraModules != []) " -p vmod_path='${makeSearchPathOutput "lib" "lib/varnish/vmods" ([pkgs.varnish] ++ cfg.extraModules)}' -r vmod_path";
Restart = "always"; Restart = "always";
RestartSec = "5s"; RestartSec = "5s";
User = "varnish"; User = "varnish";
@ -83,6 +86,14 @@ with lib;
environment.systemPackages = [ pkgs.varnish ]; environment.systemPackages = [ pkgs.varnish ];
# check .vcl syntax at compile time (e.g. before nixops deployment)
system.extraDependencies = [
(pkgs.stdenv.mkDerivation {
name = "check-varnish-syntax";
buildCommand = "${pkgs.varnish}/sbin/varnishd -C ${commandLine} 2> $out";
})
];
users.extraUsers.varnish = { users.extraUsers.varnish = {
group = "varnish"; group = "varnish";
uid = config.ids.uids.varnish; uid = config.ids.uids.varnish;

View File

@ -30,6 +30,8 @@ let
let let
kernelPath = "${config.boot.kernelPackages.kernel}/" + kernelPath = "${config.boot.kernelPackages.kernel}/" +
"${config.system.boot.loader.kernelFile}"; "${config.system.boot.loader.kernelFile}";
initrdPath = "${config.system.build.initialRamdisk}/" +
"${config.system.boot.loader.initrdFile}";
in '' in ''
mkdir $out mkdir $out
@ -50,7 +52,7 @@ let
echo -n "$kernelParams" > $out/kernel-params echo -n "$kernelParams" > $out/kernel-params
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd ln -s ${initrdPath} $out/initrd
ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out
@ -106,7 +108,7 @@ let
if [] == failed then pkgs.stdenvNoCC.mkDerivation { if [] == failed then pkgs.stdenvNoCC.mkDerivation {
name = let hn = config.networking.hostName; name = let hn = config.networking.hostName;
nn = if (hn != "") then hn else "unnamed"; nn = if (hn != "") then hn else "unnamed";
in "nixos-system-${nn}-${config.system.nixosLabel}"; in "nixos-system-${nn}-${config.system.nixos.label}";
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;
buildCommand = systemBuilder; buildCommand = systemBuilder;
@ -120,7 +122,7 @@ let
config.system.build.installBootLoader config.system.build.installBootLoader
or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true"; or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
activationScript = config.system.activationScripts.script; activationScript = config.system.activationScripts.script;
nixosLabel = config.system.nixosLabel; nixosLabel = config.system.nixos.label;
configurationName = config.boot.loader.grub.configurationName; configurationName = config.boot.loader.grub.configurationName;
@ -179,6 +181,15 @@ in
''; '';
}; };
system.boot.loader.initrdFile = mkOption {
internal = true;
default = "initrd";
type = types.str;
description = ''
Name of the initrd file to be passed to the bootloader.
'';
};
system.copySystemConfiguration = mkOption { system.copySystemConfiguration = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;

View File

@ -10,7 +10,7 @@ let
breezePlymouth = pkgs.breeze-plymouth.override { breezePlymouth = pkgs.breeze-plymouth.override {
nixosBranding = true; nixosBranding = true;
nixosVersion = config.system.nixosRelease; nixosVersion = config.system.nixos.release;
}; };
themesEnv = pkgs.buildEnv { themesEnv = pkgs.buildEnv {

View File

@ -20,14 +20,8 @@ let
"sys-subsystem-net-devices-${escapeSystemdPath interface}.device"; "sys-subsystem-net-devices-${escapeSystemdPath interface}.device";
interfaceIps = i: interfaceIps = i:
i.ip4 ++ optionals cfg.enableIPv6 i.ip6 i.ipv4.addresses
++ optional (i.ipAddress != null) { ++ optionals cfg.enableIPv6 i.ipv6.addresses;
address = i.ipAddress;
prefixLength = i.prefixLength;
} ++ optional (cfg.enableIPv6 && i.ipv6Address != null) {
address = i.ipv6Address;
prefixLength = i.ipv6PrefixLength;
};
destroyBond = i: '' destroyBond = i: ''
while true; do while true; do
@ -80,7 +74,7 @@ let
else optional (dev != null && dev != "lo" && !config.boot.isContainer) (subsystemDevice dev); else optional (dev != null && dev != "lo" && !config.boot.isContainer) (subsystemDevice dev);
hasDefaultGatewaySet = (cfg.defaultGateway != null && cfg.defaultGateway.address != "") hasDefaultGatewaySet = (cfg.defaultGateway != null && cfg.defaultGateway.address != "")
|| (cfg.defaultGateway6 != null && cfg.defaultGateway6.address != ""); || (cfg.enableIPv6 && cfg.defaultGateway6 != null && cfg.defaultGateway6.address != "");
networkLocalCommands = { networkLocalCommands = {
after = [ "network-setup.service" ]; after = [ "network-setup.service" ];
@ -185,33 +179,58 @@ let
path = [ pkgs.iproute ]; path = [ pkgs.iproute ];
script = script =
'' ''
# FIXME: shouldn't this be done in network-link?
echo "bringing up interface..."
ip link set "${i.name}" up
state="/run/nixos/network/addresses/${i.name}" state="/run/nixos/network/addresses/${i.name}"
mkdir -p $(dirname "$state") mkdir -p $(dirname "$state")
'' + flip concatMapStrings (ips) (ip: ${flip concatMapStrings ips (ip:
let let
address = "${ip.address}/${toString ip.prefixLength}"; cidr = "${ip.address}/${toString ip.prefixLength}";
in in
'' ''
echo "${address}" >> $state echo "${cidr}" >> $state
if out=$(ip addr add "${address}" dev "${i.name}" 2>&1); then echo -n "adding address ${cidr}... "
echo "added ip ${address}" if out=$(ip addr add "${cidr}" dev "${i.name}" 2>&1); then
echo "done"
elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then
echo "failed to add ${address}" echo "failed"
exit 1 exit 1
fi fi
''); ''
)}
state="/run/nixos/network/routes/${i.name}"
mkdir -p $(dirname "$state")
${flip concatMapStrings (i.ipv4.routes ++ i.ipv6.routes) (route:
let
cidr = "${route.address}/${toString route.prefixLength}";
via = optionalString (route.via != null) ''via "${route.via}"'';
options = concatStrings (mapAttrsToList (name: val: "${name} ${val} ") route.options);
in
''
echo "${cidr}" >> $state
echo -n "adding route ${cidr}... "
if out=$(ip route add "${cidr}" ${options} ${via} dev "${i.name}" 2>&1); then
echo "done"
elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then
echo "failed"
exit 1
fi
''
)}
'';
preStop = '' preStop = ''
state="/run/nixos/network/routes/${i.name}"
while read cidr; do
echo -n "deleting route $cidr... "
ip route del "$cidr" dev "${i.name}" >/dev/null 2>&1 && echo "done" || echo "failed"
done < "$state"
rm -f "$state"
state="/run/nixos/network/addresses/${i.name}" state="/run/nixos/network/addresses/${i.name}"
while read address; do while read cidr; do
echo -n "deleting $address..." echo -n "deleting address $cidr... "
ip addr del "$address" dev "${i.name}" >/dev/null 2>&1 || echo -n " Failed" ip addr del "$cidr" dev "${i.name}" >/dev/null 2>&1 && echo "done" || echo "failed"
echo ""
done < "$state" done < "$state"
rm -f "$state" rm -f "$state"
''; '';

View File

@ -9,14 +9,8 @@ let
interfaces = attrValues cfg.interfaces; interfaces = attrValues cfg.interfaces;
interfaceIps = i: interfaceIps = i:
i.ip4 ++ optionals cfg.enableIPv6 i.ip6 i.ipv4.addresses
++ optional (i.ipAddress != null) { ++ optionals cfg.enableIPv6 i.ipv6.addresses;
address = i.ipAddress;
prefixLength = i.prefixLength;
} ++ optional (cfg.enableIPv6 && i.ipv6Address != null) {
address = i.ipv6Address;
prefixLength = i.ipv6PrefixLength;
};
dhcpStr = useDHCP: if useDHCP == true || useDHCP == null then "both" else "none"; dhcpStr = useDHCP: if useDHCP == true || useDHCP == null then "both" else "none";

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, utils, stdenv, ... }: { config, options, lib, pkgs, utils, stdenv, ... }:
with lib; with lib;
with utils; with utils;
@ -116,6 +116,40 @@ let
}; };
}; };
routeOpts = v:
{ options = {
address = mkOption {
type = types.str;
description = "IPv${toString v} address of the network.";
};
prefixLength = mkOption {
type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128));
description = ''
Subnet mask of the network, specified as the number of
bits in the prefix (<literal>${if v == 4 then "24" else "64"}</literal>).
'';
};
via = mkOption {
type = types.nullOr types.str;
default = null;
description = "IPv${toString v} address of the next hop.";
};
options = mkOption {
type = types.attrsOf types.str;
default = { };
example = { mtu = "1492"; window = "524288"; };
description = ''
Other route options. See the symbol <literal>OPTION</literal>
in the <literal>ip-route(8)</literal> manual page for the details.
'';
};
};
};
gatewayCoerce = address: { inherit address; }; gatewayCoerce = address: { inherit address; };
gatewayOpts = { ... }: { gatewayOpts = { ... }: {
@ -148,7 +182,6 @@ let
interfaceOpts = { name, ... }: { interfaceOpts = { name, ... }: {
options = { options = {
name = mkOption { name = mkOption {
example = "eth0"; example = "eth0";
type = types.str; type = types.str;
@ -175,7 +208,7 @@ let
''; '';
}; };
ip4 = mkOption { ipv4.addresses = mkOption {
default = [ ]; default = [ ];
example = [ example = [
{ address = "10.0.0.1"; prefixLength = 16; } { address = "10.0.0.1"; prefixLength = 16; }
@ -187,7 +220,7 @@ let
''; '';
}; };
ip6 = mkOption { ipv6.addresses = mkOption {
default = [ ]; default = [ ];
example = [ example = [
{ address = "fdfd:b3f0:482::1"; prefixLength = 48; } { address = "fdfd:b3f0:482::1"; prefixLength = 48; }
@ -199,50 +232,27 @@ let
''; '';
}; };
ipAddress = mkOption { ipv4.routes = mkOption {
default = null; default = [];
example = "10.0.0.1"; example = [
type = types.nullOr types.str; { address = "10.0.0.0"; prefixLength = 16; }
{ address = "192.168.2.0"; prefixLength = 24; via = "192.168.1.1"; }
];
type = with types; listOf (submodule (routeOpts 4));
description = '' description = ''
IP address of the interface. Leave empty to configure the List of extra IPv4 static routes that will be assigned to the interface.
interface using DHCP.
''; '';
}; };
prefixLength = mkOption { ipv6.routes = mkOption {
default = null; default = [];
example = 24; example = [
type = types.nullOr types.int; { address = "fdfd:b3f0::"; prefixLength = 48; }
{ address = "2001:1470:fffd:2098::"; prefixLength = 64; via = "fdfd:b3f0::1"; }
];
type = with types; listOf (submodule (routeOpts 6));
description = '' description = ''
Subnet mask of the interface, specified as the number of List of extra IPv6 static routes that will be assigned to the interface.
bits in the prefix (<literal>24</literal>).
'';
};
subnetMask = mkOption {
default = null;
description = ''
Defunct, supply the prefix length instead.
'';
};
ipv6Address = mkOption {
default = null;
example = "2001:1470:fffd:2098::e006";
type = types.nullOr types.str;
description = ''
IPv6 address of the interface. Leave empty to configure the
interface using NDP.
'';
};
ipv6PrefixLength = mkOption {
default = 64;
example = 64;
type = types.int;
description = ''
Subnet mask of the interface, specified as the number of
bits in the prefix (<literal>64</literal>).
''; '';
}; };
@ -317,6 +327,32 @@ let
name = mkDefault name; name = mkDefault name;
}; };
# Renamed or removed options
imports =
let
defined = x: x != "_mkMergedOptionModule";
in [
(mkRenamedOptionModule [ "ip4" ] [ "ipv4" "addresses"])
(mkRenamedOptionModule [ "ip6" ] [ "ipv6" "addresses"])
(mkRemovedOptionModule [ "subnetMask" ] ''
Supply a prefix length instead; use option
networking.interfaces.<name>.ipv{4,6}.addresses'')
(mkMergedOptionModule
[ [ "ipAddress" ] [ "prefixLength" ] ]
[ "ipv4" "addresses" ]
(cfg: with cfg;
optional (defined ipAddress && defined prefixLength)
{ address = ipAddress; prefixLength = prefixLength; }))
(mkMergedOptionModule
[ [ "ipv6Address" ] [ "ipv6PrefixLength" ] ]
[ "ipv6" "addresses" ]
(cfg: with cfg;
optional (defined ipv6Address && defined ipv6PrefixLength)
{ address = ipv6Address; prefixLength = ipv6PrefixLength; }))
({ options.warnings = options.warnings; })
];
}; };
hexChars = stringToCharacters "0123456789abcdef"; hexChars = stringToCharacters "0123456789abcdef";
@ -453,7 +489,7 @@ in
networking.interfaces = mkOption { networking.interfaces = mkOption {
default = {}; default = {};
example = example =
{ eth0.ip4 = [ { { eth0.ipv4 = [ {
address = "131.211.84.78"; address = "131.211.84.78";
prefixLength = 25; prefixLength = 25;
} ]; } ];
@ -932,13 +968,10 @@ in
config = { config = {
warnings = concatMap (i: i.warnings) interfaces;
assertions = assertions =
(flip map interfaces (i: { (flip map interfaces (i: {
assertion = i.subnetMask == null;
message = ''
The networking.interfaces."${i.name}".subnetMask option is defunct. Use prefixLength instead.
'';
})) ++ (flip map interfaces (i: {
# With the linux kernel, interface name length is limited by IFNAMSIZ # With the linux kernel, interface name length is limited by IFNAMSIZ
# to 16 bytes, including the trailing null byte. # to 16 bytes, including the trailing null byte.
# See include/linux/if.h in the kernel sources # See include/linux/if.h in the kernel sources
@ -947,7 +980,7 @@ in
The name of networking.interfaces."${i.name}" is too long, it needs to be less than 16 characters. The name of networking.interfaces."${i.name}" is too long, it needs to be less than 16 characters.
''; '';
})) ++ (flip map slaveIfs (i: { })) ++ (flip map slaveIfs (i: {
assertion = i.ip4 == [ ] && i.ipAddress == null && i.ip6 == [ ] && i.ipv6Address == null; assertion = i.ipv4.addresses == [ ] && i.ipv6.addresses == [ ];
message = '' message = ''
The networking.interfaces."${i.name}" must not have any defined ips when it is a slave. The networking.interfaces."${i.name}" must not have any defined ips when it is a slave.
''; '';
@ -1089,6 +1122,9 @@ in
'' + optionalString (i.mtu != null) '' '' + optionalString (i.mtu != null) ''
echo "setting MTU to ${toString i.mtu}..." echo "setting MTU to ${toString i.mtu}..."
ip link set "${i.name}" mtu "${toString i.mtu}" ip link set "${i.name}" mtu "${toString i.mtu}"
'' + ''
echo -n "bringing up interface... "
ip link set "${i.name}" up && echo "done" || (echo "failed"; exit 1)
''; '';
}))); })));

View File

@ -26,7 +26,7 @@ in
rm $diskImageBase rm $diskImageBase
popd popd
''; '';
diskImageBase = "nixos-image-${config.system.nixosLabel}-${pkgs.stdenv.system}.raw"; diskImageBase = "nixos-image-${config.system.nixos.label}-${pkgs.stdenv.system}.raw";
buildInputs = [ pkgs.utillinux pkgs.perl ]; buildInputs = [ pkgs.utillinux pkgs.perl ];
exportReferencesGraph = exportReferencesGraph =
[ "closure" config.system.build.toplevel ]; [ "closure" config.system.build.toplevel ];

View File

@ -14,7 +14,7 @@ in
PATH=$PATH:${pkgs.stdenv.lib.makeBinPath [ pkgs.gnutar pkgs.gzip ]} PATH=$PATH:${pkgs.stdenv.lib.makeBinPath [ pkgs.gnutar pkgs.gzip ]}
pushd $out pushd $out
mv $diskImage disk.raw mv $diskImage disk.raw
tar -Szcf nixos-image-${config.system.nixosLabel}-${pkgs.stdenv.system}.raw.tar.gz disk.raw tar -Szcf nixos-image-${config.system.nixos.label}-${pkgs.stdenv.system}.raw.tar.gz disk.raw
rm $out/disk.raw rm $out/disk.raw
popd popd
''; '';

View File

@ -124,7 +124,7 @@ in
''; '';
}; };
networking.interfaces.vboxnet0.ip4 = [ { address = "192.168.56.1"; prefixLength = 24; } ]; networking.interfaces.vboxnet0.ipv4.addresses = [{ address = "192.168.56.1"; prefixLength = 24; }];
# Make sure NetworkManager won't assume this interface being up # Make sure NetworkManager won't assume this interface being up
# means we have internet access. # means we have internet access.
networking.networkmanager.unmanaged = ["vboxnet0"]; networking.networkmanager.unmanaged = ["vboxnet0"];

View File

@ -22,7 +22,7 @@ in {
config = { config = {
system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix { system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix {
name = "nixos-ova-${config.system.nixosLabel}-${pkgs.stdenv.system}"; name = "nixos-ova-${config.system.nixos.label}-${pkgs.stdenv.system}";
inherit pkgs lib config; inherit pkgs lib config;
partitionTableType = "legacy"; partitionTableType = "legacy";
@ -37,7 +37,7 @@ in {
VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk $diskImage VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk $diskImage
echo "creating VirtualBox VM..." echo "creating VirtualBox VM..."
vmName="NixOS ${config.system.nixosLabel} (${pkgs.stdenv.system})" vmName="NixOS ${config.system.nixos.label} (${pkgs.stdenv.system})"
VBoxManage createvm --name "$vmName" --register \ VBoxManage createvm --name "$vmName" --register \
--ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"} --ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
VBoxManage modifyvm "$vmName" \ VBoxManage modifyvm "$vmName" \
@ -53,7 +53,7 @@ in {
echo "exporting VirtualBox VM..." echo "exporting VirtualBox VM..."
mkdir -p $out mkdir -p $out
fn="$out/nixos-${config.system.nixosLabel}-${pkgs.stdenv.system}.ova" fn="$out/nixos-${config.system.nixos.label}-${pkgs.stdenv.system}.ova"
VBoxManage export "$vmName" --output "$fn" VBoxManage export "$vmName" --output "$fn"
rm -v $diskImage rm -v $diskImage

View File

@ -35,8 +35,8 @@ let
versionModule = versionModule =
{ system.nixosVersionSuffix = versionSuffix; { system.nixos.versionSuffix = versionSuffix;
system.nixosRevision = nixpkgs.rev or nixpkgs.shortRev; system.nixos.revision = nixpkgs.rev or nixpkgs.shortRev;
}; };

View File

@ -16,7 +16,7 @@ let
miniupnpdConf = nodes: pkgs.writeText "miniupnpd.conf" miniupnpdConf = nodes: pkgs.writeText "miniupnpd.conf"
'' ''
ext_ifname=eth1 ext_ifname=eth1
listening_ip=${(pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ip4).address}/24 listening_ip=${(pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ipv4.addresses).address}/24
allow 1024-65535 192.168.2.0/24 1024-65535 allow 1024-65535 192.168.2.0/24 1024-65535
''; '';
@ -56,7 +56,7 @@ in
{ environment.systemPackages = [ pkgs.transmission ]; { environment.systemPackages = [ pkgs.transmission ];
virtualisation.vlans = [ 2 ]; virtualisation.vlans = [ 2 ];
networking.defaultGateway = networking.defaultGateway =
(pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ip4).address; (pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ipv4.addresses).address;
networking.firewall.enable = false; networking.firewall.enable = false;
}; };
@ -84,7 +84,7 @@ in
# Create the torrent. # Create the torrent.
$tracker->succeed("mkdir /tmp/data"); $tracker->succeed("mkdir /tmp/data");
$tracker->succeed("cp ${file} /tmp/data/test.tar.bz2"); $tracker->succeed("cp ${file} /tmp/data/test.tar.bz2");
$tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -p -t http://${(pkgs.lib.head nodes.tracker.config.networking.interfaces.eth1.ip4).address}:6969/announce -o /tmp/test.torrent"); $tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -p -t http://${(pkgs.lib.head nodes.tracker.config.networking.interfaces.eth1.ipv4.addresses).address}:6969/announce -o /tmp/test.torrent");
$tracker->succeed("chmod 644 /tmp/test.torrent"); $tracker->succeed("chmod 644 /tmp/test.torrent");
# Start the tracker. !!! use a less crappy tracker # Start the tracker. !!! use a less crappy tracker

View File

@ -12,7 +12,6 @@ let
# the sequence of address assignment less stochastic. # the sequence of address assignment less stochastic.
networking.useDHCP = false; networking.useDHCP = false;
networking.interfaces.eth1.prefixLength = 24;
# CJDNS output is incompatible with the XML log. # CJDNS output is incompatible with the XML log.
systemd.services.cjdns.serviceConfig.StandardOutput = "null"; systemd.services.cjdns.serviceConfig.StandardOutput = "null";
#networking.firewall.enable = true; #networking.firewall.enable = true;
@ -49,7 +48,9 @@ import ./make-test.nix ({ pkgs, ...} : {
{ imports = [ basicConfig ]; { imports = [ basicConfig ];
networking.interfaces.eth1.ipAddress = "192.168.0.2"; networking.interfaces.eth1.ipv4.addresses = [
{ address = "192.168.0.2"; prefixLength = 24; }
];
services.cjdns = services.cjdns =
{ UDPInterface = { UDPInterface =
@ -76,7 +77,9 @@ import ./make-test.nix ({ pkgs, ...} : {
CJDNS_ADMIN_PASSWORD=FOOBAR CJDNS_ADMIN_PASSWORD=FOOBAR
''; '';
networking.interfaces.eth1.ipAddress = "192.168.0.1"; networking.interfaces.eth1.ipv4.addresses = [
{ address = "192.168.0.1"; prefixLength = 24; }
];
services.cjdns = services.cjdns =
{ authorizedPasswords = [ carolPassword ]; { authorizedPasswords = [ carolPassword ];

View File

@ -26,8 +26,8 @@ import ./make-test.nix ({ pkgs, ...} : {
}; };
networking.interfaces = { networking.interfaces = {
br0 = { br0 = {
ip4 = [{ address = hostIp; prefixLength = 24; }]; ipv4.addresses = [{ address = hostIp; prefixLength = 24; }];
ip6 = [{ address = hostIp6; prefixLength = 7; }]; ipv6.addresses = [{ address = hostIp6; prefixLength = 7; }];
}; };
}; };

View File

@ -21,11 +21,11 @@ import ./make-test.nix ({ pkgs, ...} : {
}; };
networking.interfaces = { networking.interfaces = {
br0 = { br0 = {
ip4 = [{ address = "192.168.0.1"; prefixLength = 24; }]; ipv4.addresses = [{ address = "192.168.0.1"; prefixLength = 24; }];
ip6 = [{ address = "fc00::1"; prefixLength = 7; }]; ipv6.addresses = [{ address = "fc00::1"; prefixLength = 7; }];
}; };
br1 = { br1 = {
ip4 = [{ address = "192.168.1.1"; prefixLength = 24; }]; ipv4.addresses = [{ address = "192.168.1.1"; prefixLength = 24; }];
}; };
}; };

View File

@ -13,9 +13,9 @@ import ./make-test.nix ({ pkgs, ...} : {
virtualisation.vlans = []; virtualisation.vlans = [];
networking.bridges.br0.interfaces = []; networking.bridges.br0.interfaces = [];
networking.interfaces.br0 = { networking.interfaces.br0.ipv4.addresses = [
ip4 = [ { address = "10.11.0.254"; prefixLength = 24; } ]; { address = "10.11.0.254"; prefixLength = 24; }
}; ];
# Force /etc/hosts to be the only source for host name resolution # Force /etc/hosts to be the only source for host name resolution
environment.etc."nsswitch.conf".text = lib.mkForce '' environment.etc."nsswitch.conf".text = lib.mkForce ''

View File

@ -26,9 +26,9 @@ import ./make-test.nix ({ pkgs, ...} : {
interface = "eth1"; interface = "eth1";
mode = "bridge"; mode = "bridge";
}; };
networking.interfaces.eth1.ip4 = lib.mkForce []; networking.interfaces.eth1.ipv4.addresses = lib.mkForce [];
networking.interfaces.mv-eth1-host = { networking.interfaces.mv-eth1-host = {
ip4 = [ { address = "192.168.1.1"; prefixLength = 24; } ]; ipv4.addresses = [ { address = "192.168.1.1"; prefixLength = 24; } ];
}; };
containers.test1 = { containers.test1 = {
@ -37,7 +37,7 @@ import ./make-test.nix ({ pkgs, ...} : {
config = { config = {
networking.interfaces.mv-eth1 = { networking.interfaces.mv-eth1 = {
ip4 = [ { address = containerIp1; prefixLength = 24; } ]; ipv4.addresses = [ { address = containerIp1; prefixLength = 24; } ];
}; };
}; };
}; };
@ -48,7 +48,7 @@ import ./make-test.nix ({ pkgs, ...} : {
config = { config = {
networking.interfaces.mv-eth1 = { networking.interfaces.mv-eth1 = {
ip4 = [ { address = containerIp2; prefixLength = 24; } ]; ipv4.addresses = [ { address = containerIp2; prefixLength = 24; } ];
}; };
}; };
}; };

View File

@ -16,9 +16,9 @@ import ./make-test.nix ({ pkgs, ...} : {
interfaces = [ "eth1" ]; interfaces = [ "eth1" ];
config = { config = {
networking.interfaces.eth1 = { networking.interfaces.eth1.ipv4.addresses = [
ip4 = [ { address = "10.10.0.1"; prefixLength = 24; } ]; { address = "10.10.0.1"; prefixLength = 24; }
}; ];
networking.firewall.enable = false; networking.firewall.enable = false;
}; };
}; };
@ -33,9 +33,9 @@ import ./make-test.nix ({ pkgs, ...} : {
config = { config = {
networking.bridges.br0.interfaces = [ "eth1" ]; networking.bridges.br0.interfaces = [ "eth1" ];
networking.interfaces.br0 = { networking.interfaces.br0.ipv4.addresses = [
ip4 = [ { address = "10.10.0.2"; prefixLength = 24; } ]; { address = "10.10.0.2"; prefixLength = 24; }
}; ];
networking.firewall.enable = false; networking.firewall.enable = false;
}; };
}; };
@ -54,9 +54,9 @@ import ./make-test.nix ({ pkgs, ...} : {
interfaces = [ "eth1" ]; interfaces = [ "eth1" ];
mode = "active-backup"; mode = "active-backup";
}; };
networking.interfaces.bond0 = { networking.interfaces.bond0.ipv4.addresses = [
ip4 = [ { address = "10.10.0.3"; prefixLength = 24; } ]; { address = "10.10.0.3"; prefixLength = 24; }
}; ];
networking.firewall.enable = false; networking.firewall.enable = false;
}; };
}; };
@ -76,9 +76,9 @@ import ./make-test.nix ({ pkgs, ...} : {
mode = "active-backup"; mode = "active-backup";
}; };
networking.bridges.br0.interfaces = [ "bond0" ]; networking.bridges.br0.interfaces = [ "bond0" ];
networking.interfaces.br0 = { networking.interfaces.br0.ipv4.addresses = [
ip4 = [ { address = "10.10.0.4"; prefixLength = 24; } ]; { address = "10.10.0.4"; prefixLength = 24; }
}; ];
networking.firewall.enable = false; networking.firewall.enable = false;
}; };
}; };

View File

@ -11,7 +11,7 @@ let
# prevent make-test.nix to change IP # prevent make-test.nix to change IP
networking.interfaces = { networking.interfaces = {
eth1.ip4 = lib.mkOverride 0 [ ]; eth1.ipv4.addresses = lib.mkOverride 0 [ ];
}; };
}; };
in { in {

View File

@ -11,7 +11,7 @@ let
config = { config = {
networking.firewall.enable = false; networking.firewall.enable = false;
networking.firewall.allowPing = true; networking.firewall.allowPing = true;
networking.interfaces.eth0.ip4 = [ networking.interfaces.eth0.ipv4.addresses = [
{ address = "192.168.1.122"; prefixLength = 24; } { address = "192.168.1.122"; prefixLength = 24; }
]; ];
}; };
@ -33,8 +33,8 @@ in import ./make-test.nix ({ pkgs, lib, ...} :
rstp = false; rstp = false;
}; };
networking.interfaces = { networking.interfaces = {
eth1.ip4 = lib.mkOverride 0 [ ]; eth1.ipv4.addresses = lib.mkOverride 0 [ ];
br0.ip4 = [{ address = "192.168.1.1"; prefixLength = 24; }]; br0.ipv4.addresses = [ { address = "192.168.1.1"; prefixLength = 24; } ];
}; };
}; };
@ -44,8 +44,8 @@ in import ./make-test.nix ({ pkgs, lib, ...} :
rstp = false; rstp = false;
}; };
networking.interfaces = { networking.interfaces = {
eth1.ip4 = lib.mkOverride 0 [ ]; eth1.ipv4.addresses = lib.mkOverride 0 [ ];
br0.ip4 = [{ address = "192.168.1.2"; prefixLength = 24; }]; br0.ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
}; };
}; };
client_eth1_rstp = { lib, pkgs, ... }: client_base // { client_eth1_rstp = { lib, pkgs, ... }: client_base // {
@ -54,8 +54,8 @@ in import ./make-test.nix ({ pkgs, lib, ...} :
rstp = true; rstp = true;
}; };
networking.interfaces = { networking.interfaces = {
eth1.ip4 = lib.mkOverride 0 [ ]; eth1.ipv4.addresses = lib.mkOverride 0 [ ];
br0.ip4 = [{ address = "192.168.1.2"; prefixLength = 24; }]; br0.ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
}; };
}; };
}; };

View File

@ -11,8 +11,8 @@ import ./make-test.nix ({ pkgs, ...} : {
with pkgs.lib; with pkgs.lib;
{ {
networking = { networking = {
interfaces.eth1.ip6 = mkOverride 0 [ { address = "fd00::2"; prefixLength = 64; } ]; interfaces.eth1.ipv6.addresses = mkOverride 0 [ { address = "fd00::2"; prefixLength = 64; } ];
interfaces.eth1.ip4 = mkOverride 0 [ { address = "192.168.1.2"; prefixLength = 24; } ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ { address = "192.168.1.2"; prefixLength = 24; } ];
}; };
}; };
server = server =
@ -20,8 +20,8 @@ import ./make-test.nix ({ pkgs, ...} : {
with pkgs.lib; with pkgs.lib;
{ {
networking = { networking = {
interfaces.eth1.ip6 = mkOverride 0 [ { address = "fd00::1"; prefixLength = 64; } ]; interfaces.eth1.ipv6.addresses = mkOverride 0 [ { address = "fd00::1"; prefixLength = 64; } ];
interfaces.eth1.ip4 = mkOverride 0 [ { address = "192.168.1.1"; prefixLength = 24; } ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ { address = "192.168.1.1"; prefixLength = 24; } ];
}; };
services = { services = {

View File

@ -11,9 +11,7 @@ import ../make-test.nix ({ pkgs, lib, ... }:
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
boot.kernelParams = [ boot.kernelParams = [
"ip=${ "ip=${config.networking.primaryIPAddress}:::255.255.255.0::eth1:none"
(head config.networking.interfaces.eth1.ip4).address
}:::255.255.255.0::eth1:none"
]; ];
boot.initrd.network = { boot.initrd.network = {
enable = true; enable = true;

View File

@ -47,7 +47,7 @@ import ./make-test.nix ({ pkgs, ...} : {
# Detection). # Detection).
sub waitForAddress { sub waitForAddress {
my ($machine, $iface, $scope) = @_; my ($machine, $iface, $scope) = @_;
$machine->waitUntilSucceeds("[ `ip -o -6 addr show dev $iface scope $scope | grep -v tentative | wc -l` -eq 1 ]"); $machine->waitUntilSucceeds("[ `ip -o -6 addr show dev $iface scope $scope | grep -v tentative | wc -l` -ge 1 ]");
my $ip = (split /[ \/]+/, $machine->succeed("ip -o -6 addr show dev $iface scope $scope"))[3]; my $ip = (split /[ \/]+/, $machine->succeed("ip -o -6 addr show dev $iface scope $scope"))[3];
$machine->log("$scope address on $iface is $ip"); $machine->log("$scope address on $iface is $ip");
return $ip; return $ip;

View File

@ -35,7 +35,7 @@ import ./make-test.nix ({ pkgs, lib, withFirewall, withConntrackHelpers ? false,
{ virtualisation.vlans = [ 1 ]; { virtualisation.vlans = [ 1 ];
networking.firewall.allowPing = true; networking.firewall.allowPing = true;
networking.defaultGateway = networking.defaultGateway =
(pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ip4).address; (pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ipv4.addresses).address;
} }
(lib.optionalAttrs withConntrackHelpers { (lib.optionalAttrs withConntrackHelpers {
networking.firewall.connectionTrackingModules = [ "ftp" ]; networking.firewall.connectionTrackingModules = [ "ftp" ];

View File

@ -21,10 +21,8 @@ let
firewall.allowedUDPPorts = [ 547 ]; firewall.allowedUDPPorts = [ 547 ];
interfaces = mkOverride 0 (listToAttrs (flip map vlanIfs (n: interfaces = mkOverride 0 (listToAttrs (flip map vlanIfs (n:
nameValuePair "eth${toString n}" { nameValuePair "eth${toString n}" {
ipAddress = "192.168.${toString n}.1"; ipv4.addresses = [ { address = "192.168.${toString n}.1"; prefixLength = 24; } ];
prefixLength = 24; ipv6.addresses = [ { address = "fd00:1234:5678:${toString n}::1"; prefixLength = 64; } ];
ipv6Address = "fd00:1234:5678:${toString n}::1";
ipv6PrefixLength = 64;
}))); })));
}; };
services.dhcpd4 = { services.dhcpd4 = {
@ -90,12 +88,12 @@ let
firewall.allowPing = true; firewall.allowPing = true;
useDHCP = false; useDHCP = false;
defaultGateway = "192.168.1.1"; defaultGateway = "192.168.1.1";
interfaces.eth1.ip4 = mkOverride 0 [ interfaces.eth1.ipv4.addresses = mkOverride 0 [
{ address = "192.168.1.2"; prefixLength = 24; } { address = "192.168.1.2"; prefixLength = 24; }
{ address = "192.168.1.3"; prefixLength = 32; } { address = "192.168.1.3"; prefixLength = 32; }
{ address = "192.168.1.10"; prefixLength = 32; } { address = "192.168.1.10"; prefixLength = 32; }
]; ];
interfaces.eth2.ip4 = mkOverride 0 [ interfaces.eth2.ipv4.addresses = mkOverride 0 [
{ address = "192.168.2.2"; prefixLength = 24; } { address = "192.168.2.2"; prefixLength = 24; }
]; ];
}; };
@ -143,12 +141,12 @@ let
firewall.allowPing = true; firewall.allowPing = true;
useDHCP = true; useDHCP = true;
interfaces.eth1 = { interfaces.eth1 = {
ip4 = mkOverride 0 [ ]; ipv4.addresses = mkOverride 0 [ ];
ip6 = mkOverride 0 [ ]; ipv6.addresses = mkOverride 0 [ ];
}; };
interfaces.eth2 = { interfaces.eth2 = {
ip4 = mkOverride 0 [ ]; ipv4.addresses = mkOverride 0 [ ];
ip6 = mkOverride 0 [ ]; ipv6.addresses = mkOverride 0 [ ];
}; };
}; };
}; };
@ -198,10 +196,10 @@ let
firewall.allowPing = true; firewall.allowPing = true;
useDHCP = false; useDHCP = false;
interfaces.eth1 = { interfaces.eth1 = {
ip4 = mkOverride 0 [ ]; ipv4.addresses = mkOverride 0 [ ];
useDHCP = true; useDHCP = true;
}; };
interfaces.eth2.ip4 = mkOverride 0 [ ]; interfaces.eth2.ipv4.addresses = mkOverride 0 [ ];
}; };
}; };
testScript = { nodes, ... }: testScript = { nodes, ... }:
@ -241,9 +239,9 @@ let
interfaces = [ "eth1" "eth2" ]; interfaces = [ "eth1" "eth2" ];
driverOptions.mode = "balance-rr"; driverOptions.mode = "balance-rr";
}; };
interfaces.eth1.ip4 = mkOverride 0 [ ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ]; interfaces.eth2.ipv4.addresses = mkOverride 0 [ ];
interfaces.bond.ip4 = mkOverride 0 interfaces.bond.ipv4.addresses = mkOverride 0
[ { inherit address; prefixLength = 30; } ]; [ { inherit address; prefixLength = 30; } ];
}; };
}; };
@ -274,7 +272,7 @@ let
useNetworkd = networkd; useNetworkd = networkd;
firewall.allowPing = true; firewall.allowPing = true;
useDHCP = false; useDHCP = false;
interfaces.eth1.ip4 = mkOverride 0 interfaces.eth1.ipv4.addresses = mkOverride 0
[ { inherit address; prefixLength = 24; } ]; [ { inherit address; prefixLength = 24; } ];
}; };
}; };
@ -289,9 +287,9 @@ let
firewall.allowPing = true; firewall.allowPing = true;
useDHCP = false; useDHCP = false;
bridges.bridge.interfaces = [ "eth1" "eth2" ]; bridges.bridge.interfaces = [ "eth1" "eth2" ];
interfaces.eth1.ip4 = mkOverride 0 [ ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ]; interfaces.eth2.ipv4.addresses = mkOverride 0 [ ];
interfaces.bridge.ip4 = mkOverride 0 interfaces.bridge.ipv4.addresses = mkOverride 0
[ { address = "192.168.1.1"; prefixLength = 24; } ]; [ { address = "192.168.1.1"; prefixLength = 24; } ];
}; };
}; };
@ -328,7 +326,7 @@ let
firewall.allowPing = true; firewall.allowPing = true;
useDHCP = true; useDHCP = true;
macvlans.macvlan.interface = "eth1"; macvlans.macvlan.interface = "eth1";
interfaces.eth1.ip4 = mkOverride 0 [ ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ ];
}; };
}; };
testScript = { nodes, ... }: testScript = { nodes, ... }:
@ -369,9 +367,9 @@ let
local = address4; local = address4;
dev = "eth1"; dev = "eth1";
}; };
interfaces.eth1.ip4 = mkOverride 0 interfaces.eth1.ipv4.addresses = mkOverride 0
[ { address = address4; prefixLength = 24; } ]; [ { address = address4; prefixLength = 24; } ];
interfaces.sit.ip6 = mkOverride 0 interfaces.sit.ipv6.addresses = mkOverride 0
[ { address = address6; prefixLength = 64; } ]; [ { address = address6; prefixLength = 64; } ];
}; };
}; };
@ -410,9 +408,9 @@ let
id = 1; id = 1;
interface = "eth0"; interface = "eth0";
}; };
interfaces.eth0.ip4 = mkOverride 0 [ ]; interfaces.eth0.ipv4.addresses = mkOverride 0 [ ];
interfaces.eth1.ip4 = mkOverride 0 [ ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ ];
interfaces.vlan.ip4 = mkOverride 0 interfaces.vlan.ipv4.addresses = mkOverride 0
[ { inherit address; prefixLength = 24; } ]; [ { inherit address; prefixLength = 24; } ];
}; };
}; };
@ -437,13 +435,13 @@ let
name = "Virtual"; name = "Virtual";
machine = { machine = {
networking.interfaces."tap0" = { networking.interfaces."tap0" = {
ip4 = [ { address = "192.168.1.1"; prefixLength = 24; } ]; ipv4.addresses = [ { address = "192.168.1.1"; prefixLength = 24; } ];
ip6 = [ { address = "2001:1470:fffd:2096::"; prefixLength = 64; } ]; ipv6.addresses = [ { address = "2001:1470:fffd:2096::"; prefixLength = 64; } ];
virtual = true; virtual = true;
}; };
networking.interfaces."tun0" = { networking.interfaces."tun0" = {
ip4 = [ { address = "192.168.1.2"; prefixLength = 24; } ]; ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
ip6 = [ { address = "2001:1470:fffd:2097::"; prefixLength = 64; } ]; ipv6.addresses = [ { address = "2001:1470:fffd:2097::"; prefixLength = 64; } ];
virtual = true; virtual = true;
}; };
}; };
@ -483,9 +481,9 @@ let
boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = true; boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = true;
networking = { networking = {
useNetworkd = networkd; useNetworkd = networkd;
interfaces.eth1 = { interfaces.eth1.ipv6.addresses = singleton {
ipv6Address = "fd00:1234:5678:1::1"; address = "fd00:1234:5678:1::1";
ipv6PrefixLength = 64; prefixLength = 64;
}; };
}; };
services.radvd = { services.radvd = {
@ -511,8 +509,8 @@ let
useDHCP = true; useDHCP = true;
interfaces.eth1 = { interfaces.eth1 = {
preferTempAddress = true; preferTempAddress = true;
ip4 = mkOverride 0 [ ]; ipv4.addresses = mkOverride 0 [ ];
ip6 = mkOverride 0 [ ]; ipv6.addresses = mkOverride 0 [ ];
}; };
}; };
}; };
@ -533,6 +531,69 @@ let
$client->waitUntilSucceeds("! ip route get fd00:1234:5678:1::1 | grep -q ':[a-f0-9]*ff:fe[a-f0-9]*:'"); $client->waitUntilSucceeds("! ip route get fd00:1234:5678:1::1 | grep -q ':[a-f0-9]*ff:fe[a-f0-9]*:'");
''; '';
}; };
routes = {
name = "routes";
machine = {
networking.useDHCP = false;
networking.interfaces."eth0" = {
ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
ipv6.addresses = [ { address = "2001:1470:fffd:2097::"; prefixLength = 64; } ];
ipv6.routes = [
{ address = "fdfd:b3f0::"; prefixLength = 48; }
{ address = "2001:1470:fffd:2098::"; prefixLength = 64; via = "fdfd:b3f0::1"; }
];
ipv4.routes = [
{ address = "10.0.0.0"; prefixLength = 16; options = { mtu = "1500"; }; }
{ address = "192.168.2.0"; prefixLength = 24; via = "192.168.1.1"; }
];
};
virtualisation.vlans = [ ];
};
testScript = ''
my $targetIPv4Table = <<'END';
10.0.0.0/16 scope link mtu 1500
192.168.1.0/24 proto kernel scope link src 192.168.1.2
192.168.2.0/24 via 192.168.1.1
END
my $targetIPv6Table = <<'END';
2001:1470:fffd:2097::/64 proto kernel metric 256 pref medium
2001:1470:fffd:2098::/64 via fdfd:b3f0::1 metric 1024 pref medium
fdfd:b3f0::/48 metric 1024 pref medium
END
$machine->start;
$machine->waitForUnit("network.target");
# test routing tables
my $ipv4Table = $machine->succeed("ip -4 route list dev eth0 | head -n3");
my $ipv6Table = $machine->succeed("ip -6 route list dev eth0 | head -n3");
"$ipv4Table" eq "$targetIPv4Table" or die(
"The IPv4 routing table does not match the expected one:\n",
"Result:\n", "$ipv4Table\n",
"Expected:\n", "$targetIPv4Table\n"
);
"$ipv6Table" eq "$targetIPv6Table" or die(
"The IPv6 routing table does not match the expected one:\n",
"Result:\n", "$ipv6Table\n",
"Expected:\n", "$targetIPv6Table\n"
);
# test clean-up of the tables
$machine->succeed("systemctl stop network-addresses-eth0");
my $ipv4Residue = $machine->succeed("ip -4 route list dev eth0 | head -n-3");
my $ipv6Residue = $machine->succeed("ip -6 route list dev eth0 | head -n-3");
$ipv4Residue eq "" or die(
"The IPv4 routing table has not been properly cleaned:\n",
"$ipv4Residue\n"
);
$ipv6Residue eq "" or die(
"The IPv6 routing table has not been properly cleaned:\n",
"$ipv6Residue\n"
);
'';
};
}; };
in mapAttrs (const (attrs: makeTest (attrs // { in mapAttrs (const (attrs: makeTest (attrs // {

View File

@ -15,25 +15,31 @@ in import ./make-test.nix ({ pkgs, ...} : {
clientv4 = { lib, nodes, ... }: { clientv4 = { lib, nodes, ... }: {
imports = [ common ]; imports = [ common ];
networking.nameservers = lib.mkForce [ networking.nameservers = lib.mkForce [
nodes.server.config.networking.interfaces.eth1.ipAddress (lib.head nodes.server.config.networking.interfaces.eth1.ipv4.addresses).address
];
networking.interfaces.eth1.ipv4.addresses = [
{ address = "192.168.0.2"; prefixLength = 24; }
]; ];
networking.interfaces.eth1.ipAddress = "192.168.0.2";
networking.interfaces.eth1.prefixLength = 24;
}; };
clientv6 = { lib, nodes, ... }: { clientv6 = { lib, nodes, ... }: {
imports = [ common ]; imports = [ common ];
networking.nameservers = lib.mkForce [ networking.nameservers = lib.mkForce [
nodes.server.config.networking.interfaces.eth1.ipv6Address (lib.head nodes.server.config.networking.interfaces.eth1.ipv6.addresses).address
];
networking.interfaces.eth1.ipv4.addresses = [
{ address = "dead:beef::2"; prefixLength = 24; }
]; ];
networking.interfaces.eth1.ipv6Address = "dead:beef::2";
}; };
server = { lib, ... }: { server = { lib, ... }: {
imports = [ common ]; imports = [ common ];
networking.interfaces.eth1.ipAddress = "192.168.0.1"; networking.interfaces.eth1.ipv4.addresses = [
networking.interfaces.eth1.prefixLength = 24; { address = "192.168.0.1"; prefixLength = 24; }
networking.interfaces.eth1.ipv6Address = "dead:beef::1"; ];
networking.interfaces.eth1.ipv6.addresses = [
{ address = "dead:beef::1"; prefixLength = 64; }
];
services.nsd.enable = true; services.nsd.enable = true;
services.nsd.interfaces = lib.mkForce []; services.nsd.interfaces = lib.mkForce [];
services.nsd.zones."example.com.".data = '' services.nsd.zones."example.com.".data = ''

View File

@ -8,7 +8,7 @@
import ./make-test.nix ({ pkgs, ... }: import ./make-test.nix ({ pkgs, ... }:
let let
ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ip4).address; ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address;
ospfConf = '' ospfConf = ''
interface eth2 interface eth2

View File

@ -2,7 +2,7 @@
buildGoPackage rec { buildGoPackage rec {
name = "go-ethereum-${version}"; name = "go-ethereum-${version}";
version = "1.7.3"; version = "1.8.1";
goPackagePath = "github.com/ethereum/go-ethereum"; goPackagePath = "github.com/ethereum/go-ethereum";
# Fix for usb-related segmentation faults on darwin # Fix for usb-related segmentation faults on darwin
@ -16,7 +16,7 @@ buildGoPackage rec {
owner = "ethereum"; owner = "ethereum";
repo = "go-ethereum"; repo = "go-ethereum";
rev = "v${version}"; rev = "v${version}";
sha256 = "1w6rbq2qpjyf2v9mr18yiv2af1h2sgyvgrdk4bd8ixgl3qcd5b11"; sha256 = "0k7ly9cw68ranksa1fdn7v2lncmlqgabw3qiiyqya2xz3s4aazlf";
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -40,13 +40,13 @@ let
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "radiotray-ng-${version}"; name = "radiotray-ng-${version}";
version = "0.2.0"; version = "0.2.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ebruck"; owner = "ebruck";
repo = "radiotray-ng"; repo = "radiotray-ng";
rev = "v${version}"; rev = "v${version}";
sha256 = "12mhi0q137cjdpmpczvrcr7szq1ja1r8bm0gh03b925y8xyrqp5z"; sha256 = "0hqg6vn8hv5pic96klf1d9vj8fibrgiqnqb5vwrg3wvakx0y32kr";
}; };
nativeBuildInputs = [ cmake pkgconfig wrapGAppsHook makeWrapper ]; nativeBuildInputs = [ cmake pkgconfig wrapGAppsHook makeWrapper ];
@ -63,10 +63,9 @@ stdenv.mkDerivation rec {
++ pythonInputs; ++ pythonInputs;
prePatch = '' prePatch = ''
substituteInPlace debian/CMakeLists.txt \ for x in debian/CMakeLists.txt include/radiotray-ng/common.hpp data/*.desktop; do
--replace /usr $out substituteInPlace $x --replace /usr $out
substituteInPlace include/radiotray-ng/common.hpp \ done
--replace /usr $out
# We don't find the radiotray-ng-notification icon otherwise # We don't find the radiotray-ng-notification icon otherwise
substituteInPlace data/radiotray-ng.desktop \ substituteInPlace data/radiotray-ng.desktop \
@ -75,6 +74,8 @@ stdenv.mkDerivation rec {
--replace radiotray-ng-notification radiotray-ng-on --replace radiotray-ng-notification radiotray-ng-on
''; '';
cmakeFlags = stdenv.lib.optional doCheck "-DBUILD_TESTS=ON";
enableParallelBuilding = true; enableParallelBuilding = true;
doCheck = true; doCheck = true;

View File

@ -0,0 +1,45 @@
{ stdenv, fetchurl, cmake, qt5, zlib, taglib, pkgconfig, pcre, gst_all_1 }:
let
version = "1.0.0-git5-20180115";
in
stdenv.mkDerivation {
name = "sayonara-player-${version}";
src = fetchurl {
url = "https://sayonara-player.com/sw/sayonara-player-${version}.tar.gz";
sha256 = "1fl7zplnrrvbv1xm4g348bpd46jj39jvbm808hyjjq92i64wqg37";
};
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = with qt5; with gst_all_1;
[ gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly
pcre qtbase qttools taglib zlib
];
# CMake Error at src/GUI/Resources/Icons/cmake_install.cmake:49 (file):
# file cannot create directory: /usr/share/icons. Maybe need administrative
# privileges.
# Call Stack (most recent call first):
# src/GUI/Resources/cmake_install.cmake:50 (include)
# src/GUI/cmake_install.cmake:50 (include)
# src/cmake_install.cmake:59 (include)
# cmake_install.cmake:42 (include)
postPatch = ''
substituteInPlace src/GUI/Resources/Icons/CMakeLists.txt \
--replace "/usr/share" "$out/share"
'';
# [ 65%] Building CXX object src/Components/Engine/CMakeFiles/say_comp_engine.dir/AbstractPipeline.cpp.o
# /tmp/nix-build-sayonara-player-1.0.0-git5-20180115.drv-0/sayonara-player/src/Components/Engine/AbstractPipeline.cpp:28:32: fatal error: gst/app/gstappsink.h: No such file or directory
# #include <gst/app/gstappsink.h>
NIX_CFLAGS_COMPILE = "-I${gst_all_1.gst-plugins-base.dev}/include/gstreamer-1.0";
meta = with stdenv.lib;
{ description = "Sayonara music player";
homepage = https://sayonara-player.com/;
license = licenses.gpl3;
platforms = qt5.qtbase.meta.platforms;
maintainers = [ maintainers.deepfire ];
};
}

View File

@ -1,18 +1,18 @@
{ stdenv, fetchgit , boost, libX11, mesa, liblo, libjack2, ladspaH, lv2, pkgconfig, rubberband, libsndfile }: { stdenv, fetchgit , boost, libX11, mesa, liblo, libjack2, ladspaH, lv2, pkgconfig, rubberband, libsndfile, fftwFloat, libsamplerate }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "zam-plugins-${version}"; name = "zam-plugins-${version}";
version = "3.9"; version = "3.10";
src = fetchgit { src = fetchgit {
url = "https://github.com/zamaudio/zam-plugins.git"; url = "https://github.com/zamaudio/zam-plugins.git";
deepClone = true; deepClone = true;
rev = "4976cf204074c1dfaf344821e83e8d896b35107d"; rev = "a3321af1892a6994d64fb705e48ae8adf8d7df20";
sha256 = "1xgwl51sf2hgc5ikcnycyxaw9vy82lrcswn07b6av6i67qclm8f8"; sha256 = "0yqrs21ph2lx00p0jlc70qkmzfrnf9ihg1r3i9j5n2r903ljdg5p";
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ boost libX11 mesa liblo libjack2 ladspaH lv2 rubberband libsndfile ]; buildInputs = [ boost libX11 mesa liblo libjack2 ladspaH lv2 rubberband libsndfile fftwFloat libsamplerate ];
patchPhase = '' patchPhase = ''
patchShebangs ./dpf/utils/generate-ttl.sh patchShebangs ./dpf/utils/generate-ttl.sh

View File

@ -0,0 +1,102 @@
{ stdenv, fetchurl, makeWrapper, getopt, jre, cpio, gawk, gnugrep, gnused,
procps, which, gtk2, atk, glib, pango, gdk_pixbuf, cairo, freetype,
fontconfig, dbus, gconf, nss, nspr, alsaLib, cups, expat, libudev,
libX11, libxcb, libXi, libXcursor, libXdamage, libXrandr, libXcomposite,
libXext, libXfixes, libXrender, libXtst, libXScrnSaver, nodePackages,
maxRam ? "1024m" }:
stdenv.mkDerivation rec {
version = "6.6.0";
rev = "1506661200660_4347";
pname = "CrashPlanSmb";
name = "${pname}_${version}_${rev}";
src = fetchurl {
url = "https://web-eam-msp.crashplanpro.com/client/installers/${name}_Linux.tgz";
sha256 = "1zzx60fpmi2nlzpq80x4hfgspsrgd7ycfcvc6w391wxr0qzf2i9k";
};
nativeBuildInputs = [ makeWrapper cpio nodePackages.asar ];
buildInputs = [ getopt which ];
vardir = "/var/lib/crashplan";
manifestdir = "${vardir}/manifest";
postPatch = ''
# patch scripts/CrashPlanEngine
substituteInPlace scripts/CrashPlanEngine \
--replace /bin/ps ${procps}/bin/ps \
--replace awk ${gawk}/bin/awk \
--replace '`sed' '`${gnused}/bin/sed' \
--replace grep ${gnugrep}/bin/grep \
--replace TARGETDIR/log VARDIR/log \
--replace TARGETDIR/\''${NAME} VARDIR/\''${NAME} \
--replace \$TARGETDIR/bin/run.conf $out/bin/run.conf \
--replace \$VARDIR ${vardir}
# patch scripts/CrashPlanDesktop
substituteInPlace scripts/CrashPlanDesktop \
--replace awk ${gawk}/bin/awk \
--replace "\"\$SCRIPTDIR/..\"" "$out" \
--replace "\$(dirname \$SCRIPT)" "$out" \
--replace "\''${TARGETDIR}/log" ${vardir}/log \
--replace "\''${TARGETDIR}" "$out"
'';
installPhase = ''
mkdir $out
zcat -v ${pname}_${version}.cpi | (cd $out; cpio -i -d -v --no-preserve-owner)
install -D -m 755 scripts/CrashPlanDesktop $out/bin/CrashPlanDesktop
install -D -m 755 scripts/CrashPlanEngine $out/bin/CrashPlanEngine
install -D -m 644 scripts/run.conf $out/bin/run.conf
install -D -m 644 scripts/CrashPlan.desktop $out/share/applications/CrashPlan.desktop
# unpack, patch and repack app.asar to stop electron from creating /usr/local/crashplan/log to store the ui logs.
asar e $out/app.asar $out/app.asar-unpacked
rm -v $out/app.asar
substituteInPlace $out/app.asar-unpacked/shared_modules/shell/platform_paths.js \
--replace "getLogFileParentPath();" "\"$vardir/log\";"
asar p $out/app.asar-unpacked $out/app.asar
mv -v $out/*.asar $out/electron/resources
chmod 755 "$out/electron/crashplan"
rm -r $out/log
mv -v $out/conf $out/conf.template
ln -s $vardir/log $out/log
ln -s $vardir/cache $out/cache
ln -s $vardir/conf $out/conf
substituteInPlace $out/bin/run.conf \
--replace "-Xmx1024m" "-Xmx${maxRam}"
echo "JAVACOMMON=${jre}/bin/java" > $out/install.vars
echo "APP_BASENAME=CrashPlan" >> $out/install.vars
echo "TARGETDIR=$out" >> $out/install.vars
echo "BINSDIR=$out/bin" >> $out/install.vars
echo "MANIFESTDIR=${manifestdir}" >> $out/install.vars
echo "VARDIR=${vardir}" >> $out/install.vars
echo "INITDIR=" >> $out/install.vars
echo "RUNLVLDIR=" >> $out/install.vars
echo "INSTALLDATE=" >> $out/install.vars
'';
postFixup = ''
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $out/electron/crashplan
wrapProgram $out/bin/CrashPlanDesktop --prefix LD_LIBRARY_PATH ":" "${stdenv.lib.makeLibraryPath [
stdenv.cc.cc.lib gtk2 atk glib pango gdk_pixbuf cairo freetype
fontconfig dbus gconf nss nspr alsaLib cups expat libudev
libX11 libxcb libXi libXcursor libXdamage libXrandr libXcomposite
libXext libXfixes libXrender libXtst libXScrnSaver]}"
'';
meta = with stdenv.lib; {
description = "An online backup solution";
homepage = http://www.crashplan.com/business/;
license = licenses.unfree;
maintainers = with maintainers; [ xvapx ];
};
}

View File

@ -4,15 +4,15 @@ with stdenv.lib;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "kakoune-unstable-${version}"; name = "kakoune-unstable-${version}";
version = "2017-04-12"; version = "2018-02-15";
src = fetchFromGitHub { src = fetchFromGitHub {
repo = "kakoune"; repo = "kakoune";
owner = "mawww"; owner = "mawww";
rev = "7482d117cc85523e840dff595134dcb9cdc62207"; rev = "f5e39972eb525166dc5b1d963067f79990991a75";
sha256 = "08j611y192n9vln9i94ldlvz3k0sg79dkmfc0b1vczrmaxhpgpfh"; sha256 = "160a302xg6nfzx49dkis6ij20kyzr63kxvcv8ld3l07l8k69g80r";
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ ncurses boost asciidoc docbook_xsl libxslt ]; buildInputs = [ ncurses asciidoc docbook_xsl libxslt ];
postPatch = '' postPatch = ''
export PREFIX=$out export PREFIX=$out

View File

@ -1,14 +1,14 @@
{ stdenv, fetchFromGitHub, pythonPackages, gnome2, keybinder }: { stdenv, fetchFromGitHub, pythonPackages, gnome2, keybinder }:
pythonPackages.buildPythonApplication rec { pythonPackages.buildPythonApplication rec {
ver = "0.92"; ver = "0.93";
name = "dockbarx-${ver}"; name = "dockbarx-${ver}";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "M7S"; owner = "M7S";
repo = "dockbarx"; repo = "dockbarx";
rev = ver; rev = ver;
sha256 = "17n7jc3bk3f2i0i1ddpp05bakifc8y5xppads7ihpkj3qw9g35vl"; sha256 = "1h1g2vag5vnx87sa1f0qi8rq7wlr2ymvkrdr08kk7cma4wk0x6hg";
}; };
postPatch = '' postPatch = ''

View File

@ -1,7 +0,0 @@
source 'https://rubygems.org'
gem 'jekyll'
gem 'jekyll-feed'
gem 'jekyll-paginate'
gem 'rdiscount'
gem 'RedCloth'
gem 'minima'

View File

@ -1,59 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.3.2)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
colorator (1.1.0)
ffi (1.9.18)
forwardable-extended (2.6.0)
jekyll (3.4.1)
addressable (~> 2.4)
colorator (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 3.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (~> 1.7)
safe_yaml (~> 1.0)
jekyll-feed (0.9.1)
jekyll (~> 3.3)
jekyll-paginate (1.1.0)
jekyll-sass-converter (1.5.0)
sass (~> 3.4)
jekyll-watch (1.5.0)
listen (~> 3.0, < 3.1)
kramdown (1.13.2)
liquid (3.0.6)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
mercenary (0.3.6)
minima (2.1.0)
jekyll (~> 3.3)
pathutil (0.14.0)
forwardable-extended (~> 2.6)
public_suffix (2.0.5)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
rdiscount (2.2.0.1)
rouge (1.11.1)
safe_yaml (1.0.4)
sass (3.4.23)
PLATFORMS
ruby
DEPENDENCIES
RedCloth
jekyll
jekyll-feed
jekyll-paginate
minima
rdiscount
BUNDLED WITH
1.14.4

View File

@ -0,0 +1,10 @@
source "https://rubygems.org"
gem "jekyll"
# jekyll alone might be enough for most use-cases
gem "rouge"
gem "activesupport", "~> 4.2"
gem "jekyll-avatar"
gem "jekyll-mentions"
gem "jekyll-seo-tag"
gem "jekyll-sitemap"
gem "jemoji"

View File

@ -0,0 +1,101 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
colorator (1.1.0)
concurrent-ruby (1.0.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.5)
ffi (1.9.21)
forwardable-extended (2.6.0)
gemoji (3.0.0)
html-pipeline (2.7.1)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.7.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
jekyll-avatar (0.5.0)
jekyll (~> 3.0)
jekyll-mentions (1.2.0)
activesupport (~> 4.0)
html-pipeline (~> 2.3)
jekyll (~> 3.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-seo-tag (2.4.0)
jekyll (~> 3.3)
jekyll-sitemap (1.2.0)
jekyll (~> 3.3)
jekyll-watch (2.0.0)
listen (~> 3.0)
jemoji (0.9.0)
activesupport (~> 4.0, >= 4.2.9)
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (~> 3.0)
kramdown (1.16.2)
liquid (4.0.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
mercenary (0.3.6)
mini_portile2 (2.3.0)
minitest (5.11.3)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
public_suffix (3.0.2)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rouge (3.1.1)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
PLATFORMS
ruby
DEPENDENCIES
activesupport (~> 4.2)
jekyll
jekyll-avatar
jekyll-mentions
jekyll-seo-tag
jekyll-sitemap
jemoji
rouge
BUNDLED WITH
1.14.6

View File

@ -0,0 +1,326 @@
{
activesupport = {
dependencies = ["i18n" "minitest" "thread_safe" "tzinfo"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0s12j8vl8vrxfngkdlz9g8bpz9akq1z42d57mx5r537b2pji8nr7";
type = "gem";
};
version = "4.2.10";
};
addressable = {
dependencies = ["public_suffix"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0viqszpkggqi8hq87pqp0xykhvz60g99nwmkwsb0v45kc2liwxvk";
type = "gem";
};
version = "2.5.2";
};
colorator = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72";
type = "gem";
};
version = "1.1.0";
};
concurrent-ruby = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "183lszf5gx84kcpb779v6a2y0mx9sssy8dgppng1z9a505nj1qcf";
type = "gem";
};
version = "1.0.5";
};
em-websocket = {
dependencies = ["eventmachine" "http_parser.rb"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1bsw8vjz0z267j40nhbmrvfz7dvacq4p0pagvyp17jif6mj6v7n3";
type = "gem";
};
version = "0.5.1";
};
eventmachine = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "075hdw0fgzldgss3xaqm2dk545736khcvv1fmzbf1sgdlkyh1v8z";
type = "gem";
};
version = "1.2.5";
};
ffi = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0c2dl10pi6a30kcvx2s6p2v1wb4kbm48iv38kmz2ff600nirhpb8";
type = "gem";
};
version = "1.9.21";
};
forwardable-extended = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v";
type = "gem";
};
version = "2.6.0";
};
gemoji = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1h85qpn2xbmsn8ssf2fqzlqg181j000m5z4l3g26r7vblncg162d";
type = "gem";
};
version = "3.0.0";
};
html-pipeline = {
dependencies = ["activesupport" "nokogiri"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0hkx70z9ijgnncmrna9qdh9ajn9m7v146k91j257lrzyq2f6jdjd";
type = "gem";
};
version = "2.7.1";
};
"http_parser.rb" = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "15nidriy0v5yqfjsgsra51wmknxci2n2grliz78sf9pga3n0l7gi";
type = "gem";
};
version = "0.6.0";
};
i18n = {
dependencies = ["concurrent-ruby"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "038qvz7kd3cfxk8bvagqhakx68pfbnmghpdkx7573wbf0maqp9a3";
type = "gem";
};
version = "0.9.5";
};
jekyll = {
dependencies = ["addressable" "colorator" "em-websocket" "i18n" "jekyll-sass-converter" "jekyll-watch" "kramdown" "liquid" "mercenary" "pathutil" "rouge" "safe_yaml"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "05f61rqwz1isci7by34zyz38ah2rv5b8i5h618cxcl97hwqps8n2";
type = "gem";
};
version = "3.7.2";
};
jekyll-avatar = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0y2w7pnahkm3ddxrq589wv1w53ay7p1pvfs6khcmh6wq85r6wpsf";
type = "gem";
};
version = "0.5.0";
};
jekyll-mentions = {
dependencies = ["activesupport" "html-pipeline" "jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "00nqm1ng4iiibmv4vx0ayzq7fqm2sm1af98r4ykvld6asqj5qkyd";
type = "gem";
};
version = "1.2.0";
};
jekyll-sass-converter = {
dependencies = ["sass"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "008ikh5fk0n6ri54mylcl8jn0mq8p2nfyfqif2q3pp0lwilkcxsk";
type = "gem";
};
version = "1.5.2";
};
jekyll-seo-tag = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f9b2mvmx57zj49afb3x8cmzdmb1kh4rbpbv3v7w5bh47g2c9big";
type = "gem";
};
version = "2.4.0";
};
jekyll-sitemap = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xy93ysl1q8r4xhbnffycvsslja0dskh2z2pl1jnykwsy27dc89n";
type = "gem";
};
version = "1.2.0";
};
jekyll-watch = {
dependencies = ["listen"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0m7scvj3ki8bmyx5v8pzibpg6my10nycnc28lip98dskf8iakprp";
type = "gem";
};
version = "2.0.0";
};
jemoji = {
dependencies = ["activesupport" "gemoji" "html-pipeline" "jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0acmi7mgr844dmzgfi9flcqkkb0jh5l21h579cidxwf1409w588b";
type = "gem";
};
version = "0.9.0";
};
kramdown = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0mkrqpp01rrfn3rx6wwsjizyqmafp0vgg8ja1dvbjs185r5zw3za";
type = "gem";
};
version = "1.16.2";
};
liquid = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "17fa0jgwm9a935fyvzy8bysz7j5n1vf1x2wzqkdfd5k08dbw3x2y";
type = "gem";
};
version = "4.0.0";
};
listen = {
dependencies = ["rb-fsevent" "rb-inotify" "ruby_dep"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "01v5mrnfqm6sgm8xn2v5swxsn1wlmq7rzh2i48d4jzjsc7qvb6mx";
type = "gem";
};
version = "3.1.5";
};
mercenary = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "10la0xw82dh5mqab8bl0dk21zld63cqxb1g16fk8cb39ylc4n21a";
type = "gem";
};
version = "0.3.6";
};
mini_portile2 = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "13d32jjadpjj6d2wdhkfpsmy68zjx90p49bgf8f7nkpz86r1fr11";
type = "gem";
};
version = "2.3.0";
};
minitest = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0icglrhghgwdlnzzp4jf76b0mbc71s80njn5afyfjn4wqji8mqbq";
type = "gem";
};
version = "5.11.3";
};
nokogiri = {
dependencies = ["mini_portile2"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "05fm3xh462glvs0rwnfmc1spmgl4ljg2giifynbmwwqvl42zaaiq";
type = "gem";
};
version = "1.8.2";
};
pathutil = {
dependencies = ["forwardable-extended"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0wc18ms1rzi44lpjychyw2a96jcmgxqdvy2949r4vvb5f4p0lgvz";
type = "gem";
};
version = "0.16.1";
};
public_suffix = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1x5h1dh1i3gwc01jbg01rly2g6a1qwhynb1s8a30ic507z1nh09s";
type = "gem";
};
version = "3.0.2";
};
rb-fsevent = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1fbpmjypwxkb8r7y1kmhmyp6gawa4byw0yb3jc3dn9ly4ld9lizf";
type = "gem";
};
version = "0.10.2";
};
rb-inotify = {
dependencies = ["ffi"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0yfsgw5n7pkpyky6a9wkf1g9jafxb0ja7gz0qw0y14fd2jnzfh71";
type = "gem";
};
version = "0.9.10";
};
rouge = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1sfhy0xxqjnzqa7qxmpz1bmy0mzcr55qyvi410gsb6d6i4ialbw3";
type = "gem";
};
version = "3.1.1";
};
ruby_dep = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1c1bkl97i9mkcvkn1jks346ksnvnnp84cs22gwl0vd7radybrgy5";
type = "gem";
};
version = "1.5.0";
};
safe_yaml = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1hly915584hyi9q9vgd968x2nsi5yag9jyf5kq60lwzi5scr7094";
type = "gem";
};
version = "1.0.4";
};
sass = {
dependencies = ["sass-listen"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "10401m2xlv6vaxfwzy4xxmk51ddcnkvwi918cw3jkki0qqdl7d8v";
type = "gem";
};
version = "3.5.5";
};
sass-listen = {
dependencies = ["rb-fsevent" "rb-inotify"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xw3q46cmahkgyldid5hwyiwacp590zj2vmswlll68ryvmvcp7df";
type = "gem";
};
version = "4.0.0";
};
thread_safe = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy";
type = "gem";
};
version = "0.3.6";
};
tzinfo = {
dependencies = ["thread_safe"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1fjx9j327xpkkdlxwmkl3a8wqj7i4l4jwlrv3z13mg95z9wl253z";
type = "gem";
};
version = "1.2.5";
};
}

View File

@ -1,19 +1,34 @@
{ stdenv, lib, bundlerEnv, ruby }: { lib, bundlerEnv, ruby
, withOptionalDependencies ? false
}:
bundlerEnv rec { bundlerEnv rec {
name = "jekyll-${version}"; name = pname + "-" + version;
pname = "jekyll";
version = (import
(if withOptionalDependencies
then ./full/gemset.nix
else ./basic/gemset.nix))
.jekyll.version;
version = (import gemset).jekyll.version;
inherit ruby; inherit ruby;
gemfile = ./Gemfile; gemdir = if withOptionalDependencies
lockfile = ./Gemfile.lock; then ./full
gemset = ./gemset.nix; else ./basic;
meta = with lib; { meta = with lib; {
description = "Simple, blog aware, static site generator"; description = "A blog-aware, static site generator, written in Ruby";
longDescription = ''
Jekyll is a simple, blog-aware, static site generator, written in Ruby.
Think of it like a file-based CMS, without all the complexity. Jekyll
takes your content, renders Markdown and Liquid templates, and spits out a
complete, static website ready to be served by Apache, Nginx or another
web server. Jekyll is the engine behind GitHub Pages, which you can use to
host sites right from your GitHub repositories.
'';
homepage = https://jekyllrb.com/; homepage = https://jekyllrb.com/;
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ pesterhazy ]; maintainers = with maintainers; [ primeos pesterhazy ];
platforms = platforms.unix; platforms = platforms.unix;
}; };
} }

View File

@ -0,0 +1,30 @@
source "https://rubygems.org"
gem "jekyll"
gem "rouge"
gem "activesupport", "~> 4.2"
gem "jekyll-avatar"
gem "jekyll-mentions"
gem "jekyll-seo-tag"
gem "jekyll-sitemap"
gem "jemoji"
# Optional dependencies:
gem "coderay", "~> 1.1.0"
gem "jekyll-coffeescript"
gem "jekyll-docs"
gem "jekyll-feed", "~> 0.9"
gem "jekyll-gist"
gem "jekyll-paginate"
gem "jekyll-redirect-from"
gem "kramdown", "~> 1.14"
gem "mime-types", "~> 3.0"
gem "rdoc", RUBY_VERSION >= "2.2.2" ? "~> 6.0" : "~> 5.1"
gem "tomlrb", "~> 1.2"
platform :ruby, :mswin, :mingw, :x64_mingw do
gem "classifier-reborn", "~> 2.2.0"
gem "liquid-c", "~> 3.0"
gem "pygments.rb", "~> 1.0"
gem "rdiscount", "~> 2.0"
gem "redcarpet", "~> 3.2", ">= 3.2.3"
gem "yajl-ruby", "~> 1.3.1"
end

View File

@ -0,0 +1,160 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
classifier-reborn (2.2.0)
fast-stemmer (~> 1.0)
coderay (1.1.2)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
concurrent-ruby (1.0.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.5)
execjs (2.7.0)
faraday (0.14.0)
multipart-post (>= 1.2, < 3)
fast-stemmer (1.0.2)
ffi (1.9.21)
forwardable-extended (2.6.0)
gemoji (3.0.0)
html-pipeline (2.7.1)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.7.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
jekyll-avatar (0.5.0)
jekyll (~> 3.0)
jekyll-coffeescript (1.1.1)
coffee-script (~> 2.2)
coffee-script-source (~> 1.11.1)
jekyll-docs (3.7.2)
jekyll (= 3.7.2)
jekyll-feed (0.9.3)
jekyll (~> 3.3)
jekyll-gist (1.5.0)
octokit (~> 4.2)
jekyll-mentions (1.2.0)
activesupport (~> 4.0)
html-pipeline (~> 2.3)
jekyll (~> 3.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.13.0)
jekyll (~> 3.3)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-seo-tag (2.4.0)
jekyll (~> 3.3)
jekyll-sitemap (1.2.0)
jekyll (~> 3.3)
jekyll-watch (2.0.0)
listen (~> 3.0)
jemoji (0.9.0)
activesupport (~> 4.0, >= 4.2.9)
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (~> 3.0)
kramdown (1.16.2)
liquid (4.0.0)
liquid-c (3.0.0)
liquid (>= 3.0.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
mercenary (0.3.6)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.13.1)
multipart-post (2.0.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
octokit (4.8.0)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
public_suffix (3.0.2)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdiscount (2.2.0.1)
rdoc (6.0.1)
redcarpet (3.4.0)
rouge (3.1.1)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
thread_safe (0.3.6)
tomlrb (1.2.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
yajl-ruby (1.3.1)
PLATFORMS
ruby
DEPENDENCIES
activesupport (~> 4.2)
classifier-reborn (~> 2.2.0)
coderay (~> 1.1.0)
jekyll
jekyll-avatar
jekyll-coffeescript
jekyll-docs
jekyll-feed (~> 0.9)
jekyll-gist
jekyll-mentions
jekyll-paginate
jekyll-redirect-from
jekyll-seo-tag
jekyll-sitemap
jemoji
kramdown (~> 1.14)
liquid-c (~> 3.0)
mime-types (~> 3.0)
pygments.rb (~> 1.0)
rdiscount (~> 2.0)
rdoc (~> 6.0)
redcarpet (~> 3.2, >= 3.2.3)
rouge
tomlrb (~> 1.2)
yajl-ruby (~> 1.3.1)
BUNDLED WITH
1.14.6

View File

@ -0,0 +1,547 @@
{
activesupport = {
dependencies = ["i18n" "minitest" "thread_safe" "tzinfo"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0s12j8vl8vrxfngkdlz9g8bpz9akq1z42d57mx5r537b2pji8nr7";
type = "gem";
};
version = "4.2.10";
};
addressable = {
dependencies = ["public_suffix"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0viqszpkggqi8hq87pqp0xykhvz60g99nwmkwsb0v45kc2liwxvk";
type = "gem";
};
version = "2.5.2";
};
classifier-reborn = {
dependencies = ["fast-stemmer"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "04nxmm5b7j7r0ij9pcpdr7xqpig559gfzrw042ycxcfyav2pv6ij";
type = "gem";
};
version = "2.2.0";
};
coderay = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "15vav4bhcc2x3jmi3izb11l4d9f3xv8hp2fszb7iqmpsccv1pz4y";
type = "gem";
};
version = "1.1.2";
};
coffee-script = {
dependencies = ["coffee-script-source" "execjs"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0rc7scyk7mnpfxqv5yy4y5q1hx3i7q3ahplcp4bq2g5r24g2izl2";
type = "gem";
};
version = "2.4.1";
};
coffee-script-source = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xfshhlz808f8639wc88wgls1mww35sid8rd55vn0a4yqajf4vh9";
type = "gem";
};
version = "1.11.1";
};
colorator = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72";
type = "gem";
};
version = "1.1.0";
};
concurrent-ruby = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "183lszf5gx84kcpb779v6a2y0mx9sssy8dgppng1z9a505nj1qcf";
type = "gem";
};
version = "1.0.5";
};
em-websocket = {
dependencies = ["eventmachine" "http_parser.rb"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1bsw8vjz0z267j40nhbmrvfz7dvacq4p0pagvyp17jif6mj6v7n3";
type = "gem";
};
version = "0.5.1";
};
eventmachine = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "075hdw0fgzldgss3xaqm2dk545736khcvv1fmzbf1sgdlkyh1v8z";
type = "gem";
};
version = "1.2.5";
};
execjs = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1yz55sf2nd3l666ms6xr18sm2aggcvmb8qr3v53lr4rir32y1yp1";
type = "gem";
};
version = "2.7.0";
};
faraday = {
dependencies = ["multipart-post"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1c3x3s8vb5nf7inyfvhdxwa4q3swmnacpxby6pish5fgmhws7zrr";
type = "gem";
};
version = "0.14.0";
};
fast-stemmer = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0688clyk4xxh3kdb18vi089k90mca8ji5fwaknh3da5wrzcrzanh";
type = "gem";
};
version = "1.0.2";
};
ffi = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0c2dl10pi6a30kcvx2s6p2v1wb4kbm48iv38kmz2ff600nirhpb8";
type = "gem";
};
version = "1.9.21";
};
forwardable-extended = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v";
type = "gem";
};
version = "2.6.0";
};
gemoji = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1h85qpn2xbmsn8ssf2fqzlqg181j000m5z4l3g26r7vblncg162d";
type = "gem";
};
version = "3.0.0";
};
html-pipeline = {
dependencies = ["activesupport" "nokogiri"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0hkx70z9ijgnncmrna9qdh9ajn9m7v146k91j257lrzyq2f6jdjd";
type = "gem";
};
version = "2.7.1";
};
"http_parser.rb" = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "15nidriy0v5yqfjsgsra51wmknxci2n2grliz78sf9pga3n0l7gi";
type = "gem";
};
version = "0.6.0";
};
i18n = {
dependencies = ["concurrent-ruby"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "038qvz7kd3cfxk8bvagqhakx68pfbnmghpdkx7573wbf0maqp9a3";
type = "gem";
};
version = "0.9.5";
};
jekyll = {
dependencies = ["addressable" "colorator" "em-websocket" "i18n" "jekyll-sass-converter" "jekyll-watch" "kramdown" "liquid" "mercenary" "pathutil" "rouge" "safe_yaml"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "05f61rqwz1isci7by34zyz38ah2rv5b8i5h618cxcl97hwqps8n2";
type = "gem";
};
version = "3.7.2";
};
jekyll-avatar = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0y2w7pnahkm3ddxrq589wv1w53ay7p1pvfs6khcmh6wq85r6wpsf";
type = "gem";
};
version = "0.5.0";
};
jekyll-coffeescript = {
dependencies = ["coffee-script" "coffee-script-source"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "06qf4j9f6ysjb4bq6gsdaiz2ksmhc5yb484v458ra3s6ybccqvvy";
type = "gem";
};
version = "1.1.1";
};
jekyll-docs = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0dw8pvxr0q02rivc0n0v4w6151zi6s212xwl27iam6pjc8skbg9b";
type = "gem";
};
version = "3.7.2";
};
jekyll-feed = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0kr3kyaq4z3jixn6ay8h16bxxlv6slvvp7nqnl05jdymhkl0bmm9";
type = "gem";
};
version = "0.9.3";
};
jekyll-gist = {
dependencies = ["octokit"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "03wz9j6yq3552nzf4g71qrdm9pfdgbm68abml9sjjgiaan1n8ns9";
type = "gem";
};
version = "1.5.0";
};
jekyll-mentions = {
dependencies = ["activesupport" "html-pipeline" "jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "00nqm1ng4iiibmv4vx0ayzq7fqm2sm1af98r4ykvld6asqj5qkyd";
type = "gem";
};
version = "1.2.0";
};
jekyll-paginate = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0r7bcs8fq98zldih4787zk5i9w24nz5wa26m84ssja95n3sas2l8";
type = "gem";
};
version = "1.1.0";
};
jekyll-redirect-from = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1crm5xqgv5asbbbaxfgky4ppib5rih59yzpa3yc94gh8b9cjixrj";
type = "gem";
};
version = "0.13.0";
};
jekyll-sass-converter = {
dependencies = ["sass"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "008ikh5fk0n6ri54mylcl8jn0mq8p2nfyfqif2q3pp0lwilkcxsk";
type = "gem";
};
version = "1.5.2";
};
jekyll-seo-tag = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f9b2mvmx57zj49afb3x8cmzdmb1kh4rbpbv3v7w5bh47g2c9big";
type = "gem";
};
version = "2.4.0";
};
jekyll-sitemap = {
dependencies = ["jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xy93ysl1q8r4xhbnffycvsslja0dskh2z2pl1jnykwsy27dc89n";
type = "gem";
};
version = "1.2.0";
};
jekyll-watch = {
dependencies = ["listen"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0m7scvj3ki8bmyx5v8pzibpg6my10nycnc28lip98dskf8iakprp";
type = "gem";
};
version = "2.0.0";
};
jemoji = {
dependencies = ["activesupport" "gemoji" "html-pipeline" "jekyll"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0acmi7mgr844dmzgfi9flcqkkb0jh5l21h579cidxwf1409w588b";
type = "gem";
};
version = "0.9.0";
};
kramdown = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0mkrqpp01rrfn3rx6wwsjizyqmafp0vgg8ja1dvbjs185r5zw3za";
type = "gem";
};
version = "1.16.2";
};
liquid = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "17fa0jgwm9a935fyvzy8bysz7j5n1vf1x2wzqkdfd5k08dbw3x2y";
type = "gem";
};
version = "4.0.0";
};
liquid-c = {
dependencies = ["liquid"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0a5n7q314ma32y7v9a1g6ps60b14zfn2q4nip4j5aknblz51v7gi";
type = "gem";
};
version = "3.0.0";
};
listen = {
dependencies = ["rb-fsevent" "rb-inotify" "ruby_dep"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "01v5mrnfqm6sgm8xn2v5swxsn1wlmq7rzh2i48d4jzjsc7qvb6mx";
type = "gem";
};
version = "3.1.5";
};
mercenary = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "10la0xw82dh5mqab8bl0dk21zld63cqxb1g16fk8cb39ylc4n21a";
type = "gem";
};
version = "0.3.6";
};
mime-types = {
dependencies = ["mime-types-data"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0087z9kbnlqhci7fxh9f6il63hj1k02icq2rs0c6cppmqchr753m";
type = "gem";
};
version = "3.1";
};
mime-types-data = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "04my3746hwa4yvbx1ranhfaqkgf6vavi1kyijjnw8w3dy37vqhkm";
type = "gem";
};
version = "3.2016.0521";
};
mini_portile2 = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "13d32jjadpjj6d2wdhkfpsmy68zjx90p49bgf8f7nkpz86r1fr11";
type = "gem";
};
version = "2.3.0";
};
minitest = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0icglrhghgwdlnzzp4jf76b0mbc71s80njn5afyfjn4wqji8mqbq";
type = "gem";
};
version = "5.11.3";
};
multi_json = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1rl0qy4inf1mp8mybfk56dfga0mvx97zwpmq5xmiwl5r770171nv";
type = "gem";
};
version = "1.13.1";
};
multipart-post = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "09k0b3cybqilk1gwrwwain95rdypixb2q9w65gd44gfzsd84xi1x";
type = "gem";
};
version = "2.0.0";
};
nokogiri = {
dependencies = ["mini_portile2"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "05fm3xh462glvs0rwnfmc1spmgl4ljg2giifynbmwwqvl42zaaiq";
type = "gem";
};
version = "1.8.2";
};
octokit = {
dependencies = ["sawyer"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1hp77svmpxcwnfajb324i1g2b7jazg23fn4ccjr5y3lww0rnj1dg";
type = "gem";
};
version = "4.8.0";
};
pathutil = {
dependencies = ["forwardable-extended"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0wc18ms1rzi44lpjychyw2a96jcmgxqdvy2949r4vvb5f4p0lgvz";
type = "gem";
};
version = "0.16.1";
};
public_suffix = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1x5h1dh1i3gwc01jbg01rly2g6a1qwhynb1s8a30ic507z1nh09s";
type = "gem";
};
version = "3.0.2";
};
"pygments.rb" = {
dependencies = ["multi_json"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0lbvnwvz770ambm4d6lxgc2097rydn5rcc5d6986bnkzyxfqqjnv";
type = "gem";
};
version = "1.2.1";
};
rb-fsevent = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1fbpmjypwxkb8r7y1kmhmyp6gawa4byw0yb3jc3dn9ly4ld9lizf";
type = "gem";
};
version = "0.10.2";
};
rb-inotify = {
dependencies = ["ffi"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0yfsgw5n7pkpyky6a9wkf1g9jafxb0ja7gz0qw0y14fd2jnzfh71";
type = "gem";
};
version = "0.9.10";
};
rdiscount = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1arvk3k06prxasq1djbj065ixar4zl171340g7wr1ww4gj9makx3";
type = "gem";
};
version = "2.2.0.1";
};
rdoc = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1vzhv04lp76iax258dh47zsxhjg34r9sg76vgikbyfywjzflvfyj";
type = "gem";
};
version = "6.0.1";
};
redcarpet = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0h9qz2hik4s9knpmbwrzb3jcp3vc5vygp9ya8lcpl7f1l9khmcd7";
type = "gem";
};
version = "3.4.0";
};
rouge = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1sfhy0xxqjnzqa7qxmpz1bmy0mzcr55qyvi410gsb6d6i4ialbw3";
type = "gem";
};
version = "3.1.1";
};
ruby_dep = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1c1bkl97i9mkcvkn1jks346ksnvnnp84cs22gwl0vd7radybrgy5";
type = "gem";
};
version = "1.5.0";
};
safe_yaml = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1hly915584hyi9q9vgd968x2nsi5yag9jyf5kq60lwzi5scr7094";
type = "gem";
};
version = "1.0.4";
};
sass = {
dependencies = ["sass-listen"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "10401m2xlv6vaxfwzy4xxmk51ddcnkvwi918cw3jkki0qqdl7d8v";
type = "gem";
};
version = "3.5.5";
};
sass-listen = {
dependencies = ["rb-fsevent" "rb-inotify"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xw3q46cmahkgyldid5hwyiwacp590zj2vmswlll68ryvmvcp7df";
type = "gem";
};
version = "4.0.0";
};
sawyer = {
dependencies = ["addressable" "faraday"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0sv1463r7bqzvx4drqdmd36m7rrv6sf1v3c6vswpnq3k6vdw2dvd";
type = "gem";
};
version = "0.8.1";
};
thread_safe = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy";
type = "gem";
};
version = "0.3.6";
};
tomlrb = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "09gh67v8s1pr7c37490sjp782gi4wf9k9cadp4l926h1sp27bcgz";
type = "gem";
};
version = "1.2.6";
};
tzinfo = {
dependencies = ["thread_safe"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1fjx9j327xpkkdlxwmkl3a8wqj7i4l4jwlrv3z13mg95z9wl253z";
type = "gem";
};
version = "1.2.5";
};
yajl-ruby = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1rn4kc9fha990yd252wglh6rcyh35cavm1vpyfj8krlcwph09g30";
type = "gem";
};
version = "1.3.1";
};
}

View File

@ -1,183 +0,0 @@
{
addressable = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1j5r0anj8m4qlf2psnldip4b8ha2bsscv11lpdgnfh4nnchzjnxw";
type = "gem";
};
version = "2.5.0";
};
colorator = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72";
type = "gem";
};
version = "1.1.0";
};
ffi = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "034f52xf7zcqgbvwbl20jwdyjwznvqnwpbaps9nk18v9lgb1dpx0";
type = "gem";
};
version = "1.9.18";
};
forwardable-extended = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v";
type = "gem";
};
version = "2.6.0";
};
jekyll = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0qbnjx7bpshbcam6p9ss2g6gpd3gxz6h4w9yszphj3ip335yhawb";
type = "gem";
};
version = "3.4.1";
};
jekyll-feed = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1dj62gy1jskkn703mi5h0bkg1psbpkdm2qqdw3bhjfid9358qvay";
type = "gem";
};
version = "0.9.1";
};
jekyll-paginate = {
source = {
sha256 = "0r7bcs8fq98zldih4787zk5i9w24nz5wa26m84ssja95n3sas2l8";
type = "gem";
};
version = "1.1.0";
};
jekyll-sass-converter = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "01m921763yfgx1gc33k5ixqz623f4c4azgnpqhgsc2q61fyfk3q1";
type = "gem";
};
version = "1.5.0";
};
jekyll-watch = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "02rg3wi95w2l0bg1igl5k6pza723vn2b2gj975gycz1cpmhdjn6z";
type = "gem";
};
version = "1.5.0";
};
kramdown = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1isiqc40q44zg57bd6cfnw1a2l0s2j5skw2awn2cz3gcm7wsf49d";
type = "gem";
};
version = "1.13.2";
};
liquid = {
source = {
sha256 = "033png37ym4jrjz5bi7zb4ic4yxacwvnllm1xxmrnr4swgyyygc2";
type = "gem";
};
version = "3.0.6";
};
listen = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1l0y7hbyfiwpvk172r28hsdqsifq1ls39hsfmzi1vy4ll0smd14i";
type = "gem";
};
version = "3.0.8";
};
mercenary = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "10la0xw82dh5mqab8bl0dk21zld63cqxb1g16fk8cb39ylc4n21a";
type = "gem";
};
version = "0.3.6";
};
minima = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1s7ks9fqfvqx7qicnkrg76wavg9mjas52f7iyhr89lz9mqiy7p39";
type = "gem";
};
version = "2.1.0";
};
pathutil = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f444wx6vjd30lkkb2zn1k5a6g33lidrpyy7lmgy66n1gsiipzn7";
type = "gem";
};
version = "0.14.0";
};
public_suffix = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "040jf98jpp6w140ghkhw2hvc1qx41zvywx5gj7r2ylr1148qnj7q";
type = "gem";
};
version = "2.0.5";
};
rb-fsevent = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1pdiasp9zlr306yld19szapi6kdjk38rpv1hih9x0ry40x6mb63n";
type = "gem";
};
version = "0.9.8";
};
rb-inotify = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0bq14f3md5nm00kgxgf0r9lcbn0vgbwljgajif0slxcwv622fjg9";
type = "gem";
};
version = "0.9.8";
};
rdiscount = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1arvk3k06prxasq1djbj065ixar4zl171340g7wr1ww4gj9makx3";
type = "gem";
};
version = "2.2.0.1";
};
RedCloth = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0m9dv7ya9q93r8x1pg2gi15rxlbck8m178j1fz7r5v6wr1avrrqy";
type = "gem";
};
version = "4.3.2";
};
rouge = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "13amckbdknnc5491ag28y8pqbyfpbzx5n4rlmadxhd3wkrhp92c8";
type = "gem";
};
version = "1.11.1";
};
safe_yaml = {
source = {
sha256 = "1hly915584hyi9q9vgd968x2nsi5yag9jyf5kq60lwzi5scr7094";
type = "gem";
};
version = "1.0.4";
};
sass = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0da4mn3n60cm1ss1pw1rrpa7fxagglxiwcgvz1asf1qgf4mvcwyr";
type = "gem";
};
version = "3.4.23";
};
}

View File

@ -7,6 +7,13 @@ let
flinkVersion = "1.3.2"; flinkVersion = "1.3.2";
scalaVersion = "2.11"; scalaVersion = "2.11";
sha256 = "0mf4qz0963bflzidgslvwpdlvj9za9sj20dfybplw9lhd4sf52rp"; sha256 = "0mf4qz0963bflzidgslvwpdlvj9za9sj20dfybplw9lhd4sf52rp";
hadoopBundle = "-hadoop27";
};
"1.4" = {
flinkVersion = "1.4.0";
scalaVersion = "2.11";
sha256 = "0d80djx1im3h8mf60qzi12km1bbik8a5l3nks85jzi0r0xzfgkm6";
hadoopBundle = "";
}; };
}; };
in in
@ -17,7 +24,7 @@ stdenv.mkDerivation rec {
name = "flink-${flinkVersion}"; name = "flink-${flinkVersion}";
src = fetchurl { src = fetchurl {
url = "mirror://apache/flink/${name}/${name}-bin-hadoop27-scala_${scalaVersion}.tgz"; url = "mirror://apache/flink/${name}/${name}-bin${hadoopBundle}-scala_${scalaVersion}.tgz";
inherit sha256; inherit sha256;
}; };

View File

@ -4,10 +4,10 @@ let
then "linux-amd64" then "linux-amd64"
else "darwin-amd64"; else "darwin-amd64";
checksum = if stdenv.isLinux checksum = if stdenv.isLinux
then "19sbvpll947y4dxn2dj26by2bwhcxa5nbkrq7x3cikn7z5bmj7vf" then "07bgny8mfdgv9f6zmk31hxhkwy90wr22js21jz679pkz3gmykxvx"
else "0jllj13jv8yil6iqi4xcs5v4z388h7i7hcnv98gc14spkyjshf3d"; else "1f6h96gyhsdb03am586kdqn619h4niwlj29j4bypf3yg2sar4p6x";
pname = "helm"; pname = "helm";
version = "2.8.0"; version = "2.8.1";
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "${pname}-${version}"; name = "${pname}-${version}";

View File

@ -3,13 +3,13 @@
let let
xorgxrdp = stdenv.mkDerivation rec { xorgxrdp = stdenv.mkDerivation rec {
name = "xorgxrdp-${version}"; name = "xorgxrdp-${version}";
version = "0.2.3"; version = "0.2.5";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "neutrinolabs"; owner = "neutrinolabs";
repo = "xorgxrdp"; repo = "xorgxrdp";
rev = "v${version}"; rev = "v${version}";
sha256 = "0l1b38j3q9mxyb8ffpdplbqs6rnabj92i8wngrwlkhfh2c88szn1"; sha256 = "05ix0bvbgpg0l0f6pyxp64a4785yv16dxf522y7k84b0rag4bxr7";
}; };
nativeBuildInputs = [ pkgconfig autoconf automake which libtool nasm ]; nativeBuildInputs = [ pkgconfig autoconf automake which libtool nasm ];
@ -34,7 +34,7 @@ let
}; };
xrdp = stdenv.mkDerivation rec { xrdp = stdenv.mkDerivation rec {
version = "0.9.3"; version = "0.9.5";
name = "xrdp-${version}"; name = "xrdp-${version}";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -42,7 +42,7 @@ let
repo = "xrdp"; repo = "xrdp";
rev = "refs/heads/runtime-cfg-path-${version}"; # Fixes https://github.com/neutrinolabs/xrdp/issues/609; not a patch on top of the official repo because "xorgxrdp.configureFlags" above includes "xrdp.src" which must be patched already rev = "refs/heads/runtime-cfg-path-${version}"; # Fixes https://github.com/neutrinolabs/xrdp/issues/609; not a patch on top of the official repo because "xorgxrdp.configureFlags" above includes "xrdp.src" which must be patched already
fetchSubmodules = true; fetchSubmodules = true;
sha256 = "0xqyg3m688fj442zgg9fqmbz7nnzvqpd7a9ki2cwh1hyibacpmz7"; sha256 = "1sm994dic72zvxgwxw9z6an6050976nlnnn2my42pnzj9l5842d8";
}; };
nativeBuildInputs = [ pkgconfig autoconf automake which libtool nasm ]; nativeBuildInputs = [ pkgconfig autoconf automake which libtool nasm ];

View File

@ -0,0 +1,98 @@
From 44b0f612499764dad425d467aadacb01fbd4a920 Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Tue, 20 Feb 2018 07:59:43 -0500
Subject: [PATCH] riscv: Respect the -initrd flag.
Logic for initrd start address borrowed from arm/boot.c
---
hw/riscv/virt.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 46d95b2b79..5c7d191a3f 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -77,7 +77,35 @@ static uint64_t load_kernel(const char *kernel_filename)
return kernel_entry;
}
-static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
+static hwaddr load_initrd(const char *filename, uint64_t mem_size,
+ uint64_t kernel_entry, hwaddr *start)
+{
+ int size;
+
+ /* We want to put the initrd far enough into RAM that when the
+ * kernel is uncompressed it will not clobber the initrd. However
+ * on boards without much RAM we must ensure that we still leave
+ * enough room for a decent sized initrd, and on boards with large
+ * amounts of RAM we must avoid the initrd being so far up in RAM
+ * that it is outside lowmem and inaccessible to the kernel.
+ * So for boards with less than 256MB of RAM we put the initrd
+ * halfway into RAM, and for boards with 256MB of RAM or more we put
+ * the initrd at 128MB.
+ */
+ *start = kernel_entry + MIN(mem_size / 2, 128 * 1024 * 1024);
+
+ size = load_ramdisk(filename, *start, mem_size - *start);
+ if (size == -1) {
+ size = load_image_targphys(filename, *start, mem_size - *start);
+ if (size == -1) {
+ error_report("qemu: could not load ramdisk '%s'", filename);
+ exit(1);
+ }
+ }
+ return *start + size;
+}
+
+static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
uint64_t mem_size, const char *cmdline)
{
void *fdt;
@@ -233,6 +261,8 @@ static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", nodename);
qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
g_free(nodename);
+
+ return fdt;
}
static void riscv_virt_board_init(MachineState *machine)
@@ -246,6 +276,7 @@ static void riscv_virt_board_init(MachineState *machine)
char *plic_hart_config;
size_t plic_hart_config_len;
int i;
+ void *fdt;
/* Initialize SOC */
object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
@@ -265,7 +296,8 @@ static void riscv_virt_board_init(MachineState *machine)
main_mem);
/* create device tree */
- create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
+ fdt = create_fdt(s, memmap, machine->ram_size,
+ machine->kernel_cmdline);
/* boot rom */
memory_region_init_ram(boot_rom, NULL, "riscv_virt_board.bootrom",
@@ -273,7 +305,18 @@ static void riscv_virt_board_init(MachineState *machine)
memory_region_add_subregion(system_memory, 0x0, boot_rom);
if (machine->kernel_filename) {
- load_kernel(machine->kernel_filename);
+ uint64_t kernel_entry = load_kernel(machine->kernel_filename);
+
+ if (machine->initrd_filename) {
+ hwaddr start;
+ hwaddr end = load_initrd(machine->initrd_filename,
+ machine->ram_size, kernel_entry,
+ &start);
+ qemu_fdt_setprop_cell(fdt, "/chosen",
+ "linux,initrd-start", start);
+ qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
+ end);
+ }
}
/* reset vector */

View File

@ -15,6 +15,8 @@
in lib.overrideDerivation qemu (orig: { in lib.overrideDerivation qemu (orig: {
name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}"; name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}";
inherit src; inherit src;
# https://github.com/riscv/riscv-qemu/pull/109
patches = orig.patches ++ [ ./riscv-initrd.patch ];
configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ]; configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ];
postInstall = null; postInstall = null;
}) })

View File

@ -1,4 +1,4 @@
{ stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC. { lib, stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC.
let let
@ -20,7 +20,7 @@ let
# "gnu", etc.). # "gnu", etc.).
sites = builtins.attrNames mirrors; sites = builtins.attrNames mirrors;
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars ++ [ impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
# This variable allows the user to pass additional options to curl # This variable allows the user to pass additional options to curl
"NIX_CURL_FLAGS" "NIX_CURL_FLAGS"
@ -89,22 +89,28 @@ in
, passthru ? {} , passthru ? {}
}: }:
assert builtins.isList urls;
assert (urls == []) != (url == "");
assert sha512 != "" -> builtins.compareVersions "1.11" builtins.nixVersion <= 0; assert sha512 != "" -> builtins.compareVersions "1.11" builtins.nixVersion <= 0;
let let
hasHash = showURLs || (outputHash != "" && outputHashAlgo != "") urls_ =
|| sha1 != "" || sha256 != "" || sha512 != ""; if urls != [] && url == "" then
urls_ = if urls != [] then urls else [url]; (if lib.isList urls then urls
else throw "`urls` is not a list")
else if urls == [] && url != "" then [url]
else throw "fetchurl requires either `url` or `urls` to be set";
hash_ =
if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512"
else if (outputHash != "" && outputHashAlgo != "") then { inherit outputHashAlgo outputHash; }
else if sha512 != "" then { outputHashAlgo = "sha512"; outputHash = sha512; }
else if sha256 != "" then { outputHashAlgo = "sha256"; outputHash = sha256; }
else if sha1 != "" then { outputHashAlgo = "sha1"; outputHash = sha1; }
else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}";
in in
if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512" stdenvNoCC.mkDerivation {
else if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenvNoCC.lib.concatStringsSep ", " urls_}"
else stdenvNoCC.mkDerivation {
name = name =
if showURLs then "urls" if showURLs then "urls"
else if name != "" then name else if name != "" then name
@ -121,10 +127,7 @@ else stdenvNoCC.mkDerivation {
preferHashedMirrors = true; preferHashedMirrors = true;
# New-style output content requirements. # New-style output content requirements.
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else inherit (hash_) outputHashAlgo outputHash;
if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else "sha1";
outputHash = if outputHash != "" then outputHash else
if sha512 != "" then sha512 else if sha256 != "" then sha256 else sha1;
outputHashMode = if (recursiveHash || executable) then "recursive" else "flat"; outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";

View File

@ -78,10 +78,10 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
header "Generated DEB package: $i" header "Generated DEB package: $i"
dpkg-deb --info "$i" dpkg-deb --info "$i"
pkgName=$(dpkg-deb -W "$i" | awk '{print $1}') pkgName=$(dpkg-deb -W "$i" | awk '{print $1}')
dpkg -i "$i"
echo "file deb $i" >> $out/nix-support/hydra-build-products echo "file deb $i" >> $out/nix-support/hydra-build-products
stopNest stopNest
done done
dpkg -i $out/debs/*.deb
for i in $extraDebs; do for i in $extraDebs; do
echo "file deb-extra $(ls $i/debs/*.deb | sort | head -1)" >> $out/nix-support/hydra-build-products echo "file deb-extra $(ls $i/debs/*.deb | sort | head -1)" >> $out/nix-support/hydra-build-products

View File

@ -6,16 +6,7 @@
{ lib, buildPlatform, stdenv, defaultCrateOverrides, fetchCrate, ncurses, rustc }: { lib, buildPlatform, stdenv, defaultCrateOverrides, fetchCrate, ncurses, rustc }:
let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies, let makeDeps = dependencies:
dependencies, completeDeps, completeBuildDeps,
crateFeatures, libName, build, release, libPath,
crateType, metadata, crateBin, finalBins,
verbose, colors }:
let depsDir = lib.concatStringsSep " " dependencies;
completeDepsDir = lib.concatStringsSep " " completeDeps;
completeBuildDepsDir = lib.concatStringsSep " " completeBuildDeps;
makeDeps = dependencies:
(lib.concatMapStringsSep " " (dep: (lib.concatMapStringsSep " " (dep:
let extern = lib.strings.replaceStrings ["-"] ["_"] dep.libName; in let extern = lib.strings.replaceStrings ["-"] ["_"] dep.libName; in
(if dep.crateType == "lib" then (if dep.crateType == "lib" then
@ -23,27 +14,8 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
else else
" --extern ${extern}=${dep.out}/lib/lib${extern}-${dep.metadata}${buildPlatform.extensions.sharedLibrary}") " --extern ${extern}=${dep.out}/lib/lib${extern}-${dep.metadata}${buildPlatform.extensions.sharedLibrary}")
) dependencies); ) dependencies);
deps = makeDeps dependencies;
buildDeps = makeDeps buildDependencies;
optLevel = if release then 3 else 0;
rustcOpts = (if release then "-C opt-level=3" else "-C debuginfo=2");
rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}";
version_ = lib.splitString "-" crateVersion;
versionPre = if lib.tail version_ == [] then "" else builtins.elemAt version_ 1;
version = lib.splitString "." (lib.head version_);
authors = lib.concatStringsSep ":" crateAuthors;
in ''
norm=""
bold=""
green=""
boldgreen=""
if [[ "${colors}" -eq "always" ]]; then
norm="$(printf '\033[0m')" #returns to "normal"
bold="$(printf '\033[0;1m')" #set bold
green="$(printf '\033[0;32m')" #set green
boldgreen="$(printf '\033[0;1;32m')" #set bold, and set green.
fi
echo_build_heading = colors: ''
echo_build_heading() { echo_build_heading() {
start="" start=""
end="" end=""
@ -57,7 +29,8 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
echo "$start""Building $1 ($2)""$end" echo "$start""Building $1 ($2)""$end"
fi fi
} }
'';
noisily = colors: verbose: ''
noisily() { noisily() {
start="" start=""
end="" end=""
@ -71,18 +44,29 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
''} ''}
$@ $@
} }
'';
configureCrate =
{ crateName, crateVersion, crateAuthors, build, libName, crateFeatures, colors, libPath, release, buildDependencies, completeDeps, completeBuildDeps, verbose, dependencies }:
let version_ = lib.splitString "-" crateVersion;
versionPre = if lib.tail version_ == [] then "" else builtins.elemAt version_ 1;
version = lib.splitString "." (lib.head version_);
rustcOpts = (if release then "-C opt-level=3" else "-C debuginfo=2");
buildDeps = makeDeps buildDependencies;
authors = lib.concatStringsSep ":" crateAuthors;
optLevel = if release then 3 else 0;
completeDepsDir = lib.concatStringsSep " " completeDeps;
completeBuildDepsDir = lib.concatStringsSep " " completeBuildDeps;
in ''
runHook preConfigure
${echo_build_heading colors}
${noisily colors verbose}
symlink_dependency() { symlink_dependency() {
# $1 is the nix-store path of a dependency # $1 is the nix-store path of a dependency
# $2 is the target path
i=$1 i=$1
dest=target/deps ln -s -f $i/lib/*.rlib $2 #*/
if [ ! -z $2 ]; then ln -s -f $i/lib/*.so $i/lib/*.dylib $2 #*/
if [ "$2" = "--buildDep" ]; then
dest=target/buildDeps
fi
fi
ln -s -f $i/lib/*.rlib $dest #*/
ln -s -f $i/lib/*.so $i/lib/*.dylib $dest #*/
if [ -e "$i/lib/link" ]; then if [ -e "$i/lib/link" ]; then
cat $i/lib/link >> target/link cat $i/lib/link >> target/link
cat $i/lib/link >> target/link.final cat $i/lib/link >> target/link.final
@ -92,48 +76,15 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
fi fi
} }
build_lib() {
lib_src=$1
echo_build_heading $lib_src ${libName}
noisily rustc --crate-name $CRATE_NAME $lib_src --crate-type ${crateType} \
${rustcOpts} ${rustcMeta} ${crateFeatures} --out-dir target/lib \
--emit=dep-info,link -L dependency=target/deps ${deps} --cap-lints allow \
$BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors}
EXTRA_LIB=" --extern $CRATE_NAME=target/lib/lib$CRATE_NAME-${metadata}.rlib"
if [ -e target/deps/lib$CRATE_NAME-${metadata}${buildPlatform.extensions.sharedLibrary} ]; then
EXTRA_LIB="$EXTRA_LIB --extern $CRATE_NAME=target/lib/lib$CRATE_NAME-${metadata}${buildPlatform.extensions.sharedLibrary}"
fi
}
build_bin() {
crate_name=$1
crate_name_=$(echo $crate_name | sed -e "s/-/_/g")
main_file=""
if [[ ! -z $2 ]]; then
main_file=$2
fi
echo_build_heading $@
noisily rustc --crate-name $crate_name_ $main_file --crate-type bin ${rustcOpts}\
${crateFeatures} --out-dir target/bin --emit=dep-info,link -L dependency=target/deps \
$LINK ${deps}$EXTRA_LIB --cap-lints allow \
$BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors}
if [ "$crate_name_" -ne "$crate_name" ]; then
mv target/bin/$crate_name_ target/bin/$crate_name
fi
}
runHook preBuild
mkdir -p target/{deps,lib,build,buildDeps} mkdir -p target/{deps,lib,build,buildDeps}
chmod uga+w target -R chmod uga+w target -R
for i in ${completeDepsDir}; do for i in ${completeDepsDir}; do
symlink_dependency $i symlink_dependency $i target/deps
done done
for i in ${completeBuildDepsDir}; do for i in ${completeBuildDepsDir}; do
symlink_dependency $i --buildDep symlink_dependency $i target/buildDeps
done done
if [ -e target/link ]; then if [[ -e target/link ]]; then
sort -u target/link > target/link.sorted sort -u target/link > target/link.sorted
mv target/link.sorted target/link mv target/link.sorted target/link
sort -u target/link.final > target/link.final.sorted sort -u target/link.final > target/link.final.sorted
@ -145,10 +96,16 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
export CARGO_PKG_NAME=${crateName} export CARGO_PKG_NAME=${crateName}
export CARGO_PKG_VERSION=${crateVersion} export CARGO_PKG_VERSION=${crateVersion}
export CARGO_PKG_AUTHORS="${authors}" export CARGO_PKG_AUTHORS="${authors}"
export CARGO_CFG_TARGET_ARCH=${buildPlatform.parsed.cpu.name} export CARGO_CFG_TARGET_ARCH=${buildPlatform.parsed.cpu.name}
export CARGO_CFG_TARGET_OS=${buildPlatform.parsed.kernel.name} export CARGO_CFG_TARGET_OS=${buildPlatform.parsed.kernel.name}
export CARGO_CFG_TARGET_FAMILY="unix"
export CARGO_CFG_UNIX=1
export CARGO_CFG_TARGET_ENV="gnu" export CARGO_CFG_TARGET_ENV="gnu"
export CARGO_CFG_TARGET_ENDIAN=${if buildPlatform.parsed.cpu.significantByte.name == "littleEndian" then "little" else "big"}
export CARGO_CFG_TARGET_POINTER_WIDTH=${toString buildPlatform.parsed.cpu.bits}
export CARGO_CFG_TARGET_VENDOR=${buildPlatform.parsed.vendor.name}
export CARGO_MANIFEST_DIR="." export CARGO_MANIFEST_DIR="."
export DEBUG="${toString (!release)}" export DEBUG="${toString (!release)}"
export OPT_LEVEL="${toString optLevel}" export OPT_LEVEL="${toString optLevel}"
@ -159,7 +116,7 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
export CARGO_PKG_VERSION_MAJOR=${builtins.elemAt version 0} export CARGO_PKG_VERSION_MAJOR=${builtins.elemAt version 0}
export CARGO_PKG_VERSION_MINOR=${builtins.elemAt version 1} export CARGO_PKG_VERSION_MINOR=${builtins.elemAt version 1}
export CARGO_PKG_VERSION_PATCH=${builtins.elemAt version 2} export CARGO_PKG_VERSION_PATCH=${builtins.elemAt version 2}
if [ -n "${versionPre}" ]; then if [[ -n "${versionPre}" ]]; then
export CARGO_PKG_VERSION_PRE="${versionPre}" export CARGO_PKG_VERSION_PRE="${versionPre}"
fi fi
@ -198,33 +155,104 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
| sed -e "s/cargo:\([^=]*\)=\(.*\)/export DEP_$(echo $CRATENAME)_\U\1\E=\2/" > target/env | sed -e "s/cargo:\([^=]*\)=\(.*\)/export DEP_$(echo $CRATENAME)_\U\1\E=\2/" > target/env
set -e set -e
if [ -n "$(ls target/build/${crateName}.out)" ]; then if [[ -n "$(ls target/build/${crateName}.out)" ]]; then
if [ -e "${libPath}" ] ; then if [[ -e "${libPath}" ]]; then
cp -r target/build/${crateName}.out/* $(dirname ${libPath}) #*/ cp -r target/build/${crateName}.out/* $(dirname ${libPath}) #*/
else else
cp -r target/build/${crateName}.out/* src #*/ cp -r target/build/${crateName}.out/* src #*/
fi fi
fi fi
fi fi
runHook postConfigure
'';
buildCrate = { crateName, crateVersion, crateAuthors,
dependencies, completeDeps, completeBuildDeps,
crateFeatures, libName, build, release, libPath,
crateType, metadata, crateBin, finalBins,
extraRustcOpts,
verbose, colors }:
let depsDir = lib.concatStringsSep " " dependencies;
completeDepsDir = lib.concatStringsSep " " completeDeps;
completeBuildDepsDir = lib.concatStringsSep " " completeBuildDeps;
deps = makeDeps dependencies;
optLevel = if release then 3 else 0;
rustcOpts =
lib.lists.foldl' (opts: opt: opts + " " + opt)
(if release then "-C opt-level=3" else "-C debuginfo=2")
extraRustcOpts;
rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}";
version_ = lib.splitString "-" crateVersion;
versionPre = if lib.tail version_ == [] then "" else builtins.elemAt version_ 1;
version = lib.splitString "." (lib.head version_);
authors = lib.concatStringsSep ":" crateAuthors;
in ''
runHook preBuild
norm=""
bold=""
green=""
boldgreen=""
if [[ "${colors}" -eq "always" ]]; then
norm="$(printf '\033[0m')" #returns to "normal"
bold="$(printf '\033[0;1m')" #set bold
green="$(printf '\033[0;32m')" #set green
boldgreen="$(printf '\033[0;1;32m')" #set bold, and set green.
fi
${echo_build_heading colors}
${noisily colors verbose}
build_lib() {
lib_src=$1
echo_build_heading $lib_src ${libName}
noisily rustc --crate-name $CRATE_NAME $lib_src --crate-type ${crateType} \
${rustcOpts} ${rustcMeta} ${crateFeatures} --out-dir target/lib \
--emit=dep-info,link -L dependency=target/deps ${deps} --cap-lints allow \
$BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors}
EXTRA_LIB=" --extern $CRATE_NAME=target/lib/lib$CRATE_NAME-${metadata}.rlib"
if [ -e target/deps/lib$CRATE_NAME-${metadata}${buildPlatform.extensions.sharedLibrary} ]; then
EXTRA_LIB="$EXTRA_LIB --extern $CRATE_NAME=target/lib/lib$CRATE_NAME-${metadata}${buildPlatform.extensions.sharedLibrary}"
fi
}
build_bin() {
crate_name=$1
crate_name_=$(echo $crate_name | sed -e "s/-/_/g")
main_file=""
if [[ ! -z $2 ]]; then
main_file=$2
fi
echo_build_heading $@
noisily rustc --crate-name $crate_name_ $main_file --crate-type bin ${rustcOpts}\
${crateFeatures} --out-dir target/bin --emit=dep-info,link -L dependency=target/deps \
$LINK ${deps}$EXTRA_LIB --cap-lints allow \
$BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors}
if [ "$crate_name_" -ne "$crate_name" ]; then
mv target/bin/$crate_name_ target/bin/$crate_name
fi
}
EXTRA_LIB="" EXTRA_LIB=""
CRATE_NAME=$(echo ${libName} | sed -e "s/-/_/g") CRATE_NAME=$(echo ${libName} | sed -e "s/-/_/g")
if [ -e target/link_ ]; then if [[ -e target/link_ ]]; then
EXTRA_BUILD="$(cat target/link_) $EXTRA_BUILD" EXTRA_BUILD="$(cat target/link_) $EXTRA_BUILD"
fi fi
if [ -e "${libPath}" ] ; then if [[ -e "${libPath}" ]]; then
build_lib ${libPath} build_lib ${libPath}
elif [ -e src/lib.rs ] ; then elif [[ -e src/lib.rs ]]; then
build_lib src/lib.rs build_lib src/lib.rs
elif [ -e src/${libName}.rs ] ; then elif [[ -e src/${libName}.rs ]]; then
build_lib src/${libName}.rs build_lib src/${libName}.rs
fi fi
echo "$EXTRA_LINK_SEARCH" | while read i; do echo "$EXTRA_LINK_SEARCH" | while read i; do
if [ ! -z "$i" ]; then if [[ ! -z "$i" ]]; then
for lib in $i; do for lib in $i; do
echo "-L $lib" >> target/link echo "-L $lib" >> target/link
L=$(echo $lib | sed -e "s#$(pwd)/target/build#$out/lib#") L=$(echo $lib | sed -e "s#$(pwd)/target/build#$out/lib#")
@ -233,7 +261,7 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
fi fi
done done
echo "$EXTRA_LINK" | while read i; do echo "$EXTRA_LINK" | while read i; do
if [ ! -z "$i" ]; then if [[ ! -z "$i" ]]; then
for lib in $i; do for lib in $i; do
echo "-l $lib" >> target/link echo "-l $lib" >> target/link
echo "-l $lib" >> target/link.final echo "-l $lib" >> target/link.final
@ -241,7 +269,7 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
fi fi
done done
if [ -e target/link ]; then if [[ -e target/link ]]; then
sort -u target/link.final > target/link.final.sorted sort -u target/link.final > target/link.final.sorted
mv target/link.final.sorted target/link.final mv target/link.final.sorted target/link.final
sort -u target/link > target/link.sorted sort -u target/link > target/link.sorted
@ -253,7 +281,7 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
mkdir -p target/bin mkdir -p target/bin
echo "${crateBin}" | sed -n 1'p' | tr ',' '\n' | while read BIN; do echo "${crateBin}" | sed -n 1'p' | tr ',' '\n' | while read BIN; do
if [ ! -z "$BIN" ]; then if [[ ! -z "$BIN" ]]; then
build_bin $BIN build_bin $BIN
fi fi
done done
@ -267,27 +295,32 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
''} ''}
# Remove object files to avoid "wrong ELF type" # Remove object files to avoid "wrong ELF type"
find target -type f -name "*.o" -print0 | xargs -0 rm -f find target -type f -name "*.o" -print0 | xargs -0 rm -f
'' + finalBins + ''
runHook postBuild runHook postBuild
'' + finalBins; '';
installCrate = crateName: '' installCrate = crateName: metadata: ''
runHook preInstall
mkdir -p $out mkdir -p $out
if [ -s target/env ]; then if [[ -s target/env ]]; then
cp target/env $out/env cp target/env $out/env
fi fi
if [ -s target/link.final ]; then if [[ -s target/link.final ]]; then
mkdir -p $out/lib mkdir -p $out/lib
cp target/link.final $out/lib/link cp target/link.final $out/lib/link
fi fi
if [ "$(ls -A target/lib)" ]; then if [[ "$(ls -A target/lib)" ]]; then
mkdir -p $out/lib mkdir -p $out/lib
cp target/lib/* $out/lib #*/ cp target/lib/* $out/lib #*/
for lib in $out/lib/*.so $out/lib/*.dylib; do #*/
ln -s $lib $(echo $lib | sed -e "s/-${metadata}//")
done
fi fi
if [ "$(ls -A target/build)" ]; then # */ if [[ "$(ls -A target/build)" ]]; then # */
mkdir -p $out/lib mkdir -p $out/lib
cp -r target/build/* $out/lib # */ cp -r target/build/* $out/lib # */
fi fi
if [ "$(ls -A target/bin)" ]; then if [[ "$(ls -A target/bin)" ]]; then
mkdir -p $out/bin mkdir -p $out/bin
cp -P target/bin/* $out/bin # */ cp -P target/bin/* $out/bin # */
fi fi
@ -295,9 +328,16 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
''; '';
in in
crate_: lib.makeOverridable ({ rust, release, verbose, features, buildInputs, crateOverrides }: crate_: lib.makeOverridable ({ rust, release, verbose, features, buildInputs, crateOverrides,
dependencies, buildDependencies,
extraRustcOpts,
preUnpack, postUnpack, prePatch, patches, postPatch,
preConfigure, postConfigure, preBuild, postBuild, preInstall, postInstall }:
let crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: {}) crateOverrides crate_); let crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: {}) crateOverrides crate_);
release_ = release;
dependencies_ = dependencies;
buildDependencies_ = buildDependencies;
processedAttrs = [ processedAttrs = [
"src" "buildInputs" "crateBin" "crateLib" "libName" "libPath" "src" "buildInputs" "crateBin" "crateLib" "libName" "libPath"
"buildDependencies" "dependencies" "features" "buildDependencies" "dependencies" "features"
@ -309,6 +349,7 @@ in
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
inherit (crate) crateName; inherit (crate) crateName;
inherit preUnpack postUnpack prePatch patches postPatch preConfigure postConfigure preBuild postBuild preInstall postInstall;
src = if lib.hasAttr "src" crate then src = if lib.hasAttr "src" crate then
crate.src crate.src
@ -319,12 +360,12 @@ stdenv.mkDerivation (rec {
dependencies = dependencies =
builtins.map builtins.map
(dep: dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; }) (dep: dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; })
(crate.dependencies or []); dependencies_;
buildDependencies = buildDependencies =
builtins.map builtins.map
(dep: dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; }) (dep: dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; })
(crate.buildDependencies or []); buildDependencies_;
completeDeps = lib.lists.unique (dependencies ++ lib.lists.concatMap (dep: dep.completeDeps) dependencies); completeDeps = lib.lists.unique (dependencies ++ lib.lists.concatMap (dep: dep.completeDeps) dependencies);
completeBuildDeps = lib.lists.unique ( completeBuildDeps = lib.lists.unique (
@ -339,7 +380,8 @@ stdenv.mkDerivation (rec {
libName = if crate ? libName then crate.libName else crate.crateName; libName = if crate ? libName then crate.libName else crate.crateName;
libPath = if crate ? libPath then crate.libPath else ""; libPath = if crate ? libPath then crate.libPath else "";
metadata = builtins.substring 0 10 (builtins.hashString "sha256" (crateName + "-" + crateVersion)); depsMetadata = builtins.foldl' (str: dep: str + dep.metadata) "" (dependencies ++ buildDependencies);
metadata = builtins.substring 0 10 (builtins.hashString "sha256" (crateName + "-" + crateVersion + "___" + toString crateFeatures + "___" + depsMetadata ));
crateBin = if crate ? crateBin then crateBin = if crate ? crateBin then
builtins.foldl' (bins: bin: builtins.foldl' (bins: bin:
@ -370,20 +412,42 @@ stdenv.mkDerivation (rec {
crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else []; crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [];
crateType = crateType =
if lib.attrByPath ["procMacro"] false crate then "proc-macro" else if lib.attrByPath ["procMacro"] false crate then "proc-macro" else
if lib.attrByPath ["plugin"] false crate then "dylib" else "lib"; if lib.attrByPath ["plugin"] false crate then "dylib" else
if crate ? type then crate.type else "lib";
colors = lib.attrByPath [ "colors" ] "always" crate; colors = lib.attrByPath [ "colors" ] "always" crate;
buildPhase = buildCrate { configurePhase = configureCrate {
inherit crateName dependencies buildDependencies completeDeps completeBuildDeps inherit crateName dependencies buildDependencies completeDeps completeBuildDeps
crateFeatures libName build release libPath crateType crateVersion crateFeatures libName build release libPath crateVersion
crateAuthors metadata crateBin finalBins verbose colors; crateAuthors verbose colors;
}; };
installPhase = installCrate crateName; extraRustcOpts = if crate ? extraRustcOpts then crate.extraRustcOpts else [];
buildPhase = buildCrate {
inherit crateName dependencies completeDeps completeBuildDeps
crateFeatures libName build release libPath crateType crateVersion
crateAuthors metadata crateBin finalBins verbose colors extraRustcOpts;
};
installPhase = installCrate crateName metadata;
} // extraDerivationAttrs)) { } // extraDerivationAttrs
)) {
rust = rustc; rust = rustc;
release = true; release = crate_.release or true;
verbose = true; verbose = crate_.verbose or true;
extraRustcOpts = [];
features = []; features = [];
buildInputs = []; buildInputs = [];
crateOverrides = defaultCrateOverrides; crateOverrides = defaultCrateOverrides;
preUnpack = crate_.preUnpack or "";
postUnpack = crate_.postUnpack or "";
prePatch = crate_.prePatch or "";
patches = crate_.patches or [];
postPatch = crate_.postPatch or "";
preConfigure = crate_.preConfigure or "";
postConfigure = crate_.postConfigure or "";
preBuild = crate_.preBuild or "";
postBuild = crate_.postBuild or "";
preInstall = crate_.preInstall or "";
postInstall = crate_.postInstall or "";
dependencies = crate_.dependencies or [];
buildDependencies = crate_.buildDependencies or [];
} }

View File

@ -1,4 +1,4 @@
# Generated by carnix 0.6.5: carnix -o carnix.nix Cargo.lock --src ./. # Generated by carnix 0.6.5: carnix -o carnix.nix Cargo.lock
{ lib, buildPlatform, buildRustCrate, fetchgit }: { lib, buildPlatform, buildRustCrate, fetchgit }:
let kernel = buildPlatform.parsed.kernel.name; let kernel = buildPlatform.parsed.kernel.name;
abi = buildPlatform.parsed.abi.name; abi = buildPlatform.parsed.abi.name;
@ -18,7 +18,7 @@ let kernel = buildPlatform.parsed.kernel.name;
) [] (builtins.attrNames feat); ) [] (builtins.attrNames feat);
in in
rec { rec {
carnix = f: carnix_0_6_5 { features = carnix_0_6_5_features { carnix_0_6_5 = f; }; }; carnix = f: carnix_0_6_6 { features = carnix_0_6_6_features { carnix_0_6_6 = f; }; };
aho_corasick_0_6_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { aho_corasick_0_6_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "aho-corasick"; crateName = "aho-corasick";
version = "0.6.3"; version = "0.6.3";
@ -71,11 +71,11 @@ rec {
sha256 = "0p4b3nr0s5nda2qmm7xdhnvh4lkqk3xd8l9ffmwbvqw137vx7mj1"; sha256 = "0p4b3nr0s5nda2qmm7xdhnvh4lkqk3xd8l9ffmwbvqw137vx7mj1";
inherit dependencies buildDependencies features; inherit dependencies buildDependencies features;
}; };
carnix_0_6_5_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { carnix_0_6_6_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "carnix"; crateName = "carnix";
version = "0.6.5"; version = "0.6.6";
authors = [ "pe@pijul.org <pe@pijul.org>" ]; authors = [ "pe@pijul.org <pe@pijul.org>" ];
sha256 = "0r952s5az5mhw7z2r421i5lr0w5h436hah61md2bdb3204c2pl9c"; sha256 = "1ai2r52j6vlrclhb7cvifx3lsg9naiy3jpsrbi3mmfmr6zbi7rdw";
inherit dependencies buildDependencies features; inherit dependencies buildDependencies features;
}; };
cc_1_0_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { cc_1_0_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
@ -623,11 +623,11 @@ rec {
(f.bitflags_1_0_1.default or false) || (f.bitflags_1_0_1.default or false) ||
(bitflags_1_0_1.default or false); (bitflags_1_0_1.default or false);
}) []; }) [];
carnix_0_6_5 = { features?(carnix_0_6_5_features {}) }: carnix_0_6_5_ { carnix_0_6_6 = { features?(carnix_0_6_6_features {}) }: carnix_0_6_6_ {
dependencies = mapFeatures features ([ clap_2_28_0 env_logger_0_5_3 error_chain_0_11_0 itertools_0_7_3 log_0_4_1 nom_3_2_1 regex_0_2_2 rusqlite_0_13_0 serde_1_0_21 serde_derive_1_0_21 serde_json_1_0_6 tempdir_0_3_5 toml_0_4_5 ]); dependencies = mapFeatures features ([ clap_2_28_0 env_logger_0_5_3 error_chain_0_11_0 itertools_0_7_3 log_0_4_1 nom_3_2_1 regex_0_2_2 rusqlite_0_13_0 serde_1_0_21 serde_derive_1_0_21 serde_json_1_0_6 tempdir_0_3_5 toml_0_4_5 ]);
}; };
carnix_0_6_5_features = f: updateFeatures f (rec { carnix_0_6_6_features = f: updateFeatures f (rec {
carnix_0_6_5.default = (f.carnix_0_6_5.default or true); carnix_0_6_6.default = (f.carnix_0_6_6.default or true);
clap_2_28_0.default = true; clap_2_28_0.default = true;
env_logger_0_5_3.default = true; env_logger_0_5_3.default = true;
error_chain_0_11_0.default = true; error_chain_0_11_0.default = true;

View File

@ -4,7 +4,7 @@ let
inherit stdenv cacert git rust cargo-vendor; inherit stdenv cacert git rust cargo-vendor;
}; };
in in
{ name, cargoSha256 { name, cargoSha256 ? null
, src ? null , src ? null
, srcs ? null , srcs ? null
, sourceRoot ? null , sourceRoot ? null
@ -13,15 +13,31 @@ in
, cargoUpdateHook ? "" , cargoUpdateHook ? ""
, cargoDepsHook ? "" , cargoDepsHook ? ""
, cargoBuildFlags ? [] , cargoBuildFlags ? []
, cargoVendorDir ? null
, ... } @ args: , ... } @ args:
assert cargoVendorDir == null -> cargoSha256 != null;
let let
lib = stdenv.lib; lib = stdenv.lib;
cargoDeps = fetchcargo { cargoDeps = if cargoVendorDir == null
then fetchcargo {
inherit name src srcs sourceRoot cargoUpdateHook; inherit name src srcs sourceRoot cargoUpdateHook;
sha256 = cargoSha256; sha256 = cargoSha256;
}; }
else null;
setupVendorDir = if cargoVendorDir == null
then ''
unpackFile "$cargoDeps"
cargoDepsCopy=$(stripHash $(basename $cargoDeps))
chmod -R +w "$cargoDepsCopy"
''
else ''
cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
'';
in stdenv.mkDerivation (args // { in stdenv.mkDerivation (args // {
inherit cargoDeps; inherit cargoDeps;
@ -39,9 +55,7 @@ in stdenv.mkDerivation (args // {
postUnpack = '' postUnpack = ''
eval "$cargoDepsHook" eval "$cargoDepsHook"
unpackFile "$cargoDeps" ${setupVendorDir}
cargoDepsCopy=$(stripHash $(basename $cargoDeps))
chmod -R +w "$cargoDepsCopy"
mkdir .cargo mkdir .cargo
cat >.cargo/config <<-EOF cat >.cargo/config <<-EOF

View File

@ -1,16 +1,16 @@
{stdenv, fetchzip}: {stdenv, fetchzip}:
let let
version = "10.0.0"; version = "10.0.2";
in fetchzip { in fetchzip {
name = "babelstone-han-${version}"; name = "babelstone-han-${version}";
url = http://www.babelstone.co.uk/Fonts/0816/BabelStoneHan.zip; url = http://www.babelstone.co.uk/Fonts/7932/BabelStoneHan.zip;
postFetch = '' postFetch = ''
mkdir -p $out/share/fonts/truetype mkdir -p $out/share/fonts/truetype
unzip $downloadedFile '*.ttf' -d $out/share/fonts/truetype unzip $downloadedFile '*.ttf' -d $out/share/fonts/truetype
''; '';
sha256 = "0648hv5c1hq3bq7mlk7bnmflzzqj4wh137bjqyrwj5hy3nqzvl5r"; sha256 = "17r5cf028v66yzjf9qbncn4rchv2xxkl2adxr35ppg1l7zssz9v6";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Unicode CJK font with over 32600 Han characters"; description = "Unicode CJK font with over 32600 Han characters";

View File

@ -1,6 +1,6 @@
{ fetchurl }: { fetchurl }:
fetchurl { fetchurl {
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/00012ce23948b9547fe6609d595109741e0f58cf.tar.gz"; url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/4c8b3501ea6fc9f41cd192ddc08e2d9583a1e679.tar.gz";
sha256 = "1swgfx7b41jxq0pyws2wipdiyvy8nn6cp54yj3ip3r9l3gdv3f7b"; sha256 = "0aa4pimgllqgn8bcy2p2cdwbpz6s6wk8j41w35jvzaqfj15gysnq";
} }

View File

@ -72,8 +72,8 @@ in {
''; '';
}; };
haxe_3_4 = generic { haxe_3_4 = generic {
version = "3.4.4"; version = "3.4.6";
sha256 = "057psarsmz8q2y9pqv5221vpdya241gcy8xnl2wg9wyscn6z1lx6"; sha256 = "1myc4b8fwp0f9vky17wv45n34a583f5sjvajsc93f5gm1wanp4if";
prePatch = '' prePatch = ''
sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml
sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/haxelib/client/Main.hx sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/haxelib/client/Main.hx

View File

@ -43,6 +43,8 @@ let
# Patch for standalone doc building # Patch for standalone doc building
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
''; '';
outputs = [ "out" "lib" "python" ]; outputs = [ "out" "lib" "python" ];

View File

@ -0,0 +1,33 @@
From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 18 Feb 2016 15:33:21 +0100
Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc
stdin/out/err is part of the libc and not the kernel so we check for the
specific libc that does the unexpected instead of linux.
This is needed for making it build with musl libc.
---
lib/Support/DynamicLibrary.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp
index 9a7aeb5..0c1c8f8 100644
--- a/lib/Support/DynamicLibrary.cpp
+++ b/lib/Support/DynamicLibrary.cpp
@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
#define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return &SYM
-// On linux we have a weird situation. The stderr/out/in symbols are both
+// On GNU libc we have a weird situation. The stderr/out/in symbols are both
// macros and global variables because of standards requirements. So, we
// boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
-#if defined(__linux__) and !defined(__ANDROID__)
+#if defined(__GLIBC__)
{
EXPLICIT_SYMBOL(stderr);
EXPLICIT_SYMBOL(stdout);
--
2.7.3

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetch, cmake, llvm, libcxxabi, fixDarwinDylibNames, version }: { lib, stdenv, fetch, cmake, python, llvm, libcxxabi, fixDarwinDylibNames, version }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libc++-${version}"; name = "libc++-${version}";
@ -15,6 +15,9 @@ stdenv.mkDerivation rec {
./pthread_mach_thread_np.patch ./pthread_mach_thread_np.patch
# glibc 2.26 fix # glibc 2.26 fix
./xlocale-glibc-2.26.patch ./xlocale-glibc-2.26.patch
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
./max_align_t.patch
]; ];
prePatch = '' prePatch = ''
@ -24,9 +27,10 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR") cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patchShebangs utils/cat_files.py
''; '';
nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
nativeBuildInputs = [ cmake ];
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
@ -34,7 +38,7 @@ stdenv.mkDerivation rec {
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2" "-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi" "-DLIBCXX_CXX_ABI=libcxxabi"
]; ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
enableParallelBuilding = true; enableParallelBuilding = true;

View File

@ -0,0 +1,54 @@
From 917331c88bd2afce0cf0fdbcab55a64541b5bcf0 Mon Sep 17 00:00:00 2001
From: "David L. Jones" <dlj@google.com>
Date: Fri, 10 Feb 2017 01:27:42 +0000
Subject: [PATCH] Check for musl-libc's max_align_t in addition to other
variants.
Summary:
Libcxx will define its own max_align_t when it is not available. However, the
availability checks today only check for Clang's definition and GCC's
definition. In particular, it does not check for musl's definition, which is the
same as GCC's but guarded with a different macro.
Reviewers: mclow.lists, EricWF
Reviewed By: EricWF
Subscribers: chandlerc, cfe-commits
Differential Revision: https://reviews.llvm.org/D28478
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294683 91177308-0d34-0410-b5e6-96231b3b80d8
---
include/cstddef | 3 ++-
include/stddef.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/cstddef b/include/cstddef
index edd106c00..103898b7d 100644
--- a/include/cstddef
+++ b/include/cstddef
@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
using ::size_t;
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+ defined(__DEFINED_max_align_t)
// Re-use the compiler's <stddef.h> max_align_t where possible.
using ::max_align_t;
#else
diff --git a/include/stddef.h b/include/stddef.h
index 8841bbea2..faf8552d8 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -53,7 +53,8 @@ using std::nullptr_t;
}
// Re-use the compiler's <stddef.h> max_align_t where possible.
-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+ !defined(__DEFINED_max_align_t)
typedef long double max_align_t;
#endif

View File

@ -14,6 +14,9 @@ stdenv.mkDerivation {
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)" export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin export TRIPLE=x86_64-apple-darwin
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
patch -p1 -d $(ls -d libcxx-*) -i ${./libc++/max_align_t.patch}
''; '';
installPhase = if stdenv.isDarwin installPhase = if stdenv.isDarwin

View File

@ -80,6 +80,9 @@ in stdenv.mkDerivation (rec {
) )
'' + stdenv.lib.optionalString stdenv.isAarch64 '' '' + stdenv.lib.optionalString stdenv.isAarch64 ''
patch -p0 < ${../aarch64.patch} patch -p0 < ${../aarch64.patch}
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch}
patch -p1 -i ${./dynamiclibrary-musl.patch}
''; '';
# hacky fix: created binaries need to be run before installation # hacky fix: created binaries need to be run before installation
@ -110,6 +113,14 @@ in stdenv.mkDerivation (rec {
++ stdenv.lib.optionals (isDarwin) [ ++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON" "-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false" "-DCAN_TARGET_i386=false"
]
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
"-DCOMPILER_RT_BUILD_XRAY=OFF"
]; ];
postBuild = '' postBuild = ''

View File

@ -44,6 +44,8 @@ let
# Patch for standalone doc building # Patch for standalone doc building
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
''; '';
outputs = [ "out" "lib" "python" ]; outputs = [ "out" "lib" "python" ];

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetch, cmake, llvm, libcxxabi, fixDarwinDylibNames, version }: { lib, stdenv, fetch, cmake, python, llvm, libcxxabi, fixDarwinDylibNames, version }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libc++-${version}"; name = "libc++-${version}";
@ -10,6 +10,12 @@ stdenv.mkDerivation rec {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
''; '';
# on next rebuild, this can be replaced with optionals; for now set to null to avoid
# patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
patches = if stdenv.hostPlatform.isMusl then [
../../libcxx-0001-musl-hacks.patch
] else null;
prePatch = '' prePatch = ''
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
''; '';
@ -17,9 +23,10 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR") cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patchShebangs utils/cat_files.py
''; '';
nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
nativeBuildInputs = [ cmake ];
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
@ -27,7 +34,7 @@ stdenv.mkDerivation rec {
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2" "-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi" "-DLIBCXX_CXX_ABI=libcxxabi"
]; ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
enableParallelBuilding = true; enableParallelBuilding = true;

View File

@ -14,6 +14,8 @@ stdenv.mkDerivation {
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)" export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin export TRIPLE=x86_64-apple-darwin
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
''; '';
installPhase = if stdenv.isDarwin installPhase = if stdenv.isDarwin

View File

@ -74,6 +74,11 @@ in stdenv.mkDerivation (rec {
patch -p1 -i ${./compiler-rt-codesign.patch} -d projects/compiler-rt patch -p1 -i ${./compiler-rt-codesign.patch} -d projects/compiler-rt
'' + stdenv.lib.optionalString stdenv.isAarch64 '' '' + stdenv.lib.optionalString stdenv.isAarch64 ''
patch -p0 < ${../aarch64.patch} patch -p0 < ${../aarch64.patch}
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
''; '';
# hacky fix: created binaries need to be run before installation # hacky fix: created binaries need to be run before installation
@ -104,6 +109,14 @@ in stdenv.mkDerivation (rec {
++ stdenv.lib.optionals (isDarwin) [ ++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON" "-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false" "-DCAN_TARGET_i386=false"
]
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
"-DCOMPILER_RT_BUILD_XRAY=OFF"
]; ];
postBuild = '' postBuild = ''

View File

@ -0,0 +1,35 @@
From 5c571082fdaf61f6df19d9b7137dc26d71334058 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 18 Feb 2016 10:33:04 +0100
Subject: [PATCH 2/3] Fix build with musl libc
On musl libc the fopen64 and fopen are the same thing, but for
compatibility they have a `#define fopen64 fopen`. Same applies for
fseek64, fstat64, fstatvfs64, ftello64, lstat64, stat64 and tmpfile64.
---
include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
index 7becdf0..7f14427 100644
--- a/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/include/llvm/Analysis/TargetLibraryInfo.h
@@ -18,6 +18,15 @@
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
+#undef fopen64
+#undef fseeko64
+#undef fstat64
+#undef fstatvfs64
+#undef ftello64
+#undef lstat64
+#undef stat64
+#undef tmpfile64
+
namespace llvm {
/// VecDesc - Describes a possible vectorization of a function.
/// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized
--
2.7.3

Some files were not shown because too many files have changed in this diff Show More