forked from M-Labs/nix-scripts
Compare commits
295 Commits
Author | SHA1 | Date |
---|---|---|
Astro | f7dd925234 | |
Astro | bc501c96ab | |
Astro | a7ceb26099 | |
Astro | 4294277702 | |
Astro | e42e87d56b | |
Astro | 84fc1375d1 | |
Leon Riesebos | 50fb3cd8e1 | |
Sebastien Bourdeauducq | b8a803a64f | |
Sebastien Bourdeauducq | 4e9339e3a8 | |
Sebastien Bourdeauducq | f2bdeaf401 | |
Sebastien Bourdeauducq | a57b927418 | |
Sebastien Bourdeauducq | 5b2ee17cb9 | |
Sebastien Bourdeauducq | c46534d41b | |
Sebastien Bourdeauducq | 5eea3a8267 | |
Sebastien Bourdeauducq | 9806228a8c | |
Astro | bc1ffe4fbf | |
Sebastien Bourdeauducq | 0c3f5161e1 | |
Astro | 72fb469b0b | |
Sebastien Bourdeauducq | a6ea6e3666 | |
Astro | 64ee51b673 | |
Astro | 33c33d49df | |
Sebastien Bourdeauducq | d1a6c2f5db | |
Sebastien Bourdeauducq | 5c6dc61d4d | |
Sebastien Bourdeauducq | 87c2586250 | |
Sebastien Bourdeauducq | 42107ff1e9 | |
Sebastien Bourdeauducq | 0d706f000f | |
topquark12 | 29b4cb1b09 | |
topquark12 | b83f40008c | |
topquark12 | 6d0dafb722 | |
topquark12 | f1d689ae78 | |
Harry Ho | 487bf219ba | |
Astro | 4666f1aa6a | |
Astro | d149c66d05 | |
Sebastien Bourdeauducq | 3c1a84a07e | |
Astro | 70a0b8f90f | |
Astro | b0e041c716 | |
Harry Ho | 6fe5a903b9 | |
Harry Ho | 726ee7aa82 | |
Harry Ho | 21f5362b6f | |
Harry Ho | 35c2844612 | |
Sebastien Bourdeauducq | d5b5dbeeb2 | |
Sebastien Bourdeauducq | 57aca5d142 | |
David Nadlinger | 87fdb2c5ea | |
Sebastien Bourdeauducq | 58aabaaa0e | |
Sebastien Bourdeauducq | eac7f4bddb | |
Sebastien Bourdeauducq | b810407aa9 | |
Sebastien Bourdeauducq | e39f359122 | |
occheung | 049de83093 | |
Sebastien Bourdeauducq | 221d2fe793 | |
Sebastien Bourdeauducq | 8b59734705 | |
Sebastien Bourdeauducq | 360eb10ada | |
Sebastien Bourdeauducq | 4d99f4884e | |
Sebastien Bourdeauducq | 45f46f8901 | |
Sebastien Bourdeauducq | 7ee9e4f068 | |
Sebastien Bourdeauducq | 8396cfa1cb | |
Sebastien Bourdeauducq | 7a76d08cb0 | |
Astro | ce676be8e4 | |
Sebastien Bourdeauducq | 2984cff156 | |
occheung | 3cd8e64846 | |
occheung | f5145e23ee | |
occheung | 58b49c173e | |
occheung | d4c78c8d1b | |
Astro | cc6e7095f3 | |
Astro | e189ee4c8f | |
Astro | 2f4b063513 | |
Astro | 0cf2def070 | |
Astro | 22a6d5fb2e | |
Astro | 1c103ccb62 | |
Sebastien Bourdeauducq | 42df27a7fd | |
Drew Risinger | 2577aa52c0 | |
Sebastien Bourdeauducq | a45b6fc771 | |
Sebastien Bourdeauducq | 228a73fc55 | |
occheung | e97e8be246 | |
Sebastien Bourdeauducq | 2814292f05 | |
Robert Jördens | cefb3ce2f2 | |
Robert Jördens | 2f2ed2b68e | |
Robert Jördens | 718230f12a | |
Drew Risinger | ca28925120 | |
Drew Risinger | beb99234fe | |
Sebastien Bourdeauducq | f072c46ee3 | |
occheung | abf17296c8 | |
occheung | 755f36ecdf | |
Sebastien Bourdeauducq | 0c3cb62cde | |
occheung | d1f7e5d25f | |
occheung | 73d7fe2502 | |
Sebastien Bourdeauducq | eb48b4a6b8 | |
Sebastien Bourdeauducq | 093b1b7224 | |
Sebastien Bourdeauducq | faedd3e1ea | |
Sebastien Bourdeauducq | 56382d6301 | |
Robert Jördens | 6721a8ea17 | |
SingularitySurfer | 08241d9ab0 | |
Sebastien Bourdeauducq | 7259a0b3aa | |
SingularitySurfer | b17a99ac3b | |
SingularitySurfer | 3d26cd62cf | |
SingularitySurfer | 8771512787 | |
Sebastien Bourdeauducq | d688ed1a56 | |
Sebastien Bourdeauducq | ea292df252 | |
Astro | 00352b9942 | |
SingularitySurfer | cf4ca3e4f2 | |
Astro | eab83a6a3f | |
occheung | 262ef72eb7 | |
Astro | 12fbe64616 | |
Robert Jördens | 6acf5b3f93 | |
Astro | 5695977531 | |
Astro | 2e62831998 | |
Astro | fd25af0733 | |
Astro | 843da12452 | |
Drew Risinger | 267b497ac4 | |
Sebastien Bourdeauducq | ff54c815d5 | |
Sebastien Bourdeauducq | eb398dcc53 | |
Robert Jördens | 88cd472f90 | |
Robert Jördens | 6eac1b5f3f | |
Robert Jördens | c31b0144d3 | |
Robert Jördens | 34c5ff76b9 | |
Astro | 571cfbd8a6 | |
Sebastien Bourdeauducq | 0db0ffb128 | |
Sebastien Bourdeauducq | 083e389b41 | |
Sebastien Bourdeauducq | 777b9dbecd | |
Sebastien Bourdeauducq | 0a11450df3 | |
Sebastien Bourdeauducq | 30629929a8 | |
Sebastien Bourdeauducq | d53eed3880 | |
Astro | df36762bfe | |
occheung | 8477bc2919 | |
Sebastien Bourdeauducq | 01dbcb5886 | |
Sebastien Bourdeauducq | f2c9e226ac | |
Sebastien Bourdeauducq | b46f418176 | |
Harry Ho | 6ee5fa70ec | |
Sebastien Bourdeauducq | 24510c81d6 | |
occheung | 17e6cbf6b1 | |
Sebastien Bourdeauducq | 59844c28d9 | |
Sebastien Bourdeauducq | 4172f745e3 | |
Sebastien Bourdeauducq | ee9983728e | |
Sebastien Bourdeauducq | b50d1a0f7e | |
Sebastien Bourdeauducq | a9108d5fa3 | |
Sebastien Bourdeauducq | 0064906c6f | |
Sebastien Bourdeauducq | 9754f45904 | |
Sebastien Bourdeauducq | 59ad8b124a | |
Sebastien Bourdeauducq | 1263c7f15f | |
Sebastien Bourdeauducq | 477f9ce197 | |
Sebastien Bourdeauducq | 4dd16d3aa8 | |
Sebastien Bourdeauducq | 497f1970a0 | |
Sebastien Bourdeauducq | bf45666b2b | |
Sebastien Bourdeauducq | 6cbfebf626 | |
Sebastien Bourdeauducq | 9870fce5a6 | |
Sebastien Bourdeauducq | a6f94d37e9 | |
Sebastien Bourdeauducq | 657d3c1b27 | |
Sebastien Bourdeauducq | fe728a7303 | |
Sebastien Bourdeauducq | f392ca6fd6 | |
Sebastien Bourdeauducq | 9a39d707da | |
Sebastien Bourdeauducq | 3e607f7d12 | |
Sebastien Bourdeauducq | f69616307e | |
Astro | 62f7610087 | |
Harry Ho | 68318b05ec | |
Astro | 7c7c0cb58d | |
Sebastien Bourdeauducq | 5ba0896be6 | |
Harry Ho | 7c4eb8e770 | |
Sebastien Bourdeauducq | c64d73649f | |
Sebastien Bourdeauducq | e6fb3088b1 | |
Sebastien Bourdeauducq | e4d6dd253d | |
Sebastien Bourdeauducq | b5d7b1d10a | |
Sebastien Bourdeauducq | 864bddd0b4 | |
Sebastien Bourdeauducq | de7c867866 | |
Sebastien Bourdeauducq | 58c9c6f83c | |
Sebastien Bourdeauducq | 532dd5c861 | |
Sebastien Bourdeauducq | eabcda5013 | |
Sebastien Bourdeauducq | b3715bbfc8 | |
Sebastien Bourdeauducq | 51bd917512 | |
Sebastien Bourdeauducq | b7a1f42a06 | |
Sebastien Bourdeauducq | 53838bd55f | |
Sebastien Bourdeauducq | 354f653a13 | |
Sebastien Bourdeauducq | 33b66b1a65 | |
Sebastien Bourdeauducq | 1b324970e5 | |
Sebastien Bourdeauducq | 44ffc90e3a | |
Sebastien Bourdeauducq | 6c51ea48fa | |
Sebastien Bourdeauducq | 953000afd1 | |
Sebastien Bourdeauducq | 82ff5added | |
Sebastien Bourdeauducq | 51ecc65edc | |
Sebastien Bourdeauducq | 536e26b771 | |
Robert Jördens | a7179589bd | |
Sebastien Bourdeauducq | d88e2287e2 | |
Sebastien Bourdeauducq | 1c43932205 | |
Sebastien Bourdeauducq | 60e554c501 | |
Sebastien Bourdeauducq | 7b27d68841 | |
Sebastien Bourdeauducq | 241d6224cb | |
Sebastien Bourdeauducq | 3c463f7397 | |
Sebastien Bourdeauducq | 4a1de56ce5 | |
Sebastien Bourdeauducq | 7a1ac77c8b | |
Sebastien Bourdeauducq | 7001d011fd | |
Sebastien Bourdeauducq | 454c3d806c | |
Sebastien Bourdeauducq | 4ef1b6e76d | |
Astro | be5787ab55 | |
Astro | bc447638a9 | |
Astro | 7f32f8e438 | |
Astro | 89d700a796 | |
Harry Ho | d86ea71a76 | |
Harry Ho | 756c256c77 | |
Astro | 1d7b1e9175 | |
Astro | 3409eb3c11 | |
Sebastien Bourdeauducq | 6c328f32f1 | |
Sebastien Bourdeauducq | e75d16f55a | |
Sebastien Bourdeauducq | cc00cfc1a8 | |
Sebastien Bourdeauducq | e8054aebbd | |
Sebastien Bourdeauducq | 30e0886a16 | |
Sebastien Bourdeauducq | 888481c0ce | |
Sebastien Bourdeauducq | cc5694dedf | |
Sebastien Bourdeauducq | e0a9253084 | |
Sebastien Bourdeauducq | eaa571b61f | |
Sebastien Bourdeauducq | c0f5d74bd0 | |
Astro | fe8417e229 | |
Sebastien Bourdeauducq | 46388263c4 | |
Sebastien Bourdeauducq | bba16a693e | |
Sebastien Bourdeauducq | e623036a65 | |
Sebastien Bourdeauducq | 8e30790990 | |
Sebastien Bourdeauducq | 1888638dd5 | |
Sebastien Bourdeauducq | 7ab53bb9eb | |
Sebastien Bourdeauducq | eba5934c80 | |
Sebastien Bourdeauducq | e372f357a8 | |
Sebastien Bourdeauducq | a89e2e5e5b | |
Sebastien Bourdeauducq | 0b87a11ae2 | |
Sebastien Bourdeauducq | f6e1164476 | |
Sebastien Bourdeauducq | 2c26169353 | |
Sebastien Bourdeauducq | 1a3c57864d | |
Sebastien Bourdeauducq | 3dfd3b166a | |
Sebastien Bourdeauducq | 563161860e | |
Sebastien Bourdeauducq | 02899d343c | |
Sebastien Bourdeauducq | 50f9897c2e | |
Robert Jördens | eb867a355b | |
Sebastien Bourdeauducq | 4578bbc74e | |
Astro | 088a101d89 | |
Sebastien Bourdeauducq | 8c508de922 | |
Sebastien Bourdeauducq | 48bc991c7c | |
Sebastien Bourdeauducq | 4cd7a559e8 | |
Sebastien Bourdeauducq | 005792ed77 | |
Sebastien Bourdeauducq | 64224a0b51 | |
Sebastien Bourdeauducq | 6eecb5085d | |
Sebastien Bourdeauducq | 486b343b15 | |
Astro | 30f205680f | |
Astro | c00c10e223 | |
Sebastien Bourdeauducq | e87d2b4ecd | |
Sebastien Bourdeauducq | d809926d10 | |
Sebastien Bourdeauducq | 491aae094c | |
Sebastien Bourdeauducq | e347cb7c4b | |
Sebastien Bourdeauducq | 9733ec3509 | |
Sebastien Bourdeauducq | ed313133b8 | |
Sebastien Bourdeauducq | 69d8e02853 | |
Sebastien Bourdeauducq | 80bf1d300e | |
Sebastien Bourdeauducq | 536d45012e | |
Sebastien Bourdeauducq | 4158527dba | |
Sebastien Bourdeauducq | 3f75a81ec1 | |
Sebastien Bourdeauducq | 5c07a9e95d | |
Sebastien Bourdeauducq | 8111b2f42b | |
Sebastien Bourdeauducq | 1b79bdaa20 | |
Sebastien Bourdeauducq | d641e1613f | |
Sebastien Bourdeauducq | 7ca6ada7ee | |
Sebastien Bourdeauducq | 3766781a24 | |
Sebastien Bourdeauducq | 5dc2ed0c79 | |
Sebastien Bourdeauducq | 72d4eab21b | |
Sebastien Bourdeauducq | 11dfff09b9 | |
Sebastien Bourdeauducq | 97bb368cab | |
Sebastien Bourdeauducq | a448d3bdc0 | |
Sebastien Bourdeauducq | 05cde854dd | |
Sebastien Bourdeauducq | bd8fa5d955 | |
Sebastien Bourdeauducq | d895203b5b | |
Sebastien Bourdeauducq | 7838d6e683 | |
Sebastien Bourdeauducq | b2e40e0594 | |
Sebastien Bourdeauducq | dd377e0459 | |
Sebastien Bourdeauducq | ffed59ad95 | |
Sebastien Bourdeauducq | 8c8ede8387 | |
Sebastien Bourdeauducq | 942c654af0 | |
Sebastien Bourdeauducq | 90cc2c5049 | |
Sebastien Bourdeauducq | 77722ae68b | |
Sebastien Bourdeauducq | 8fa63fe916 | |
Sebastien Bourdeauducq | 561eb3a02e | |
Your Name | 5ef34eff97 | |
Astro | 131df3a337 | |
Sebastien Bourdeauducq | 0e4d2e3b54 | |
Sebastien Bourdeauducq | ae201e2aa8 | |
Sebastien Bourdeauducq | b30fa47e53 | |
Sebastien Bourdeauducq | e589989955 | |
Sebastien Bourdeauducq | df38a58ae7 | |
Sebastien Bourdeauducq | eb4fa6ee15 | |
Sebastien Bourdeauducq | 7ff56838b6 | |
Sebastien Bourdeauducq | f18d1d70d2 | |
Sebastien Bourdeauducq | 9479f297fc | |
Sebastien Bourdeauducq | 330636726c | |
Sebastien Bourdeauducq | 21f3b682c5 | |
Sebastien Bourdeauducq | 2db006aa19 | |
Sebastien Bourdeauducq | d64fcec76e | |
Astro | f1325dce29 | |
Sebastien Bourdeauducq | 08d28437e4 | |
Sebastien Bourdeauducq | 1bf63a88ad | |
Sebastien Bourdeauducq | 6d2d0745e0 | |
Sebastien Bourdeauducq | 0e446db26e | |
Sebastien Bourdeauducq | ab90fc88f6 | |
Sebastien Bourdeauducq | 0f99ffc583 |
|
@ -0,0 +1,97 @@
|
|||
# Install Vivado in /opt and add to /etc/nixos/configuration.nix:
|
||||
# nix.sandboxPaths = ["/opt"];
|
||||
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
, artiq-fast
|
||||
}:
|
||||
|
||||
let
|
||||
artiqSrc = import (artiq-fast + "/pkgs/artiq-src.nix") { fetchgit = pkgs.fetchgit; };
|
||||
artiqpkgs = import artiq-fast { inherit pkgs; };
|
||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||
jinja2 jsonschema numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq
|
||||
]);
|
||||
fetchcargo = import (artiq-fast + "/fetchcargo.nix") {
|
||||
inherit (pkgs) stdenv lib cacert git;
|
||||
inherit (artiqpkgs) cargo cargo-vendor;
|
||||
};
|
||||
cargoDeps = fetchcargo rec {
|
||||
name = "artiq-firmware-cargo-deps";
|
||||
src = "${artiqSrc}/artiq/firmware";
|
||||
sha256 = import (artiqSrc + "/artiq/firmware/cargosha256.nix");
|
||||
};
|
||||
|
||||
cargoVendored = pkgs.stdenv.mkDerivation {
|
||||
name = "artiq-firmware-cargo-vendored";
|
||||
src = cargoDeps;
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/registry
|
||||
cat << EOF > $out/config
|
||||
[source.crates-io]
|
||||
registry = "https://github.com/rust-lang/crates.io-index"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."https://github.com/m-labs/libfringe"]
|
||||
git = "https://github.com/m-labs/libfringe"
|
||||
rev = "b8a6d8f"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source.vendored-sources]
|
||||
directory = "$out/registry"
|
||||
EOF
|
||||
cp -R * $out/registry
|
||||
'';
|
||||
};
|
||||
in
|
||||
{ target
|
||||
, variant
|
||||
, src ? null
|
||||
, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}"
|
||||
, extraInstallCommands ? ""
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
name = "artiq-board-${target}-${variant}-${artiqpkgs.artiq.version}-xxx";
|
||||
installPath = "${pkgs.python3Packages.python.sitePackages}/artiq/board-support/${target}-${variant}";
|
||||
in
|
||||
# Board packages are Python modules so that they get added to the ARTIQ Python
|
||||
# environment, and artiq_flash finds them.
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "artiq-board-${target}-${variant}-${artiqpkgs.artiq.version}";
|
||||
inherit src;
|
||||
phases = [ "buildPhase" "installPhase" ];
|
||||
nativeBuildInputs = [
|
||||
pkgs.gnumake pkgs.which pythonEnv
|
||||
artiqpkgs.cargo
|
||||
artiqpkgs.rustc
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.llvm-or1k
|
||||
];
|
||||
buildInputs = [ pythonEnv ];
|
||||
buildPhase =
|
||||
''
|
||||
export CARGO_HOME=${cargoVendored}
|
||||
export TARGET_AR=or1k-linux-ar
|
||||
${buildCommand} --no-compile-gateware --gateware-identifier-str=unprogrammed
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out
|
||||
cp -ar artiq_${target}/${variant}/gateware $out
|
||||
|
||||
TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}/artiq/board-support/${target}-${variant}
|
||||
mkdir -p $TARGET_DIR
|
||||
if [ -e artiq_${target}/${variant}/software/bootloader/bootloader.bin ]
|
||||
then cp artiq_${target}/${variant}/software/bootloader/bootloader.bin $TARGET_DIR
|
||||
fi
|
||||
if [ -e artiq_${target}/${variant}/software/runtime ]
|
||||
then cp artiq_${target}/${variant}/software/runtime/runtime.{elf,fbi} $TARGET_DIR
|
||||
else cp artiq_${target}/${variant}/software/satman/satman.{elf,fbi} $TARGET_DIR
|
||||
fi
|
||||
${extraInstallCommands}
|
||||
'';
|
||||
# don't mangle ELF files as they are not for NixOS
|
||||
dontFixup = true;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
{ pkgs ? import <artiq-fast/pkgs/nixpkgs.nix> { inherit (import <nixpkgs> {}) fetchgit; } {}
|
||||
, artiq-fast ? <artiq-fast>
|
||||
}:
|
||||
|
||||
let
|
||||
sinaraSystemsSrc = <sinaraSystemsSrc>;
|
||||
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
|
||||
''
|
||||
mkdir $out
|
||||
cp ${./artiq-board.nix} $out/artiq-board.nix
|
||||
cp ${../artiq-full/artiq-targets.nix} $out/artiq-targets.nix
|
||||
cp -a ${artiq-fast} $out/fast
|
||||
|
||||
REV=`git --git-dir ${sinaraSystemsSrc}/.git rev-parse HEAD`
|
||||
echo -n $REV > $out/sinara-rev.txt
|
||||
SINARA_SRC_CLEAN=`mktemp -d`
|
||||
cp -a ${sinaraSystemsSrc}/. $SINARA_SRC_CLEAN
|
||||
chmod -R 755 $SINARA_SRC_CLEAN/.git
|
||||
chmod 755 $SINARA_SRC_CLEAN
|
||||
rm -rf $SINARA_SRC_CLEAN/.git
|
||||
HASH=`nix-hash --type sha256 --base32 $SINARA_SRC_CLEAN`
|
||||
echo -n $HASH > $out/sinara-hash.txt
|
||||
|
||||
cat > $out/default.nix << EOF
|
||||
{ pkgs ? import ./fast/pkgs/nixpkgs.git { inherit (import <nixpkgs> {}) fetchgit; }
|
||||
}:
|
||||
|
||||
let
|
||||
sinaraSystemsSrc = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||
rev = "$REV";
|
||||
sha256 = "$HASH";
|
||||
};
|
||||
artiq-fast = import ./fast { inherit pkgs; };
|
||||
artiq-board = import ./artiq-board.nix {
|
||||
inherit pkgs;
|
||||
artiq-fast = ./fast;
|
||||
};
|
||||
in
|
||||
builtins.mapAttrs (_: conf: pkgs.lib.hydraJob (artiq-board conf)) (
|
||||
import ./artiq-targets.nix {
|
||||
inherit pkgs sinaraSystemsSrc;
|
||||
artiqVersion = artiq-fast.artiq.version;
|
||||
}
|
||||
)
|
||||
EOF
|
||||
'';
|
||||
artiq-board-generated = import generatedNix {
|
||||
inherit pkgs;
|
||||
};
|
||||
in
|
||||
artiq-board-generated // {
|
||||
generated-nix = pkgs.lib.hydraJob generatedNix;
|
||||
}
|
|
@ -30,21 +30,28 @@ let
|
|||
EOF
|
||||
echo "{ stdenv, git, fetchgit }: \"$MAJOR_VERSION.$COMMIT_COUNT.`cut -c1-8 <<< $REV`$SUFFIX\"" > $out/pkgs/artiq-version.nix
|
||||
echo "{ stdenv, git, fetchgit }: \"$TIMESTAMP\"" > $out/pkgs/artiq-timestamp.nix
|
||||
'';
|
||||
generateTestOkHash = pkgs.runCommand "generate-test-ok-hash" { buildInputs = [ pkgs.nix ]; }
|
||||
''
|
||||
TMPDIR=`mktemp -d`
|
||||
cp ${generatedNix}/pkgs/artiq-version.nix $TMPDIR/passed
|
||||
HASH=`nix-hash --type sha256 --base32 $TMPDIR`
|
||||
echo \"$HASH\" > $out
|
||||
|
||||
REV=`git --git-dir ${<nixpkgs>}/.git rev-parse HEAD`
|
||||
NIXPKGS_CLEAN=`mktemp -d`
|
||||
cp -a ${<nixpkgs>}/. $NIXPKGS_CLEAN
|
||||
chmod -R 755 $NIXPKGS_CLEAN/.git
|
||||
chmod 755 $NIXPKGS_CLEAN
|
||||
rm -rf $NIXPKGS_CLEAN/.git
|
||||
HASH=`nix-hash --type sha256 --base32 $NIXPKGS_CLEAN`
|
||||
cat > $out/pkgs/nixpkgs.nix << EOF
|
||||
{ fetchgit }:
|
||||
import (fetchgit {
|
||||
url = "https://github.com/nixos/nixpkgs.git";
|
||||
rev = "$REV";
|
||||
sha256 = "$HASH";
|
||||
})
|
||||
EOF
|
||||
'';
|
||||
artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; };
|
||||
artiqVersion = import "${generatedNix}/pkgs/artiq-version.nix" (with pkgs; { inherit stdenv fetchgit git; });
|
||||
windowsRunner = overrides:
|
||||
import "${generatedNix}/windows/run-test.nix" ({
|
||||
inherit pkgs;
|
||||
sipycoPkg = artiqpkgs.conda-sipyco;
|
||||
artiqPkg = artiqpkgs.conda-artiq;
|
||||
inherit pkgs artiqpkgs;
|
||||
} // overrides);
|
||||
jobs = (builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs);
|
||||
in
|
||||
|
@ -58,32 +65,23 @@ in
|
|||
|
||||
windows-no-hardware-tests = pkgs.stdenv.mkDerivation {
|
||||
name = "windows-no-hardware-tests";
|
||||
buildInputs = [ (windowsRunner {}) ];
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase = ''
|
||||
${windowsRunner {}}/bin/run.sh
|
||||
${windowsRunner { testCommand = "python -m unittest discover -v sipyco.test && python -m unittest discover -v artiq.test"; }}/bin/wfvm-run-windows-tests
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
# HACK: Abuse fixed-output derivations to escape the sandbox and run the hardware
|
||||
# unit tests, all integrated in the Hydra interface.
|
||||
# One major downside of this hack is the tests are only run when generateTestOkHash
|
||||
# changes, i.e. when the ARTIQ version changes (and not the dependencies).
|
||||
# Impure derivations, when they land in Nix/Hydra, should improve the situation.
|
||||
extended-tests = pkgs.stdenv.mkDerivation {
|
||||
name = "extended-tests";
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = import generateTestOkHash;
|
||||
__hydraRetry = false;
|
||||
# requires patched Nix
|
||||
__networked = true;
|
||||
|
||||
buildInputs = [
|
||||
(pkgs.python3.withPackages(ps: [ ps.paramiko artiqpkgs.artiq artiqpkgs.artiq-board-kc705-nist_clock ]))
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.openocd
|
||||
pkgs.iputils
|
||||
pkgs.openssh
|
||||
];
|
||||
phases = [ "buildPhase" ];
|
||||
|
@ -93,7 +91,7 @@ in
|
|||
mkdir $HOME/.ssh
|
||||
cp /opt/hydra_id_rsa $HOME/.ssh/id_rsa
|
||||
cp /opt/hydra_id_rsa.pub $HOME/.ssh/id_rsa.pub
|
||||
echo "rpi-1,192.168.1.188 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMc7waNkP2HjL5Eo94evoxJhC8CbYj4i2n1THe5TPIR3" > $HOME/.ssh/known_hosts
|
||||
echo "rpi-1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMc7waNkP2HjL5Eo94evoxJhC8CbYj4i2n1THe5TPIR3" > $HOME/.ssh/known_hosts
|
||||
chmod 600 $HOME/.ssh/id_rsa
|
||||
LOCKCTL=$(mktemp -d)
|
||||
mkfifo $LOCKCTL/lockctl
|
||||
|
@ -102,7 +100,7 @@ in
|
|||
-i $HOME/.ssh/id_rsa \
|
||||
-o UserKnownHostsFile=$HOME/.ssh/known_hosts \
|
||||
sb@rpi-1 \
|
||||
'flock /tmp/board_lock-kc705-1 -c "echo Ok; cat"' \
|
||||
'mkdir -p /tmp/board_lock && flock /tmp/board_lock/kc705-1 -c "echo Ok; cat"' \
|
||||
| (
|
||||
# End remote flock via FIFO
|
||||
atexit_unlock() {
|
||||
|
@ -115,18 +113,15 @@ in
|
|||
|
||||
artiq_flash -t kc705 -H rpi-1
|
||||
sleep 15
|
||||
# ping: socket: Operation not permitted
|
||||
#ping kc705-1 -c10 -w30
|
||||
|
||||
export ARTIQ_ROOT=`python -c "import artiq; print(artiq.__path__[0])"`/examples/kc705_nist_clock
|
||||
export ARTIQ_LOW_LATENCY=1
|
||||
python -m unittest discover -v artiq.test.coredevice
|
||||
|
||||
${windowsRunner { testCommand = "set ARTIQ_ROOT=%cd%\\anaconda\\envs\\artiq-env\\Lib\\site-packages\\artiq\\examples\\kc705_nist_clock&&python -m unittest discover -v artiq.test.coredevice"; }}/bin/run.sh
|
||||
${windowsRunner { testCommand = "set ARTIQ_ROOT=%cd%\\Anaconda3\\envs\\artiq-env\\Lib\\site-packages\\artiq\\examples\\kc705_nist_clock&& python -m unittest discover -v artiq.test.coredevice"; }}/bin/wfvm-run-windows-tests
|
||||
)
|
||||
|
||||
mkdir $out
|
||||
cp ${generatedNix}/pkgs/artiq-version.nix $out/passed
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
# Install Vivado in /opt and add to /etc/nixos/configuration.nix:
|
||||
# nix.sandboxPaths = ["/opt"];
|
||||
|
||||
{ pkgs }:
|
||||
{ target
|
||||
, variant
|
||||
, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}"
|
||||
, extraInstallCommands ? ""}:
|
||||
{ pkgs
|
||||
, vivado ? import ./vivado.nix { inherit pkgs; }
|
||||
}:
|
||||
|
||||
let
|
||||
artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
|
||||
artiqpkgs = import ./default.nix { inherit pkgs; };
|
||||
fetchcargo = import ./fetchcargo.nix {
|
||||
inherit (pkgs) stdenv cacert git;
|
||||
inherit (pkgs) stdenv lib cacert git;
|
||||
inherit (artiqpkgs) cargo cargo-vendor;
|
||||
};
|
||||
cargoDeps = fetchcargo rec {
|
||||
|
@ -44,39 +42,43 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
vivado = import ./vivado.nix { inherit pkgs; };
|
||||
in
|
||||
{ target
|
||||
, variant
|
||||
, src ? null
|
||||
, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}"
|
||||
, extraInstallCommands ? ""
|
||||
, ... }:
|
||||
|
||||
# Board packages are Python modules so that they get added to the ARTIQ Python
|
||||
# environment, and artiq_flash finds them.
|
||||
in pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec {
|
||||
pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec {
|
||||
name = "artiq-board-${target}-${variant}-${version}";
|
||||
version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; });
|
||||
phases = [ "buildPhase" "installCheckPhase" "installPhase" ];
|
||||
buildInputs = [
|
||||
inherit src;
|
||||
phases = [ "buildPhase" "installCheckPhase" "installPhase" "checkPhase" ];
|
||||
nativeBuildInputs = [
|
||||
vivado
|
||||
pkgs.gnumake
|
||||
(pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ]))
|
||||
artiqpkgs.cargo
|
||||
artiqpkgs.rustc
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.llvm-or1k
|
||||
];
|
||||
buildInputs = [ (pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ])) ];
|
||||
buildPhase =
|
||||
''
|
||||
export CARGO_HOME=${cargoVendored}
|
||||
export TARGET_AR=or1k-linux-ar
|
||||
${buildCommand}
|
||||
'';
|
||||
# temporarily disabled because there is currently always at least one Kasli bitstream
|
||||
# that fails timing and blocks the conda channel.
|
||||
doCheck = false;
|
||||
checkPhase = ''
|
||||
# Search for PCREs in the Vivado output to check for errors
|
||||
check_log() {
|
||||
set +e
|
||||
grep -Pe "$1" artiq_${target}/${variant}/gateware/vivado.log
|
||||
FOUND=$?
|
||||
set -e
|
||||
if [ $FOUND != 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
grep -Pe "$1" artiq_${target}/${variant}/gateware/vivado.log && exit 1 || true
|
||||
}
|
||||
check_log "\d+ constraint not met\."
|
||||
check_log "Timing constraints are not met\."
|
||||
|
@ -95,4 +97,6 @@ in pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec {
|
|||
fi
|
||||
${extraInstallCommands}
|
||||
'';
|
||||
# don't mangle ELF files as they are not for NixOS
|
||||
dontFixup = true;
|
||||
})
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- a/intl/relocatable.c 2018-02-28 18:19:46.318224392 +0000
|
||||
+++ b/intl/relocatable.c 2018-02-28 18:19:37.614224749 +0000
|
||||
@@ -145,7 +145,7 @@
|
||||
libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
#endif
|
||||
#if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109
|
||||
- libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
+ // libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
#endif
|
||||
#if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix
|
||||
libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
|
@ -0,0 +1,21 @@
|
|||
set MSYS=C:\MSYS64
|
||||
set TRIPLE=x86_64-w64-mingw32
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
set CFLAGS=-I%PREFIX:\=/%/Library/include/
|
||||
set LDFLAGS=-L%PREFIX:\=/%/Library/lib/
|
||||
sh ../configure --build=%TRIPLE% ^
|
||||
--prefix="%PREFIX:\=/%/Library" ^
|
||||
--target=##TARGET##
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
make -j4
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
make install
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
rem this is a copy of prefixed executables
|
||||
rmdir /S /Q %PREFIX%\Library\##TARGET##
|
|
@ -0,0 +1,17 @@
|
|||
package:
|
||||
name: binutils-##TARGET##
|
||||
version: ##VERSION##
|
||||
|
||||
source:
|
||||
url: ../src.tar.bz2
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- libiconv
|
||||
run:
|
||||
- libiconv
|
||||
|
||||
about:
|
||||
home: https://www.gnu.org/software/binutils/
|
||||
license: GPL
|
||||
summary: 'A set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code.'
|
|
@ -1,72 +1,54 @@
|
|||
{ pkgs, version, src, target }:
|
||||
|
||||
let
|
||||
wfvm = import ../wfvm { inherit pkgs; };
|
||||
libiconv-filename = "libiconv-1.15-h0c8e037_1006.tar.bz2";
|
||||
wfvm = import ../wfvm.nix { inherit pkgs; };
|
||||
libiconv-filename = "libiconv-1.15-h1df5818_7.tar.bz2";
|
||||
libiconv = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/conda-forge/libiconv/1.15/download/win-64/${libiconv-filename}";
|
||||
sha256 = "1jaxnpg5y5pkhvpp9kaq0kpvz7jlj5hynp567q35l7hpfk6xxghh";
|
||||
url = "https://anaconda.org/anaconda/libiconv/1.15/download/win-64/${libiconv-filename}";
|
||||
sha256 = "0p431madykrjmi9sbl2sy9kzb0l3vhgs677i8q7cx8g210ab5g52";
|
||||
};
|
||||
vc14-filename = "vc-14.1-h0510ff6_4.tar.bz2";
|
||||
vc14 = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/vc/14.1/download/win-64/${vc14-filename}";
|
||||
sha256 = "0nsyxph667x8ky1nybakpnk816dkrzbf1684jd7pp6wm5x73p34v";
|
||||
};
|
||||
vs2015_runtime-filename = "vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
vs2015_runtime = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/vs2015_runtime/14.16.27012/download/win-64/${vs2015_runtime-filename}";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
};
|
||||
build = wfvm.utils.wfvm-run {
|
||||
name = "build-binutils";
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; };
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 (msys2-packages (import ./msys_packages.nix { inherit pkgs; } )) ]; };
|
||||
script = ''
|
||||
${wfvm.utils.win-put}/bin/win-put ${libiconv} ${libiconv-filename}
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build ${libiconv-filename}"
|
||||
# Create a fake channel to work around another pile of bugs and cretinous design decisions from conda.
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir fake-channel && mkdir fake-channel\win-64"
|
||||
ln -s ${libiconv} ${libiconv-filename}
|
||||
${wfvm.utils.win-put}/bin/win-put ${libiconv-filename} ./fake-channel/win-64
|
||||
ln -s ${vc14} ${vc14-filename}
|
||||
${wfvm.utils.win-put}/bin/win-put ${vc14-filename} ./fake-channel/win-64
|
||||
ln -s ${vs2015_runtime} ${vs2015_runtime-filename}
|
||||
${wfvm.utils.win-put}/bin/win-put ${vs2015_runtime-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda index fake-channel"
|
||||
|
||||
cat > meta.yaml << EOF
|
||||
package:
|
||||
name: binutils-${target}
|
||||
version: ${version}
|
||||
cp --no-preserve=mode,ownership -R ${./binutils-recipe} binutils
|
||||
sed -i s/##TARGET##/${target}/g binutils/*
|
||||
sed -i s/##VERSION##/${version}/g binutils/*
|
||||
${wfvm.utils.win-put}/bin/win-put binutils .
|
||||
tar xjf ${src}
|
||||
patch -d binutils-${version} -p1 < ${./binutils-hack-libiconv.patch}
|
||||
tar cjf src.tar.bz2 binutils-${version}
|
||||
${wfvm.utils.win-put}/bin/win-put src.tar.bz2 .
|
||||
|
||||
source:
|
||||
url: ../src.tar.bz2
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda build --no-anaconda-upload --no-test -c file:///C:/users/wfvm/fake-channel --override-channels binutils"
|
||||
|
||||
requirements:
|
||||
run:
|
||||
- libiconv
|
||||
|
||||
EOF
|
||||
|
||||
cat > bld.bat << EOF
|
||||
set MSYS=C:\MSYS64
|
||||
set TOOLPREF=mingw-w64-x86_64-
|
||||
set TRIPLE=x86_64-pc-mingw64
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
set CFLAGS=-I%PREFIX:\=/%/Library/include/
|
||||
set LDFLAGS=-L%PREFIX:\=/%/Library/lib/
|
||||
sh ../configure --build=%TRIPLE% ^
|
||||
--prefix="%PREFIX:\=/%/Library" ^
|
||||
--target=${target}
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
make -j4
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
make install
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
rem this is a copy of prefixed executables
|
||||
rmdir /S /Q %PREFIX%\Library\${target}
|
||||
EOF
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir binutils"
|
||||
${wfvm.utils.win-put}/bin/win-put meta.yaml ".\binutils"
|
||||
${wfvm.utils.win-put}/bin/win-put bld.bat ".\binutils"
|
||||
${wfvm.utils.win-put}/bin/win-put ${src} ".\src.tar.bz2"
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate build && conda build --no-anaconda-upload --no-test binutils"
|
||||
|
||||
${wfvm.utils.win-get}/bin/win-get ".\Anaconda3\conda-bld\win-64\binutils-${target}-${version}-0.tar.bz2"
|
||||
${wfvm.utils.win-get}/bin/win-get "Anaconda3/conda-bld/win-64/binutils-${target}-${version}-0.tar.bz2"
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.runCommand "conda-windows-binutils-${target}" { buildInputs = [ build ]; } ''
|
||||
wfvm-run-build-binutils
|
||||
mkdir -p $out/win-64 $out/nix-support
|
||||
cp *.tar.bz2 $out/win-64
|
||||
cp binutils-*.tar.bz2 $out/win-64
|
||||
echo file conda $out/win-64/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
||||
''
|
||||
|
|
|
@ -1,12 +1,28 @@
|
|||
{ pkgs, version, src }:
|
||||
|
||||
let
|
||||
wfvm = import ../wfvm { inherit pkgs; };
|
||||
wfvm = import ../wfvm.nix { inherit pkgs; };
|
||||
conda-vs2015_runtime-filename = "vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
conda-vs2015_runtime = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/vs2015_runtime/14.16.27012/download/win-64/${conda-vs2015_runtime-filename}";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
};
|
||||
conda-cmake-filename = "cmake-3.17.2-h33f27b4_0.tar.bz2";
|
||||
conda-cmake = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/cmake/3.17.2/download/win-64/${conda-cmake-filename}";
|
||||
sha256 = "0lg782pj2i9h20rwfkwwskis038r98b3z4c9j1a6ih95rc6m2acn";
|
||||
};
|
||||
build = wfvm.utils.wfvm-run {
|
||||
name = "build-llvm-or1k";
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; };
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msvc msvc-ide-unbreak ]; };
|
||||
script = ''
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build --offline"
|
||||
# Create a fake channel so that the conda garbage doesn't complain about not finding the packages it just installed.
|
||||
ln -s ${conda-vs2015_runtime} ${conda-vs2015_runtime-filename}
|
||||
ln -s ${conda-cmake} ${conda-cmake-filename}
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir fake-channel && mkdir fake-channel\win-64"
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-vs2015_runtime-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-cmake-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda index fake-channel"
|
||||
|
||||
cat > meta.yaml << EOF
|
||||
package:
|
||||
|
@ -16,18 +32,19 @@ let
|
|||
source:
|
||||
url: ../src.tar
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- cmake
|
||||
EOF
|
||||
|
||||
cat > bld.bat << EOF
|
||||
set MSYS=C:\MSYS64
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
|
||||
|
||||
set BUILD_TYPE=Release
|
||||
set CMAKE_GENERATOR=MinGW Makefiles
|
||||
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "%CMAKE_GENERATOR%" ^
|
||||
-Thost=x64 ^
|
||||
-DCMAKE_BUILD_TYPE="%BUILD_TYPE%" ^
|
||||
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON ^
|
||||
|
@ -46,21 +63,21 @@ let
|
|||
EOF
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir llvm-or1k"
|
||||
${wfvm.utils.win-put}/bin/win-put meta.yaml ".\llvm-or1k"
|
||||
${wfvm.utils.win-put}/bin/win-put bld.bat ".\llvm-or1k"
|
||||
${wfvm.utils.win-put}/bin/win-put meta.yaml llvm-or1k
|
||||
${wfvm.utils.win-put}/bin/win-put bld.bat llvm-or1k
|
||||
ln -s ${src} src
|
||||
tar chf src.tar src
|
||||
${wfvm.utils.win-put}/bin/win-put src.tar ".\src.tar"
|
||||
${wfvm.utils.win-put}/bin/win-put src.tar .
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate build && conda build --no-anaconda-upload --no-test llvm-or1k"
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda build --no-anaconda-upload --no-test -c file:///C:/users/wfvm/fake-channel --override-channels llvm-or1k"
|
||||
|
||||
${wfvm.utils.win-get}/bin/win-get ".\Anaconda3\conda-bld\win-64\llvm-or1k-${version}-0.tar.bz2"
|
||||
${wfvm.utils.win-get}/bin/win-get "Anaconda3/conda-bld/win-64/llvm-or1k-${version}-0.tar.bz2"
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.runCommand "conda-windows-llvm-or1k" { buildInputs = [ build ]; } ''
|
||||
wfvm-run-build-llvm-or1k
|
||||
mkdir -p $out/win-64 $out/nix-support
|
||||
cp *.tar.bz2 $out/win-64
|
||||
cp llvm-or1k-*.tar.bz2 $out/win-64
|
||||
echo file conda $out/win-64/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
||||
''
|
||||
|
|
|
@ -1,15 +1,28 @@
|
|||
{ pkgs, conda-windows-llvm-or1k, version, src }:
|
||||
|
||||
# See: https://github.com/valtron/llvm-stuff/wiki/Build-llvmlite-with-MSYS2
|
||||
|
||||
let
|
||||
wfvm = import ../wfvm { inherit pkgs; };
|
||||
wfvm = import ../wfvm.nix { inherit pkgs; };
|
||||
conda-vs2015_runtime-filename = "vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
conda-vs2015_runtime = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/vs2015_runtime/14.16.27012/download/win-64/${conda-vs2015_runtime-filename}";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
};
|
||||
conda-cmake-filename = "cmake-3.17.2-h33f27b4_0.tar.bz2";
|
||||
conda-cmake = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/cmake/3.17.2/download/win-64/${conda-cmake-filename}";
|
||||
sha256 = "0lg782pj2i9h20rwfkwwskis038r98b3z4c9j1a6ih95rc6m2acn";
|
||||
};
|
||||
build = wfvm.utils.wfvm-run {
|
||||
name = "build-llvmlite-artiq";
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; };
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msvc msvc-ide-unbreak ]; };
|
||||
script = ''
|
||||
${wfvm.utils.win-put}/bin/win-put "${conda-windows-llvm-or1k}/win-64/llvm-or1k-*.tar.bz2" ".\llvm-or1k.tar.bz2"
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build llvm-or1k.tar.bz2"
|
||||
ln -s ${conda-vs2015_runtime} ${conda-vs2015_runtime-filename}
|
||||
ln -s ${conda-cmake} ${conda-cmake-filename}
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir fake-channel && mkdir fake-channel\win-64"
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-vs2015_runtime-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-cmake-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-windows-llvm-or1k}/win-64/llvm-or1k-*.tar.bz2 ./fake-channel/win-64
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda index fake-channel"
|
||||
|
||||
cat > meta.yaml << EOF
|
||||
package:
|
||||
|
@ -18,36 +31,46 @@ let
|
|||
|
||||
source:
|
||||
url: ../src.tar
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- cmake
|
||||
- llvm-or1k
|
||||
run:
|
||||
- python<3.8
|
||||
EOF
|
||||
|
||||
cat > bld.bat << EOF
|
||||
set MSYS=C:\MSYS64
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
|
||||
@rem Let CMake know about the LLVM install path, for find_package()
|
||||
set CMAKE_PREFIX_PATH=%LIBRARY_PREFIX%
|
||||
|
||||
@rem Ensure there are no build leftovers (CMake can complain)
|
||||
if exist ffi\build rmdir /S /Q ffi\build
|
||||
|
||||
python setup.py install \
|
||||
--prefix=\$PREFIX \
|
||||
--prefix=%PREFIX% \
|
||||
--single-version-externally-managed \
|
||||
--record=record.txt \
|
||||
--no-compile
|
||||
if errorlevel 1 exit 1
|
||||
EOF
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir llvmlite-artiq"
|
||||
${wfvm.utils.win-put}/bin/win-put meta.yaml ".\llvmlite-artiq"
|
||||
${wfvm.utils.win-put}/bin/win-put bld.bat ".\llvmlite-artiq"
|
||||
cp --no-preserve=mode,ownership -R ${src} src
|
||||
patch -d src -p1 < ${./llvmlite-msys.diff}
|
||||
${wfvm.utils.win-put}/bin/win-put meta.yaml llvmlite-artiq
|
||||
${wfvm.utils.win-put}/bin/win-put bld.bat llvmlite-artiq
|
||||
ln -s ${src} src
|
||||
tar chf src.tar src
|
||||
${wfvm.utils.win-put}/bin/win-put src.tar ".\src.tar"
|
||||
${wfvm.utils.win-put}/bin/win-put src.tar .
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate build && conda build --no-anaconda-upload --no-test llvmlite-artiq"
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda build --no-anaconda-upload --no-test -c file:///C:/users/wfvm/fake-channel --override-channels llvmlite-artiq"
|
||||
|
||||
${wfvm.utils.win-get}/bin/win-get ".\Anaconda3\conda-bld\win-64\llvmlite-artiq-${version}-0.tar.bz2"
|
||||
${wfvm.utils.win-get}/bin/win-get "Anaconda3/conda-bld/win-64/llvmlite-artiq-${version}-0.tar.bz2"
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.runCommand "conda-windows-llvmlite-artiq" { buildInputs = [ build ]; } ''
|
||||
wfvm-run-build-llvmlite-artiq
|
||||
mkdir -p $out/win-64 $out/nix-support
|
||||
cp *.tar.bz2 $out/win-64
|
||||
cp llvmlite-artiq-*.tar.bz2 $out/win-64
|
||||
echo file conda $out/win-64/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
||||
''
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
diff --git a/ffi/CMakeLists.txt b/ffi/CMakeLists.txt
|
||||
index 15470d4..11d06a5 100755
|
||||
--- a/ffi/CMakeLists.txt
|
||||
+++ b/ffi/CMakeLists.txt
|
||||
@@ -29,6 +29,7 @@ list(REMOVE_ITEM LLVM_AVAILABLE_LIBS LTO LLVM)
|
||||
# that we wish to use
|
||||
# llvm_map_components_to_libnames(llvm_libs support core irreader)
|
||||
llvm_map_components_to_libnames(llvm_libs all)
|
||||
+list(REMOVE_ITEM llvm_libs "LTO")
|
||||
|
||||
# Link against LLVM libraries
|
||||
target_link_libraries(llvmlite ${llvm_libs})
|
||||
diff --git a/ffi/build.py b/ffi/build.py
|
||||
index 9169d35..41a9a40 100755
|
||||
--- a/ffi/build.py
|
||||
+++ b/ffi/build.py
|
||||
@@ -24,7 +24,7 @@ def try_cmake(cmake_dir, build_dir, generator):
|
||||
old_dir = os.getcwd()
|
||||
try:
|
||||
os.chdir(build_dir)
|
||||
- subprocess.check_call(['cmake', '-G', generator, cmake_dir])
|
||||
+ subprocess.check_call(['cmake', '-G', generator, '-D', 'LLVM_DIR=$LLVM/lib/cmake/llvm', cmake_dir])
|
||||
finally:
|
||||
os.chdir(old_dir)
|
||||
|
||||
@@ -57,6 +57,7 @@ def find_win32_generator():
|
||||
if is_64bit:
|
||||
generator += ' Win64'
|
||||
build_dir = tempfile.mkdtemp()
|
||||
+ generator = 'MinGW Makefiles'
|
||||
print("Trying generator %r" % (generator,))
|
||||
try:
|
||||
try_cmake(cmake_dir, build_dir, generator)
|
||||
@@ -78,7 +79,7 @@ def main_win32():
|
||||
# Run configuration step
|
||||
try_cmake(here_dir, build_dir, generator)
|
||||
subprocess.check_call(['cmake', '--build', build_dir, '--config', config])
|
||||
- shutil.copy(os.path.join(build_dir, config, 'llvmlite.dll'), target_dir)
|
||||
+ shutil.copy(os.path.join(build_dir, 'libllvmlite.dll'), os.path.join(target_dir, 'llvmlite.dll'))
|
||||
|
||||
|
||||
def main_posix(kind, library_ext):
|
|
@ -174,159 +174,4 @@
|
|||
url = "http://repo.msys2.org/msys/x86_64/texinfo-6.7-1-x86_64.pkg.tar.xz";
|
||||
sha256 = "0c50809yg9g95m8yib867q8m28sjabqppz2qbzh3gr83z55kknnw";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-expat-2.2.9-1-any.pkg.tar.xz";
|
||||
sha256 = "16fz2r902mmc0kka3pm7g54xjd8x3q07bi7y54vzpbmic31rrvh4";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gettext-0.19.8.1-8-any.pkg.tar.xz";
|
||||
sha256 = "1g28871qgc66k4csmc4rk4vcajzw5wavicc2x3iw4pnigh9vsj83";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-make-4.3-1-any.pkg.tar.xz";
|
||||
sha256 = "0v133ip1r3djcki5znn946r1c81vvyc6xk5xf35ad8b30wmlfqvq";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-pkg-config-0.29.2-1-any.pkg.tar.xz";
|
||||
sha256 = "1w6s9nb7kjwnlz2vgimzvyjmay47d6g008c82xab4k8nhd7nm77n";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-c-ares-1.16.1-1-any.pkg.tar.zst";
|
||||
sha256 = "13sfv0cs4rj3vw4y9pibp02qvvcv5qnzs87282m7pxxnjzccv9an";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-brotli-1.0.7-4-any.pkg.tar.xz";
|
||||
sha256 = "02i5jxmwbvraszy5rm31gm6wi21vclzsbqq9rx4qxjdgjwgn4rfl";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libunistring-0.9.10-1-any.pkg.tar.xz";
|
||||
sha256 = "1q03qjyndbv65j0w71x41gc7nhdcbmdsc5xb882gmzlgwrdi77hq";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libidn2-2.3.0-1-any.pkg.tar.xz";
|
||||
sha256 = "06523dq5q3dq07iz6f11pwk3b4v18z3b72ly3wvxl0kdy89khqjj";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libmetalink-0.1.3-3-any.pkg.tar.xz";
|
||||
sha256 = "1nvjvygcxmrb7xlqzxym3g6vhz31nr83qx2vfsqrc0haw4r08d5j";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libpsl-0.21.0-2-any.pkg.tar.xz";
|
||||
sha256 = "13456p4kl53i49hz6b9cpjbkb19k4443nksbii9c29x09lagbzwv";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libtasn1-4.16.0-1-any.pkg.tar.xz";
|
||||
sha256 = "0aziyg127l9742g7i8dl4ffp80v55272i8p3jqk3pvz8qaf8dfyh";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libffi-3.3-1-any.pkg.tar.xz";
|
||||
sha256 = "05sh8hwr171bbpjw9yf4z04sa3m4dg37kqbdz90y68glrj43i4xd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-p11-kit-0.23.20-2-any.pkg.tar.xz";
|
||||
sha256 = "02f3k46b09b4rd0fmadavjj04f4a2v1c56r9qlkr5lkjlmfm7a5a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ca-certificates-20190110-1-any.pkg.tar.xz";
|
||||
sha256 = "1wjbm67rb07sp803dl51lfsrrih2xjnwbrif0hvsc6nq63q1i3dq";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-openssl-1.1.1.g-1-any.pkg.tar.xz";
|
||||
sha256 = "047x6dxxqm8y8fj236cd3p9jk4cdnmzdp3pgh84gsqa2vgxdn64f";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libssh2-1.9.0-1-any.pkg.tar.xz";
|
||||
sha256 = "10pd4mmvsrvcs4sw0v786ry3w2xwrli6prnhpwcjfjvb25jn0y9a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-jansson-2.12-1-any.pkg.tar.xz";
|
||||
sha256 = "133al0y3fg38b303934ls7f7l5f76qy7v6wx2cnxmfq2k0fxj7cc";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-jemalloc-5.2.1-1-any.pkg.tar.xz";
|
||||
sha256 = "1w0mm0wlsx37gbf5vcrbf7c4hvkcrhls8a1aiq3s4vbld8maccdl";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-nghttp2-1.40.0-2-any.pkg.tar.xz";
|
||||
sha256 = "0m2xww09f5j8ii6nqk8wz6g8dy1qbgvv185ikrpabpbdaqgkaijj";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-curl-7.70.0-1-any.pkg.tar.zst";
|
||||
sha256 = "013b04dxcfgcbx9ccknm8rkkxp5lxzi2473li678f0n1dagcxn0d";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-jsoncpp-1.9.2-1-any.pkg.tar.xz";
|
||||
sha256 = "0wdxn26lv9j9fdixcvgbg299wix9xxl48jjdnqf1387aiprhsj4m";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-bzip2-1.0.8-1-any.pkg.tar.xz";
|
||||
sha256 = "1ipndg1lg96hfznhcv8ifazv07944vk387i35rzaaamac2hm7nyf";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-lz4-1.9.2-1-any.pkg.tar.xz";
|
||||
sha256 = "067rm6fjziid747b9lzng4hpzlddqq8d2xfrxd95nzvj4qrj1xli";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libtre-git-r128.6fb7206-2-any.pkg.tar.xz";
|
||||
sha256 = "0dp3ca83j8jlx32gml2qvqpwp5b42q8r98gf6hyiki45d910wb7x";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libsystre-1.0.1-4-any.pkg.tar.xz";
|
||||
sha256 = "037gkzaaj8kp5nspcbc8ll64s9b3mj8d6m663lk1za94bq2axff1";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-nettle-3.6-1-any.pkg.tar.zst";
|
||||
sha256 = "1m5kakcfmwvmvajblscq541b40f5zhc01hqgvwlcgpdm4c1mjxhx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-xz-5.2.5-1-any.pkg.tar.xz";
|
||||
sha256 = "09h7qpy8nrrk3z9fh31k9jc17449qs9cf5v183rz6v6526x3v7jg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libarchive-3.4.3-1-any.pkg.tar.zst";
|
||||
sha256 = "1c9wxa9i1hm1yvv82qdzc1pqgrw3gcfc0s9wjah7w1civ9a63flf";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libuv-1.38.0-1-any.pkg.tar.zst";
|
||||
sha256 = "1x9vz2ib8mgx0g2gxjmyshdcf1qgql0d6hycyh4xf7ns4zk70mh0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-rhash-1.3.9-1-any.pkg.tar.xz";
|
||||
sha256 = "1a5b1wvljbdn38jcw2w46mcw377aw8k7j93fxsjzghhf9msscl1a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-cmake-3.17.3-1-any.pkg.tar.zst";
|
||||
sha256 = "0b9zaa11qazsgz88yfm6j93rddnw8mz9zzh8maz3vrmi9p4asldd";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, name, filename, baseurl, sha256 }:
|
||||
|
||||
let
|
||||
download = pkgs.fetchurl {
|
||||
url = "${baseurl}${filename}";
|
||||
inherit sha256;
|
||||
};
|
||||
in
|
||||
pkgs.runCommand "conda-windows-${name}" { } ''
|
||||
mkdir -p $out/win-64 $out/nix-support
|
||||
ln -s ${download} $out/win-64/${filename}
|
||||
echo file conda $out/win-64/${filename} >> $out/nix-support/hydra-build-products
|
||||
''
|
|
@ -1,17 +0,0 @@
|
|||
[
|
||||
"python >=3.5.3"
|
||||
"llvmlite-artiq"
|
||||
"binutils-or1k-linux >=2.27"
|
||||
"pythonparser >=1.1"
|
||||
"scipy"
|
||||
"numpy"
|
||||
"prettytable"
|
||||
"h5py 2.8"
|
||||
"python-dateutil"
|
||||
"pyqt >=5.5"
|
||||
"quamash"
|
||||
"pyqtgraph 0.10.0"
|
||||
"pygit2"
|
||||
"python-levenshtein"
|
||||
"sipyco"
|
||||
]
|
|
@ -6,7 +6,22 @@ let
|
|||
name = "artiq";
|
||||
inherit version;
|
||||
src = import ../pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
|
||||
dependencies = import ./artiq-deps.nix;
|
||||
dependencies = [
|
||||
"llvmlite-artiq"
|
||||
"binutils-or1k-linux"
|
||||
"pythonparser"
|
||||
"scipy"
|
||||
"numpy"
|
||||
"prettytable"
|
||||
"h5py"
|
||||
"python-dateutil"
|
||||
"pyqt"
|
||||
(if (pkgs.lib.strings.versionAtLeast version "6.0") then "qasync" else "quamash")
|
||||
"pyqtgraph"
|
||||
"pygit2"
|
||||
"python-levenshtein"
|
||||
"sipyco"
|
||||
];
|
||||
extraYaml =
|
||||
''
|
||||
about:
|
||||
|
|
|
@ -2,12 +2,22 @@
|
|||
# recipe must be a string pointing to a path within the source.
|
||||
|
||||
{ pkgs }:
|
||||
{ name, src, recipe ? "fake-conda"}:
|
||||
{ name ? null
|
||||
, src
|
||||
, pname ? null
|
||||
, version ? null
|
||||
, recipe ? "fake-conda"
|
||||
}:
|
||||
|
||||
# Check that either name is specified or both pname & version are specified.
|
||||
assert (name == null) -> pname != null && version != null;
|
||||
assert (name != null) -> pname == null && version == null;
|
||||
let
|
||||
condaBuilderEnv = import ./builder-env.nix { inherit pkgs; };
|
||||
realName = if (name != null) then name else "${pname}-${version}";
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
inherit name src;
|
||||
name = realName;
|
||||
inherit src;
|
||||
buildCommand =
|
||||
''
|
||||
HOME=`pwd`
|
||||
|
|
|
@ -25,7 +25,7 @@ let
|
|||
# that they are not there if they have been installed from files.
|
||||
requirements:
|
||||
run:
|
||||
- python
|
||||
- python<3.8
|
||||
- ncurses [linux]
|
||||
EOF
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{ pkgs ? import ./pkgs/nixpkgs.nix { inherit (import <nixpkgs> {}) fetchgit; } {}}:
|
||||
with pkgs;
|
||||
let
|
||||
pythonDeps = import ./pkgs/python-deps.nix { inherit (pkgs) stdenv fetchFromGitHub python3Packages; };
|
||||
artiq6 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "6.0";
|
||||
pythonDeps = import ./pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = artiq6; };
|
||||
|
||||
boards = [
|
||||
{ target = "kasli"; variant = "tester"; }
|
||||
|
@ -17,13 +18,14 @@ let
|
|||
start // {
|
||||
"artiq-board-${board.target}-${board.variant}" = boardBinaries;
|
||||
}) {} boards;
|
||||
|
||||
mainPackages = rec {
|
||||
inherit (pythonDeps) sipyco asyncserial pythonparser pyqtgraph-qt5 misoc migen microscope jesd204b migen-axi lit outputcheck;
|
||||
inherit (pythonDeps) sipyco asyncserial pythonparser pyqtgraph-qt5 artiq-netboot misoc migen microscope jesd204b migen-axi lit outputcheck qasync;
|
||||
binutils-or1k = callPackage ./pkgs/binutils.nix { platform = "or1k"; target = "or1k-linux"; };
|
||||
binutils-arm = callPackage ./pkgs/binutils.nix { platform = "arm"; target = "armv7-unknown-linux-gnueabihf"; };
|
||||
llvm-or1k = callPackage ./pkgs/llvm-or1k.nix {};
|
||||
rustc = callPackage ./pkgs/rust/rustc-with-crates.nix
|
||||
((stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
|
||||
((lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
|
||||
stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
||||
}) //
|
||||
{ inherit llvm-or1k; });
|
||||
|
@ -31,40 +33,25 @@ let
|
|||
cargo-vendor = callPackage ./pkgs/rust/cargo-vendor.nix {};
|
||||
llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; };
|
||||
libartiq-support = callPackage ./pkgs/libartiq-support.nix { inherit rustc; };
|
||||
artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k llvm-or1k llvmlite-artiq libartiq-support lit outputcheck; };
|
||||
artiq = callPackage ./pkgs/artiq.nix { inherit pythonDeps binutils-or1k binutils-arm llvm-or1k llvmlite-artiq libartiq-support lit outputcheck; };
|
||||
artiq-env = (pkgs.python3.withPackages(ps: [ artiq ])).overrideAttrs (oldAttrs: { name = "${pkgs.python3.name}-artiq-env-${artiq.version}"; });
|
||||
openocd = callPackage ./pkgs/openocd.nix {};
|
||||
};
|
||||
|
||||
condaNoarch = {
|
||||
conda-pythonparser = import ./conda/build.nix { inherit pkgs; } {
|
||||
name = "conda-pythonparser";
|
||||
pname = "conda-pythonparser";
|
||||
inherit (pythonDeps.pythonparser) version;
|
||||
src = import ./conda/fake-source.nix { inherit pkgs; } {
|
||||
name = "pythonparser";
|
||||
inherit (pythonDeps.pythonparser) version src;
|
||||
extraSrcCommands = "patch -p1 < ${./pkgs/python37hack.patch}";
|
||||
extraSrcCommands = "patch -p1 < ${./pkgs/pythonparserver.patch}";
|
||||
dependencies = ["regex"];
|
||||
};
|
||||
};
|
||||
conda-binutils-or1k = import ./conda/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (binutils-or1k) version src;
|
||||
target = "or1k-linux";
|
||||
};
|
||||
conda-binutils-arm = import ./conda/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (binutils-arm) version src;
|
||||
target = "armv7-unknown-linux-gnueabihf";
|
||||
};
|
||||
conda-llvm-or1k = import ./conda/llvm-or1k.nix {
|
||||
inherit pkgs;
|
||||
inherit (llvm-or1k) version;
|
||||
src = llvm-or1k.llvm-src;
|
||||
};
|
||||
conda-llvmlite-artiq = import ./conda/llvmlite-artiq.nix {
|
||||
inherit pkgs conda-llvm-or1k;
|
||||
inherit (llvmlite-artiq) version src;
|
||||
};
|
||||
conda-sipyco = import ./conda/build.nix { inherit pkgs; } {
|
||||
name = "conda-sipyco";
|
||||
pname = "conda-sipyco";
|
||||
inherit (pythonDeps.sipyco) version;
|
||||
src = import ./conda/fake-source.nix { inherit pkgs; } {
|
||||
name = "sipyco";
|
||||
inherit (pythonDeps.sipyco) version src;
|
||||
|
@ -72,45 +59,105 @@ let
|
|||
};
|
||||
};
|
||||
conda-quamash = import ./conda/build.nix { inherit pkgs; } {
|
||||
name = "conda-quamash";
|
||||
pname = "conda-quamash";
|
||||
inherit (pkgs.python3Packages.quamash) version;
|
||||
src = import ./conda/fake-source.nix { inherit pkgs; } {
|
||||
name = "quamash";
|
||||
inherit (pkgs.python3Packages.quamash) version src;
|
||||
};
|
||||
};
|
||||
conda-qasync = import ./conda/build.nix { inherit pkgs; } {
|
||||
pname = "conda-qasync";
|
||||
inherit (pythonDeps.qasync) version;
|
||||
src = import ./conda/fake-source.nix { inherit pkgs; } {
|
||||
name = "qasync";
|
||||
inherit (pythonDeps.qasync) version src;
|
||||
};
|
||||
};
|
||||
conda-bscan-spi-bitstreams = import ./conda/bscan-spi-bitstreams.nix {
|
||||
inherit pkgs;
|
||||
inherit (openocd) bscan_spi_bitstreams;
|
||||
inherit (mainPackages.openocd) bscan_spi_bitstreams;
|
||||
};
|
||||
conda-artiq = import ./conda/artiq.nix { inherit pkgs; };
|
||||
conda-asyncserial = import ./conda/build.nix { inherit pkgs; } {
|
||||
name = "conda-asyncserial";
|
||||
pname = "conda-asyncserial";
|
||||
inherit (pythonDeps.asyncserial) version;
|
||||
src = import ./conda/fake-source.nix { inherit pkgs; } {
|
||||
name = "asyncserial";
|
||||
inherit (pythonDeps.asyncserial) version src;
|
||||
dependencies = ["pyserial"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
condaLinux = rec {
|
||||
conda-binutils-or1k = import ./conda/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.binutils-or1k) version src;
|
||||
target = "or1k-linux";
|
||||
};
|
||||
conda-binutils-arm = import ./conda/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.binutils-arm) version src;
|
||||
target = "armv7-unknown-linux-gnueabihf";
|
||||
};
|
||||
conda-llvm-or1k = import ./conda/llvm-or1k.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.llvm-or1k) version;
|
||||
src = mainPackages.llvm-or1k.llvm-src;
|
||||
};
|
||||
conda-llvmlite-artiq = import ./conda/llvmlite-artiq.nix {
|
||||
inherit pkgs conda-llvm-or1k;
|
||||
inherit (mainPackages.llvmlite-artiq) version src;
|
||||
};
|
||||
};
|
||||
|
||||
condaWindowsLegacy = {
|
||||
conda-windows-binutils-or1k = import ./conda-windows/redistribute.nix {
|
||||
inherit pkgs;
|
||||
name = "binutils-or1k";
|
||||
filename = "binutils-or1k-linux-2.27-h93a10e1_6.tar.bz2";
|
||||
baseurl = "https://anaconda.org/m-labs/binutils-or1k-linux/2.27/download/win-64/";
|
||||
sha256 = "0gbks36hfsx3893mihj0bdmg5vwccrq5fw8xp9b9xb8p5pr8qhzx";
|
||||
};
|
||||
conda-windows-llvm-or1k = import ./conda-windows/redistribute.nix {
|
||||
inherit pkgs;
|
||||
name = "llvm-or1k";
|
||||
filename = "llvm-or1k-6.0.0-25.tar.bz2";
|
||||
baseurl = "https://anaconda.org/m-labs/llvm-or1k/6.0.0/download/win-64/";
|
||||
sha256 = "06mnrg79rn9ni0d5z0x3jzb300nhqhbc2h9qbq5m50x3sgm8km63";
|
||||
};
|
||||
conda-windows-llvmlite-artiq = import ./conda-windows/redistribute.nix {
|
||||
inherit pkgs;
|
||||
name = "llvmlite-artiq";
|
||||
filename = "llvmlite-artiq-0.23.0.dev-py35_5.tar.bz2";
|
||||
baseurl = "https://anaconda.org/m-labs/llvmlite-artiq/0.23.0.dev/download/win-64/";
|
||||
sha256 = "10w24w5ljvan06pbvwqj4pzal072jnyynmwm42dn06pq88ryz9wj";
|
||||
};
|
||||
};
|
||||
|
||||
condaWindowsExperimental = rec {
|
||||
conda-windows-binutils-or1k = import ./conda-windows/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (binutils-or1k) version src;
|
||||
inherit (mainPackages.binutils-or1k) version src;
|
||||
target = "or1k-linux";
|
||||
};
|
||||
conda-windows-binutils-arm = import ./conda-windows/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (binutils-arm) version src;
|
||||
inherit (mainPackages.binutils-or1k) version src;
|
||||
target = "armv7-unknown-linux-gnueabihf";
|
||||
};
|
||||
conda-windows-llvm-or1k = import ./conda-windows/llvm-or1k.nix {
|
||||
inherit pkgs;
|
||||
inherit (llvm-or1k) version;
|
||||
src = llvm-or1k.llvm-src;
|
||||
inherit (mainPackages.llvm-or1k) version;
|
||||
src = mainPackages.llvm-or1k.llvm-src;
|
||||
};
|
||||
conda-windows-llvmlite-artiq = import ./conda-windows/llvmlite-artiq.nix {
|
||||
inherit pkgs conda-windows-llvm-or1k;
|
||||
inherit (llvmlite-artiq) version src;
|
||||
inherit (mainPackages.llvmlite-artiq) version src;
|
||||
};
|
||||
};
|
||||
|
||||
condaWindows = if artiq6 then condaWindowsExperimental else condaWindowsLegacy;
|
||||
in
|
||||
mainPackages // boardPackages
|
||||
boardPackages // mainPackages // condaNoarch // condaLinux // condaWindows
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ stdenv, cacert, git, cargo, cargo-vendor }:
|
||||
{ stdenv, lib, cacert, git, cargo, cargo-vendor }:
|
||||
{ name, src, sha256 }:
|
||||
stdenv.mkDerivation {
|
||||
name = "${name}-vendor";
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ cacert git cargo cargo-vendor ];
|
||||
inherit src;
|
||||
|
||||
|
@ -30,6 +31,6 @@ stdenv.mkDerivation {
|
|||
outputHashMode = "recursive";
|
||||
outputHash = sha256;
|
||||
|
||||
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
|
|
|
@ -1,29 +1,45 @@
|
|||
{ stdenv, callPackage, fetchgit, git, python3Packages, qt5Full, binutils-or1k, llvm-or1k, llvmlite-artiq, libartiq-support, lit, outputcheck }:
|
||||
{ stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq, libartiq-support, lit, outputcheck }:
|
||||
|
||||
let
|
||||
pythonDeps = callPackage ./python-deps.nix {};
|
||||
in
|
||||
python3Packages.buildPythonPackage rec {
|
||||
name = "artiq-${version}";
|
||||
version = import ./artiq-version.nix { inherit stdenv fetchgit git; };
|
||||
src = import ./artiq-src.nix { inherit fetchgit; };
|
||||
preBuild = "export VERSIONEER_OVERRIDE=${version}";
|
||||
propagatedBuildInputs = [ binutils-or1k llvm-or1k llvmlite-artiq qt5Full ]
|
||||
++ (with pythonDeps; [ sipyco pyqtgraph-qt5 pythonparser ])
|
||||
++ (with python3Packages; [ pygit2 numpy dateutil quamash scipy prettytable pyserial python-Levenshtein h5py pyqt5 ]);
|
||||
checkInputs = [ binutils-or1k outputcheck ];
|
||||
checkPhase =
|
||||
''
|
||||
python -m unittest discover -v artiq.test
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "artiq";
|
||||
version = import ./artiq-version.nix { inherit stdenv fetchgit git; };
|
||||
src = import ./artiq-src.nix { inherit fetchgit; };
|
||||
|
||||
TESTDIR=`mktemp -d`
|
||||
cp --no-preserve=mode,ownership -R ${src}/artiq/test/lit $TESTDIR
|
||||
LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so ${lit}/bin/lit -v $TESTDIR/lit
|
||||
'';
|
||||
meta = with stdenv.lib; {
|
||||
description = "A leading-edge control system for quantum information experiments";
|
||||
homepage = https://m-labs/artiq;
|
||||
license = licenses.lgpl3;
|
||||
maintainers = [ maintainers.sb0 ];
|
||||
};
|
||||
}
|
||||
preBuild = "export VERSIONEER_OVERRIDE=${version}";
|
||||
|
||||
nativeBuildInputs = [ qt5.wrapQtAppsHook ];
|
||||
propagatedBuildInputs = [ binutils-or1k llvm-or1k llvmlite-artiq ]
|
||||
++ (lib.lists.optionals (lib.strings.versionAtLeast version "6.0") [ binutils-arm ])
|
||||
++ (with pythonDeps; [ sipyco pyqtgraph-qt5 pythonparser ])
|
||||
++ (with python3Packages; [ pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 ])
|
||||
++ [(if (lib.strings.versionAtLeast version "6.0") then pythonDeps.qasync else python3Packages.quamash)];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
postFixup = ''
|
||||
wrapQtApp "$out/bin/artiq_dashboard"
|
||||
wrapQtApp "$out/bin/artiq_browser"
|
||||
wrapQtApp "$out/bin/artiq_session"
|
||||
'';
|
||||
|
||||
# Modifies PATH to pass the wrapped python environment (i.e. python3.withPackages(...) to subprocesses.
|
||||
# Allows subprocesses using python to find all packages you have installed
|
||||
makeWrapperArgs = [ ''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' '' ];
|
||||
|
||||
checkInputs = [ binutils-or1k outputcheck ];
|
||||
checkPhase =
|
||||
''
|
||||
python -m unittest discover -v artiq.test
|
||||
|
||||
TESTDIR=`mktemp -d`
|
||||
cp --no-preserve=mode,ownership -R ${src}/artiq/test/lit $TESTDIR
|
||||
LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so ${lit}/bin/lit -v $TESTDIR/lit
|
||||
'';
|
||||
|
||||
|
||||
meta = with lib; {
|
||||
description = "A leading-edge control system for quantum information experiments";
|
||||
homepage = https://m-labs/artiq;
|
||||
license = licenses.lgpl3;
|
||||
maintainers = [ maintainers.sb0 ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, buildPackages
|
||||
{ stdenv, lib, buildPackages
|
||||
, fetchurl, zlib
|
||||
, platform, target
|
||||
}:
|
||||
|
@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
|
|||
`gprof', `nm', `strip', etc.
|
||||
'';
|
||||
homepage = http://www.gnu.org/software/binutils/;
|
||||
license = stdenv.lib.licenses.gpl3Plus;
|
||||
license = lib.licenses.gpl3Plus;
|
||||
/* Give binutils a lower priority than gcc-wrapper to prevent a
|
||||
collision due to the ld/as wrappers/symlinks in the latter. */
|
||||
priority = "10";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchgit, git, rustc }:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "libartiq-support-${version}";
|
||||
pname = "libartiq-support";
|
||||
version = import ./artiq-version.nix { inherit stdenv fetchgit git; };
|
||||
|
||||
src = import ./artiq-src.nix { inherit fetchgit; };
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{ stdenv
|
||||
{ stdenv, lib
|
||||
, fetchFromGitHub, runCommand
|
||||
, perl, groff, cmake, libxml2, python, libffi, valgrind
|
||||
}:
|
||||
|
||||
let
|
||||
llvm-src = fetchFromGitHub {
|
||||
rev = "527aa86b578da5dfb9cf4510b71f0f46a11249f7";
|
||||
rev = "7746fe85489e92e1caffda18b9d7b2ae9e5da1a8";
|
||||
owner = "m-labs";
|
||||
repo = "llvm-or1k";
|
||||
sha256 = "0lmcg9xj66pf4mb6racipw67vm8kwm84dl861hyqnywd61kvhrwa";
|
||||
sha256 = "0jqbb3k9r91swsyrdak8fzvs1qi451zy8dqmpqriaxk5g83ny5b7";
|
||||
};
|
||||
clang-src = fetchFromGitHub {
|
||||
rev = "9e996136d52ed506ed8f57ef8b13b0f0f735e6a3";
|
||||
|
@ -25,12 +25,12 @@ let
|
|||
'';
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "llvm-or1k";
|
||||
pname = "llvm-or1k";
|
||||
version = "6.0.0";
|
||||
passthru.llvm-src = llvm-src;
|
||||
src = llvm-clang-src;
|
||||
version = "6.0.0";
|
||||
|
||||
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
|
||||
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ lib.optional stdenv.isLinux valgrind;
|
||||
|
||||
preBuild = ''
|
||||
NIX_BUILD_CORES=4
|
||||
|
@ -59,8 +59,8 @@ in
|
|||
meta = {
|
||||
description = "Collection of modular and reusable compiler and toolchain technologies";
|
||||
homepage = http://llvm.org/;
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
maintainers = with stdenv.lib.maintainers; [ sb0 ];
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ sb0 ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchFromGitHub, llvm-or1k, makeWrapper, python3, ncurses, zlib, python3Packages }:
|
||||
{ stdenv, lib, fetchFromGitHub, llvm-or1k, makeWrapper, python3, ncurses, zlib, python3Packages }:
|
||||
python3Packages.buildPythonPackage rec {
|
||||
name = "llvmlite-artiq";
|
||||
pname = "llvmlite-artiq";
|
||||
version = "0.23.0.dev";
|
||||
src = fetchFromGitHub {
|
||||
rev = "158f9d3a898dbf055ca513d69505df288c681fea";
|
||||
|
@ -13,7 +13,7 @@ python3Packages.buildPythonPackage rec {
|
|||
|
||||
preBuild = "export LLVM_CONFIG=${llvm-or1k}/bin/llvm-config";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "A lightweight LLVM python binding for writing JIT compilers";
|
||||
homepage = "http://llvmlite.pydata.org/";
|
||||
maintainers = with maintainers; [ sb0 ];
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{ fetchgit }:
|
||||
import (fetchgit {
|
||||
url = "https://github.com/nixos/nixpkgs.git";
|
||||
rev = "1c7f02b0b9f115ccbc122ce39ae99debc1af857a";
|
||||
sha256 = "14sichs3hyg4ybcacvzglw97lg747y1ls5lsazv0n5yxv5w06l3d";
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
{ stdenv, fetchFromGitHub, autoreconfHook, libftdi, libusb1, pkgconfig, hidapi }:
|
||||
{ stdenv, lib, fetchFromGitHub, autoreconfHook, libftdi, libusb1, pkgconfig, hidapi }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "openocd-mlabs-${version}";
|
||||
pname = "openocd-mlabs";
|
||||
version = "0.10.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
|
@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
|
|||
cp ${bscan_spi_bitstreams}/*.bit "$out/share/bscan-spi-bitstreams"
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing";
|
||||
longDescription = ''
|
||||
OpenOCD provides on-chip programming and debugging support with a layered
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
{ stdenv, fetchFromGitHub, python3Packages }:
|
||||
{ lib, fetchgit, fetchFromGitHub, python3Packages, misoc-new }:
|
||||
|
||||
rec {
|
||||
# User dependencies
|
||||
sipyco = python3Packages.buildPythonPackage rec {
|
||||
name = "sipyco";
|
||||
version = "1.1";
|
||||
pname = "sipyco";
|
||||
version = "1.2";
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "sipyco";
|
||||
rev = "v${version}";
|
||||
sha256 = "09vyrzfhnbp65ybd7w2g96gvvnhzafpn72syls2kbg2paqjjf9gs";
|
||||
sha256 = "02x2s66x9bbzj82d823vjg2i73w7iqwvkrjbbyrsav6ccj7f90sj";
|
||||
};
|
||||
propagatedBuildInputs = with python3Packages; [ numpy ];
|
||||
};
|
||||
|
||||
asyncserial = python3Packages.buildPythonPackage rec {
|
||||
name = "asyncserial";
|
||||
pname = "asyncserial";
|
||||
version = "0.1";
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
|
@ -27,7 +27,7 @@ rec {
|
|||
};
|
||||
|
||||
pythonparser = python3Packages.buildPythonPackage rec {
|
||||
name = "pythonparser";
|
||||
pname = "pythonparser";
|
||||
version = "1.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
|
@ -35,41 +35,81 @@ rec {
|
|||
rev = "5b391fe86f43bb9f4f96c5bc0532e2a112db2936";
|
||||
sha256 = "1gw1fk4y2l6bwq0fg2a9dfc1rvq8cv492dyil96amjdhsxvnx35b";
|
||||
};
|
||||
patches = [ ./python37hack.patch ];
|
||||
patches = [ ./pythonparserver.patch ];
|
||||
propagatedBuildInputs = with python3Packages; [ regex ];
|
||||
};
|
||||
|
||||
pyqtgraph-qt5 = python3Packages.buildPythonPackage rec {
|
||||
name = "pyqtgraph_qt5-${version}";
|
||||
version = "0.10.0";
|
||||
pname = "pyqtgraph_qt5";
|
||||
version = "0.11.0";
|
||||
doCheck = false;
|
||||
pythonImportsCheck = [ "pyqtgraph" ];
|
||||
src = fetchFromGitHub {
|
||||
owner = "pyqtgraph";
|
||||
repo = "pyqtgraph";
|
||||
rev = "1426e334e1d20542400d77c72c132b04c6d17ddb";
|
||||
sha256 = "1079haxyr316jf0wpirxdj0ry6j8mr16cqr0dyyrd5cnxwl7zssh";
|
||||
rev = "pyqtgraph-${version}";
|
||||
sha256 = "03fvpkqdn80ni51msvyivmghw41qk4vplwdqndkvzzzlppimdjbn";
|
||||
};
|
||||
propagatedBuildInputs = with python3Packages; [ scipy numpy pyqt5 pyopengl ];
|
||||
};
|
||||
|
||||
# Development/firmware dependencies
|
||||
misoc = python3Packages.buildPythonPackage rec {
|
||||
name = "misoc";
|
||||
|
||||
qasync = python3Packages.buildPythonPackage rec {
|
||||
pname = "qasync";
|
||||
version = "0.10.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "misoc";
|
||||
rev = "7e5fe8d38835175202dad2c51d37b20b76fd9e16";
|
||||
sha256 = "0i8bppz7x2s45lx9n49c0r87pqps09z35yzc17amvx21qsplahxn";
|
||||
fetchSubmodules = true;
|
||||
owner = "CabbageDevelopment";
|
||||
repo = "qasync";
|
||||
rev = "v${version}";
|
||||
sha256 = "1zga8s6dr7gk6awmxkh4pf25gbg8n6dv1j4b0by7y0fhi949qakq";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ python3Packages.pyqt5 ];
|
||||
|
||||
checkInputs = [ python3Packages.pytest ];
|
||||
checkPhase = ''
|
||||
pytest -k 'test_qthreadexec.py' # the others cause the test execution to be aborted, I think because of asyncio
|
||||
'';
|
||||
};
|
||||
|
||||
# Development/firmware dependencies
|
||||
artiq-netboot = python3Packages.buildPythonPackage rec {
|
||||
pname = "artiq-netboot";
|
||||
version = "unstable-2020-10-15";
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.m-labs.hk/m-labs/artiq-netboot.git";
|
||||
rev = "04f69eb07df73abe4b89fde2c24084f7664f2104";
|
||||
sha256 = "0ql4fr8m8gpb2yql8aqsdqsssxb8zqd6l65kl1f6s9845zy7shs9";
|
||||
};
|
||||
};
|
||||
|
||||
misoc = python3Packages.buildPythonPackage {
|
||||
pname = "misoc";
|
||||
version = if misoc-new then "unstable-2021-02-15" else "unstable-2020-05-29";
|
||||
|
||||
src = if misoc-new
|
||||
then (fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "misoc";
|
||||
rev = "d84551418042cea0891ea743442e20684b51e77a";
|
||||
sha256 = "1id5qjr9dl4r3vi6jdn7dfpnr2wb08nrm3nfscn18clbbdxybyjn";
|
||||
fetchSubmodules = true;
|
||||
})
|
||||
else (fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "misoc";
|
||||
rev = "7e5fe8d38835175202dad2c51d37b20b76fd9e16";
|
||||
sha256 = "0i8bppz7x2s45lx9n49c0r87pqps09z35yzc17amvx21qsplahxn";
|
||||
fetchSubmodules = true;
|
||||
});
|
||||
|
||||
# TODO: fix misoc bitrot and re-enable tests
|
||||
doCheck = false;
|
||||
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [ pyserial jinja2 numpy asyncserial migen ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "A high performance and small footprint system-on-chip based on Migen";
|
||||
homepage = "https://m-labs.hk/migen";
|
||||
license = licenses.bsd2;
|
||||
|
@ -78,18 +118,19 @@ rec {
|
|||
};
|
||||
|
||||
migen = python3Packages.buildPythonPackage rec {
|
||||
name = "migen";
|
||||
pname = "migen";
|
||||
version = "unstable-2021-02-08";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "migen";
|
||||
rev = "b1b2b298b85a795239daad84c75be073ddc4f8bd";
|
||||
sha256 = "1qy2ydk8xqqv92i992j1g71fbi185zd6s3kigzsf3169874dyh81";
|
||||
rev = "7014bdccc11270764186e6a4441fb58238c612aa";
|
||||
sha256 = "12mhmcdf0jqv33ald9x9zb1qi26sw4ywdfgg5saqvmx0pmbmvynk";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [ colorama ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "A Python toolbox for building complex digital hardware";
|
||||
homepage = "https://m-labs.hk/migen";
|
||||
license = licenses.bsd2;
|
||||
|
@ -98,7 +139,8 @@ rec {
|
|||
};
|
||||
|
||||
microscope = python3Packages.buildPythonPackage rec {
|
||||
name = "microscope";
|
||||
pname = "microscope";
|
||||
version = "unstable-2019-05-17";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
|
@ -109,7 +151,7 @@ rec {
|
|||
|
||||
propagatedBuildInputs = with python3Packages; [ pyserial prettytable msgpack migen ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Finding the bacteria in rotting FPGA designs";
|
||||
homepage = "https://m-labs.hk/migen";
|
||||
license = licenses.bsd2;
|
||||
|
@ -118,18 +160,19 @@ rec {
|
|||
};
|
||||
|
||||
jesd204b = python3Packages.buildPythonPackage rec {
|
||||
name = "jesd204b";
|
||||
pname = "jesd204b";
|
||||
version = "unstable-2020-12-18";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "jesd204b";
|
||||
rev = "ac877ac5975411a438415f824e182338ed773529";
|
||||
sha256 = "1lkb7cyj87bq4y0hp6379jq4q4lm2ijldccpyhawiizcfkawxa10";
|
||||
rev = "23bd08f5ee95eb42502f9fbe1c2a45e8c083eab9";
|
||||
sha256 = "0x2mh5fv4q0b1f8pjc2kcyjqbfgiyp1hlvbfgk8dbsraj50i566h";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [ migen misoc ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "JESD204B core for Migen/MiSoC";
|
||||
homepage = "https://m-labs.hk/migen";
|
||||
license = licenses.bsd2;
|
||||
|
@ -146,7 +189,7 @@ rec {
|
|||
sha256 = "0j15i54p7nri6hkzn1wal9pxri4pgql01wgjccig6ar0v5jjbvsy";
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Super-fast and clean conversions to numbers";
|
||||
homepage = "https://github.com/SethMMorton/fastnumbers";
|
||||
license = licenses.mit;
|
||||
|
@ -155,7 +198,8 @@ rec {
|
|||
};
|
||||
|
||||
ramda = python3Packages.buildPythonPackage {
|
||||
name = "ramda";
|
||||
pname = "ramda";
|
||||
version = "unstable-2019-02-01";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "peteut";
|
||||
|
@ -174,7 +218,7 @@ rec {
|
|||
export PBR_VERSION=0.0.1
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Ramda, ported to Python";
|
||||
homepage = "https://github.com/peteut/ramda.py";
|
||||
license = licenses.mit;
|
||||
|
@ -183,13 +227,14 @@ rec {
|
|||
};
|
||||
|
||||
migen-axi = python3Packages.buildPythonPackage {
|
||||
name = "migen-axi";
|
||||
pname = "migen-axi";
|
||||
version = "unstable-2021-01-22";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "peteut";
|
||||
repo = "migen-axi";
|
||||
rev = "c4002f7db62cb9c4599336a9413006ee1d138fbd";
|
||||
sha256 = "0p2ndznch7z4sbp4m8hq49rkg7p4vcrlbbfk6l8644wyl1kk0fvg";
|
||||
rev = "9439ee900358598cecc682db327aa30e506172b5";
|
||||
sha256 = "1z5s8ifq7fbpqi6sx2i87rmz63kbgh9ck94fs2qf21ixhxi46nm3";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ python3Packages.pbr ];
|
||||
|
@ -214,7 +259,7 @@ rec {
|
|||
export PBR_VERSION=0.0.1
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "AXI support for Migen/MiSoC";
|
||||
homepage = "https://github.com/peteut/migen-axi";
|
||||
license = licenses.mit;
|
||||
|
@ -235,7 +280,7 @@ rec {
|
|||
# Non-standard test suite. Needs custom checkPhase.
|
||||
doCheck = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Portable tool for executing LLVM and Clang style test suites";
|
||||
homepage = http://llvm.org/docs/CommandGuide/lit.html;
|
||||
license = licenses.ncsa;
|
||||
|
@ -254,7 +299,7 @@ rec {
|
|||
};
|
||||
prePatch = "echo ${version} > RELEASE-VERSION";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "A tool for checking tool output inspired by LLVM's FileCheck";
|
||||
homepage = "https://github.com/stp/OutputCheck";
|
||||
license = licenses.bsd3;
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
diff --git a/pythonparser/lexer.py b/pythonparser/lexer.py
|
||||
index a62eaf1..2c48d36 100644
|
||||
index a62eaf1..c70e85a 100644
|
||||
--- a/pythonparser/lexer.py
|
||||
+++ b/pythonparser/lexer.py
|
||||
@@ -79,6 +79,7 @@ class Lexer:
|
||||
@@ -79,6 +79,8 @@ class Lexer:
|
||||
(3, 4): _reserved_3_1,
|
||||
(3, 5): _reserved_3_5,
|
||||
(3, 6): _reserved_3_5,
|
||||
+ (3, 7): _reserved_3_5,
|
||||
+ (3, 8): _reserved_3_5,
|
||||
}
|
||||
"""
|
||||
A map from a tuple (*major*, *minor*) corresponding to Python version to
|
||||
@@ -102,6 +103,7 @@ class Lexer:
|
||||
@@ -102,6 +104,8 @@ class Lexer:
|
||||
(3, 4): _string_prefixes_3_3,
|
||||
(3, 5): _string_prefixes_3_3,
|
||||
(3, 6): _string_prefixes_3_6,
|
||||
+ (3, 7): _string_prefixes_3_6,
|
||||
+ (3, 8): _string_prefixes_3_6,
|
||||
}
|
||||
"""
|
||||
A map from a tuple (*major*, *minor*) corresponding to Python version to
|
||||
diff --git a/pythonparser/parser.py b/pythonparser/parser.py
|
||||
index 10c741d..f748695 100644
|
||||
index 10c741d..62b93e1 100644
|
||||
--- a/pythonparser/parser.py
|
||||
+++ b/pythonparser/parser.py
|
||||
@@ -419,7 +419,7 @@ class Parser(object):
|
||||
|
@ -27,7 +29,7 @@ index 10c741d..f748695 100644
|
|||
self.yield_expr = self.yield_expr__26
|
||||
return
|
||||
- elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6)):
|
||||
+ elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7)):
|
||||
+ elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8)):
|
||||
if version == (3, 0):
|
||||
self.with_stmt = self.with_stmt__26 # lol
|
||||
else:
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, makeWrapper, bash, buildRustPackage, curl, darwin
|
||||
{ stdenv, lib, makeWrapper, bash, buildRustPackage, curl, darwin
|
||||
, version
|
||||
, src
|
||||
, platform
|
||||
|
@ -6,7 +6,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optionalString;
|
||||
inherit (lib) optionalString;
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
|
||||
bootstrapping = versionType == "bootstrap";
|
||||
|
@ -26,14 +26,14 @@ rec {
|
|||
inherit version;
|
||||
inherit src;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
homepage = http://www.rust-lang.org/;
|
||||
description = "A safe, concurrent, practical language";
|
||||
maintainers = with maintainers; [ sb0 ];
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
};
|
||||
|
||||
buildInputs = [ bash ] ++ stdenv.lib.optional stdenv.isDarwin Security;
|
||||
buildInputs = [ bash ] ++ lib.optional stdenv.isDarwin Security;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
@ -60,7 +60,7 @@ rec {
|
|||
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/rustdoc"
|
||||
install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo"
|
||||
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/cargo"
|
||||
install_name_tool -change /usr/lib/libcurl.4.dylib '${stdenv.lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo"
|
||||
install_name_tool -change /usr/lib/libcurl.4.dylib '${lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo"
|
||||
for f in $out/lib/lib*.dylib; do
|
||||
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$f"
|
||||
done
|
||||
|
@ -80,14 +80,14 @@ rec {
|
|||
inherit version;
|
||||
inherit src;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
homepage = http://www.rust-lang.org/;
|
||||
description = "A safe, concurrent, practical language";
|
||||
maintainers = with maintainers; [ sb0 ];
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
};
|
||||
|
||||
buildInputs = [ makeWrapper bash ] ++ stdenv.lib.optional stdenv.isDarwin Security;
|
||||
buildInputs = [ makeWrapper bash ] ++ lib.optional stdenv.isDarwin Security;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
@ -107,7 +107,7 @@ rec {
|
|||
${optionalString (stdenv.isDarwin && bootstrapping) ''
|
||||
install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo"
|
||||
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/cargo"
|
||||
install_name_tool -change /usr/lib/libcurl.4.dylib '${stdenv.lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo"
|
||||
install_name_tool -change /usr/lib/libcurl.4.dylib '${lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo"
|
||||
''}
|
||||
|
||||
wrapProgram "$out/bin/cargo" \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, file, curl, pkgconfig, python, openssl, cmake, zlib
|
||||
{ stdenv, lib, file, curl, pkgconfig, python, openssl, cmake, zlib
|
||||
, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2
|
||||
, fetchurl
|
||||
}:
|
||||
|
@ -6,11 +6,12 @@
|
|||
rustPlatform.buildRustPackage rec {
|
||||
# Note: we can't build cargo 1.28.0 because rustc tightened the borrow checker rules and broke
|
||||
# backward compatibility, which affects old cargo versions.
|
||||
name = "cargo-${version}";
|
||||
version = "1.37.0";
|
||||
# There are also issues with asm/llvm_asm with recent rustc and cargo versions prior to 1.39.
|
||||
pname = "cargo";
|
||||
version = "1.39.0";
|
||||
src = fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/rustc-1.37.0-src.tar.gz";
|
||||
sha256 = "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj";
|
||||
url = "https://static.rust-lang.org/dist/rustc-1.39.0-src.tar.gz";
|
||||
sha256 = "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl";
|
||||
};
|
||||
|
||||
# the rust source tarball already has all the dependencies vendored, no need to fetch them again
|
||||
|
@ -51,7 +52,7 @@ rustPlatform.buildRustPackage rec {
|
|||
# Disable check phase as there are failures (4 tests fail)
|
||||
doCheck = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
homepage = https://crates.io;
|
||||
description = "Downloads your Rust project's dependencies and builds your project";
|
||||
maintainers = with maintainers; [ wizeman retrry ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, targetPackages
|
||||
{ stdenv, lib, targetPackages
|
||||
, fetchurl, file, python2, tzdata, ps
|
||||
, llvm-or1k, ncurses, zlib, darwin, rustPlatform, git, cmake, curl
|
||||
, which, libffi, gdb
|
||||
|
@ -14,7 +14,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optional optionalString;
|
||||
inherit (lib) optional optionalString;
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
|
||||
target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
|
||||
|
@ -26,7 +26,7 @@ let
|
|||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "rustc-${version}";
|
||||
pname = "rustc";
|
||||
inherit version;
|
||||
|
||||
inherit src;
|
||||
|
@ -171,7 +171,7 @@ stdenv.mkDerivation {
|
|||
# https://github.com/rust-lang/rust/issues/30181
|
||||
# enableParallelBuilding = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
homepage = https://www.rust-lang.org/;
|
||||
description = "A safe, concurrent, practical language";
|
||||
maintainers = with maintainers; [ sb0 ];
|
||||
|
|
|
@ -8,7 +8,7 @@ in
|
|||
buildInputs = [
|
||||
vivado
|
||||
pkgs.gnumake
|
||||
(pkgs.python3.withPackages(ps: (with ps; [ jinja2 numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ])))
|
||||
(pkgs.python3.withPackages(ps: (with ps; [ jinja2 jsonschema numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ])))
|
||||
artiqpkgs.cargo
|
||||
artiqpkgs.rustc
|
||||
artiqpkgs.binutils-or1k
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{ pkgs }:
|
||||
|
||||
let
|
||||
# Pin nixpkgs to avoid frequent resource-intensive Windows reinstallations on Hydra.
|
||||
wfvm-pkgs = pkgs.fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
rev = "f8248ab6d9e69ea9c07950d73d48807ec595e923";
|
||||
sha256 = "009i9j6mbq6i481088jllblgdnci105b2q4mscprdawg3knlyahk";
|
||||
};
|
||||
wfvm = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/wfvm.git";
|
||||
rev = "4b497938ffd9fcddf84a3dbe2f01524395292adb";
|
||||
sha256 = "0m3kdbbcskqc1lf8b5f7ccbll9b7vkl4r00kbyx3yjb2rs6cqvil";
|
||||
};
|
||||
in import "${wfvm}/wfvm" { pkgs = (import wfvm-pkgs {}); }
|
|
@ -1,26 +0,0 @@
|
|||
# Preparation steps
|
||||
|
||||
## Install a Windows image
|
||||
|
||||
1. Adjust demo-image.nix accordingly
|
||||
2. Run:
|
||||
|
||||
If in impure mode
|
||||
```shell
|
||||
nix-build demo-image.nix
|
||||
./result
|
||||
```
|
||||
Results in a file called c.img
|
||||
|
||||
If in pure mode
|
||||
```shell
|
||||
nix-build demo-image.nix
|
||||
ls -la ./result
|
||||
```
|
||||
Results in a symlink to the image in the nix store
|
||||
|
||||
|
||||
# Impure/pure mode
|
||||
Sometimes it can be useful to build the image _outside_ of the Nix sandbox for debugging purposes.
|
||||
|
||||
For this purpose we have an attribute called `impureMode` which outputs the shell script used by Nix inside the sandbox to build the image.
|
|
@ -1,317 +0,0 @@
|
|||
{ pkgs
|
||||
, fullName ? "John Doe"
|
||||
, organization ? "KVM Authority"
|
||||
, administratorPassword ? "123456"
|
||||
, uiLanguage ? "en-US"
|
||||
, inputLocale ? "en-US"
|
||||
, userLocale ? "en-US"
|
||||
, systemLocale ? "en-US"
|
||||
, users ? {}
|
||||
, productKey ? null
|
||||
, defaultUser ? "wfvm"
|
||||
, setupCommands ? []
|
||||
, timeZone ? "UTC"
|
||||
, services ? {}
|
||||
, impureShellCommands ? []
|
||||
, driveLetter ? "E:"
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
serviceCommands = lib.mapAttrsToList (
|
||||
serviceName: attrs: "powershell Set-Service -Name ${serviceName} " + (
|
||||
lib.concatStringsSep " " (
|
||||
(
|
||||
lib.mapAttrsToList (
|
||||
n: v: if builtins.typeOf v != "bool" then "-${n} ${v}" else "-${n}"
|
||||
)
|
||||
) (
|
||||
# Always run without interaction
|
||||
{ Force = true; } // attrs
|
||||
)
|
||||
)
|
||||
)
|
||||
) services;
|
||||
|
||||
sshSetupCommands =
|
||||
# let
|
||||
# makeDirs = lib.mapAttrsToList (n: v: ''mkdir C:\Users\${n}\.ssh'') users;
|
||||
# writeKeys = lib.flatten (lib.mapAttrsToList (n: v: builtins.map (key: let
|
||||
# commands = [
|
||||
# ''powershell.exe Set-Content -Path C:\Users\${n}\.ssh\authorized_keys -Value '${key}' ''
|
||||
# ];
|
||||
# in lib.concatStringsSep "\n" commands) (v.sshKeys or [])) users);
|
||||
# mkDirsDesc = builtins.map (c: {Path = c; Description = "Make SSH key dir";}) makeDirs;
|
||||
# writeKeysDesc = builtins.map (c: {Path = c; Description = "Add SSH key";}) writeKeys;
|
||||
# in
|
||||
# mkDirsDesc ++ writeKeysDesc ++
|
||||
[
|
||||
{
|
||||
Path = ''powershell.exe Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 -Source ${driveLetter}\fod -LimitAccess'';
|
||||
Description = "Add OpenSSH service.";
|
||||
}
|
||||
{
|
||||
Path = ''powershell.exe Set-Service -Name sshd -StartupType Automatic'';
|
||||
Description = "Enable SSH by default.";
|
||||
}
|
||||
];
|
||||
|
||||
assertCommand = c: builtins.typeOf c == "string" || builtins.typeOf c == "set" && builtins.hasAttr "Path" c && builtins.hasAttr "Description" c;
|
||||
|
||||
commands = builtins.map (x: assert assertCommand x; if builtins.typeOf x == "string" then { Path = x; Description = x; } else x) (
|
||||
[
|
||||
{
|
||||
Path = "powershell.exe Set-ExecutionPolicy -Force Unrestricted";
|
||||
Description = "Allow unsigned powershell scripts.";
|
||||
}
|
||||
]
|
||||
++ [
|
||||
{
|
||||
Path = ''powershell.exe ${driveLetter}\win-bundle-installer.exe'';
|
||||
Description = "Install any declared packages.";
|
||||
}
|
||||
]
|
||||
++ setupCommands
|
||||
++ [
|
||||
{
|
||||
Path = ''powershell.exe ${driveLetter}\ssh-setup.ps1'';
|
||||
Description = "Setup SSH and keys";
|
||||
}
|
||||
]
|
||||
++ serviceCommands
|
||||
++ impureShellCommands
|
||||
);
|
||||
|
||||
mkCommand = attrs: ''
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
${lib.concatStringsSep "\n" (lib.attrsets.mapAttrsToList (n: v: "<${n}>${v}</${n}>") attrs)}
|
||||
</RunSynchronousCommand>
|
||||
'';
|
||||
mkCommands = commands: (
|
||||
builtins.foldl' (
|
||||
acc: v: rec {
|
||||
i = acc.i + 1;
|
||||
values = acc.values ++ [ (mkCommand (v // { Order = builtins.toString i; })) ];
|
||||
}
|
||||
) {
|
||||
i = 0;
|
||||
values = [];
|
||||
} commands
|
||||
).values;
|
||||
|
||||
mkUser =
|
||||
{ name
|
||||
, password
|
||||
, description ? ""
|
||||
, displayName ? ""
|
||||
, groups ? []
|
||||
# , sshKeys ? [] # Handled in scripts
|
||||
}: ''
|
||||
<LocalAccount wcm:action="add">
|
||||
<Password>
|
||||
<Value>${password}</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
<Description>${description}</Description>
|
||||
<DisplayName>${displayName}</DisplayName>
|
||||
<Group>${builtins.concatStringsSep ";" (lib.unique ([ "Users" ] ++ groups))}</Group>
|
||||
<Name>${name}</Name>
|
||||
</LocalAccount>
|
||||
'';
|
||||
|
||||
# Windows expects a flat list of users while we want to manage them as a set
|
||||
flatUsers = builtins.attrValues (builtins.mapAttrs (name: s: s // { inherit name; }) users);
|
||||
|
||||
autounattendXML = pkgs.writeText "autounattend.xml" ''
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||
<settings pass="windowsPE">
|
||||
<component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<DriverPaths>
|
||||
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
|
||||
<Path>D:\</Path>
|
||||
</PathAndCredentials>
|
||||
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
|
||||
<Path>E:\</Path>
|
||||
</PathAndCredentials>
|
||||
</DriverPaths>
|
||||
</component>
|
||||
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<DiskConfiguration>
|
||||
<Disk wcm:action="add">
|
||||
<CreatePartitions>
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<Type>EFI</Type>
|
||||
<Size>100</Size>
|
||||
</CreatePartition>
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>2</Order>
|
||||
<Type>MSR</Type>
|
||||
<Size>16</Size>
|
||||
</CreatePartition>
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>3</Order>
|
||||
<Type>Primary</Type>
|
||||
<Extend>true</Extend>
|
||||
</CreatePartition>
|
||||
</CreatePartitions>
|
||||
<ModifyPartitions>
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<Format>FAT32</Format>
|
||||
<Label>System</Label>
|
||||
<PartitionID>1</PartitionID>
|
||||
</ModifyPartition>
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>2</Order>
|
||||
<PartitionID>2</PartitionID>
|
||||
</ModifyPartition>
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>3</Order>
|
||||
<Format>NTFS</Format>
|
||||
<Label>Windows</Label>
|
||||
<Letter>C</Letter>
|
||||
<PartitionID>3</PartitionID>
|
||||
</ModifyPartition>
|
||||
</ModifyPartitions>
|
||||
<DiskID>0</DiskID>
|
||||
<WillWipeDisk>true</WillWipeDisk>
|
||||
</Disk>
|
||||
</DiskConfiguration>
|
||||
|
||||
<ImageInstall>
|
||||
<OSImage>
|
||||
<InstallTo>
|
||||
<DiskID>0</DiskID>
|
||||
<PartitionID>3</PartitionID>
|
||||
</InstallTo>
|
||||
<InstallFrom>
|
||||
<MetaData wcm:action="add">
|
||||
<Key>/IMAGE/INDEX</Key>
|
||||
<Value>1</Value>
|
||||
</MetaData>
|
||||
</InstallFrom>
|
||||
</OSImage>
|
||||
</ImageInstall>
|
||||
|
||||
<UserData>
|
||||
<ProductKey>
|
||||
${if productKey != null then "<Key>${productKey}</Key>" else ""}
|
||||
<WillShowUI>OnError</WillShowUI>
|
||||
</ProductKey>
|
||||
<AcceptEula>true</AcceptEula>
|
||||
<FullName>${fullName}</FullName>
|
||||
<Organization>${organization}</Organization>
|
||||
</UserData>
|
||||
|
||||
</component>
|
||||
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<SetupUILanguage>
|
||||
<UILanguage>${uiLanguage}</UILanguage>
|
||||
</SetupUILanguage>
|
||||
<InputLocale>${inputLocale}</InputLocale>
|
||||
<SystemLocale>${systemLocale}</SystemLocale>
|
||||
<UILanguage>${uiLanguage}</UILanguage>
|
||||
<UILanguageFallback>en-US</UILanguageFallback>
|
||||
<UserLocale>${userLocale}</UserLocale>
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
<settings pass="oobeSystem">
|
||||
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<InputLocale>${inputLocale}</InputLocale>
|
||||
<SystemLocale>${systemLocale}</SystemLocale>
|
||||
<UILanguage>${uiLanguage}</UILanguage>
|
||||
<UILanguageFallback>en-US</UILanguageFallback>
|
||||
<UserLocale>${userLocale}</UserLocale>
|
||||
</component>
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<OOBE>
|
||||
<HideEULAPage>true</HideEULAPage>
|
||||
<HideLocalAccountScreen>true</HideLocalAccountScreen>
|
||||
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
|
||||
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
|
||||
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
||||
<ProtectYourPC>1</ProtectYourPC>
|
||||
</OOBE>
|
||||
<TimeZone>${timeZone}</TimeZone>
|
||||
|
||||
<UserAccounts>
|
||||
${if administratorPassword != null then ''
|
||||
<AdministratorPassword>
|
||||
<Value>${administratorPassword}</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</AdministratorPassword>
|
||||
'' else ""}
|
||||
<LocalAccounts>
|
||||
${builtins.concatStringsSep "\n" (builtins.map mkUser flatUsers)}
|
||||
</LocalAccounts>
|
||||
</UserAccounts>
|
||||
|
||||
${if defaultUser == null then "" else ''
|
||||
<AutoLogon>
|
||||
<Password>
|
||||
<Value>${(builtins.getAttr defaultUser users).password}</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
<Enabled>true</Enabled>
|
||||
<Username>${defaultUser}</Username>
|
||||
</AutoLogon>
|
||||
''}
|
||||
|
||||
<FirstLogonCommands>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<CommandLine>cmd /C shutdown /s /f /t 00</CommandLine>
|
||||
<Description>ChangeHideFiles</Description>
|
||||
</SynchronousCommand>
|
||||
</FirstLogonCommands>
|
||||
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
<settings pass="specialize">
|
||||
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<RunSynchronous>
|
||||
${lib.concatStringsSep "\n" (mkCommands commands)}
|
||||
</RunSynchronous>
|
||||
</component>
|
||||
<component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<CEIPEnabled>0</CEIPEnabled>
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
<!-- Disable Windows UAC -->
|
||||
<settings pass="offlineServicing">
|
||||
<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<EnableLUA>false</EnableLUA>
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
<cpi:offlineImage cpi:source="wim:c:/wim/windows-10/install.wim#Windows 10 Enterprise LTSC 2019 Evaluation" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||
</unattend>
|
||||
'';
|
||||
|
||||
in {
|
||||
# Lint and format as a sanity check
|
||||
autounattendXML = pkgs.runCommandNoCC "autounattend.xml" {} ''
|
||||
${pkgs.libxml2}/bin/xmllint --format ${autounattendXML} > $out
|
||||
'';
|
||||
|
||||
# autounattend.xml is _super_ picky about quotes and other things
|
||||
setupScript = pkgs.writeText "ssh-setup.ps1" (
|
||||
''
|
||||
# Setup SSH and keys
|
||||
'' +
|
||||
lib.concatStrings (
|
||||
builtins.map (c: ''
|
||||
# ${c.Description}
|
||||
${c.Path}
|
||||
'') sshSetupCommands
|
||||
)
|
||||
);
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.runCommandNoCC "win-bundle-installer.exe" {} ''
|
||||
cp ${./main.go} main.go
|
||||
env HOME=$(mktemp -d) GOOS=windows GOARCH=amd64 ${pkgs.go}/bin/go build
|
||||
mv build.exe $out
|
||||
''
|
|
@ -1,116 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func Untar(dst string, r io.Reader) error {
|
||||
|
||||
tr := tar.NewReader(r)
|
||||
|
||||
for {
|
||||
header, err := tr.Next()
|
||||
|
||||
switch {
|
||||
|
||||
case err == io.EOF:
|
||||
return nil
|
||||
case err != nil:
|
||||
return err
|
||||
|
||||
case header == nil:
|
||||
continue
|
||||
}
|
||||
|
||||
target := filepath.Join(dst, header.Name)
|
||||
|
||||
switch header.Typeflag {
|
||||
|
||||
case tar.TypeDir:
|
||||
if _, err := os.Stat(target); err != nil {
|
||||
if err := os.MkdirAll(target, 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
case tar.TypeReg:
|
||||
f, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := io.Copy(f, tr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func InstallBundle(bundlePath string) error {
|
||||
|
||||
reader, err := os.Open(bundlePath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
workDir, err := ioutil.TempDir("", "bundle_install")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(workDir)
|
||||
|
||||
err = Untar(workDir, reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
installScript := filepath.Join(workDir, "install.ps1")
|
||||
|
||||
cmd := exec.Command("powershell", installScript)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Dir = workDir
|
||||
err = cmd.Run()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Get path relative to binary
|
||||
baseDir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var dirs = [2]string{"bootstrap", "user"}
|
||||
|
||||
for _, pkgDir := range dirs {
|
||||
|
||||
dir := filepath.Join(baseDir, pkgDir)
|
||||
|
||||
files, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
bundle := filepath.Join(dir, file.Name())
|
||||
fmt.Println(fmt.Sprintf("Installing: %s", bundle))
|
||||
err := InstallBundle(bundle)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
|
||||
buildInputs = [
|
||||
pkgs.go
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
unset GOPATH
|
||||
'';
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ pkgs }:
|
||||
|
||||
{
|
||||
makeWindowsImage = attrs: import ./win.nix ({ inherit pkgs; } // attrs);
|
||||
layers = (import ./layers { inherit pkgs; });
|
||||
utils = (import ./utils.nix { inherit pkgs; });
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {}, impureMode ? false }:
|
||||
|
||||
let
|
||||
wfvm = (import ./default.nix { inherit pkgs; });
|
||||
in
|
||||
wfvm.makeWindowsImage {
|
||||
# Build install script & skip building iso
|
||||
inherit impureMode;
|
||||
|
||||
# Custom base iso
|
||||
# windowsImage = pkgs.fetchurl {
|
||||
# url = "https://software-download.microsoft.com/download/sg/17763.107.101029-1455.rs5_release_svc_refresh_CLIENT_LTSC_EVAL_x64FRE_en-us.iso";
|
||||
# sha256 = "668fe1af70c2f7416328aee3a0bb066b12dc6bbd2576f40f812b95741e18bc3a";
|
||||
# };
|
||||
|
||||
# impureShellCommands = [
|
||||
# "powershell.exe echo Hello"
|
||||
# ];
|
||||
|
||||
# User accounts
|
||||
# users = {
|
||||
# artiq = {
|
||||
# password = "1234";
|
||||
# # description = "Default user";
|
||||
# # displayName = "Display name";
|
||||
# groups = [
|
||||
# "Administrators"
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
|
||||
# Auto login
|
||||
# defaultUser = "artiq";
|
||||
|
||||
# fullName = "M-Labs";
|
||||
# organization = "m-labs";
|
||||
# administratorPassword = "12345";
|
||||
|
||||
# Imperative installation commands, to be installed incrementally
|
||||
installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ];
|
||||
|
||||
# services = {
|
||||
# # Enable remote management
|
||||
# WinRm = {
|
||||
# Status = "Running";
|
||||
# PassThru = true;
|
||||
# };
|
||||
# };
|
||||
|
||||
# License key
|
||||
# productKey = "iboughtthisone";
|
||||
|
||||
# Locales
|
||||
# uiLanguage = "en-US";
|
||||
# inputLocale = "en-US";
|
||||
# userLocale = "en-US";
|
||||
# systemLocale = "en-US";
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
let
|
||||
wfvm = (import ./default.nix { inherit pkgs; });
|
||||
in
|
||||
wfvm.utils.wfvm-run {
|
||||
name = "demo-ssh";
|
||||
image = import ./demo-image.nix { inherit pkgs; };
|
||||
isolateNetwork = false;
|
||||
script = ''
|
||||
${pkgs.sshpass}/bin/sshpass -p1234 -- ${pkgs.openssh}/bin/ssh -p 2022 wfvm@localhost -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
|
||||
'';
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
{ pkgs }:
|
||||
{
|
||||
anaconda3 = {
|
||||
name = "Anaconda3";
|
||||
script = let
|
||||
Anaconda3 = pkgs.fetchurl {
|
||||
name = "Anaconda3.exe";
|
||||
url = "https://repo.anaconda.com/archive/Anaconda3-2020.02-Windows-x86_64.exe";
|
||||
sha256 = "0n31l8l89jrjrbzbifxbjnr3g320ly9i4zfyqbf3l9blf4ygbhl3";
|
||||
};
|
||||
in ''
|
||||
ln -s ${Anaconda3} ./Anaconda3.exe
|
||||
win-put Anaconda3.exe 'C:\Users\wfvm'
|
||||
echo Running Anaconda installer...
|
||||
win-exec 'start /wait "" .\Anaconda3.exe /S /D=%UserProfile%\Anaconda3'
|
||||
echo Anaconda installer finished
|
||||
'';
|
||||
};
|
||||
msys2 = {
|
||||
name = "MSYS2";
|
||||
buildInputs = [ pkgs.expect ];
|
||||
script = let
|
||||
msys2 = pkgs.fetchurl {
|
||||
name = "msys2.exe";
|
||||
url = "https://github.com/msys2/msys2-installer/releases/download/2020-06-02/msys2-x86_64-20200602.exe";
|
||||
sha256 = "1mswlfybvk42vdr4r85dypgkwhrp5ff47gcbxgjqwq86ym44xzd4";
|
||||
};
|
||||
msys2-auto-install = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/msys2/msys2-installer/master/auto-install.js";
|
||||
sha256 = "0ww48xch2q427c58arg5llakfkfzh3kb32kahwplp0s7jc8224g7";
|
||||
};
|
||||
in ''
|
||||
ln -s ${msys2} ./msys2.exe
|
||||
ln -s ${msys2-auto-install} ./auto-install.js
|
||||
win-put msys2.exe 'C:\Users\wfvm'
|
||||
win-put auto-install.js 'C:\Users\wfvm'
|
||||
echo Running MSYS2 installer...
|
||||
# work around MSYS2 installer bug that prevents it from closing at the end of unattended install
|
||||
expect -c 'set timeout 600; spawn win-exec ".\\msys2.exe --script auto-install.js -v InstallPrefix=C:\\msys64"; expect FinishedPageCallback { close }'
|
||||
echo MSYS2 installer finished
|
||||
'';
|
||||
};
|
||||
msys2-packages = {
|
||||
name = "MSYS2-packages";
|
||||
script = let
|
||||
msys-packages = import ./msys_packages.nix { inherit pkgs; };
|
||||
msys-packages-put = pkgs.lib.strings.concatStringsSep "\n"
|
||||
(map (package: ''win-put ${package} 'C:\Users\wfvm\msyspackages' '') msys-packages);
|
||||
in
|
||||
# Windows command line is so shitty it can't even do glob expansion. Why do people use Windows?
|
||||
''
|
||||
win-exec 'mkdir msyspackages'
|
||||
${msys-packages-put}
|
||||
cat > installmsyspackages.bat << EOF
|
||||
set MSYS=c:\msys64
|
||||
set ARCH=64
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw%ARCH%\bin;%PATH%
|
||||
bash -c "pacman -U --noconfirm C:/Users/wfvm/msyspackages/*"
|
||||
EOF
|
||||
win-put installmsyspackages.bat 'C:\Users\wfvm'
|
||||
win-exec installmsyspackages
|
||||
'';
|
||||
};
|
||||
cmake = {
|
||||
name = "CMake";
|
||||
script = let
|
||||
cmake = pkgs.fetchurl {
|
||||
name = "cmake.msi";
|
||||
url = "https://github.com/Kitware/CMake/releases/download/v3.18.0-rc1/cmake-3.18.0-rc1-win64-x64.msi";
|
||||
sha256 = "1n32jzbg9w3vfbvyi9jqijz97gn1zsk1w5226wlrxd2a9d4w1hrn";
|
||||
};
|
||||
in
|
||||
''
|
||||
ln -s ${cmake} cmake.msi
|
||||
win-put cmake.msi
|
||||
win-exec "msiexec.exe /q /i cmake.msi ADD_CMAKE_TO_PATH=System"
|
||||
'';
|
||||
};
|
||||
msvc = {
|
||||
name = "MSVC";
|
||||
script = let
|
||||
msvc-wine = pkgs.fetchFromGitHub {
|
||||
owner = "mstorsjo";
|
||||
repo = "msvc-wine";
|
||||
rev = "b953f996401c19df3039c04e4ac7f962e435a4b2";
|
||||
sha256 = "12rqx0r3d836x4k1ccda5xmzsd2938v5gmrp27awmzv1j3wplfsq";
|
||||
};
|
||||
vs = pkgs.stdenv.mkDerivation {
|
||||
name = "vs";
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "1ngq7mg02kzfysh559j3fkjh2hngmay4jjar55p2db4d9rkvqh22";
|
||||
|
||||
src = msvc-wine;
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
buildInputs = [ pkgs.cacert (pkgs.python3.withPackages(ps: [ ps.simplejson ps.six ])) pkgs.msitools ];
|
||||
buildPhase = "python $src/vsdownload.py --accept-license --dest $out";
|
||||
};
|
||||
in
|
||||
''
|
||||
win-put ${vs}/VC/Tools/MSVC 'C:\'
|
||||
win-exec 'setx PATH C:\MSVC\14.26.28801\bin\Hostx64\x64;%PATH% /m'
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
nix-build -E "
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
wfvm = import ../default.nix { inherit pkgs; };
|
||||
in
|
||||
wfvm.utils.wfvm-run {
|
||||
name = \"get-msys-packages\";
|
||||
image = wfvm.makeWindowsImage { installCommands = [ wfvm.layers.msys2 ]; };
|
||||
script = ''
|
||||
cat > getmsyspackages.bat << EOF
|
||||
set MSYS=C:\\MSYS64
|
||||
set TOOLPREF=mingw-w64-x86_64-
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
|
||||
pacman -Sp %TOOLPREF%gcc %TOOLPREF%binutils make autoconf automake libtool texinfo %TOOLPREF%make %TOOLPREF%cmake > packages.txt
|
||||
EOF
|
||||
\${wfvm.utils.win-put}/bin/win-put getmsyspackages.bat
|
||||
\${wfvm.utils.win-exec}/bin/win-exec getmsyspackages
|
||||
\${wfvm.utils.win-get}/bin/win-get packages.txt
|
||||
'';
|
||||
}
|
||||
"
|
||||
|
||||
./result/bin/wfvm-run-get-msys-packages
|
||||
|
||||
echo "{ pkgs } : [" > msys_packages.nix
|
||||
while read package; do
|
||||
hash=$(nix-prefetch-url $package)
|
||||
echo "
|
||||
(pkgs.fetchurl {
|
||||
url = \"$package\";
|
||||
sha256 = \"$hash\";
|
||||
})" >> msys_packages.nix
|
||||
done < packages.txt
|
||||
echo "]" >> msys_packages.nix
|
||||
|
||||
rm result getmsyspackages.bat packages.txt
|
|
@ -1 +0,0 @@
|
|||
This file is not publicaly acessible anywhere so had to be extracted from a connected instance
|
Binary file not shown.
|
@ -1,98 +0,0 @@
|
|||
{ pkgs, baseRtc ? "2020-04-20T14:21:42", cores ? "4", qemuMem ? "4G" }:
|
||||
|
||||
rec {
|
||||
# qemu_test is a smaller closure only building for a single system arch
|
||||
qemu = pkgs.qemu_test;
|
||||
|
||||
mkQemuFlags = extraFlags: [
|
||||
"-enable-kvm"
|
||||
"-cpu host"
|
||||
"-smp ${cores}"
|
||||
"-m ${qemuMem}"
|
||||
"-bios ${pkgs.OVMF.fd}/FV/OVMF.fd"
|
||||
"-vga virtio"
|
||||
"-rtc base=${baseRtc}"
|
||||
"-device piix3-usb-uhci"
|
||||
"-device e1000,netdev=n1"
|
||||
] ++ extraFlags;
|
||||
|
||||
# Pass empty config file to prevent ssh from failing to create ~/.ssh
|
||||
sshOpts = "-F /dev/null -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=1";
|
||||
win-exec = pkgs.writeShellScriptBin "win-exec" ''
|
||||
${pkgs.sshpass}/bin/sshpass -p1234 -- \
|
||||
${pkgs.openssh}/bin/ssh -np 2022 ${sshOpts} \
|
||||
wfvm@localhost \
|
||||
$1
|
||||
'';
|
||||
win-wait = pkgs.writeShellScriptBin "win-wait" ''
|
||||
# If the machine is not up within 10 minutes it's likely never coming up
|
||||
timeout=600
|
||||
|
||||
# Wait for VM to be accessible
|
||||
sleep 20
|
||||
echo "Waiting for SSH..."
|
||||
while true; do
|
||||
if test "$timeout" -eq 0; then
|
||||
echo "SSH connection timed out"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
output=$(${win-exec}/bin/win-exec 'echo|set /p="Ran command"' || echo "")
|
||||
if test "$output" = "Ran command"; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Retrying in 1 second, timing out in $timeout seconds"
|
||||
|
||||
((timeout=$timeout-1))
|
||||
|
||||
sleep 1
|
||||
done
|
||||
echo "SSH OK"
|
||||
'';
|
||||
win-put = pkgs.writeShellScriptBin "win-put" ''
|
||||
echo win-put $1 -\> $2
|
||||
${pkgs.sshpass}/bin/sshpass -p1234 -- \
|
||||
${pkgs.openssh}/bin/scp -r -P 2022 ${sshOpts} \
|
||||
$1 wfvm@localhost:$2
|
||||
'';
|
||||
win-get = pkgs.writeShellScriptBin "win-get" ''
|
||||
echo win-get $1
|
||||
${pkgs.sshpass}/bin/sshpass -p1234 -- \
|
||||
${pkgs.openssh}/bin/scp -r -T -P 2022 ${sshOpts} \
|
||||
wfvm@localhost:$1 .
|
||||
'';
|
||||
|
||||
wfvm-run = { name, image, script, display ? false, isolateNetwork ? true, forwardedPorts ? [] }:
|
||||
let
|
||||
restrict =
|
||||
if isolateNetwork
|
||||
then "on"
|
||||
else "off";
|
||||
# use socat instead of `tcp:...` to allow multiple connections
|
||||
guestfwds =
|
||||
builtins.concatStringsSep ""
|
||||
(map ({ listenAddr, targetAddr, port }:
|
||||
",guestfwd=tcp:${listenAddr}:${toString port}-cmd:${pkgs.socat}/bin/socat\\ -\\ tcp:${targetAddr}:${toString port}"
|
||||
) forwardedPorts);
|
||||
qemuParams = mkQemuFlags (pkgs.lib.optional (!display) "-display none" ++ [
|
||||
"-drive"
|
||||
"file=${image},index=0,media=disk,cache=unsafe"
|
||||
"-snapshot"
|
||||
"-netdev user,id=n1,net=192.168.1.0/24,restrict=${restrict},hostfwd=tcp::2022-:22${guestfwds}"
|
||||
]);
|
||||
in pkgs.writeShellScriptBin "wfvm-run-${name}" ''
|
||||
set -m
|
||||
${qemu}/bin/qemu-system-x86_64 ${pkgs.lib.concatStringsSep " " qemuParams} &
|
||||
|
||||
${win-wait}/bin/win-wait
|
||||
|
||||
${script}
|
||||
|
||||
echo "Shutting down..."
|
||||
${win-exec}/bin/win-exec 'shutdown /s'
|
||||
echo "Waiting for VM to terminate..."
|
||||
fg
|
||||
echo "Done"
|
||||
'';
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
{ pkgs
|
||||
, diskImageSize ? "22G"
|
||||
, windowsImage ? null
|
||||
, autoUnattendParams ? {}
|
||||
, impureMode ? false
|
||||
, installCommands ? []
|
||||
, users ? {}
|
||||
, ...
|
||||
}@attrs:
|
||||
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
utils = import ./utils.nix { inherit pkgs; };
|
||||
libguestfs = pkgs.libguestfs-with-appliance;
|
||||
|
||||
# p7zip on >20.03 has known vulns but we have no better option
|
||||
p7zip = pkgs.p7zip.overrideAttrs(old: {
|
||||
meta = old.meta // {
|
||||
knownVulnerabilities = [];
|
||||
};
|
||||
});
|
||||
|
||||
runQemuCommand = name: command: (
|
||||
pkgs.runCommandNoCC name { buildInputs = [ p7zip utils.qemu libguestfs ]; }
|
||||
(
|
||||
''
|
||||
if ! test -f; then
|
||||
echo "KVM not available, bailing out" >> /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
'' + command
|
||||
)
|
||||
);
|
||||
|
||||
windowsIso = if windowsImage != null then windowsImage else pkgs.fetchurl {
|
||||
url = "https://software-download.microsoft.com/download/sg/17763.107.101029-1455.rs5_release_svc_refresh_CLIENT_LTSC_EVAL_x64FRE_en-us.iso";
|
||||
sha256 = "668fe1af70c2f7416328aee3a0bb066b12dc6bbd2576f40f812b95741e18bc3a";
|
||||
};
|
||||
|
||||
openSshServerPackage = ./openssh/server-package.cab;
|
||||
|
||||
autounattend = import ./autounattend.nix (
|
||||
attrs // {
|
||||
inherit pkgs;
|
||||
users = users // {
|
||||
wfvm = {
|
||||
password = "1234";
|
||||
description = "WFVM Administrator";
|
||||
groups = [
|
||||
"Administrators"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
bundleInstaller = pkgs.callPackage ./bundle {};
|
||||
|
||||
# Packages required to drive installation of other packages
|
||||
bootstrapPkgs =
|
||||
runQemuCommand "bootstrap-win-pkgs.img" ''
|
||||
mkdir -p pkgs/fod
|
||||
|
||||
cp ${bundleInstaller} pkgs/"$(stripHash "${bundleInstaller}")"
|
||||
|
||||
# Install optional windows features
|
||||
cp ${openSshServerPackage} pkgs/fod/OpenSSH-Server-Package~31bf3856ad364e35~amd64~~.cab
|
||||
|
||||
# SSH setup script goes here because windows XML parser sucks
|
||||
cp ${autounattend.setupScript} pkgs/ssh-setup.ps1
|
||||
|
||||
virt-make-fs --partition --type=fat pkgs/ $out
|
||||
'';
|
||||
|
||||
installScript = pkgs.writeScript "windows-install-script" (
|
||||
let
|
||||
qemuParams = utils.mkQemuFlags (lib.optional (!impureMode) "-display none" ++ [
|
||||
# "CD" drive with bootstrap pkgs
|
||||
"-drive"
|
||||
"id=virtio-win,file=${bootstrapPkgs},if=none,format=raw,readonly=on"
|
||||
"-device"
|
||||
"usb-storage,drive=virtio-win"
|
||||
# USB boot
|
||||
"-drive"
|
||||
"id=win-install,file=usbimage.img,if=none,format=raw,readonly=on"
|
||||
"-device"
|
||||
"usb-storage,drive=win-install"
|
||||
# Output image
|
||||
"-drive"
|
||||
"file=c.img,index=0,media=disk,cache=unsafe"
|
||||
# Network
|
||||
"-netdev user,id=n1,net=192.168.1.0/24,restrict=on"
|
||||
]);
|
||||
in
|
||||
''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -euxo pipefail
|
||||
export PATH=${lib.makeBinPath [ p7zip utils.qemu libguestfs ]}:$PATH
|
||||
|
||||
# Create a bootable "USB" image
|
||||
# Booting in USB mode circumvents the "press any key to boot from cdrom" prompt
|
||||
#
|
||||
# Also embed the autounattend answer file in this image
|
||||
mkdir -p win
|
||||
mkdir -p win/nix-win
|
||||
7z x -y ${windowsIso} -owin
|
||||
|
||||
cp ${autounattend.autounattendXML} win/autounattend.xml
|
||||
|
||||
virt-make-fs --partition --type=fat win/ usbimage.img
|
||||
rm -rf win
|
||||
|
||||
# Qemu requires files to be rw
|
||||
qemu-img create -f qcow2 c.img ${diskImageSize}
|
||||
qemu-system-x86_64 ${lib.concatStringsSep " " qemuParams}
|
||||
''
|
||||
);
|
||||
|
||||
baseImage = pkgs.runCommandNoCC "windows.img" {} ''
|
||||
${installScript}
|
||||
mv c.img $out
|
||||
'';
|
||||
|
||||
finalImage = builtins.foldl' (acc: v: pkgs.runCommandNoCC "${v.name}.img" {
|
||||
buildInputs = with utils; [
|
||||
qemu win-wait win-exec win-put
|
||||
] ++ (v.buildInputs or []);
|
||||
} (let
|
||||
script = pkgs.writeScript "${v.name}-script" v.script;
|
||||
qemuParams = utils.mkQemuFlags (lib.optional (!impureMode) "-display none" ++ [
|
||||
# Output image
|
||||
"-drive"
|
||||
"file=c.img,index=0,media=disk,cache=unsafe"
|
||||
# Network - enable SSH forwarding
|
||||
"-netdev user,id=n1,net=192.168.1.0/24,restrict=on,hostfwd=tcp::2022-:22"
|
||||
]);
|
||||
|
||||
in ''
|
||||
# Create an image referencing the previous image in the chain
|
||||
qemu-img create -f qcow2 -b ${acc} c.img
|
||||
|
||||
set -m
|
||||
qemu-system-x86_64 ${lib.concatStringsSep " " qemuParams} &
|
||||
|
||||
win-wait
|
||||
|
||||
echo "Executing script to build layer..."
|
||||
${script}
|
||||
echo "Layer script done"
|
||||
|
||||
echo "Shutting down..."
|
||||
win-exec 'shutdown /s'
|
||||
echo "Waiting for VM to terminate..."
|
||||
fg
|
||||
echo "Done"
|
||||
|
||||
mv c.img $out
|
||||
'')) baseImage installCommands;
|
||||
|
||||
in
|
||||
|
||||
# impureMode is meant for debugging the base image, not the full incremental build process
|
||||
if !(impureMode) then finalImage else assert installCommands == []; installScript
|
|
@ -1,25 +0,0 @@
|
|||
# Preparation steps
|
||||
|
||||
## Install a Windows image
|
||||
|
||||
```shell
|
||||
nix-build install.nix -I artiqSrc=…/artiq
|
||||
result/bin/windows-installer.sh
|
||||
```
|
||||
|
||||
Follow the instructions.
|
||||
|
||||
## Install Anaconda to the image
|
||||
|
||||
```shell
|
||||
result/bin/anaconda-installer.sh
|
||||
```
|
||||
|
||||
Move the image `c.img` to one of Nix' `extra-sandbox-paths` (`nix.sandboxPaths` on NixOS).
|
||||
|
||||
|
||||
# Running the tests manually
|
||||
|
||||
```shell
|
||||
nix-build --pure --arg diskImage "\"…/c.img\"" -I artiqSrc=…/artiq manual-test-run.nix
|
||||
```
|
|
@ -0,0 +1,17 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/noarch/prettytable-0.7.2-py_3.tar.bz2";
|
||||
sha256 = "0b7s4xm6bbkcg37sf1i3mxrbac0vxhryq22m3qx4x9kh6k2c5g5q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/pycparser-2.20-py_0.tar.bz2";
|
||||
sha256 = "1qwcb07q8cjz0qpj6pfxb0qb68kddmx9bv9wr5pghwz78q8073z9";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/six-1.15.0-py_0.tar.bz2";
|
||||
sha256 = "08rsfp9bd2mz8r120s8w5vgncy0gn732xa0lfgbmx833548cfqmb";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,27 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/noarch/prettytable-0.7.2-py_3.tar.bz2";
|
||||
sha256 = "0b7s4xm6bbkcg37sf1i3mxrbac0vxhryq22m3qx4x9kh6k2c5g5q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/six-1.15.0-py_0.tar.bz2";
|
||||
sha256 = "08rsfp9bd2mz8r120s8w5vgncy0gn732xa0lfgbmx833548cfqmb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/python-dateutil-2.8.1-py_0.tar.bz2";
|
||||
sha256 = "0cbcd0jq6683ibj8ncsmmrbhbjvwww8i22lb68bx4xfzsmb9z8cb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/cached-property-1.5.1-py_1.tar.bz2";
|
||||
sha256 = "1yl6h3wb6hxgw79i7rpgpq260l5vqfcj5dv5kyxn8z99xdkp52q5";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/pycparser-2.20-py_0.tar.bz2";
|
||||
sha256 = "1qwcb07q8cjz0qpj6pfxb0qb68kddmx9bv9wr5pghwz78q8073z9";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,167 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pyqt-5.9.2-py35h6538335_2.tar.bz2";
|
||||
sha256 = "1anwq53nic50cijngxaylpn6232j9wdc2wz2rykqpgzvs1ms108s";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/zlib-1.2.11-h62dcd97_4.tar.bz2";
|
||||
sha256 = "1jxd7sg0c278hqv09q6hridpdnyhkd34gbs92wkravj3gwsr1adk";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/openssl-1.1.1g-he774522_0.tar.bz2";
|
||||
sha256 = "1gwfj33qb8inikdhmgcm30iz1ag8x71lzicsxbdr7ni4153df5gb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_random-1.0.1-py35h77b88f5_1.tar.bz2";
|
||||
sha256 = "0899qg9ih8srpw9q5mxd85hg4gpawb7lmz25x9xi401cfwhgwq7l";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/hdf5-1.10.2-hac2f561_1.tar.bz2";
|
||||
sha256 = "0l1i5bpxl0bn9hf738ywygjwc32d4cq5fjkgzij3x27cxi8nvd21";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/tbb4py-2018.0.5-py35he980bc4_0.tar.bz2";
|
||||
sha256 = "0gypjcmciw3rnd2cq0sqmvspgzaas13fghv633dqj8g3bvl4lfif";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/wheel-0.31.1-py35_0.tar.bz2";
|
||||
sha256 = "07zmbg57lpvqd9nmahiff1mhzxmzchx1v128dcrj4iamymjcdlzf";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/pygit2-0.27.1-py35hfa6e2cd_0.tar.bz2";
|
||||
sha256 = "1jypm8vxs4j4yr37ai4ki9qsslv3wz6slklmisnvjraz1a4vzaf8";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pip-10.0.1-py35_0.tar.bz2";
|
||||
sha256 = "0zwlkfgnag1s64wbwdcg44zqj2dpfcq1g4b6dsk82q24j7fw40i3";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/h5py-2.8.0-py35h3bdd7fb_2.tar.bz2";
|
||||
sha256 = "0743wrf51b2vs8ybasjpn7ricbh740r7drxcimkhbxp8r6vd66vp";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-1.15.2-py35ha559c80_0.tar.bz2";
|
||||
sha256 = "1igf4gm726s4kg7km24flxdxr73fafaz3z18y3ndcb5f6r9zwa44";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl-2018.0.3-1.tar.bz2";
|
||||
sha256 = "01pq0f2787q58avg5ylfrbpf4jlg2b6rbajvf3swjpm1cmzxkm81";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libssh2-1.9.0-h7a1dbc1_1.tar.bz2";
|
||||
sha256 = "0sz405ab3n7991hxy8l9affs1slivsimgadxsdr6wvpgx3j4aqgx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/tk-8.6.10-he774522_0.tar.bz2";
|
||||
sha256 = "15bfncacdxmcbn4xixmfz2m7a09k7hcpwxvwn1lki84bx0fmzsis";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sqlite-3.32.2-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "086jjnxfchypkr8cp1q8nsis0jfvl293bv4bcg7ikv7aia3vda8p";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/wincertstore-0.2-py35hfebbdb8_0.tar.bz2";
|
||||
sha256 = "1624bzqlbiq4jlz46l65574smw739p7l38ydzxmayq3jmwx6zaar";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/certifi-2018.8.24-py35_1.tar.bz2";
|
||||
sha256 = "06ygpkx3f71rwmq9lgc29r6jj4g1zi8rvrmn4mrrsb9b5sf0rzgf";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/icu-58.2-ha925a31_3.tar.bz2";
|
||||
sha256 = "0vcl0j3v9ab022s2g3a9iv1pn7sflh670yyf5m08hdyf049m3jz7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/regex-2018.08.29-py35hfa6e2cd_0.tar.bz2";
|
||||
sha256 = "16cjgwpaqnfy8bg35iz12bb9whpws4abiz4cq4shpnh6gnwpwzj3";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/cffi-1.11.5-py35h74b6da3_1.tar.bz2";
|
||||
sha256 = "0nc3ps4xl8rqpwiqaqqr5lrqzk8lx1a4hh3fpm7i7rlppqn5pm6a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libcurl-7.69.1-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "182zrmgl2142gfgnbgjsk0gbj85vw75xzxvhn9lzm485ghxsasvg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_fft-1.0.6-py35hdbbee80_0.tar.bz2";
|
||||
sha256 = "0xb02rx28rjlp5clavg19jb129ihcarrkz46pncaar91qxckbbxz";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pyqtgraph-0.10.0-py35h28b3542_3.tar.bz2";
|
||||
sha256 = "0ywzw3i4kf5ccck9whmg1j7s22x6i5fpywndy8rkr9va38g4nazq";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sip-4.19.8-py35h6538335_0.tar.bz2";
|
||||
sha256 = "1y761zpm6bi0pb61x1y26ap56hylh6mjg1xq9zl08bmcl2dlkwfy";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/setuptools-40.2.0-py35_0.tar.bz2";
|
||||
sha256 = "146piyifnip1flqph19nxilnhfbzzsxlhfyx0i61wv7krr6ln9yy";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/python-levenshtein-0.12.0-py35_0.tar.bz2";
|
||||
sha256 = "1rdpzv1y535swf17nm88chkp1m8w3wd3nwdy7jk1xfcnx1da5ss6";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/libgit2-0.27.8-hfac1375_0.tar.bz2";
|
||||
sha256 = "05pjzwmm5vyxwcgi6vv3i961x3dgdd9c4b1ihagq9kyxgqfy21kd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/scipy-1.1.0-py35h4f6bf74_1.tar.bz2";
|
||||
sha256 = "0sdyj5nlycv4krz7f8rzhi0kxv302gpx65x1zwhj8dn6b2c50li0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/curl-7.69.1-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "0hw5dh7gzx8fap4c3vkc2xc2q9by3f5ndbigr6pm6w5v29qaydn4";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/intel-openmp-2019.4-245.tar.bz2";
|
||||
sha256 = "13qid5aagyxsfy5ng4bbwb7hs9jj29jvqbpvvkjiy6bgv36m8kr8";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-base-1.15.2-py35h8128ebf_0.tar.bz2";
|
||||
sha256 = "166w4wkp9dwl505hc00hny1mq2mlvb169n7c9nws7dz8j36pqfrx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-3.5.6-he025d50_0.tar.bz2";
|
||||
sha256 = "0ygvmbyvhc2jisb5bzb0r5709qmn8392gr7rv6c8vrdiylfiqr73";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,132 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/regex-2020.5.14-py37he774522_0.tar.bz2";
|
||||
sha256 = "125l0ywc17h5hlpidjbr7dxyz9c24xmfjllj19dmvbx8hdlmvp99";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/python_abi-3.7-1_cp37m.tar.bz2";
|
||||
sha256 = "04dllvrvczky7p7d82iqj7czmy5mm8w7h2gg0zpjzx0s09gkq09l";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/icu-58.2-ha925a31_3.tar.bz2";
|
||||
sha256 = "0vcl0j3v9ab022s2g3a9iv1pn7sflh670yyf5m08hdyf049m3jz7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pip-20.1.1-py37_1.tar.bz2";
|
||||
sha256 = "0wx0sdjq2kkdid4m0iss1bxjhpdk1lnrqsl3w7bqc0papz3gbx0a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_fft-1.1.0-py37h45dec08_0.tar.bz2";
|
||||
sha256 = "1v73rd107x1r77gv77cn2bv50hr15c0rwspzf7pdp93i5ydk7fm0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/tk-8.6.10-he774522_0.tar.bz2";
|
||||
sha256 = "15bfncacdxmcbn4xixmfz2m7a09k7hcpwxvwn1lki84bx0fmzsis";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/pygit2-1.2.1-py37h4ab8f01_0.tar.bz2";
|
||||
sha256 = "1rj6bmf56g3imcrhfd67nqfzd5jjpnmbck714p6aqljxjw5x1zja";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/certifi-2020.6.20-py37_0.tar.bz2";
|
||||
sha256 = "0601dwm5grhwnq7kvhz9sr49pw72ji8xbc28jc6z3pzihin243fy";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libssh2-1.9.0-h7a1dbc1_1.tar.bz2";
|
||||
sha256 = "0sz405ab3n7991hxy8l9affs1slivsimgadxsdr6wvpgx3j4aqgx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/intel-openmp-2020.1-216.tar.bz2";
|
||||
sha256 = "097kkdpd27gc5v5fwsanbrpvmkqricbkd2igglz0yym0x2rldgb8";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/zlib-1.2.11-h62dcd97_4.tar.bz2";
|
||||
sha256 = "1jxd7sg0c278hqv09q6hridpdnyhkd34gbs92wkravj3gwsr1adk";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pyqtgraph-0.10.0-py37h28b3542_3.tar.bz2";
|
||||
sha256 = "1vfxym7lpiv624ll82yp07v2906chdzvczjj9xbvfvk2sk0w1nk7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-levenshtein-0.12.0-py37he774522_1001.tar.bz2";
|
||||
sha256 = "0wgk6wi4hcc1msv6467y8rhd3zpxrlb6dc0a4fg5wrvzww9wh4dx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/libgit2-1.0.0-h79a9ecc_0.tar.bz2";
|
||||
sha256 = "1pi4hd4kah49wzy00iml5wpbscc0lx6ljk6lwnx92gas5z8856jd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/setuptools-47.3.1-py37_0.tar.bz2";
|
||||
sha256 = "1lljknly57bh73h30hn6vv826dx4vls736psa9jvf0d6l2kqrzrq";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libcurl-7.69.1-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "182zrmgl2142gfgnbgjsk0gbj85vw75xzxvhn9lzm485ghxsasvg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_random-1.1.1-py37h47e9c7a_0.tar.bz2";
|
||||
sha256 = "1f85bd7rrzdprgmk83v1klana32j016128fkxk8kpk7idfd36zqv";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-3.7.7-h81c818b_4.tar.bz2";
|
||||
sha256 = "092bv939n68yjkcm7q626nd6s5kqqvdrgjfqn1nadnqig612w2p9";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/curl-7.69.1-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "0hw5dh7gzx8fap4c3vkc2xc2q9by3f5ndbigr6pm6w5v29qaydn4";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/openssl-1.1.1g-he774522_0.tar.bz2";
|
||||
sha256 = "1gwfj33qb8inikdhmgcm30iz1ag8x71lzicsxbdr7ni4153df5gb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/scipy-1.5.0-py37h9439919_0.tar.bz2";
|
||||
sha256 = "01pj0a82y9qd9z5fn5gv4argcc5g5s8kqj0lwjy9hj50qf6qwj76";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-1.18.5-py37h6530119_0.tar.bz2";
|
||||
sha256 = "1knb5na7ij7ik76blsgwhdsy3i9r2l0154z5g5dkb2ds3sk878np";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sqlite-3.32.3-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "1ddzwj0f6jikj6hsasg3vlwamsqhf5lc8k1la7gqbd77s11b8isc";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-base-1.18.5-py37hc3f5095_0.tar.bz2";
|
||||
sha256 = "1dyxk2v7rm87najv3f8i04q44wxicfx9qrap9dy2vpqlrz3bj82j";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl-2020.1-216.tar.bz2";
|
||||
sha256 = "1klj0sjlj5x1anjbkf017f16ssc65dkpg1rrn06njirbhwsc9w5m";
|
||||
})
|
||||
]
|
|
@ -1,91 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {},
|
||||
diskImageSize ? "22G",
|
||||
qemuMem ? "4G",
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
windowsIso = fetchurl {
|
||||
url = "https://software-download.microsoft.com/download/sg/17763.107.101029-1455.rs5_release_svc_refresh_CLIENT_LTSC_EVAL_x64FRE_en-us.iso";
|
||||
sha256 = "668fe1af70c2f7416328aee3a0bb066b12dc6bbd2576f40f812b95741e18bc3a";
|
||||
};
|
||||
anaconda = fetchurl {
|
||||
url = "https://repo.anaconda.com/archive/Anaconda3-2019.03-Windows-x86_64.exe";
|
||||
sha256 = "1f9icm5rwab6l1f23a70dw0qixzrl62wbglimip82h4zhxlh3jfj";
|
||||
};
|
||||
|
||||
escape = builtins.replaceStrings [ "\\" ] [ "\\\\" ];
|
||||
qemu = import ./qemu.nix {
|
||||
inherit pkgs qemuMem;
|
||||
diskImage = "c.img";
|
||||
};
|
||||
# Double-escape because we produce a script from a shell heredoc
|
||||
ssh = cmd: qemu.ssh (escape cmd);
|
||||
scp = qemu.scp;
|
||||
|
||||
sshCondaEnv = cmd: ssh "anaconda\\scripts\\activate && ${cmd}";
|
||||
condaEnv = "artiq-env";
|
||||
condaDepSpecs =
|
||||
builtins.concatStringsSep " "
|
||||
(map (s: "\"${s}\"")
|
||||
(import ../conda/artiq-deps.nix));
|
||||
|
||||
instructions =
|
||||
builtins.toFile "install.txt"
|
||||
(builtins.readFile ./install.txt);
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "windows-installer";
|
||||
src = windowsIso;
|
||||
setSourceRoot = "sourceRoot=`pwd`";
|
||||
unpackCmd = ''
|
||||
ln -s $curSrc windows.iso
|
||||
'';
|
||||
propagatedBuildInputs = qemu.inputs;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin $out/data
|
||||
ln -s $(readlink windows.iso) $out/data/windows.iso
|
||||
cat > $out/bin/windows-installer.sh << EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e -m
|
||||
|
||||
${qemu.qemu-img} create -f qcow2 c.img ${diskImageSize}
|
||||
${qemu.runQemu false [] [
|
||||
"-boot" "order=d"
|
||||
"-drive" "file=c.img,index=0,media=disk,cache=unsafe"
|
||||
"-drive" "file=$out/data/windows.iso,index=1,media=cdrom,cache=unsafe"
|
||||
]} &
|
||||
cat ${instructions}
|
||||
wait
|
||||
EOF
|
||||
|
||||
cat > $out/bin/anaconda-installer.sh << EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e -m
|
||||
|
||||
${qemu.runQemu false [] [
|
||||
"-boot" "order=c"
|
||||
"-drive" "file=c.img,index=0,media=disk"
|
||||
]} &
|
||||
sleep 10
|
||||
${ssh "ver"}
|
||||
|
||||
${scp anaconda "Anaconda.exe"}
|
||||
${ssh "start /wait \"\" Anaconda.exe /S /D=%cd%\\anaconda"}
|
||||
|
||||
${sshCondaEnv "conda config --add channels conda-forge"}
|
||||
${sshCondaEnv "conda config --add channels m-labs"}
|
||||
( ${sshCondaEnv "conda update -y conda"} ) || true
|
||||
${sshCondaEnv "conda update -y --all"}
|
||||
${sshCondaEnv "conda create -y -n ${condaEnv}"}
|
||||
${sshCondaEnv "conda install -y -n ${condaEnv} ${condaDepSpecs}"}
|
||||
${ssh "shutdown /p /f"}
|
||||
|
||||
echo "Waiting for qemu exit"
|
||||
wait
|
||||
EOF
|
||||
chmod a+x $out/bin/*.sh
|
||||
'';
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
Add user account with expected password [user/user].
|
||||
Enable the OpenSSH server:
|
||||
- "Add or remove programs"
|
||||
- "Manage optional features"
|
||||
- "Add a feature"
|
||||
- "OpenSSH Server"
|
||||
- "Install"
|
||||
- Open "Services"
|
||||
- Double-click the "OpenSSH SSH Server" service
|
||||
- Set "Startup type" to "Automatic"
|
||||
- "Start"
|
||||
- "Ok"
|
||||
Then press ENTER here to proceed with automatic installation
|
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run manually to build the list of conda dependencies to install in the
|
||||
# test environments.
|
||||
|
||||
# NOTE: This procedure encounters failing HTTPS handshakes. To circumvent just
|
||||
# for testing, insert `call conda config --set ssl_verify no` into
|
||||
# getcondapackages.bat. To securely update the sources lists update the RTC
|
||||
# hack to the proper date instead.
|
||||
|
||||
set -e
|
||||
|
||||
nix-build -E "
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
wfvm = import ../wfvm.nix { inherit pkgs; };
|
||||
in
|
||||
wfvm.utils.wfvm-run {
|
||||
name = \"get-conda-packages\";
|
||||
image = wfvm.makeWindowsImage { installCommands = [ wfvm.layers.anaconda3 ]; };
|
||||
# TODO: fix wfvm login expiry and also remove 'date' workarounds below
|
||||
#fakeRtc = false;
|
||||
isolateNetwork = false;
|
||||
script = ''
|
||||
cat > getcondapackages.bat << EOF
|
||||
date 06-22-20
|
||||
call conda config --prepend channels https://conda.m-labs.hk/artiq-beta
|
||||
call conda config --append channels conda-forge
|
||||
call conda create -n artiq -y
|
||||
call conda install --dry-run --json -n artiq artiq > packages.json
|
||||
date 04-20-20
|
||||
EOF
|
||||
\${wfvm.utils.win-put}/bin/win-put getcondapackages.bat
|
||||
\${wfvm.utils.win-exec}/bin/win-exec '.\Anaconda3\Scripts\activate && getcondapackages'
|
||||
\${wfvm.utils.win-get}/bin/win-get packages.json
|
||||
'';
|
||||
}
|
||||
"
|
||||
|
||||
./result/bin/wfvm-run-get-conda-packages
|
||||
|
||||
python -c "
|
||||
import json
|
||||
|
||||
with open('packages.json') as json_file:
|
||||
packages = json.load(json_file)
|
||||
|
||||
with open('packages_noarch.txt', 'w') as list_noarch:
|
||||
with open('packages_win-64.txt', 'w') as list_win64:
|
||||
for fetch in packages['actions']['FETCH']:
|
||||
if 'm-labs' not in fetch['channel']:
|
||||
if fetch['subdir'] == 'noarch':
|
||||
list = list_noarch
|
||||
elif fetch['subdir'] == 'win-64':
|
||||
list = list_win64
|
||||
else:
|
||||
raise ValueError
|
||||
url = fetch['url']
|
||||
if url.endswith('.conda'):
|
||||
url = url[:-6] + '.tar.bz2'
|
||||
print(url, file=list)
|
||||
"
|
||||
|
||||
for type in "noarch" "win-64"; do
|
||||
echo Downloading $type packages
|
||||
out=conda_$type\_packages.nix
|
||||
echo "{ pkgs } : [" > $out
|
||||
while read package; do
|
||||
hash=$(nix-prefetch-url $package)
|
||||
echo "
|
||||
(pkgs.fetchurl {
|
||||
url = \"$package\";
|
||||
sha256 = \"$hash\";
|
||||
})" >> $out
|
||||
done < packages_$type.txt
|
||||
echo "]" >> $out
|
||||
done
|
||||
|
||||
rm result getcondapackages.bat packages.json packages_noarch.txt packages_win-64.txt
|
|
@ -1,30 +1,10 @@
|
|||
# This runs `run-test.nix` with `nix-build`
|
||||
|
||||
{ pkgs ? import <nixpkgs> {},
|
||||
artiqpkgs ? import ../. { inherit pkgs; },
|
||||
diskImage ? "/opt/windows/c.img",
|
||||
qemuMem ? "2G",
|
||||
testTimeout ? 180,
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
let
|
||||
windowsRunner = overrides:
|
||||
import ./run-test.nix ({
|
||||
inherit pkgs diskImage qemuMem testTimeout;
|
||||
sipycoPkg = artiqpkgs.conda-sipyco;
|
||||
artiqPkg = artiqpkgs.conda-artiq;
|
||||
} // overrides);
|
||||
artiqpkgs = import ../. { inherit pkgs; };
|
||||
run-test = import ./run-test.nix {
|
||||
inherit pkgs artiqpkgs;
|
||||
testCommand = "set ARTIQ_ROOT=%cd%\\Anaconda3\\envs\\artiq-env\\Lib\\site-packages\\artiq\\examples\\kc705_nist_clock&& python -m unittest discover -v sipyco.test && python -m unittest discover -v artiq.test";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "windows-test";
|
||||
|
||||
phases = [ "installPhase" "checkPhase" ];
|
||||
installPhase = "touch $out";
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
${windowsRunner { testCommand = "set ARTIQ_ROOT=%cd%\\anaconda\\envs\\artiq-env\\Lib\\site-packages\\artiq\\examples\\kc705_nist_clock&&python -m unittest discover -v artiq.test"; }}/bin/run.sh
|
||||
'';
|
||||
}
|
||||
run-test
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
{ pkgs,
|
||||
diskImage,
|
||||
qemuMem,
|
||||
sshUser ? "user",
|
||||
sshPassword ? "user",
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
qemu-img = "${qemu_kvm}/bin/qemu-img";
|
||||
runQemu = isolateNetwork: forwardedPorts: extraArgs:
|
||||
let
|
||||
restrict =
|
||||
if isolateNetwork
|
||||
then "on"
|
||||
else "off";
|
||||
# use socat instead of `tcp:…` to allow multiple connections
|
||||
guestfwds =
|
||||
builtins.concatStringsSep ""
|
||||
(map ({ listenAddr, targetAddr, port }:
|
||||
",guestfwd=tcp:${listenAddr}:${toString port}-cmd:${socat}/bin/socat\\ -\\ tcp:${targetAddr}:${toString port}"
|
||||
) forwardedPorts);
|
||||
args = [
|
||||
"-enable-kvm"
|
||||
"-m" qemuMem
|
||||
"-bios" "${OVMF.fd}/FV/OVMF.fd"
|
||||
"-netdev" "user,id=n1,net=192.168.1.0/24,restrict=${restrict},hostfwd=tcp::2022-:22${guestfwds}"
|
||||
"-device" "e1000,netdev=n1"
|
||||
];
|
||||
argStr = builtins.concatStringsSep " " (args ++ extraArgs);
|
||||
in "${qemu_kvm}/bin/qemu-system-x86_64 ${argStr}";
|
||||
|
||||
# Pass empty config file to prevent ssh from failing to create ~/.ssh
|
||||
sshOpts = "-F /dev/null -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=\$TMP/known_hosts";
|
||||
sshWithQuotes = quotes: cmd: ''
|
||||
echo ssh windows ${quotes}${cmd}${quotes}
|
||||
${sshpass}/bin/sshpass -p${sshPassword} -- \
|
||||
${openssh}/bin/ssh -np 2022 ${sshOpts} \
|
||||
${sshUser}@localhost \
|
||||
${quotes}${cmd}${quotes}
|
||||
'';
|
||||
ssh = sshWithQuotes "'";
|
||||
scp = src: target: ''
|
||||
echo "Copy ${src} to ${target}"
|
||||
${sshpass}/bin/sshpass -p${sshPassword} -- \
|
||||
${openssh}/bin/scp -P 2022 ${sshOpts} \
|
||||
"${src}" "${sshUser}@localhost:${target}"
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
inherit qemu-img runQemu ssh sshWithQuotes scp;
|
||||
inputs = [ qemu_kvm openssh sshpass ];
|
||||
}
|
|
@ -1,24 +1,6 @@
|
|||
{ pkgs,
|
||||
sipycoPkg,
|
||||
artiqPkg,
|
||||
diskImage ? "/opt/windows/c.img",
|
||||
qemuMem ? "2G",
|
||||
testTimeout ? 600,
|
||||
testCommand ? "python -m unittest discover -v sipyco.test && python -m unittest discover -v artiq.test",
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
{ pkgs, artiqpkgs, testCommand, testTimeout ? 600 }:
|
||||
|
||||
let
|
||||
escape = builtins.replaceStrings [ "\\" ] [ "\\\\" ];
|
||||
qemu = import ./qemu.nix {
|
||||
inherit pkgs qemuMem;
|
||||
diskImage = "c.img";
|
||||
};
|
||||
# Double-escape because we produce a script from a shell heredoc
|
||||
ssh = cmd: qemu.ssh (escape cmd);
|
||||
sshUnquoted = qemu.sshWithQuotes "\"";
|
||||
scp = qemu.scp;
|
||||
condaEnv = "artiq-env";
|
||||
tcpPorts = [ 1380 1381 1382 1383 ];
|
||||
forwardedPorts =
|
||||
|
@ -27,58 +9,52 @@ let
|
|||
targetAddr = "192.168.1.50";
|
||||
inherit port;
|
||||
}) tcpPorts;
|
||||
|
||||
wfvm = import ../wfvm.nix { inherit pkgs; };
|
||||
conda-deps = {
|
||||
name = "conda-deps";
|
||||
script = let
|
||||
artiq6 = pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "6.0";
|
||||
qt-asyncio-package = if artiq6 then artiqpkgs.conda-qasync else artiqpkgs.conda-quamash;
|
||||
conda-deps-noarch = import (if artiq6 then ./conda_noarch_packages.nix else ./conda_noarch_packages-legacy.nix) { inherit pkgs; };
|
||||
conda-deps-win-64 = import (if artiq6 then ./conda_win-64_packages.nix else ./conda_win-64_packages-legacy.nix) { inherit pkgs; };
|
||||
conda-packages-put = pkgs.lib.strings.concatStringsSep "\n"
|
||||
( (map (package: ''win-put ${package} 'fake-channel/noarch' '') conda-deps-noarch)
|
||||
++ (map (package: ''win-put ${package} 'fake-channel/win-64' '') conda-deps-win-64) );
|
||||
in
|
||||
''
|
||||
win-exec 'mkdir fake-channel && mkdir fake-channel\noarch && mkdir fake-channel\win-64'
|
||||
|
||||
${conda-packages-put}
|
||||
|
||||
win-put ${artiqpkgs.conda-windows-binutils-or1k}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
win-put ${artiqpkgs.conda-windows-llvm-or1k}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
win-put ${artiqpkgs.conda-windows-llvmlite-artiq}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
|
||||
win-put ${artiqpkgs.conda-pythonparser}/noarch/*.tar.bz2 'fake-channel/noarch'
|
||||
win-put ${artiqpkgs.conda-sipyco}/noarch/*.tar.bz2 'fake-channel/noarch'
|
||||
win-put ${qt-asyncio-package}/noarch/*.tar.bz2 'fake-channel/noarch'
|
||||
'';
|
||||
};
|
||||
in
|
||||
wfvm.utils.wfvm-run {
|
||||
name = "windows-tests";
|
||||
image = wfvm.makeWindowsImage { installCommands = [ wfvm.layers.anaconda3 conda-deps ]; };
|
||||
inherit forwardedPorts;
|
||||
script =
|
||||
''
|
||||
${wfvm.utils.win-put}/bin/win-put ${artiqpkgs.conda-artiq}/noarch/*.tar.bz2 'fake-channel/noarch'
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "windows-test-runner";
|
||||
src = ./.;
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda index fake-channel"
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n ${condaEnv} --offline"
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate ${condaEnv} && conda install -y -c file:///C:/users/wfvm/fake-channel --offline artiq"\
|
||||
|
||||
propagatedBuildInputs = qemu.inputs;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/run.sh << EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e -m
|
||||
# Schedule a timed shutdown against hanging test runs
|
||||
${wfvm.utils.win-exec}/bin/win-exec "shutdown -s -t ${toString testTimeout}"
|
||||
|
||||
# +1 day from last modification of the disk image
|
||||
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
||||
${qemu.runQemu true forwardedPorts [
|
||||
"-boot" "order=c"
|
||||
"-snapshot"
|
||||
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
||||
"-rtc" "base=\\$CLOCK"
|
||||
"-display" "none"
|
||||
]} &
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate ${condaEnv} && ${testCommand}"
|
||||
|
||||
echo "Wait for Windows to boot"
|
||||
sleep 30
|
||||
${ssh "ver"}
|
||||
i=0
|
||||
for pkg in ${sipycoPkg}/noarch/sipyco*.tar.bz2 ${artiqPkg}/noarch/artiq*.tar.bz2 ; do
|
||||
${scp "\\$pkg" "to_install\\$i.tar.bz2"}
|
||||
${sshUnquoted "anaconda\\scripts\\activate ${condaEnv} && conda install to_install\\$i.tar.bz2"}
|
||||
((i=i+1))
|
||||
done
|
||||
|
||||
# Schedule a timed shutdown against hanging test runs
|
||||
${ssh "shutdown -s -t ${toString testTimeout}"}
|
||||
|
||||
FAIL=n
|
||||
( ${ssh "anaconda\\scripts\\activate ${condaEnv} && ${testCommand}"} ) || FAIL=y
|
||||
|
||||
# Abort timeouted shutdown
|
||||
${ssh "shutdown -a"}
|
||||
# Power off immediately
|
||||
${ssh "shutdown -p -f"}
|
||||
wait
|
||||
|
||||
if [ "\$FAIL" = "y" ]; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
EOF
|
||||
chmod a+x $out/bin/run.sh
|
||||
'';
|
||||
}
|
||||
# Abort timeouted shutdown
|
||||
${wfvm.utils.win-exec}/bin/win-exec "shutdown -a"
|
||||
'';
|
||||
}
|
||||
|
|
343
artiq-full.nix
343
artiq-full.nix
|
@ -1,119 +1,128 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{ a6p ? <a6p>
|
||||
, artiq-fast ? (
|
||||
if a6p
|
||||
then <artiq-board-generated/fast>
|
||||
else <artiq-fast>
|
||||
)
|
||||
, pkgs ? import (artiq-fast + "/pkgs/nixpkgs.nix") { inherit (import <nixpkgs> {}) fetchgit; } {}
|
||||
}:
|
||||
|
||||
let
|
||||
sinaraSystemsSrc = <sinaraSystemsSrc>;
|
||||
sinaraSystemsRev = builtins.readFile <artiq-board-generated/sinara-rev.txt>;
|
||||
sinaraSystemsHash = builtins.readFile <artiq-board-generated/sinara-hash.txt>;
|
||||
sinaraSystemsSrc =
|
||||
if a6p
|
||||
then pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||
rev = sinaraSystemsRev;
|
||||
sha256 = sinaraSystemsHash;
|
||||
}
|
||||
else <sinaraSystemsSrc>;
|
||||
artiqVersion = import (artiq-fast + "/pkgs/artiq-version.nix") {
|
||||
inherit (pkgs) stdenv git fetchgit;
|
||||
};
|
||||
targets = import ./artiq-full/artiq-targets.nix {
|
||||
inherit pkgs artiqVersion sinaraSystemsSrc;
|
||||
};
|
||||
kasliVariants = map ({ variant, ... }: variant) (
|
||||
builtins.filter ({ target, ... }: target == "kasli") (
|
||||
builtins.attrValues targets
|
||||
)
|
||||
);
|
||||
standaloneVariants = map ({ variant, ... }: variant) (
|
||||
builtins.filter ({ target, standalone ? false, ... }: target == "kasli" && standalone) (
|
||||
builtins.attrValues targets
|
||||
)
|
||||
);
|
||||
serializedTargets = pkgs.lib.generators.toPretty {} (
|
||||
map (conf:
|
||||
if conf ? buildCommand
|
||||
then conf // {
|
||||
buildCommand = builtins.replaceStrings ["$"] ["\\\\\\$"] conf.buildCommand;
|
||||
}
|
||||
else conf
|
||||
) (builtins.attrValues targets)
|
||||
);
|
||||
|
||||
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
|
||||
''
|
||||
mkdir $out
|
||||
|
||||
cp -a ${<artiq-fast>} $out/fast
|
||||
cp ${./artiq-full/conda-artiq-board.nix} $out/conda-artiq-board.nix
|
||||
cp ${./artiq-full/extras.nix} $out/extras.nix
|
||||
${if a6p
|
||||
then ''
|
||||
cp -a ${<artiq-board-generated>} $out/board-generated
|
||||
ln -s board-generated/fast $out/fast
|
||||
''
|
||||
else "cp -a ${<artiq-fast>} $out/fast"}
|
||||
cp ${./artiq-full}/artiq-board-vivado.nix $out
|
||||
cp ${./artiq-full}/generate-identifier.py $out
|
||||
cp ${./artiq-full}/conda-artiq-board.nix $out
|
||||
cp ${./artiq-full}/extras.nix $out
|
||||
cp ${./artiq-full}/*.patch $out
|
||||
|
||||
REV=`git --git-dir ${sinaraSystemsSrc}/.git rev-parse HEAD`
|
||||
SINARA_SRC_CLEAN=`mktemp -d`
|
||||
cp -a ${sinaraSystemsSrc}/. $SINARA_SRC_CLEAN
|
||||
chmod -R 755 $SINARA_SRC_CLEAN/.git
|
||||
chmod 755 $SINARA_SRC_CLEAN
|
||||
rm -rf $SINARA_SRC_CLEAN/.git
|
||||
HASH=`nix-hash --type sha256 --base32 $SINARA_SRC_CLEAN`
|
||||
${if a6p
|
||||
then ''
|
||||
REV=${sinaraSystemsRev}
|
||||
HASH=${sinaraSystemsHash}
|
||||
''
|
||||
else ''
|
||||
REV=`git --git-dir ${sinaraSystemsSrc}/.git rev-parse HEAD`
|
||||
SINARA_SRC_CLEAN=`mktemp -d`
|
||||
cp -a ${sinaraSystemsSrc}/. $SINARA_SRC_CLEAN
|
||||
chmod -R 755 $SINARA_SRC_CLEAN/.git
|
||||
chmod 755 $SINARA_SRC_CLEAN
|
||||
rm -rf $SINARA_SRC_CLEAN/.git
|
||||
HASH=`nix-hash --type sha256 --base32 $SINARA_SRC_CLEAN`
|
||||
''}
|
||||
cat > $out/default.nix << EOF
|
||||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{ pkgs ? import ./fast/pkgs/nixpkgs.nix { inherit (import <nixpkgs> {}) fetchgit; } {} }:
|
||||
|
||||
let
|
||||
artiq-fast = import ./fast { inherit pkgs; };
|
||||
artiq-fast = import ${if a6p then "./board-generated" else "."}/fast { inherit pkgs; };
|
||||
ddbDeps = [
|
||||
artiq-fast.artiq
|
||||
(pkgs.python3.withPackages (ps: [ ps.jsonschema ]))
|
||||
];
|
||||
|
||||
target = "kasli";
|
||||
variants = [
|
||||
"afmaster"
|
||||
"afsatellite"
|
||||
"berkeley2"
|
||||
"berkeley3"
|
||||
"csu"
|
||||
"duke"
|
||||
"duke2"
|
||||
"duke3"
|
||||
"femto1"
|
||||
"femto2"
|
||||
"femto3"
|
||||
"freiburg1"
|
||||
"griffith"
|
||||
"hub"
|
||||
"hw"
|
||||
"indiana"
|
||||
"innsbruck2"
|
||||
"ist"
|
||||
"liaf"
|
||||
"luh"
|
||||
"luh2"
|
||||
"luh3"
|
||||
"mikes"
|
||||
"mit"
|
||||
"mitll3"
|
||||
"mitll4master"
|
||||
"mitll4satellite"
|
||||
"mpik"
|
||||
"mpq"
|
||||
"nict"
|
||||
"nist"
|
||||
"no"
|
||||
"npl1"
|
||||
"npl2"
|
||||
"oklahoma"
|
||||
"olomouc"
|
||||
"opticlock"
|
||||
"oregon"
|
||||
"osaka"
|
||||
"ptb"
|
||||
"ptb2"
|
||||
"ptb3"
|
||||
"ptb4"
|
||||
"ptb5"
|
||||
"ptb6"
|
||||
"ptbal"
|
||||
"ptbin"
|
||||
"purdue"
|
||||
"qe"
|
||||
"rice"
|
||||
"saymamaster"
|
||||
"siegen"
|
||||
"su"
|
||||
"sydney"
|
||||
"uaarhus"
|
||||
"ubirmingham"
|
||||
"ugranada"
|
||||
"unlv"
|
||||
"unsw2"
|
||||
"ustc2"
|
||||
"vlbaimaster"
|
||||
"vlbaisatellite"
|
||||
"wipm"
|
||||
"wipm4"
|
||||
"wipm5master"
|
||||
"wipm5satellite"
|
||||
] ++ (pkgs.lib.lists.optionals (pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0") [
|
||||
"bonn1master"
|
||||
"bonn1satellite"
|
||||
"hw2master"
|
||||
"hw2satellite"
|
||||
"uamsterdam"
|
||||
]);
|
||||
kasliVariants = [${builtins.concatStringsSep " " (
|
||||
builtins.map (variant: "\"${variant}\"") kasliVariants
|
||||
)}];
|
||||
standaloneVariants = [${builtins.concatStringsSep " " (
|
||||
builtins.map (variant: "\"${variant}\"") standaloneVariants
|
||||
)}];
|
||||
|
||||
artiq-board = import ./fast/artiq-board.nix { inherit pkgs; };
|
||||
vivado = import ${if a6p then "./board-generated" else "."}/fast/vivado.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
artiq-board =
|
||||
${if a6p
|
||||
then ''
|
||||
import ./artiq-board-vivado.nix {
|
||||
inherit pkgs vivado;
|
||||
version = artiq-fast.artiq.version;
|
||||
board-generated = import ./board-generated {
|
||||
inherit pkgs;
|
||||
};
|
||||
}
|
||||
''
|
||||
else ''
|
||||
import ./fast/artiq-board.nix {
|
||||
inherit pkgs vivado;
|
||||
}
|
||||
''};
|
||||
conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; };
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||
rev = "$REV";
|
||||
sha256 = "$HASH";
|
||||
};
|
||||
generic-kasli = pkgs.lib.lists.foldr (variant: start:
|
||||
artiq-targets = pkgs.lib.lists.foldr (conf: start:
|
||||
let
|
||||
json = builtins.toPath (src + "/\''${variant}.json");
|
||||
boardBinaries = artiq-board {
|
||||
inherit target variant;
|
||||
buildCommand = "python -m artiq.gateware.targets.kasli_generic \''${json}";
|
||||
};
|
||||
inherit (conf) target variant;
|
||||
json = src + "/\''${variant}.json";
|
||||
boardBinaries = artiq-board (conf // {
|
||||
src = json;
|
||||
});
|
||||
in
|
||||
start // {
|
||||
"artiq-board-\''${target}-\''${variant}" = boardBinaries;
|
||||
|
@ -121,10 +130,13 @@ let
|
|||
boardBinaries = boardBinaries;
|
||||
inherit target variant;
|
||||
};
|
||||
} // (pkgs.lib.optionalAttrs ((builtins.fromJSON (builtins.readFile json)).base == "standalone") {
|
||||
} // (pkgs.lib.optionalAttrs (
|
||||
target == "kasli" &&
|
||||
builtins.elem variant standaloneVariants
|
||||
) {
|
||||
"device-db-\''${target}-\''${variant}" = pkgs.stdenv.mkDerivation {
|
||||
name = "device-db-\''${target}-\''${variant}";
|
||||
buildInputs = [ artiq-fast.artiq ];
|
||||
buildInputs = ddbDeps;
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase = "
|
||||
mkdir \$out
|
||||
|
@ -133,56 +145,64 @@ let
|
|||
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
|
||||
";
|
||||
};
|
||||
})) {} variants;
|
||||
})
|
||||
) {} ${serializedTargets};
|
||||
drtio-systems = {
|
||||
af = {
|
||||
master = "afmaster";
|
||||
satellites = {
|
||||
"1" = "afsatellite";
|
||||
${pkgs.lib.optionalString a6p ''
|
||||
berkeley3 = {
|
||||
master = "berkeley3master";
|
||||
satellites = {
|
||||
"1" = "berkeley3satellite";
|
||||
};
|
||||
};
|
||||
};
|
||||
mitll4 = {
|
||||
master = "mitll4master";
|
||||
satellites = {
|
||||
"1" = "mitll4satellite";
|
||||
bonn1 = {
|
||||
master = "bonn1master";
|
||||
satellites = {
|
||||
"1" = "bonn1satellite";
|
||||
};
|
||||
};
|
||||
};
|
||||
vlbai = {
|
||||
master = "vlbaimaster";
|
||||
satellites = {
|
||||
"1" = "vlbaisatellite";
|
||||
hw2 = {
|
||||
master = "hw2master";
|
||||
satellites = {
|
||||
"1" = "hw2satellite";
|
||||
};
|
||||
};
|
||||
};
|
||||
wipm5 = {
|
||||
master = "wipm5master";
|
||||
satellites = {
|
||||
"1" = "wipm5satellite";
|
||||
ptb3 = {
|
||||
master = "ptb3master";
|
||||
satellites = {
|
||||
"1" = "ptb3satellite";
|
||||
};
|
||||
};
|
||||
};
|
||||
} // (pkgs.lib.optionalAttrs (pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0") {
|
||||
bonn1 = {
|
||||
master = "bonn1master";
|
||||
satellites = {
|
||||
"1" = "bonn1satellite";
|
||||
purdue = {
|
||||
master = "purduemaster";
|
||||
satellites = {
|
||||
"1" = "purduesatellite";
|
||||
};
|
||||
};
|
||||
};
|
||||
hw2 = {
|
||||
master = "hw2master";
|
||||
satellites = {
|
||||
"1" = "hw2satellite";
|
||||
stfc = {
|
||||
master = "stfcmaster";
|
||||
satellites = {
|
||||
"1" = "stfcsatellite";
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
wipm7 = {
|
||||
master = "wipm7master";
|
||||
satellites = {
|
||||
"1" = "wipm7satellite";
|
||||
};
|
||||
};
|
||||
''}
|
||||
};
|
||||
drtio-ddbs = pkgs.lib.attrsets.mapAttrs'
|
||||
(system: crates: pkgs.lib.attrsets.nameValuePair ("device-db-" + system)
|
||||
(pkgs.stdenv.mkDerivation {
|
||||
name = "device-db-\''${system}";
|
||||
buildInputs = [ artiq-fast.artiq ];
|
||||
buildInputs = ddbDeps;
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase = "
|
||||
mkdir \$out
|
||||
artiq_ddb_template \
|
||||
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + src + "/" + desc + ".json") crates.satellites) } \
|
||||
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + (src + "/\''${desc}.json")) crates.satellites) } \
|
||||
\''${src}/\''${crates.master}.json -o \$out/device_db.py
|
||||
mkdir \$out/nix-support
|
||||
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
|
||||
|
@ -190,42 +210,7 @@ let
|
|||
})) drtio-systems;
|
||||
extras = import ./extras.nix { inherit pkgs; inherit (artiq-fast) sipyco asyncserial artiq; };
|
||||
in
|
||||
artiq-fast // generic-kasli // drtio-ddbs // extras // rec {
|
||||
artiq-board-sayma-rtm = artiq-board {
|
||||
target = "sayma";
|
||||
variant = "rtm";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_rtm";
|
||||
};
|
||||
artiq-board-sayma-satellite = artiq-board {
|
||||
target = "sayma";
|
||||
variant = "satellite";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_amc";
|
||||
};
|
||||
artiq-board-metlino-master = artiq-board {
|
||||
target = "metlino";
|
||||
variant = "master";
|
||||
buildCommand = "python -m artiq.gateware.targets.metlino";
|
||||
};
|
||||
artiq-board-kc705-nist_qc2 = artiq-board {
|
||||
target = "kc705";
|
||||
variant = "nist_qc2";
|
||||
};
|
||||
|
||||
conda-artiq-board-sayma-rtm = conda-artiq-board {
|
||||
target = "sayma";
|
||||
variant = "rtm";
|
||||
boardBinaries = artiq-board-sayma-rtm;
|
||||
};
|
||||
conda-artiq-board-sayma-satellite = conda-artiq-board {
|
||||
target = "sayma";
|
||||
variant = "satellite";
|
||||
boardBinaries = artiq-board-sayma-satellite;
|
||||
};
|
||||
conda-artiq-board-metlino-master = conda-artiq-board {
|
||||
target = "metlino";
|
||||
variant = "master";
|
||||
boardBinaries = artiq-board-metlino-master;
|
||||
};
|
||||
artiq-fast // artiq-targets // drtio-ddbs // extras // rec {
|
||||
conda-artiq-board-kasli-tester = conda-artiq-board {
|
||||
target = "kasli";
|
||||
variant = "tester";
|
||||
|
@ -236,34 +221,28 @@ let
|
|||
variant = "nist_clock";
|
||||
boardBinaries = artiq-fast.artiq-board-kc705-nist_clock;
|
||||
};
|
||||
conda-artiq-board-kc705-nist_qc2 = conda-artiq-board {
|
||||
target = "kc705";
|
||||
variant = "nist_qc2";
|
||||
boardBinaries = artiq-board-kc705-nist_qc2;
|
||||
};
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
pythonDeps = import ./artiq-full/python-deps.nix { inherit pkgs; };
|
||||
sipycoManualPackages = import ./artiq-full/sipyco-manual.nix {
|
||||
inherit (pkgs) stdenv lib python3Packages texlive texinfo;
|
||||
inherit (import <artiq-fast> { inherit pkgs; }) sipyco;
|
||||
inherit (import artiq-fast { inherit pkgs; }) sipyco;
|
||||
};
|
||||
artiqManualPackages = import ./artiq-full/artiq-manual.nix {
|
||||
inherit (pkgs) stdenv lib fetchgit git python3Packages texlive texinfo;
|
||||
inherit (pythonDeps) sphinxcontrib-wavedrom;
|
||||
inherit artiq-fast;
|
||||
};
|
||||
jobs = (import generatedNix { inherit pkgs; }) // sipycoManualPackages // artiqManualPackages // {
|
||||
# This is in the example in the ARTIQ manual - precompile it to speed up
|
||||
# installation for users.
|
||||
matplotlib-qt = pkgs.lib.hydraJob (pkgs.python3Packages.matplotlib.override { enableQt = true; });
|
||||
};
|
||||
artiq-full = import generatedNix { inherit pkgs; };
|
||||
exampleUserEnv = import ./artiq-full/example-user-env.nix { inherit pkgs artiq-full; };
|
||||
jobs = artiq-full // sipycoManualPackages // artiqManualPackages // exampleUserEnv;
|
||||
in
|
||||
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs // {
|
||||
artiq-full = pkgs.releaseTools.channel {
|
||||
name = "artiq-full";
|
||||
src = generatedNix;
|
||||
constituents = builtins.attrValues jobs;
|
||||
constituents = [];
|
||||
};
|
||||
conda-channel = import ./artiq-full/conda-channel.nix { inherit pkgs; } { inherit jobs; };
|
||||
conda-channel = import ./artiq-full/conda-channel.nix { inherit pkgs artiq-fast; } { inherit jobs; };
|
||||
}
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
# Install Vivado in /opt and add to /etc/nixos/configuration.nix:
|
||||
# nix.sandboxPaths = ["/opt"];
|
||||
|
||||
{ pkgs
|
||||
, vivado ? import ./fast/vivado.nix { inherit pkgs; }
|
||||
, board-generated
|
||||
, version
|
||||
}:
|
||||
|
||||
let
|
||||
# Funnelling the source code through a Nix string allows dropping
|
||||
# all dependencies via `unsafeDiscardStringContext`.
|
||||
discardContextFromPath = { name, src }:
|
||||
let
|
||||
packed = pkgs.stdenv.mkDerivation {
|
||||
name = "${name}.nar.base64";
|
||||
buildInputs = [ pkgs.nix ];
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = "nix-store --dump ${src} | base64 -w0 > $out";
|
||||
};
|
||||
unpacked = archive:
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
name = builtins.unsafeDiscardStringContext name;
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
buildInputs = [ pkgs.nix ];
|
||||
installPhase = "base64 -d < ${archive} | nix-store --restore $out";
|
||||
};
|
||||
in
|
||||
unpacked (
|
||||
builtins.toFile "${builtins.unsafeDiscardStringContext name}.nar.base64" (
|
||||
builtins.unsafeDiscardStringContext (
|
||||
builtins.readFile packed
|
||||
))) ;
|
||||
in
|
||||
{ target
|
||||
, variant
|
||||
, extraInstallCommands ? ""
|
||||
, ... }:
|
||||
let
|
||||
name = "artiq-board-${target}-${variant}-${version}";
|
||||
installPath = builtins.unsafeDiscardStringContext "${pkgs.python3Packages.python.sitePackages}/artiq/board-support/${target}-${variant}";
|
||||
|
||||
generated = board-generated."artiq-board-${target}-${variant}";
|
||||
|
||||
identifierStr = "${version};${variant}";
|
||||
identifiers = import (
|
||||
pkgs.runCommandLocal "${name}-identifiers.nix" {
|
||||
buildInputs = [ pkgs.python3 ];
|
||||
} ''python ${./generate-identifier.py} "${identifierStr}" > $out''
|
||||
);
|
||||
|
||||
# Depends on just Vivado and the generated Bitstream source
|
||||
vivadoCheckpoint = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = builtins.unsafeDiscardStringContext "${name}-vivado-checkpoint";
|
||||
|
||||
src = discardContextFromPath {
|
||||
name = "${name}-gateware";
|
||||
src = "${generated}/gateware";
|
||||
};
|
||||
buildInputs = [ vivado pkgs.nix ];
|
||||
buildPhase = ''
|
||||
vivado -mode batch -source top_route.tcl
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
|
||||
chmod a+r top_route.dcp
|
||||
cp top_route.dcp $out
|
||||
cp top_bitstream.tcl $out
|
||||
'';
|
||||
};
|
||||
|
||||
vivadoOutput = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = builtins.unsafeDiscardStringContext "${name}-vivado-output";
|
||||
src = vivadoCheckpoint;
|
||||
buildInputs = [ vivado ];
|
||||
buildPhase =
|
||||
''
|
||||
cat >top.tcl <<EOF
|
||||
open_checkpoint top_route.dcp
|
||||
'' +
|
||||
(pkgs.lib.concatMapStrings ({ cell, init }:
|
||||
''
|
||||
set_property INIT ${init} [get_cell ${cell}]
|
||||
''
|
||||
) identifiers) +
|
||||
''
|
||||
source "top_bitstream.tcl"
|
||||
EOF
|
||||
vivado -mode batch -source top.tcl
|
||||
'';
|
||||
installPhase = ''
|
||||
TARGET_DIR=$out/${installPath}
|
||||
mkdir -p $TARGET_DIR
|
||||
chmod a+r top.bit
|
||||
cp top.bit $TARGET_DIR/
|
||||
'';
|
||||
|
||||
# temporarily disabled because there is currently always at least one Kasli bitstream
|
||||
# that fails timing and blocks the conda channel.
|
||||
doCheck = false;
|
||||
checkPhase = ''
|
||||
# Search for PCREs in the Vivado output to check for errors
|
||||
check_log() {
|
||||
set +e
|
||||
grep -Pe "$1" vivado.log
|
||||
FOUND=$?
|
||||
set -e
|
||||
if [ $FOUND != 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
check_log "\d+ constraint not met\."
|
||||
check_log "Timing constraints are not met\."
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.python3Packages.toPythonModule (
|
||||
pkgs.buildEnv rec {
|
||||
inherit name;
|
||||
paths = [ generated vivadoOutput ];
|
||||
pathsToLink = [ "/${installPath}" ];
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
{ stdenv, lib, fetchgit, git, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom }:
|
||||
{ stdenv, lib, fetchgit, git, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom, artiq-fast }:
|
||||
|
||||
let
|
||||
artiqVersion = import <artiq-fast/pkgs/artiq-version.nix> { inherit stdenv fetchgit git; };
|
||||
artiqVersion = import (artiq-fast + "/pkgs/artiq-version.nix") { inherit stdenv fetchgit git; };
|
||||
|
||||
isLatexPdfTarget = target: builtins.match "latexpdf.*" target != null;
|
||||
|
||||
|
@ -16,7 +16,7 @@ let
|
|||
name = "artiq-manual-${target}-${version}";
|
||||
version = artiqVersion;
|
||||
|
||||
src = import <artiq-fast/pkgs/artiq-src.nix> { inherit fetchgit; };
|
||||
src = import (artiq-fast + "/pkgs/artiq-src.nix") { inherit fetchgit; };
|
||||
buildInputs = [
|
||||
python3Packages.sphinx python3Packages.sphinx_rtd_theme
|
||||
python3Packages.sphinx-argparse sphinxcontrib-wavedrom
|
||||
|
@ -26,7 +26,7 @@ let
|
|||
|
||||
preBuild = ''
|
||||
export VERSIONEER_OVERRIDE=${artiqVersion}
|
||||
export SOURCE_DATE_EPOCH=${import <artiq-fast/pkgs/artiq-timestamp.nix> { inherit stdenv fetchgit git; }}
|
||||
export SOURCE_DATE_EPOCH=${import (artiq-fast + "/pkgs/artiq-timestamp.nix") { inherit stdenv fetchgit git; }}
|
||||
cd doc/manual
|
||||
'';
|
||||
makeFlags = [ target ];
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
{ pkgs
|
||||
, artiqVersion
|
||||
, sinaraSystemsSrc
|
||||
}:
|
||||
|
||||
let
|
||||
jsons =
|
||||
map (jsonFile: builtins.fromJSON (
|
||||
builtins.readFile (sinaraSystemsSrc + "/${jsonFile}")
|
||||
)) (
|
||||
builtins.attrNames (
|
||||
pkgs.lib.filterAttrs (name: type:
|
||||
type != "directory" &&
|
||||
builtins.match ".+\\.json" name != null
|
||||
) (builtins.readDir sinaraSystemsSrc)
|
||||
)
|
||||
);
|
||||
kasli = builtins.listToAttrs (
|
||||
builtins.map ({ variant, base, ... }: {
|
||||
name = "artiq-board-kasli-${variant}";
|
||||
value = {
|
||||
target = "kasli";
|
||||
inherit variant;
|
||||
src = sinaraSystemsSrc + "/${variant}.json";
|
||||
buildCommand = "python -m artiq.gateware.targets.kasli_generic $src";
|
||||
standalone = base == "standalone";
|
||||
};
|
||||
}) (
|
||||
builtins.filter (json:
|
||||
pkgs.lib.strings.versionAtLeast artiqVersion (
|
||||
if json ? min_artiq_version
|
||||
then json.min_artiq_version
|
||||
else "0"
|
||||
)
|
||||
) jsons
|
||||
)
|
||||
);
|
||||
in
|
||||
kasli // {
|
||||
artiq-board-sayma-rtm = {
|
||||
target = "sayma";
|
||||
variant = "rtm";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_rtm";
|
||||
};
|
||||
artiq-board-sayma-satellite = {
|
||||
target = "sayma";
|
||||
variant = "satellite";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_amc";
|
||||
};
|
||||
artiq-board-metlino-master = {
|
||||
target = "metlino";
|
||||
variant = "master";
|
||||
buildCommand = "python -m artiq.gateware.targets.metlino";
|
||||
};
|
||||
artiq-board-kc705-nist_qc2 = {
|
||||
target = "kc705";
|
||||
variant = "nist_qc2";
|
||||
};
|
||||
} // (pkgs.lib.optionalAttrs (pkgs.lib.strings.versionAtLeast artiqVersion "6.0") {
|
||||
artiq-board-sayma-satellite-st = {
|
||||
target = "sayma";
|
||||
variant = "satellite";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_amc --jdcg-type syncdds";
|
||||
};
|
||||
})
|
|
@ -1,8 +1,8 @@
|
|||
{ pkgs }:
|
||||
{ pkgs, artiq-fast }:
|
||||
{ jobs }:
|
||||
|
||||
let
|
||||
condaBuilderEnv = import <artiq-fast/conda/builder-env.nix> { inherit pkgs; };
|
||||
condaBuilderEnv = import (artiq-fast + "/conda/builder-env.nix") { inherit pkgs; };
|
||||
in
|
||||
pkgs.runCommand "conda-channel" { }
|
||||
''
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
{ pkgs, artiq-full }:
|
||||
let
|
||||
matplotlib-qt = (pkgs.python3Packages.matplotlib.override { enableQt = true; });
|
||||
in
|
||||
{
|
||||
artiq-example-user-env = pkgs.runCommand "artiq-example-user-env" {
|
||||
buildInputs = [
|
||||
(pkgs.python3.withPackages(ps: [
|
||||
artiq-full.artiq
|
||||
artiq-full.artiq-comtools
|
||||
artiq-full.wand
|
||||
artiq-full.flake8-artiq
|
||||
artiq-full.lda
|
||||
artiq-full.korad_ka3005p
|
||||
artiq-full.novatech409b
|
||||
artiq-full.thorlabs_tcube
|
||||
artiq-full.artiq-board-kc705-nist_clock
|
||||
artiq-full.artiq-board-kasli-oregon
|
||||
ps.paramiko
|
||||
ps.pandas
|
||||
ps.numpy
|
||||
ps.scipy
|
||||
ps.numba
|
||||
ps.bokeh
|
||||
matplotlib-qt
|
||||
# cirq is broken and doesn't build (as of 20.09.3281.06b11191834)
|
||||
#(ps.cirq.override { matplotlib = matplotlib-qt; })
|
||||
# qiskit does not work with matplotlib-qt
|
||||
#ps.qiskit
|
||||
]))
|
||||
|
||||
artiq-full.openocd
|
||||
pkgs.gtkwave
|
||||
#pkgs.spyder # broken on 20.03
|
||||
pkgs.R
|
||||
];
|
||||
} "touch $out";
|
||||
}
|
|
@ -3,13 +3,20 @@ let
|
|||
condaBuild = import ./fast/conda/build.nix { inherit pkgs; };
|
||||
condaFakeSource = import ./fast/conda/fake-source.nix { inherit pkgs; };
|
||||
dualPackage = (
|
||||
{ name, version, src, pythonOptions ? {}, condaOptions ? {}}:
|
||||
{ name, version, src, pythonOptions ? {}, condaOptions ? {}, withManual ? true}:
|
||||
{
|
||||
"${name}" = pkgs.python3Packages.buildPythonPackage ({
|
||||
inherit version;
|
||||
name = "${name}-${version}";
|
||||
inherit src;
|
||||
} // pythonOptions);
|
||||
"conda-${name}" = condaBuild {
|
||||
name = "conda-${name}";
|
||||
src = condaFakeSource ({
|
||||
inherit name version src;
|
||||
} // condaOptions);
|
||||
};
|
||||
} // (pkgs.lib.optionalAttrs withManual {
|
||||
"${name}-manual-html" = pkgs.stdenv.mkDerivation {
|
||||
name = "${name}-manual-html-${version}";
|
||||
inherit version src;
|
||||
|
@ -31,13 +38,7 @@ let
|
|||
echo doc manual ${dest}/html index.html >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
"conda-${name}" = condaBuild {
|
||||
name = "conda-${name}";
|
||||
src = condaFakeSource ({
|
||||
inherit name version src;
|
||||
} // condaOptions);
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
# https://github.com/m-labs/artiq/issues/23
|
||||
hidapi = pkgs.hidapi.overrideAttrs (oa: {
|
||||
|
@ -55,8 +56,8 @@ in
|
|||
src = pkgs.fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "korad_ka3005p";
|
||||
rev = "a0cfaa5792a211e166d224314c4d0be4881b9b8d";
|
||||
sha256 = "1bxzyjyvdhsbm9hj7ypf0vgkd1lvc340bb6lx3wchvh30n7bv9gv";
|
||||
rev = "a1898409cb188b388ed1cf84e76ca69e9c8a74eb";
|
||||
sha256 = "0h20qss70nssqiagc2fx75mravq1pji7rizhag3nq8xrcz2w20nc";
|
||||
};
|
||||
pythonOptions = { propagatedBuildInputs = [ sipyco asyncserial ]; };
|
||||
condaOptions = { dependencies = [ "sipyco" "asyncserial" ]; };
|
||||
|
@ -66,8 +67,8 @@ in
|
|||
src = pkgs.fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "novatech409b";
|
||||
rev = "8740b3e7b254e03395135e6bc128bbaca70d4fbb";
|
||||
sha256 = "0mwm434y83y8jb30fpz69z6z3b6sxbc8dv3nw0hq4wc7iginx89d";
|
||||
rev = "3bd559753972f07d881df66b7c6819afc5436053";
|
||||
sha256 = "1g9qv6fn5h7d393mb1v7w8sg6fimqg34blqdj22qnayb4agw1wyg";
|
||||
};
|
||||
pythonOptions = { propagatedBuildInputs = [ sipyco asyncserial ]; };
|
||||
condaOptions = { dependencies = [ "sipyco" "asyncserial" ]; };
|
||||
|
@ -77,8 +78,8 @@ in
|
|||
src = pkgs.fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "lda";
|
||||
rev = "6138a94a1116c8f7b40b8bd8bb161f847065aab6";
|
||||
sha256 = "1009k9pq8wx5zxrljkxr1g95g8q979i7mq3csksdkd3d0v2jvqif";
|
||||
rev = "e6bf828b6dfd7fbf59b61b691712736c98c95970";
|
||||
sha256 = "1w4ykzsl3386bz4ggpd6i60b6a3k7rnc6qjw59xm3hk0vs3w2vyn";
|
||||
};
|
||||
pythonOptions = {
|
||||
propagatedBuildInputs = [ sipyco ];
|
||||
|
@ -95,8 +96,8 @@ in
|
|||
src = pkgs.fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "thorlabs_tcube";
|
||||
rev = "8b85292d76a69ae72ba8da32b894c87c794574ba";
|
||||
sha256 = "09cy9nhydcwdib21wb0qg1cinvibfbszwgphrmf2ajw5kqpr1d6a";
|
||||
rev = "0cb0c15fc7e660a150e193245f5338d48f8b97db";
|
||||
sha256 = "1n4zmjcj2kpd97217y602pq6x8s80w39fgyi6qjmal92aicqdg07";
|
||||
};
|
||||
pythonOptions = { propagatedBuildInputs = [ sipyco asyncserial ]; };
|
||||
condaOptions = { dependencies = [ "sipyco" "asyncserial" ]; };
|
||||
|
@ -194,6 +195,9 @@ in
|
|||
sha256 = "165j12k9nnrkf2pv0idcv6xhnp1hnsllna4rps2dssnqgjfaw1ss";
|
||||
};
|
||||
propagatedBuildInputs = [ sipyco pkgs.python3Packages.numpy pkgs.python3Packages.aiohttp ];
|
||||
# Modifies PATH to pass the wrapped python environment (i.e. python3.withPackages(...) to subprocesses.
|
||||
# Allows subprocesses using python to find all packages you have installed
|
||||
makeWrapperArgs = [ ''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' '' ];
|
||||
};
|
||||
conda-artiq-comtools = condaBuild {
|
||||
name = "conda-artiq-comtools";
|
||||
|
@ -203,4 +207,42 @@ in
|
|||
dependencies = [ "sipyco" "numpy" "aiohttp >=3" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
} // {
|
||||
wand = pkgs.python3Packages.buildPythonApplication rec {
|
||||
name = "wand";
|
||||
version = "0.4.dev";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "OxfordIonTrapGroup";
|
||||
repo = "wand";
|
||||
rev = "0bf1cfef4aa37e5761c20ac8702abec125b45e23";
|
||||
sha256 = "0jfw6w6id7qkx2f6rklrmp13b2hsnvii1qbls60ampx399lcb43g";
|
||||
};
|
||||
patches = [ ./wand-fix-config-dir.patch ];
|
||||
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
|
||||
dontWrapQtApps = true;
|
||||
postFixup = ''
|
||||
wrapQtApp "$out/bin/wand_gui"
|
||||
'';
|
||||
propagatedBuildInputs = with pkgs.python3Packages; [ artiq quamash numpy scipy influxdb setuptools ];
|
||||
};
|
||||
} // (dualPackage {
|
||||
name = "flake8-artiq";
|
||||
version = "0.1.0";
|
||||
withManual = false;
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gitlab.com/duke-artiq/flake8-artiq.git";
|
||||
rev = "3d011bdadc41bb5d4b7e536fbfdb3744d9d9a6de";
|
||||
sha256 = "1i6vk2j97fr1fnm6lzi5n33l6ldvcyfjgfxgr59pcpbz6xhbbgp2";
|
||||
};
|
||||
pythonOptions = {
|
||||
propagatedBuildInputs = [ pkgs.python3Packages.flake8 ];
|
||||
checkInputs = [ pkgs.python3Packages.pytest pkgs.python3Packages.mypy pkgs.python3Packages.flake8 ];
|
||||
checkPhase =
|
||||
''
|
||||
pytest
|
||||
mypy
|
||||
flake8
|
||||
'';
|
||||
};
|
||||
condaOptions = { dependencies = [ "flake8" ]; };
|
||||
})
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Encodes data like ARTIQ build_soc.py ReprogrammableIdentifier
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
raise ValueError('argument missing')
|
||||
|
||||
identifier_str = sys.argv[1]
|
||||
contents = list(identifier_str.encode())
|
||||
l = len(contents)
|
||||
if l > 255:
|
||||
raise ValueError("Identifier string must be 255 characters or less")
|
||||
contents.insert(0, l)
|
||||
|
||||
f = sys.stdout
|
||||
f.write("[\n");
|
||||
for i in range(7):
|
||||
init = sum(1 << j if c & (1 << i) else 0 for j, c in enumerate(contents))
|
||||
f.write(
|
||||
' {{ cell = "identifier_str{}"; init = "256\'h{:X}"; }}\n'.format(i, init)
|
||||
)
|
||||
f.write("]\n");
|
|
@ -3,18 +3,18 @@
|
|||
rec {
|
||||
wavedrom = pkgs.python3Packages.buildPythonPackage rec {
|
||||
pname = "wavedrom";
|
||||
version = "0.1";
|
||||
version = "2.0.3.post2";
|
||||
|
||||
src = pkgs.python3Packages.fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "006w683zlmmwcw5xz1n5dwg34ims5jg3gl2700ql4wr0myjz6710";
|
||||
sha256 = "13a4086417nv836s2wbj3f4r31gwapbyw5smgl00jsqizwsk96r3";
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.python3Packages.setuptools_scm ];
|
||||
propagatedBuildInputs = with pkgs.python3Packages; [ svgwrite attrdict ];
|
||||
doCheck = false;
|
||||
|
||||
meta = with pkgs.stdenv.lib; {
|
||||
meta = with pkgs.lib; {
|
||||
description = "WaveDrom compatible Python module and command line";
|
||||
homepage = "https://pypi.org/project/wavedrom/";
|
||||
license = licenses.mit;
|
||||
|
@ -23,18 +23,18 @@ rec {
|
|||
|
||||
sphinxcontrib-wavedrom = pkgs.python3Packages.buildPythonPackage rec {
|
||||
pname = "sphinxcontrib-wavedrom";
|
||||
version = "2.0.0";
|
||||
version = "2.1.1";
|
||||
|
||||
src = pkgs.python3Packages.fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "0nk36zqq5ipxqx9izz2iazb3iraasanv3nm05bjr21gw42zgkz22";
|
||||
sha256 = "09xq4csdcil2x8mm38yd5k6lfbkazicvm278xnzwbfc9vghkqqs2";
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.python3Packages.setuptools_scm ];
|
||||
propagatedBuildInputs = [ wavedrom ] ++ (with pkgs.python3Packages; [ sphinx xcffib cairosvg ]);
|
||||
doCheck = false;
|
||||
|
||||
meta = with pkgs.stdenv.lib; {
|
||||
meta = with pkgs.lib; {
|
||||
description = "A Sphinx extension that allows including WaveDrom diagrams";
|
||||
homepage = "https://pypi.org/project/sphinxcontrib-wavedrom/";
|
||||
license = licenses.mit;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/wand/tools.py b/wand/tools.py
|
||||
index a51dabd..4d5a9d1 100644
|
||||
--- a/wand/tools.py
|
||||
+++ b/wand/tools.py
|
||||
@@ -6,6 +6,7 @@ import shutil
|
||||
import logging
|
||||
|
||||
from sipyco import pyon
|
||||
+from artiq.appdirs import user_config_dir
|
||||
import wand
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -26,10 +27,15 @@ class LockException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
+def get_user_config_dir():
|
||||
+ dir = user_config_dir("wand", "oitg", "1")
|
||||
+ os.makedirs(dir, exist_ok=True)
|
||||
+ return dir
|
||||
+
|
||||
+
|
||||
def get_config_path(args, name_suffix=""):
|
||||
config_file = "{}{}_config.pyon".format(args.name, name_suffix)
|
||||
- wand_dir = os.path.dirname(wand.__file__)
|
||||
- config_path = os.path.join(wand_dir, config_file)
|
||||
+ config_path = os.path.join(get_user_config_dir(), config_file)
|
||||
|
||||
if args.backup_dir == "":
|
||||
backup_path = ""
|
|
@ -1,14 +1,15 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
artiqpkgs = import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) stdenv fetchFromGitHub python3Packages; };
|
||||
artiqpkgs = import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) stdenv fetchgit fetchFromGitHub python3Packages; misoc-new = true; };
|
||||
ise = import ./ise.nix { inherit pkgs; };
|
||||
vivado = import ../artiq-fast/vivado.nix { inherit pkgs; };
|
||||
buildUrukulCpld = {version, src}: pkgs.stdenv.mkDerivation {
|
||||
name = "urukul-cpld-${version}";
|
||||
inherit src;
|
||||
pname = "urukul-cpld";
|
||||
inherit src version;
|
||||
buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen]))] ++ (builtins.attrValues ise);
|
||||
phases = ["buildPhase" "installPhase"];
|
||||
buildPhase = "python $src/urukul_impl.py";
|
||||
installPhase =
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp build/urukul.jed $out
|
||||
|
@ -16,12 +17,12 @@ let
|
|||
'';
|
||||
};
|
||||
buildMirnyCpld = {version, src}: pkgs.stdenv.mkDerivation {
|
||||
name = "mirny-cpld-${version}";
|
||||
inherit src;
|
||||
pname = "mirny-cpld";
|
||||
inherit src version;
|
||||
buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen]))] ++ (builtins.attrValues ise);
|
||||
phases = ["buildPhase" "installPhase"];
|
||||
buildPhase = "python $src/mirny_impl.py";
|
||||
installPhase =
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp build/mirny.jed $out
|
||||
|
@ -43,6 +44,15 @@ in
|
|||
sha256 = "1962jpzqzn22cwkcmfnvwqlj5i89pljhgfk64n6pk73clir9mp0w";
|
||||
};
|
||||
};
|
||||
urukul-cpld-legacy = buildUrukulCpld rec {
|
||||
version = "1.3.1";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "quartiq";
|
||||
repo = "urukul";
|
||||
rev = "v${version}";
|
||||
sha256 = "1nvarspqbf9f7b27j34jkkh4mj6rwrlmccmfpz5nnzk3h2j6zbqc";
|
||||
};
|
||||
};
|
||||
mirny-cpld-master = buildMirnyCpld {
|
||||
version = "master";
|
||||
src = <mirnySrc>;
|
||||
|
@ -69,4 +79,27 @@ in
|
|||
echo file binary-dist $out/fastino.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
phaser-fpga = pkgs.stdenv.mkDerivation {
|
||||
name = "phaser-fpga";
|
||||
src = <phaserSrc>;
|
||||
patchPhase = ''
|
||||
substituteInPlace phaser.py \
|
||||
--replace "source ../load.tcl" \
|
||||
""
|
||||
'';
|
||||
|
||||
buildInputs = [ (pkgs.python3.withPackages(ps: [ artiqpkgs.migen artiqpkgs.misoc ])) ] ++ [ vivado ];
|
||||
buildPhase = "python phaser.py";
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp build/phaser.bit $out
|
||||
echo file binary-dist $out/phaser.bit >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
dontFixup = true;
|
||||
|
||||
doCheck = true;
|
||||
checkInputs = [ pkgs.python3Packages.pytest ];
|
||||
checkPhase = "pytest";
|
||||
};
|
||||
}
|
||||
|
|
197
hydra/artiq.json
197
hydra/artiq.json
|
@ -1,16 +1,187 @@
|
|||
{
|
||||
"enabled": 1,
|
||||
"hidden": true,
|
||||
"description": "js",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "hydra/artiq.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false }
|
||||
"fast-beta": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git master 1", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"board-generated-beta": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Generated code for ARTIQ boards (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-board-generated",
|
||||
"checkinterval": 14400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-beta:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full-beta": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"a6p": { "type": "boolean", "value": "true" },
|
||||
"artiq-board-generated": { "type": "sysbuild", "value": "artiq:board-generated-beta:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
|
||||
"fast": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git release-6 1", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"board-generated": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Generated code for ARTIQ boards",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-board-generated",
|
||||
"checkinterval": 14400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"a6p": { "type": "boolean", "value": "true" },
|
||||
"artiq-board-generated": { "type": "sysbuild", "value": "artiq:board-generated:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
|
||||
"fast-legacy": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes (legacy version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git release-5 1", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full-legacy": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages (legacy version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"a6p": { "type": "boolean", "value": "false" },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-legacy:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
|
||||
"gluelogic": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Glue logic gateware for Sinara devices",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "gluelogic.nix",
|
||||
"checkinterval": 172800,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"urukulSrc": { "type": "git", "value": "git://github.com/quartiq/urukul", "emailresponsible": false },
|
||||
"mirnySrc": { "type": "git", "value": "git://github.com/quartiq/mirny", "emailresponsible": false },
|
||||
"fastinoSrc": { "type": "git", "value": "git://github.com/quartiq/fastino", "emailresponsible": false },
|
||||
"phaserSrc": { "type": "git", "value": "git://github.com/quartiq/phaser", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
|
||||
"zynq": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "ARTIQ on Zynq",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "zynq.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/astro/nix-scripts.git", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast:generated-nix", "emailresponsible": false },
|
||||
"zynq-rs": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/zynq-rs.git", "emailresponsible": false },
|
||||
"artiq-zynq": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/artiq-zynq.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
119
hydra/artiq.nix
119
hydra/artiq.nix
|
@ -1,119 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{
|
||||
jobsets = pkgs.runCommand "spec.json" {}
|
||||
''
|
||||
cat > $out << EOF
|
||||
{
|
||||
"fast-beta": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git master 1", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full-beta": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-beta:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"fast": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git release-5 1", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"gluelogic": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Glue logic gateware for Sinara devices",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "gluelogic.nix",
|
||||
"checkinterval": 172800,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"urukulSrc": { "type": "git", "value": "git://github.com/quartiq/urukul", "emailresponsible": false },
|
||||
"mirnySrc": { "type": "git", "value": "git://github.com/quartiq/mirny", "emailresponsible": false },
|
||||
"fastinoSrc": { "type": "git", "value": "git://github.com/quartiq/fastino", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"zynq": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "ARTIQ on the Zynq-based ZC706 board",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "zynq.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"mozillaOverlay": { "type": "git", "value": "git://github.com/mozilla/nixpkgs-mozilla", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-beta:generated-nix", "emailresponsible": false },
|
||||
"zc706": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/zc706.git", "emailresponsible": false },
|
||||
"artiq-zynq": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/artiq-zynq.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"enabled": 1,
|
||||
"hidden": true,
|
||||
"description": "js",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "hydra/fpga.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-19.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{
|
||||
jobsets = pkgs.runCommand "spec.json" {}
|
||||
''
|
||||
cat > $out << EOF
|
||||
{
|
||||
"heavyx": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "HeavyX SoC toolkit experiment",
|
||||
"nixexprinput": "heavyx",
|
||||
"nixexprpath": "release.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-19.03", "emailresponsible": false },
|
||||
"heavyx": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/HeavyX.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"mcu": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "MCU firmware",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "mcu.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"mozillaOverlay": { "type": "git", "value": "git://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"stabilizerSrc": { "type": "git", "value": "git://github.com/quartiq/stabilizer.git", "emailresponsible": false },
|
||||
"thermostatSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/thermostat.git", "emailresponsible": false },
|
||||
"humpbackDdsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/humpback-dds.git", "emailresponsible": false },
|
||||
"saymaMmcSrc": { "type": "git", "value": "git://github.com/sinara-hw/openMMC sayma-devel", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"enabled": 1,
|
||||
"hidden": true,
|
||||
"description": "js",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "hydra/stm32.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{
|
||||
jobsets = pkgs.runCommand "spec.json" {}
|
||||
''
|
||||
cat > $out << EOF
|
||||
{
|
||||
"stm32": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "STM32 firmware",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "stm32.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"mozillaOverlay": { "type": "git", "value": "git://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"stabilizerSrc": { "type": "git", "value": "git://github.com/quartiq/stabilizer.git", "emailresponsible": false },
|
||||
"thermostatSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/thermostat.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
}
|
|
@ -1,16 +1,19 @@
|
|||
{
|
||||
"enabled": 1,
|
||||
"hidden": true,
|
||||
"description": "js",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "hydra/web.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false }
|
||||
"web": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "M-Labs website",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "web.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{
|
||||
jobsets = pkgs.runCommand "spec.json" {}
|
||||
''
|
||||
cat > $out << EOF
|
||||
{
|
||||
"web": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "M-Labs website",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "web.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-20.03", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
let
|
||||
jobs = import ./mcu/default.nix {
|
||||
mozillaOverlay = import <mozillaOverlay>;
|
||||
};
|
||||
in
|
||||
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,105 @@
|
|||
{ # Use master branch of the overlay by default
|
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
||||
rustManifest ? ./channel-rust-nightly.toml
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix {
|
||||
inherit rustManifest;
|
||||
});
|
||||
buildStm32Firmware = { name, src, patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", ... } @ args:
|
||||
let
|
||||
# If binaryName is specified as an arg of buildStm32Firmware,
|
||||
# then the .nix containing the cargoSha256 must be named "cargosha256-${binaryName}.nix";
|
||||
# otherwise, the .nix must be named "cargosha256.nix".
|
||||
cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''
|
||||
cp "${src}/cargosha256${
|
||||
if (args ? binaryName) then "-" + args.binaryName else ""
|
||||
}.nix" $out
|
||||
'';
|
||||
# If binaryName is specified as an arg of buildStm32Firmware,
|
||||
# then use it as the filename of the ELF generated from `cargo build`;
|
||||
# otherwise, use the `name` arg (i.e. the Rust package name) as the ELF filename.
|
||||
binaryName = if (args ? binaryName) then args.binaryName else name;
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
inherit name;
|
||||
version = "0.0.0";
|
||||
|
||||
inherit src;
|
||||
cargoSha256 = (import cargoSha256Drv);
|
||||
|
||||
inherit patchPhase;
|
||||
nativeBuildInputs = [ pkgs.llvm ] ++ extraNativeBuildInputs;
|
||||
buildPhase = ''
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
cargo build --release
|
||||
'';
|
||||
|
||||
inherit checkPhase;
|
||||
installPhase = ''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp target/thumbv7em-none-eabihf/release/${binaryName} $out/${name}.elf
|
||||
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
|
||||
llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/${binaryName} $out/${name}.bin
|
||||
echo file binary-dist $out/${name}.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
};
|
||||
migen = (import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) stdenv fetchgit fetchFromGitHub python3Packages; misoc-new = true; }).migen;
|
||||
in
|
||||
{
|
||||
stabilizer-dual-iir = buildStm32Firmware {
|
||||
name = "stabilizer-dual-iir";
|
||||
binaryName = "dual-iir";
|
||||
src = <stabilizerSrc>;
|
||||
patchPhase = ''
|
||||
substituteInPlace src/hardware/configuration.rs \
|
||||
--replace "IpAddress::v4(10, 34, 16, 103)" \
|
||||
"IpAddress::v4(192, 168, 1, 76)" \
|
||||
--replace "Ipv4Address::new(10, 34, 16, 1)" \
|
||||
"Ipv4Address::new(192, 168, 1, 1)"
|
||||
'';
|
||||
};
|
||||
thermostat = buildStm32Firmware {
|
||||
name = "thermostat";
|
||||
src = <thermostatSrc>;
|
||||
checkPhase = ''
|
||||
cargo test --target=${pkgs.rust.toRustTarget pkgs.stdenv.targetPlatform}
|
||||
'';
|
||||
};
|
||||
humpback-dds = buildStm32Firmware {
|
||||
name = "humpback-dds";
|
||||
src = <humpbackDdsSrc>;
|
||||
extraNativeBuildInputs = [
|
||||
(pkgs.python3.withPackages(ps: [ migen ]))
|
||||
pkgs.yosys
|
||||
pkgs.nextpnr
|
||||
pkgs.icestorm
|
||||
];
|
||||
};
|
||||
# openMMC build system breaks if host compiler is not available, so do not use stdenvNoCC here
|
||||
sayma-mmc = pkgs.stdenv.mkDerivation {
|
||||
name = "sayma-mmc";
|
||||
src = <saymaMmcSrc>;
|
||||
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
|
||||
nativeBuildInputs = [ pkgs.cmake pkgs.gcc-arm-embedded ];
|
||||
buildPhase =
|
||||
''
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBOARD=sayma -DBOARD_RTM=sayma -DVERSION= -DTARGET_CONTROLLER=LPC1776 -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
mkdir $out
|
||||
cp out/* $out
|
||||
mkdir -p $out $out/nix-support
|
||||
echo file binary-dist $out/openMMC.axf >> $out/nix-support/hydra-build-products
|
||||
echo file binary-dist $out/openMMC.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
makeBackup = pkgs.writeScript "make-backup" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
|
||||
set -e
|
||||
umask 0077
|
||||
|
||||
DBDUMPDIR=`mktemp -d`
|
||||
pushd $DBDUMPDIR
|
||||
|
||||
${config.services.mysql.package}/bin/mysqldump --single-transaction flarum > flarum.sql
|
||||
${pkgs.sudo}/bin/sudo -u mattermost ${config.services.postgresql.package}/bin/pg_dump mattermost > mattermost.sql
|
||||
|
||||
${pkgs.gnutar}/bin/tar cf - --exclude "/var/lib/gitea/repositories/*/*.git/archives" /etc/nixos /var/lib/gitea flarum.sql mattermost.sql | \
|
||||
${pkgs.bzip2}/bin/bzip2 | \
|
||||
${pkgs.gnupg}/bin/gpg --symmetric --batch --passphrase-file /etc/nixos/secret/backup-passphrase | \
|
||||
${pkgs.rclone}/bin/rclone rcat --config /etc/nixos/secret/rclone.conf dropbox:backup-`date +%F`.tar.bz2.gpg
|
||||
|
||||
popd
|
||||
rm -rf $DBDUMPDIR
|
||||
|
||||
echo Backup done
|
||||
'';
|
||||
cfg = config.services.mlabs-backup;
|
||||
in
|
||||
{
|
||||
options.services.mlabs-backup = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable backups";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.mlabs-backup = {
|
||||
description = "M-Labs backup";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
Group = "root";
|
||||
ExecStart = "${makeBackup}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.mlabs-backup = {
|
||||
description = "M-Labs backup";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig.OnCalendar = "weekly";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,666 +0,0 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
netifWan = "enp0s31f6";
|
||||
netifLan = "enp3s0";
|
||||
netifWifi = "wlp1s0";
|
||||
netifSit = "henet0";
|
||||
hydraWwwOutputs = "/var/www/hydra-outputs";
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./hardware-configuration.nix
|
||||
./homu/nixos-module.nix
|
||||
./backup-module.nix
|
||||
(builtins.fetchTarball {
|
||||
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.3.0/nixos-mailserver-v2.3.0.tar.gz";
|
||||
sha256 = "0lpz08qviccvpfws2nm83n7m2r8add2wvfg9bljx9yxx8107r919";
|
||||
})
|
||||
];
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.blacklistedKernelModules = ["iwlwifi"];
|
||||
|
||||
security.apparmor.enable = true;
|
||||
|
||||
networking = {
|
||||
hostName = "nixbld";
|
||||
firewall = {
|
||||
allowedTCPPorts = [ 80 443 ];
|
||||
allowedUDPPorts = [ 53 67 ];
|
||||
trustedInterfaces = [ netifLan ];
|
||||
};
|
||||
interfaces."${netifLan}" = {
|
||||
ipv4.addresses = [{
|
||||
address = "192.168.1.1";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
ipv6.addresses = [{
|
||||
address = "2001:470:f821:1::";
|
||||
prefixLength = 64;
|
||||
}];
|
||||
};
|
||||
interfaces."${netifWifi}" = {
|
||||
ipv4.addresses = [{
|
||||
address = "192.168.12.1";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
ipv6.addresses = [{
|
||||
address = "2001:470:f821:2::";
|
||||
prefixLength = 64;
|
||||
}];
|
||||
};
|
||||
nat = {
|
||||
enable = true;
|
||||
externalInterface = netifWan;
|
||||
internalInterfaces = [ netifLan netifWifi ];
|
||||
forwardPorts = [
|
||||
{ sourcePort = 2201; destination = "192.168.1.201:22"; proto = "tcp"; }
|
||||
{ sourcePort = 2202; destination = "192.168.1.202:22"; proto = "tcp"; }
|
||||
{ sourcePort = 2203; destination = "192.168.1.203:22"; proto = "tcp"; }
|
||||
{ sourcePort = 2204; destination = "192.168.1.204:22"; proto = "tcp"; }
|
||||
{ sourcePort = 2205; destination = "192.168.1.205:22"; proto = "tcp"; }
|
||||
];
|
||||
extraCommands = ''
|
||||
iptables -w -N block-lan-from-wifi
|
||||
iptables -w -A block-lan-from-wifi -i ${netifLan} -o ${netifWifi} -j DROP
|
||||
iptables -w -A block-lan-from-wifi -i ${netifWifi} -o ${netifLan} -j DROP
|
||||
iptables -w -A FORWARD -j block-lan-from-wifi
|
||||
'';
|
||||
extraStopCommands = ''
|
||||
iptables -w -D FORWARD -j block-lan-from-wifi 2>/dev/null|| true
|
||||
iptables -w -F block-lan-from-wifi 2>/dev/null|| true
|
||||
iptables -w -X block-lan-from-wifi 2>/dev/null|| true
|
||||
'';
|
||||
};
|
||||
sits."${netifSit}" = {
|
||||
dev = netifWan;
|
||||
remote = "216.218.221.6";
|
||||
local = "42.200.147.171";
|
||||
ttl = 255;
|
||||
};
|
||||
interfaces."${netifSit}".ipv6 = {
|
||||
addresses = [{ address = "2001:470:18:629::2"; prefixLength = 64; }];
|
||||
routes = [{ address = "::"; prefixLength = 0; }];
|
||||
};
|
||||
};
|
||||
boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = "1";
|
||||
boot.kernel.sysctl."net.ipv6.conf.default.forwarding" = "1";
|
||||
|
||||
services.unbound = {
|
||||
enable = true;
|
||||
extraConfig =
|
||||
''
|
||||
server:
|
||||
port: 5353
|
||||
'';
|
||||
};
|
||||
|
||||
services.hostapd = {
|
||||
enable = true;
|
||||
interface = netifWifi;
|
||||
hwMode = "g";
|
||||
ssid = "M-Labs";
|
||||
wpaPassphrase = (import /etc/nixos/secret/wifi_password.nix);
|
||||
extraConfig = ''
|
||||
ieee80211d=1
|
||||
country_code=HK
|
||||
ieee80211n=1
|
||||
wmm_enabled=1
|
||||
auth_algs=1
|
||||
wpa_key_mgmt=WPA-PSK
|
||||
rsn_pairwise=CCMP
|
||||
'';
|
||||
};
|
||||
services.dnsmasq = {
|
||||
enable = true;
|
||||
servers = ["::1#5353"];
|
||||
extraConfig = ''
|
||||
interface=${netifLan}
|
||||
interface=${netifWifi}
|
||||
bind-interfaces
|
||||
dhcp-range=interface:${netifLan},192.168.1.81,192.168.1.254,24h
|
||||
dhcp-range=interface:${netifWifi},192.168.12.10,192.168.12.254,24h
|
||||
enable-ra
|
||||
dhcp-range=interface:${netifLan},::,constructor:${netifLan},ra-names
|
||||
dhcp-range=interface:${netifWifi},::,constructor:${netifWifi},ra-only
|
||||
|
||||
no-resolv
|
||||
|
||||
# Static IPv4s to make Red Pitayas less annoying
|
||||
dhcp-host=rp-f05cc9,192.168.1.190
|
||||
dhcp-host=rp-f0612e,192.168.1.191
|
||||
# Static IPv4s to make port redirections work
|
||||
dhcp-host=rpi-1,192.168.1.201
|
||||
dhcp-host=rpi-2,192.168.1.202
|
||||
dhcp-host=rpi-3,192.168.1.203
|
||||
dhcp-host=rpi-4,192.168.1.204
|
||||
dhcp-host=rpi-5,192.168.1.205
|
||||
|
||||
# Default IP addresses for ARTIQ boards
|
||||
address=/thermostat/192.168.1.26
|
||||
address=/kc705/192.168.1.50
|
||||
address=/zc706/192.168.1.51
|
||||
address=/zc706-2/192.168.1.52
|
||||
address=/sayma/192.168.1.60
|
||||
address=/metlino/192.168.1.65
|
||||
address=/kasli/192.168.1.70
|
||||
address=/kasli-customer/192.168.1.75
|
||||
address=/stabilizer-customer/192.168.1.76
|
||||
# uTCA MCH from NAT
|
||||
address=/tschernobyl/192.168.1.80
|
||||
'';
|
||||
};
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
keyMap = "de";
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Asia/Hong_Kong";
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget vim git file lm_sensors acpi pciutils psmisc telnet nixops
|
||||
irssi tmux usbutils imagemagick jq zip unzip
|
||||
];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
# programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
services.apcupsd.enable = true;
|
||||
services.apcupsd.configText = ''
|
||||
UPSTYPE usb
|
||||
NISIP 127.0.0.1
|
||||
BATTERYLEVEL 10
|
||||
MINUTES 5
|
||||
'';
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
services.openssh.forwardX11 = true;
|
||||
services.openssh.passwordAuthentication = false;
|
||||
programs.mosh.enable = true;
|
||||
|
||||
programs.fish.enable = true;
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
services.avahi.enable = true;
|
||||
services.avahi.interfaces = [ netifLan ];
|
||||
services.avahi.publish.enable = true;
|
||||
services.avahi.publish.userServices = true;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
services.printing.enable = true;
|
||||
services.printing.drivers = [ pkgs.hplipWithPlugin ];
|
||||
services.printing.browsing = true;
|
||||
services.printing.listenAddresses = [ "*:631" ];
|
||||
services.printing.defaultShared = true;
|
||||
hardware.sane.enable = true;
|
||||
hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
|
||||
|
||||
users.extraGroups.plugdev = { };
|
||||
users.extraUsers.sb = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel" "plugdev" "dialout" "lp" "scanner"];
|
||||
shell = pkgs.fish;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyPk5WyFoWSvF4ozehxcVBoZ+UHgrI7VW/OoQfFFwIQe0qvetUZBMZwR2FwkLPAMZV8zz1v4EfncudEkVghy4P+/YVLlDjqDq9zwZnh8Nd/ifu84wmcNWHT2UcqnhjniCdshL8a44memzABnxfLLv+sXhP2x32cJAamo5y6fukr2qLp2jbXzR+3sv3klE0ruUXis/BR1lLqNJEYP8jB6fLn2sLKinnZPfn6DwVOk10mGeQsdME/eGl3phpjhODH9JW5V2V5nJBbC0rBnq+78dyArKVqjPSmIcSy72DEIpTctnMEN1W34BGrnsDd5Xd/DKxKxHKTMCHtZRwLC2X0NWN"
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCMALVC8RDTHec+PC8y1s3tcpUAODgq6DEzQdHDf/cyvDMfmCaPiMxfIdmkns5lMa03hymIfSmLUF0jFFDc7biRp7uf9AAXNsrTmplHii0l0McuOOZGlSdZM4eL817P7UwJqFMxJyFXDjkubhQiX6kp25Kfuj/zLnupRCaiDvE7ho/xay6Jrv0XLz935TPDwkc7W1asLIvsZLheB+sRz9SMOb9gtrvk5WXZl5JTOFOLu+JaRwQLHL/xdcHJTOod7tqHYfpoC5JHrEwKzbhTOwxZBQBfTQjQktKENQtBxXHTe71rUEWfEZQGg60/BC4BrRmh4qJjlJu3v4VIhC7SSHn1"
|
||||
];
|
||||
};
|
||||
users.extraUsers.rj = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel" "plugdev" "dialout"];
|
||||
};
|
||||
users.extraUsers.astro = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["plugdev" "dialout"];
|
||||
};
|
||||
users.extraUsers.nix = {
|
||||
isNormalUser = true;
|
||||
};
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
security.hideProcessInformation = true;
|
||||
boot.kernel.sysctl."kernel.dmesg_restrict" = true;
|
||||
services.udev.packages = [ pkgs.sane-backends ];
|
||||
|
||||
nix.distributedBuilds = true;
|
||||
nix.buildMachines = [
|
||||
{
|
||||
hostName = "localhost";
|
||||
maxJobs = 4;
|
||||
system = "x86_64-linux";
|
||||
supportedFeatures = ["big-parallel"];
|
||||
}
|
||||
{
|
||||
hostName = "rpi-3";
|
||||
sshUser = "nix";
|
||||
sshKey = "/etc/nixos/secret/nix_id_rsa";
|
||||
maxJobs = 1;
|
||||
system = "aarch64-linux";
|
||||
}
|
||||
];
|
||||
services.hydra = {
|
||||
enable = true;
|
||||
package = pkgs.hydra-unstable;
|
||||
useSubstitutes = true;
|
||||
hydraURL = "https://nixbld.m-labs.hk";
|
||||
notificationSender = "hydra@m-labs.hk";
|
||||
minimumDiskFree = 15; # in GB
|
||||
minimumDiskFreeEvaluator = 1;
|
||||
extraConfig =
|
||||
''
|
||||
binary_cache_secret_key_file = /etc/nixos/secret/nixbld.m-labs.hk-1
|
||||
max_output_size = 10000000000
|
||||
|
||||
<runcommand>
|
||||
job = web:web:web
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/web
|
||||
</runcommand>
|
||||
|
||||
<runcommand>
|
||||
job = artiq:full:sipyco-manual-html
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/sipyco-manual-html
|
||||
</runcommand>
|
||||
<runcommand>
|
||||
job = artiq:full:sipyco-manual-latexpdf
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/sipyco-manual-latexpdf
|
||||
</runcommand>
|
||||
|
||||
<runcommand>
|
||||
job = artiq:full-beta:artiq-manual-html
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-manual-html-beta
|
||||
</runcommand>
|
||||
<runcommand>
|
||||
job = artiq:full-beta:artiq-manual-latexpdf
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-manual-latexpdf-beta
|
||||
</runcommand>
|
||||
<runcommand>
|
||||
job = artiq:full-beta:conda-channel
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-conda-channel-beta
|
||||
</runcommand>
|
||||
|
||||
<runcommand>
|
||||
job = artiq:full:artiq-manual-html
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-manual-html
|
||||
</runcommand>
|
||||
<runcommand>
|
||||
job = artiq:full:artiq-manual-latexpdf
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-manual-latexpdf
|
||||
</runcommand>
|
||||
<runcommand>
|
||||
job = artiq:full:conda-channel
|
||||
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && ln -sfn $(jq -r '.outputs[0].path' < $HYDRA_JSON) ${hydraWwwOutputs}/artiq-conda-channel
|
||||
</runcommand>
|
||||
'';
|
||||
};
|
||||
systemd.services.hydra-www-outputs-init = {
|
||||
description = "Set up a hydra-owned directory for build outputs";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requiredBy = [ "hydra-queue-runner.service" ];
|
||||
before = [ "hydra-queue-runner.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = [ "${pkgs.coreutils}/bin/mkdir -p ${hydraWwwOutputs}" "${pkgs.coreutils}/bin/chown hydra-queue-runner:hydra ${hydraWwwOutputs}" ];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
nix.extraOptions = ''
|
||||
secret-key-files = /etc/nixos/secret/nixbld.m-labs.hk-1
|
||||
'';
|
||||
nix.sandboxPaths = ["/opt"];
|
||||
|
||||
services.munin-node.enable = true;
|
||||
services.munin-cron = {
|
||||
enable = true;
|
||||
hosts = ''
|
||||
[${config.networking.hostName}]
|
||||
address localhost
|
||||
'';
|
||||
};
|
||||
services.mlabs-backup.enable = true;
|
||||
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
httpPort = 3001;
|
||||
rootUrl = "https://git.m-labs.hk/";
|
||||
appName = "M-Labs Git";
|
||||
cookieSecure = true;
|
||||
disableRegistration = true;
|
||||
mailerPasswordFile = "/etc/nixos/secret/mailerpassword";
|
||||
extraConfig =
|
||||
''
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
HOST = ssl.serverraum.org:587
|
||||
FROM = sysop@m-labs.hk
|
||||
USER = sysop@m-labs.hk
|
||||
|
||||
[service]
|
||||
ENABLE_NOTIFY_MAIL = true
|
||||
|
||||
[attachment]
|
||||
ALLOWED_TYPES = */*
|
||||
'';
|
||||
};
|
||||
systemd.tmpfiles.rules = [
|
||||
"L+ '${config.services.gitea.stateDir}/custom/templates/home.tmpl' - - - - ${./gitea-home.tmpl}"
|
||||
];
|
||||
|
||||
services.mattermost = {
|
||||
enable = true;
|
||||
siteUrl = "https://chat.m-labs.hk/";
|
||||
mutableConfig = true;
|
||||
};
|
||||
|
||||
services.matterbridge = {
|
||||
enable = true;
|
||||
configPath = "/etc/nixos/secret/matterbridge.toml";
|
||||
};
|
||||
|
||||
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
|
||||
hydra-unstable = super.hydra-unstable.overrideAttrs(oa: {
|
||||
patches = oa.patches or [] ++ [ ./hydra-conda.patch ./hydra-retry.patch ./hydra-unbreak-sysbuild.patch ];
|
||||
hydraPath = oa.hydraPath + ":" + super.lib.makeBinPath [ super.jq ];
|
||||
});
|
||||
matterbridge = super.matterbridge.overrideAttrs(oa: {
|
||||
patches = oa.patches or [] ++ [ ./matterbridge-disable-github.patch ];
|
||||
});
|
||||
};
|
||||
|
||||
security.acme.acceptTerms = true;
|
||||
security.acme.email = "sb" + "@m-labs.hk";
|
||||
security.acme.certs = {
|
||||
"nixbld.m-labs.hk" = {
|
||||
group = "nginx";
|
||||
user = "nginx";
|
||||
webroot = "/var/lib/acme/acme-challenge";
|
||||
extraDomains = {
|
||||
"m-labs.hk" = null;
|
||||
"www.m-labs.hk" = null;
|
||||
"conda.m-labs.hk" = null;
|
||||
"lab.m-labs.hk" = null;
|
||||
"git.m-labs.hk" = null;
|
||||
"chat.m-labs.hk" = null;
|
||||
"hooks.m-labs.hk" = null;
|
||||
"forum.m-labs.hk" = null;
|
||||
"perso.m-labs.hk" = null;
|
||||
"nmigen.org" = null;
|
||||
"www.nmigen.org" = null;
|
||||
|
||||
"openhardware.hk" = null;
|
||||
"git.openhardware.hk" = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedGzipSettings = true;
|
||||
virtualHosts = let
|
||||
mainWebsite = {
|
||||
addSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
root = "${hydraWwwOutputs}/web";
|
||||
extraConfig = ''
|
||||
error_page 404 /404.html;
|
||||
'';
|
||||
locations."^~ /fonts/".extraConfig = ''
|
||||
expires 60d;
|
||||
'';
|
||||
locations."^~ /js/".extraConfig = ''
|
||||
expires 60d;
|
||||
'';
|
||||
locations."/MathJax/" = {
|
||||
alias = "/var/www/MathJax/";
|
||||
extraConfig = ''
|
||||
expires 60d;
|
||||
'';
|
||||
};
|
||||
|
||||
# legacy URLs, redirect to avoid breaking people's bookmarks
|
||||
locations."/gateware.html".extraConfig = ''
|
||||
return 301 /gateware/migen/;
|
||||
'';
|
||||
locations."/migen".extraConfig = ''
|
||||
return 301 /gateware/migen/;
|
||||
'';
|
||||
locations."/artiq".extraConfig = ''
|
||||
return 301 /experiment-control/artiq/;
|
||||
'';
|
||||
locations."/artiq/resources.html".extraConfig = ''
|
||||
return 301 /experiment-control/resources/;
|
||||
'';
|
||||
|
||||
# autogenerated manuals
|
||||
locations."/artiq/sipyco-manual/" = {
|
||||
alias = "${hydraWwwOutputs}/sipyco-manual-html/share/doc/sipyco-manual/html/";
|
||||
};
|
||||
locations."=/artiq/sipyco-manual.pdf" = {
|
||||
alias = "${hydraWwwOutputs}/sipyco-manual-latexpdf/share/doc/sipyco-manual/SiPyCo.pdf";
|
||||
};
|
||||
locations."/artiq/manual-beta/" = {
|
||||
alias = "${hydraWwwOutputs}/artiq-manual-html-beta/share/doc/artiq-manual/html/";
|
||||
};
|
||||
locations."=/artiq/manual-beta.pdf" = {
|
||||
alias = "${hydraWwwOutputs}/artiq-manual-latexpdf-beta/share/doc/artiq-manual/ARTIQ.pdf";
|
||||
};
|
||||
locations."/artiq/manual/" = {
|
||||
alias = "${hydraWwwOutputs}/artiq-manual-html/share/doc/artiq-manual/html/";
|
||||
};
|
||||
locations."=/artiq/manual.pdf" = {
|
||||
alias = "${hydraWwwOutputs}/artiq-manual-latexpdf/share/doc/artiq-manual/ARTIQ.pdf";
|
||||
};
|
||||
|
||||
# legacy content
|
||||
locations."/migen/manual/" = {
|
||||
alias = "/var/www/m-labs.hk.old/migen/manual/";
|
||||
};
|
||||
locations."/artiq/manual-release-4/" = {
|
||||
alias = "/var/www/m-labs.hk.old/artiq/manual-release-4/";
|
||||
};
|
||||
locations."/artiq/manual-release-3/" = {
|
||||
alias = "/var/www/m-labs.hk.old/artiq/manual-release-3/";
|
||||
};
|
||||
locations."/artiq/manual-release-2/" = {
|
||||
alias = "/var/www/m-labs.hk.old/artiq/manual-release-2/";
|
||||
};
|
||||
};
|
||||
in {
|
||||
"m-labs.hk" = mainWebsite;
|
||||
"www.m-labs.hk" = mainWebsite;
|
||||
"lab.m-labs.hk" = {
|
||||
addSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/munin/".alias = "/var/www/munin/";
|
||||
locations."/munin".extraConfig = ''
|
||||
auth_basic "Munin";
|
||||
auth_basic_user_file /etc/nixos/secret/muninpasswd;
|
||||
'';
|
||||
locations."/homu/".proxyPass = "http://127.0.0.1:54856/";
|
||||
};
|
||||
"nixbld.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/".proxyPass = "http://127.0.0.1:3000";
|
||||
};
|
||||
"conda.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/artiq-beta/" = {
|
||||
alias = "${hydraWwwOutputs}/artiq-conda-channel-beta/";
|
||||
extraConfig = ''
|
||||
autoindex on;
|
||||
index bogus_index_file;
|
||||
'';
|
||||
};
|
||||
locations."/artiq/" = {
|
||||
alias = "${hydraWwwOutputs}/artiq-conda-channel/";
|
||||
extraConfig = ''
|
||||
autoindex on;
|
||||
index bogus_index_file;
|
||||
'';
|
||||
};
|
||||
};
|
||||
"git.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/".proxyPass = "http://127.0.0.1:3001";
|
||||
extraConfig = ''
|
||||
client_max_body_size 300M;
|
||||
'';
|
||||
};
|
||||
"chat.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/".proxyPass = "http://127.0.0.1:8065";
|
||||
locations."~ /api/v[0-9]+/(users/)?websocket$".proxyPass = "http://127.0.0.1:8065";
|
||||
locations."~ /api/v[0-9]+/(users/)?websocket$".proxyWebsockets = true;
|
||||
};
|
||||
"hooks.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/mattermost-github".extraConfig = ''
|
||||
include ${pkgs.nginx}/conf/uwsgi_params;
|
||||
uwsgi_pass unix:${config.services.uwsgi.runDir}/uwsgi-mgi.sock;
|
||||
'';
|
||||
locations."/rfq".extraConfig = ''
|
||||
include ${pkgs.nginx}/conf/uwsgi_params;
|
||||
uwsgi_pass unix:${config.services.uwsgi.runDir}/uwsgi-rfq.sock;
|
||||
'';
|
||||
};
|
||||
"forum.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
root = "/var/www/flarum/public";
|
||||
locations."~ \.php$".extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.flarum.socket};
|
||||
fastcgi_index index.php;
|
||||
'';
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
include /var/www/flarum/.nginx.conf;
|
||||
'';
|
||||
};
|
||||
"perso.m-labs.hk" = {
|
||||
addSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
root = "/var/www/perso";
|
||||
};
|
||||
"nmigen.org" = {
|
||||
addSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/".extraConfig = ''
|
||||
return 307 https://m-labs.hk/gateware/nmigen/;
|
||||
'';
|
||||
};
|
||||
"www.nmigen.org" = {
|
||||
addSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/".extraConfig = ''
|
||||
return 307 https://m-labs.hk/gateware/nmigen/;
|
||||
'';
|
||||
};
|
||||
|
||||
"git.openhardware.hk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "nixbld.m-labs.hk";
|
||||
locations."/".proxyPass = "http://127.0.0.1:3002";
|
||||
extraConfig = ''
|
||||
client_max_body_size 300M;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
services.uwsgi = {
|
||||
enable = true;
|
||||
plugins = [ "python3" ];
|
||||
instance = {
|
||||
type = "emperor";
|
||||
vassals = {
|
||||
mattermostgithub = import ./mattermost-github-integration/uwsgi-config.nix { inherit config pkgs; };
|
||||
rfq = import ./rfq/uwsgi-config.nix { inherit config pkgs; };
|
||||
};
|
||||
};
|
||||
};
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mariadb;
|
||||
};
|
||||
services.phpfpm.pools.flarum = {
|
||||
user = "nobody";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"listen.mode" = "0600";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = 5;
|
||||
"pm.start_servers" = 2;
|
||||
"pm.min_spare_servers" = 1;
|
||||
"pm.max_spare_servers" = 3;
|
||||
"pm.max_requests" = 500;
|
||||
};
|
||||
};
|
||||
|
||||
services.homu = {
|
||||
enable = true;
|
||||
config = "/etc/nixos/secret/homu.toml";
|
||||
};
|
||||
|
||||
mailserver = {
|
||||
enable = true;
|
||||
localDnsResolver = false; # conflicts with dnsmasq
|
||||
# Some mail servers do reverse DNS lookups to filter spam.
|
||||
# Getting a proper reverse DNS record from ISP is difficult, so use whatever already exists.
|
||||
fqdn = "42-200-147-171.static.imsbiz.com";
|
||||
domains = [ "nmigen.org" ];
|
||||
loginAccounts = (import /etc/nixos/secret/email_accounts.nix);
|
||||
certificateScheme = 3;
|
||||
};
|
||||
security.acme.certs."${config.mailserver.fqdn}".extraDomains = {
|
||||
"mail.nmigen.org" = null;
|
||||
};
|
||||
|
||||
containers.openhardwarehk = {
|
||||
autoStart = true;
|
||||
config =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
httpPort = 3002;
|
||||
rootUrl = "https://git.openhardware.hk/";
|
||||
appName = "Open Hardware HK";
|
||||
cookieSecure = true;
|
||||
disableRegistration = true;
|
||||
extraConfig =
|
||||
''
|
||||
[attachment]
|
||||
ALLOWED_TYPES = */*
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# This value determines the NixOS release with which your system is to be
|
||||
# compatible, in order to avoid breaking some software such as database
|
||||
# servers. You should change this only after NixOS release notes say you
|
||||
# should.
|
||||
system.stateVersion = "18.09"; # Did you read the comment?
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{{template "base/head" .}}
|
||||
<div class="home">
|
||||
<div class="ui stackable middle very relaxed page grid">
|
||||
<div class="sixteen wide center aligned centered column">
|
||||
<div>
|
||||
<img class="logo" src="{{AppSubUrl}}/img/gitea-lg.png" />
|
||||
</div>
|
||||
<div class="hero">
|
||||
<h1 class="ui icon header title">
|
||||
{{AppName}}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui stackable middle very relaxed page grid">
|
||||
<div class="sixteen wide center column">
|
||||
<p class="large">
|
||||
Welcome! This Gitea instance is here to support projects related to <a href="https://m-labs.hk">M-Labs</a>. You may want to browse the <a href="https://git.m-labs.hk/M-Labs/">M-Labs organization</a> where many projects are located. If you would like an account (we give them to anyone who wants to contribute on projects related to Sinara, ARTIQ, nMigen, etc.), simply write a short email to sb@m-***.hk stating the username you would like to have.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/homu/git_helper.py b/homu/git_helper.py
|
||||
index 0f70c69..f53fb57 100755
|
||||
--- a/homu/git_helper.py
|
||||
+++ b/homu/git_helper.py
|
||||
@@ -7,7 +7,7 @@ SSH_KEY_FILE = os.path.join(os.path.dirname(__file__), '../cache/key')
|
||||
|
||||
|
||||
def main():
|
||||
- args = ['ssh', '-i', SSH_KEY_FILE, '-S', 'none'] + sys.argv[1:]
|
||||
+ args = ['ssh', '-o', 'StrictHostKeyChecking=no', '-i', SSH_KEY_FILE, '-S', 'none'] + sys.argv[1:]
|
||||
os.execvp('ssh', args)
|
||||
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
homu = pkgs.callPackage ./pkg.nix {};
|
||||
cfg = config.services.homu;
|
||||
in
|
||||
|
||||
{
|
||||
options.services.homu = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable the bot";
|
||||
};
|
||||
dbDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/db/homu";
|
||||
description = "Path to the database file (use the same path in config.toml)";
|
||||
};
|
||||
config = mkOption {
|
||||
description = "Location of config.toml";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.homu = {
|
||||
group = "homu";
|
||||
home = cfg.dbDir;
|
||||
createHome = true;
|
||||
};
|
||||
users.groups.homu = {};
|
||||
|
||||
systemd.services.homu = {
|
||||
description = "Homu bot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${homu}/bin/homu -c ${cfg.config}";
|
||||
|
||||
Restart = "always";
|
||||
RestartSec = "5sec";
|
||||
|
||||
User = "homu";
|
||||
Group = "homu";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
diff --git a/homu/git_helper.py b/homu/git_helper.py
|
||||
index 0f70c69..732230c 100755
|
||||
--- a/homu/git_helper.py
|
||||
+++ b/homu/git_helper.py
|
||||
@@ -3,7 +3,7 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
-SSH_KEY_FILE = os.path.join(os.path.dirname(__file__), '../cache/key')
|
||||
+SSH_KEY_FILE = os.path.expanduser("~/cache/key")
|
||||
|
||||
|
||||
def main():
|
||||
diff --git a/homu/main.py b/homu/main.py
|
||||
index 16b60a2..a2e109a 100644
|
||||
--- a/homu/main.py
|
||||
+++ b/homu/main.py
|
||||
@@ -649,7 +649,7 @@ def git_push(git_cmd, branch, state):
|
||||
|
||||
|
||||
def init_local_git_cmds(repo_cfg, git_cfg):
|
||||
- fpath = 'cache/{}/{}'.format(repo_cfg['owner'], repo_cfg['name'])
|
||||
+ fpath = '{}/cache/{}/{}'.format(os.path.expanduser("~"), repo_cfg['owner'], repo_cfg['name'])
|
||||
url = 'git@github.com:{}/{}.git'.format(repo_cfg['owner'], repo_cfg['name']) # noqa
|
||||
|
||||
if not os.path.exists(SSH_KEY_FILE):
|
|
@ -1,34 +0,0 @@
|
|||
{ python3Packages, python3, fetchFromGitHub, git, openssh }:
|
||||
|
||||
let
|
||||
uritemplate_0_2_0 = python3Packages.github3_py.overrideAttrs(oa: rec {
|
||||
version = "0.2.0";
|
||||
src = python3Packages.fetchPypi {
|
||||
pname = "uritemplate.py";
|
||||
inherit version;
|
||||
sha256 = "1pfk04pmnysz0383lwzgig8zqlwiv2n4pmq51f0mc60zz1jimq4g";
|
||||
};
|
||||
});
|
||||
github3_py_0_9_6 = python3Packages.github3_py.overrideAttrs(oa: rec {
|
||||
version = "0.9.6";
|
||||
src = python3Packages.fetchPypi {
|
||||
pname = "github3.py";
|
||||
inherit version;
|
||||
sha256 = "1i8xnh586z4kka7pjl7cy08fmzjs14c8jdp8ykb9jjpzsy2xncdq";
|
||||
};
|
||||
propagatedBuildInputs = [ python3Packages.requests uritemplate_0_2_0 ];
|
||||
});
|
||||
in
|
||||
python3Packages.buildPythonApplication {
|
||||
name = "homu";
|
||||
src = fetchFromGitHub {
|
||||
owner = "servo";
|
||||
repo = "homu";
|
||||
rev = "2ea53e76ebac3e5fa11bc39054b3cd4c42eff607";
|
||||
sha256 = "1ih7s8zfbpq0qb9vqbxzr0r4s9ff52l4ipr916kwbck3ygliq3r9";
|
||||
};
|
||||
patches = [ ./patch-cache-directory.patch ./disable-ssh-host-keycheck.patch ];
|
||||
postInstall = "chmod 755 $out/${python3.sitePackages}/homu/git_helper.py";
|
||||
propagatedBuildInputs = [ github3_py_0_9_6 git openssh ] ++ (with python3Packages; [ toml jinja2 requests bottle waitress retrying ]);
|
||||
checkPhase = "python -m unittest discover tests -v";
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
commit 5aa5f8d5742883d41d7278a2c8bc2c9a2ddfef45
|
||||
Author: Sebastien Bourdeauducq <sb@m-labs.hk>
|
||||
Date: Sun Apr 14 18:25:27 2019 +0800
|
||||
|
||||
add SVG icon for conda package
|
||||
|
||||
diff --git a/src/root/product-list.tt b/src/root/product-list.tt
|
||||
index 298d0a66..85914bbd 100644
|
||||
--- a/src/root/product-list.tt
|
||||
+++ b/src/root/product-list.tt
|
||||
@@ -157,6 +157,11 @@
|
||||
<img src="[% c.uri_for("/static/images/debian.png") %]" alt="DEB" />
|
||||
</td>
|
||||
<td>Debian package</td>
|
||||
+ [% CASE "conda" %]
|
||||
+ <td>
|
||||
+ <img src="[% c.uri_for("/static/images/conda.svg") %]" width="32" height="32" alt="Conda" />
|
||||
+ </td>
|
||||
+ <td>Conda package</td>
|
||||
[% CASE "iso" %]
|
||||
<td>
|
||||
<img src="[% c.uri_for("/static/images/iso.png") %]" alt="ISO" />
|
||||
diff --git a/src/root/static/images/conda.svg b/src/root/static/images/conda.svg
|
||||
new file mode 100644
|
||||
index 00000000..67859731
|
||||
--- /dev/null
|
||||
+++ b/src/root/static/images/conda.svg
|
||||
@@ -0,0 +1,18 @@
|
||||
+<svg width="128" height="128" style="enable-background:new 0 0 128 128;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
+ <g id="g2">
|
||||
+ <g>
|
||||
+ <path d="M118.89,75.13c-1.31-2.72-3.46-5.53-6.97-7.33c-2.37-1.48-4.57-2.24-6.01-2.63 c1.53-5.6-0.64-10.06-3.69-13.39c-4.53-4.88-9.27-5.59-9.27-5.59l-0.01,0c1.56-3.03,2.15-6.54,1.36-9.99 c-1-4.26-3.29-6.94-6.31-8.73c-3.09-1.83-6.91-2.73-10.83-3.43c-1.88-0.34-9.81-1.45-13.1-6c-2.65-3.69-2.73-10.33-3.45-12.32 c-0.77-2.05-3.38-1.15-6.23,0.76c-3.33,2.22-10.23,9.35-12.89,16.49c-2.03,5.47-2.08,10.21-1.28,13.89 c-3.29,0.55-5.76,1.66-6.23,1.88c-0.16,0.05-0.32,0.1-0.49,0.17c-3.01,1.24-9.43,7.02-10.01,15.85c-0.2,3.14,0.21,6.31,1.2,9.26 c-3.94,1.1-6.22,2.54-6.26,2.57c-2,0.75-5.18,2.95-6.15,4.13c-1.97,2.38-3.34,5.21-4.15,8.18C6.35,85.36,7,92.71,10.14,98.67 c1.74,3.31,4.12,6.83,6.74,9.52c8.55,8.79,23.31,12.11,34.96,14.03c14.19,2.34,29.05,1.52,42.33-3.97 c19.92-8.22,25.22-21.44,26-25.17C121.92,84.77,119.8,77,118.89,75.13z" style="fill:#865D53;"/>
|
||||
+ <g>
|
||||
+ <g>
|
||||
+ <ellipse cx="85.95" cy="66.39" rx="16.61" ry="15.5" style="fill:#FFFFFF;" transform="matrix(0.1106 -0.9939 0.9939 0.1106 10.453 144.4706)"/>
|
||||
+ <path d="M92.63,66.36c-0.23,3.3-3.14,5.82-6.49,5.62c-3.36-0.19-5.9-3.04-5.67-6.34 c0.22-3.31,3.12-5.82,6.48-5.62C90.31,60.21,92.86,63.06,92.63,66.36" style="fill:#2F2F2F;"/>
|
||||
+ </g>
|
||||
+ <g>
|
||||
+ <ellipse cx="42.46" cy="66.4" rx="15.5" ry="16.61" style="fill:#FFFFFF;" transform="matrix(0.9972 -0.0752 0.0752 0.9972 -4.8714 3.3796)"/>
|
||||
+ <path d="M49.02,65.13c0.38,3.29-2.01,6.3-5.34,6.72c-3.34,0.43-6.36-1.9-6.74-5.18 c-0.4-3.29,1.99-6.3,5.33-6.73C45.6,59.52,48.63,61.85,49.02,65.13" style="fill:#2F2F2F;"/>
|
||||
+ </g>
|
||||
+ </g>
|
||||
+ <path d="M87.35,89.46c-2.22-1.5-5.02-0.51-7.49,0c-6.9,1.42-12.95,1.48-15.86,1.48 c-2.91,0-8.96-0.06-15.86-1.48c-2.47-0.51-5.27-1.5-7.49,0c-2.82,1.9-0.74,8.74,3.7,13.36c2.68,2.79,9.07,8.21,19.66,8.21 c10.58,0,16.97-5.42,19.66-8.21C88.09,98.2,90.17,91.37,87.35,89.46z" style="fill:#ED6D31;"/>
|
||||
+ </g>
|
||||
+ </g>
|
||||
+</svg>
|
||||
\ No newline at end of file
|
|
@ -1,19 +0,0 @@
|
|||
commit 86bf81c0b8a51bffa4b4b566e1caaac6f0e041d3
|
||||
Author: Sebastien Bourdeauducq <sb@m-labs.hk>
|
||||
Date: Thu Mar 14 17:45:32 2019 +0800
|
||||
|
||||
add option to disable retries on transient failures
|
||||
|
||||
diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc
|
||||
index 69c430eb..bdbc808d 100644
|
||||
--- a/src/hydra-queue-runner/build-remote.cc
|
||||
+++ b/src/hydra-queue-runner/build-remote.cc
|
||||
@@ -344,7 +344,7 @@ void State::buildRemote(ref<Store> destStore,
|
||||
break;
|
||||
case BuildResult::TransientFailure:
|
||||
result.stepStatus = bsFailed;
|
||||
- result.canRetry = true;
|
||||
+ result.canRetry = get(step->drv->env, "__hydraRetry").value_or("1") == "1";
|
||||
result.errorMsg = "";
|
||||
break;
|
||||
case BuildResult::TimedOut:
|
|
@ -1,25 +0,0 @@
|
|||
diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm
|
||||
index d4334300..014d07ce 100644
|
||||
--- a/src/lib/Hydra/Schema/Builds.pm
|
||||
+++ b/src/lib/Hydra/Schema/Builds.pm
|
||||
@@ -608,6 +608,7 @@ makeQueries('', "");
|
||||
makeQueries('ForProject', "and project = ?");
|
||||
makeQueries('ForJobset', "and jobset_id = ?");
|
||||
makeQueries('ForJob', "and jobset_id = ? and job = ?");
|
||||
+makeQueries('ForJobName', "and jobset_id = (select id from jobsets j where j.name = ?) and job = ?");
|
||||
|
||||
|
||||
my %hint = (
|
||||
diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset
|
||||
index ea336bfc..2f208418 100755
|
||||
--- a/src/script/hydra-eval-jobset
|
||||
+++ b/src/script/hydra-eval-jobset
|
||||
@@ -142,7 +142,7 @@ sub fetchInputSystemBuild {
|
||||
$projectName ||= $project->name;
|
||||
$jobsetName ||= $jobset->name;
|
||||
|
||||
- my @latestBuilds = $db->resultset('LatestSucceededForJob')
|
||||
+ my @latestBuilds = $db->resultset('LatestSucceededForJobName')
|
||||
->search({}, {bind => [$jobsetName, $jobName]});
|
||||
|
||||
my @validBuilds = ();
|
|
@ -1,15 +0,0 @@
|
|||
diff --git a/bridge/mattermost/helpers.go b/bridge/mattermost/helpers.go
|
||||
index 14b7469d..d9b77bdf 100644
|
||||
--- a/bridge/mattermost/helpers.go
|
||||
+++ b/bridge/mattermost/helpers.go
|
||||
@@ -206,6 +206,10 @@ func (b *Bmattermost) skipMessage(message *matterclient.Message) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
+ if message.Username == "github" {
|
||||
+ return true
|
||||
+ }
|
||||
+
|
||||
// if the message has reactions don't repost it (for now, until we can correlate reaction with message)
|
||||
if message.Post.HasReactions {
|
||||
return true
|
|
@ -1,32 +0,0 @@
|
|||
{ fetchFromGitHub, python3Packages }:
|
||||
with python3Packages;
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "mattermost-github-integration";
|
||||
version = "0.0.0-unstable";
|
||||
src = fetchFromGitHub {
|
||||
owner = "softdevteam";
|
||||
repo = "mattermost-github-integration";
|
||||
rev = "1124a0ff233b50ed6070cb84cfffd128ad219831";
|
||||
sha256 = "1hfvjaxjhliy8sv9j3616fkdwd2jqhfsj9ai7ggx88zhxknrfx85";
|
||||
};
|
||||
propagatedBuildInputs = [
|
||||
appdirs
|
||||
click
|
||||
flask
|
||||
itsdangerous
|
||||
jinja2
|
||||
markupsafe
|
||||
olefile
|
||||
packaging
|
||||
pillow
|
||||
pyparsing
|
||||
requests
|
||||
six
|
||||
werkzeug
|
||||
];
|
||||
checkInputs = [
|
||||
pytest
|
||||
];
|
||||
doCheck = true;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{ config, pkgs }:
|
||||
|
||||
let
|
||||
pkg = pkgs.callPackage ./pkg.nix {};
|
||||
in {
|
||||
type = "normal";
|
||||
pythonPackages = self: [ pkg ];
|
||||
module = "mattermostgithub:app";
|
||||
env = [
|
||||
"MGI_CONFIG_FILE=${./../secret/mattermost-github-integration.py}"
|
||||
];
|
||||
socket = "${config.services.uwsgi.runDir}/uwsgi-mgi.sock";
|
||||
# allow access from nginx
|
||||
chmod-socket = 666;
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
notifico = (pkgs.callPackage ./pkg.nix {})
|
||||
.overrideAttrs (attrs: {
|
||||
buildInputs = attrs.buildInputs ++ [ pkgs.makeWrapper ];
|
||||
# Extend the module path so that local_config.py can be found
|
||||
postInstall = ''
|
||||
${attrs.postInstall}
|
||||
|
||||
wrapProgram $out/bin/notifico \
|
||||
--set PYTHONPATH "$${PYTHONPATH}:${cfg.dbDir}"
|
||||
'';
|
||||
});
|
||||
cfg = config.services.notifico;
|
||||
in
|
||||
|
||||
{
|
||||
options.services.notifico = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable the commit notification service";
|
||||
};
|
||||
enableLocalRedis = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable a local Redis server";
|
||||
};
|
||||
dbDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/db/notifico";
|
||||
description = "Home directory and location of the database file";
|
||||
};
|
||||
config = mkOption {
|
||||
description = "Path to local_config.py, https://github.com/notifico/notifico/raw/master/notifico/config.py";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.notifico = {
|
||||
group = "notifico";
|
||||
home = cfg.dbDir;
|
||||
createHome = true;
|
||||
};
|
||||
users.groups.notifico = {};
|
||||
|
||||
services.redis = mkIf cfg.enableLocalRedis {
|
||||
enable = true;
|
||||
bind = "127.0.0.1";
|
||||
};
|
||||
|
||||
systemd.services =
|
||||
let
|
||||
User = "notifico";
|
||||
Group = "notifico";
|
||||
WorkingDirectory = "${cfg.dbDir}";
|
||||
ExecStartPre = [
|
||||
"${pkgs.coreutils}/bin/rm -f local_config.pyc"
|
||||
"${pkgs.coreutils}/bin/ln -sf ${cfg.config} local_config.py"
|
||||
];
|
||||
|
||||
notifico-init = {
|
||||
description = "Notifico initialization";
|
||||
serviceConfig = {
|
||||
inherit User Group WorkingDirectory ExecStartPre;
|
||||
Type = "oneshot";
|
||||
ExecStart = "${notifico}/bin/notifico init";
|
||||
};
|
||||
};
|
||||
notificoService = component: {
|
||||
description = "Notifico ${component}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "notifico-init.service" ];
|
||||
requires = [ "notifico-init.service" ];
|
||||
serviceConfig = {
|
||||
inherit User Group WorkingDirectory ExecStartPre;
|
||||
Type = "simple";
|
||||
ExecStart = "${notifico}/bin/notifico ${component}";
|
||||
|
||||
Restart = "always";
|
||||
RestartSec = "5sec";
|
||||
};
|
||||
};
|
||||
in {
|
||||
inherit notifico-init;
|
||||
notifico-www = notificoService "www";
|
||||
notifico-worker = notificoService "worker";
|
||||
notifico-bots = notificoService "bots";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
{ python2Packages, python2, fetchFromGitHub, fetchurl }:
|
||||
|
||||
let
|
||||
Flask-Gravatar = python2Packages.buildPythonPackage {
|
||||
name = "Flask-Gravatar";
|
||||
src = python2Packages.fetchPypi {
|
||||
pname = "Flask-Gravatar";
|
||||
version = "0.5.0";
|
||||
sha256 = "1qb2ylirjajdqsmldhwfdhf8i86k7vlh3y4gnqfqj4n6q8qmyrk0";
|
||||
};
|
||||
propagatedBuildInputs = with python2Packages; [
|
||||
pytestrunner
|
||||
flask
|
||||
];
|
||||
checkInputs = with python2Packages; [
|
||||
check-manifest
|
||||
coverage
|
||||
isort
|
||||
pydocstyle
|
||||
pytestcache
|
||||
pytestcov
|
||||
pytestpep8
|
||||
pytest
|
||||
pygments
|
||||
];
|
||||
};
|
||||
utopia = python2Packages.buildPythonPackage {
|
||||
name = "utopia";
|
||||
src = fetchFromGitHub {
|
||||
owner = "notifico";
|
||||
repo = "utopia";
|
||||
rev = "70293ed5e1ca55232e0fae71061e7e9b9b29be6f";
|
||||
sha256 = "11cnh9l4d9jlhafnfis9si6kgk9zsdd5439qnhxh6dca3x4a986q";
|
||||
};
|
||||
propagatedBuildInputs = with python2Packages; [
|
||||
gevent
|
||||
blinker
|
||||
];
|
||||
doCheck = false;
|
||||
};
|
||||
Flask-WTF = python2Packages.flask_wtf.overrideAttrs(oa: rec {
|
||||
version = "0.8.4";
|
||||
src = python2Packages.fetchPypi {
|
||||
pname = "Flask-WTF";
|
||||
inherit version;
|
||||
sha256 = "1khbwmlrcnk9f46f7kf531n06pkyfs6nc8fk273js9mj2igngg2y";
|
||||
};
|
||||
});
|
||||
Flask-XML-RPC = python2Packages.flask_wtf.overrideAttrs(oa: rec {
|
||||
version = "0.1.2";
|
||||
src = python2Packages.fetchPypi {
|
||||
pname = "Flask-XML-RPC";
|
||||
inherit version;
|
||||
sha256 = "1dwalj7pc5iid9l1k50q5mllirnn9f5s7jq54a66x48a4j179p2a";
|
||||
};
|
||||
});
|
||||
in
|
||||
python2Packages.buildPythonApplication {
|
||||
name = "notifico";
|
||||
src = fetchFromGitHub {
|
||||
owner = "notifico";
|
||||
repo = "notifico";
|
||||
rev = "6af849e4c75dff4d740051676f5a2093a44efcee";
|
||||
sha256 = "18jifqdvjy4x5s1bh7vx501pin52g4n3hhw1z4m2c0h512z4spdr";
|
||||
};
|
||||
patches = [
|
||||
(fetchurl {
|
||||
url = https://github.com/whitequark/notifico/commit/22b582fad6cb97af6f7437e8462d720ddacc42ef.patch;
|
||||
sha256 = "0w8i8hf1r8b0p1y1zn9vyvnyi20qp120aiyalqymhsxsh17mma52";
|
||||
})
|
||||
];
|
||||
propagatedBuildInputs = with python2Packages; [
|
||||
flask
|
||||
Flask-WTF
|
||||
Flask-Gravatar
|
||||
flask_sqlalchemy
|
||||
Flask-XML-RPC
|
||||
flask_mail
|
||||
flask-caching
|
||||
Fabric
|
||||
sqlalchemy
|
||||
utopia
|
||||
gevent
|
||||
oauth2
|
||||
redis
|
||||
gunicorn
|
||||
requests
|
||||
PyGithub
|
||||
xmltodict
|
||||
unidecode
|
||||
raven
|
||||
blinker
|
||||
docopt
|
||||
celery
|
||||
];
|
||||
postInstall = ''
|
||||
mkdir $out/bin
|
||||
cat << EOF > $out/bin/notifico
|
||||
#!${python2}/bin/python
|
||||
import sys
|
||||
from notifico.__main__ import main
|
||||
|
||||
sys.exit(main(sys.argv))
|
||||
EOF
|
||||
chmod +x $out/bin/notifico
|
||||
'';
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{ python3Packages, runCommand }:
|
||||
|
||||
# Note: we do not use fetchgit but a local copy instead to avoid
|
||||
# chicken-and-egg problem if reinstalling nixbld.m-labs.hk from scratch.
|
||||
with python3Packages; buildPythonPackage rec {
|
||||
name = "rfq";
|
||||
src = ./src;
|
||||
propagatedBuildInputs = [ flask flask_mail python-dotenv ];
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
blinker
|
||||
click
|
||||
Flask
|
||||
Flask-Mail
|
||||
itsdangerous
|
||||
Jinja2
|
||||
MarkupSafe
|
||||
python-dotenv
|
||||
six
|
||||
Werkzeug
|
|
@ -1,75 +0,0 @@
|
|||
from os import getenv
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from flask import Flask
|
||||
from flask import current_app
|
||||
from flask import json
|
||||
from flask import jsonify
|
||||
from flask import make_response
|
||||
from flask import request
|
||||
from flask_mail import Mail
|
||||
from flask_mail import Message
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
|
||||
|
||||
load_dotenv()
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.update(
|
||||
DEBUG=getenv("FLASK_DEBUG") == "True",
|
||||
MAIL_SERVER=getenv("FLASK_MAIL_SERVER"),
|
||||
MAIL_PORT=getenv("FLASK_MAIL_PORT"),
|
||||
MAIL_USE_SSL=getenv("FLASK_MAIL_USE_SSL"),
|
||||
MAIL_DEBUG=False,
|
||||
MAIL_USERNAME=getenv("FLASK_MAIL_USERNAME"),
|
||||
MAIL_PASSWORD=getenv("FLASK_MAIL_PASSWORD"),
|
||||
MAIL_RECIPIENT=getenv("FLASK_MAIL_RECIPIENT"),
|
||||
MAIL_SENDER=getenv("FLASK_MAIL_SENDER")
|
||||
)
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app)
|
||||
|
||||
mail = Mail(app)
|
||||
|
||||
|
||||
@app.after_request
|
||||
def after(response):
|
||||
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||
response.headers["Access-Control-Allow-Headers"] = "*"
|
||||
return response
|
||||
|
||||
|
||||
@app.route("/rfq", methods=["POST"])
|
||||
def send_rfq():
|
||||
payload = request.json
|
||||
payload = json.loads(json.htmlsafe_dumps(payload))
|
||||
|
||||
if payload is None:
|
||||
resp = jsonify(error="invalid data")
|
||||
return make_response(resp, 400)
|
||||
|
||||
if "email" not in payload:
|
||||
resp = jsonify(error="missing email")
|
||||
return make_response(resp, 400)
|
||||
|
||||
if "note" not in payload:
|
||||
resp = jsonify(error="missing note")
|
||||
return make_response(resp, 400)
|
||||
|
||||
if "configuration" not in payload:
|
||||
resp = jsonify(error="missing configuration")
|
||||
return make_response(resp, 400)
|
||||
|
||||
sender = current_app.config["MAIL_SENDER"]
|
||||
recipient = current_app.config["MAIL_RECIPIENT"]
|
||||
|
||||
msg = Message(
|
||||
"RFQ for Sinara hardware from {}".format(payload["email"]),
|
||||
sender=sender,
|
||||
recipients=[recipient, payload["email"]])
|
||||
msg.body = ("From: {}\nConfiguration: {}\nNote: {}"
|
||||
.format(payload["email"], payload["configuration"], payload["note"]))
|
||||
|
||||
with mail.connect() as conn:
|
||||
conn.send(msg)
|
||||
|
||||
return jsonify("ok")
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue