aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------.direnv/flake-profile1
-rw-r--r--.direnv/flake-profile.rc1506
-rw-r--r--.gitignore2
-rw-r--r--backend/Cargo.lock (renamed from Cargo.lock)0
-rw-r--r--backend/Cargo.toml (renamed from Cargo.toml)0
-rw-r--r--backend/diesel.toml (renamed from diesel.toml)0
-rw-r--r--backend/migrations/.gitkeep (renamed from migrations/.gitkeep)0
-rw-r--r--backend/migrations/2020-09-22-104623_create_users/down.sql (renamed from migrations/2020-09-22-104623_create_users/down.sql)0
-rw-r--r--backend/migrations/2020-09-22-104623_create_users/up.sql (renamed from migrations/2020-09-22-104623_create_users/up.sql)0
-rw-r--r--backend/migrations/2020-11-16-133516_create_products_table/down.sql (renamed from migrations/2020-11-16-133516_create_products_table/down.sql)0
-rw-r--r--backend/migrations/2020-11-16-133516_create_products_table/up.sql (renamed from migrations/2020-11-16-133516_create_products_table/up.sql)0
-rw-r--r--backend/migrations/2020-12-13-140215_all_tables/down.sql (renamed from migrations/2020-12-13-140215_all_tables/down.sql)0
-rw-r--r--backend/migrations/2020-12-13-140215_all_tables/up.sql (renamed from migrations/2020-12-13-140215_all_tables/up.sql)0
-rw-r--r--backend/rustfmt.toml (renamed from rustfmt.toml)0
-rw-r--r--backend/src/bin/server.rs (renamed from src/bin/server.rs)0
-rw-r--r--backend/src/handlers/cart_items.rs (renamed from src/handlers/cart_items.rs)0
-rw-r--r--backend/src/handlers/mod.rs (renamed from src/handlers/mod.rs)0
-rw-r--r--backend/src/handlers/product.rs (renamed from src/handlers/product.rs)0
-rw-r--r--backend/src/handlers/rating.rs (renamed from src/handlers/rating.rs)0
-rw-r--r--backend/src/handlers/smoke.rs (renamed from src/handlers/smoke.rs)0
-rw-r--r--backend/src/handlers/users.rs (renamed from src/handlers/users.rs)0
-rw-r--r--backend/src/lib.rs (renamed from src/lib.rs)0
-rw-r--r--backend/src/models.rs (renamed from src/models.rs)0
-rw-r--r--backend/src/schema.rs (renamed from src/schema.rs)0
-rw-r--r--backend/tests/product/chair.json (renamed from tests/product/chair.json)0
-rw-r--r--backend/tests/product/dumb_sofa.json (renamed from tests/product/dumb_sofa.json)0
-rw-r--r--backend/tests/product/smart_sofa.json (renamed from tests/product/smart_sofa.json)0
-rw-r--r--backend/tests/requests.txt (renamed from tests/requests.txt)0
-rw-r--r--backend/tests/users/add_akshay.json (renamed from tests/users/add_akshay.json)0
-rw-r--r--backend/tests/users/add_user.json (renamed from tests/users/add_user.json)0
-rw-r--r--default.nix18
-rw-r--r--flake.lock44
-rw-r--r--flake.nix43
l---------frontend/.direnv/flake-profile1
-rw-r--r--frontend/.direnv/flake-profile.rc1473
-rw-r--r--frontend/elm-stuff/0.19.1/Cart.elmibin0 -> 4274 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Cart.elmobin0 -> 6973 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Catalog.elmibin0 -> 4112 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Catalog.elmobin0 -> 5002 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Login.elmibin0 -> 2307 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Login.elmobin0 -> 5241 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Main.elmibin0 -> 19391 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Main.elmobin0 -> 14316 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Product.elmibin0 -> 11250 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Product.elmobin0 -> 15801 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Signup.elmibin0 -> 3892 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/Signup.elmobin0 -> 8736 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/d.datbin0 -> 2696 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/i.datbin0 -> 122650 bytes
-rw-r--r--frontend/elm-stuff/0.19.1/lock0
-rw-r--r--frontend/elm-stuff/0.19.1/o.datbin0 -> 482300 bytes
-rw-r--r--frontend/elm.json27
-rw-r--r--frontend/src/Cart.elm164
-rw-r--r--frontend/src/Catalog.elm125
-rw-r--r--frontend/src/Login.elm119
-rw-r--r--frontend/src/Main.elm339
-rw-r--r--frontend/src/Product.elm302
-rw-r--r--frontend/src/Signup.elm194
-rw-r--r--nix/sources.json50
-rw-r--r--nix/sources.nix148
-rw-r--r--shell.nix34
61 files changed, 4339 insertions, 251 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile
new file mode 120000
index 0000000..0daa2d1
--- /dev/null
+++ b/.direnv/flake-profile
@@ -0,0 +1 @@
/nix/store/5fywra260fcw272j6vwwvq7lzy609srb-furby-env \ No newline at end of file
diff --git a/.direnv/flake-profile.rc b/.direnv/flake-profile.rc
new file mode 100644
index 0000000..dc6ae31
--- /dev/null
+++ b/.direnv/flake-profile.rc
@@ -0,0 +1,1506 @@
1unset shellHook
2nix_saved_PATH="$PATH"
3AR=ar
4export AR
5AS=as
6export AS
7BASH=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
8CC=gcc
9export CC
10CONFIG_SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
11export CONFIG_SHELL
12CXX=g++
13export CXX
14DETERMINISTIC_BUILD=1
15export DETERMINISTIC_BUILD
16DIRSTACK=()
17GROUPS=()
18HOSTTYPE=x86_64
19HOST_PATH=/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0/bin:/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/bin:/nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2/bin:/nix/store/cfkappcqwnk1kmnnqqwxrg73fjdsa2am-openssl-1.1.1g-bin/bin:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/bin:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/bin:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/bin:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/bin:/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/bin:/nix/store/k9f38hll2169jqqj72g7wx16nxavpw04-nghttp2-1.40.0-bin/bin:/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/bin:/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/bin:/nix/store/6vv8yimyaa41iwhwki9y79z8xrl9zwca-curl-7.70.0-bin/bin:/nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0/bin:/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/bin:/nix/store/pdg3mr2vsm7g8sh0q3ysac9dw0pl3c1i-jq-1.6-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin
20export HOST_PATH
21IFS=$' \t\n'
22IN_NIX_SHELL=impure
23export IN_NIX_SHELL
24LD=ld
25export LD
26MACHTYPE=x86_64-unknown-linux-gnu
27NIX_BINTOOLS=/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1
28export NIX_BINTOOLS
29NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1
30export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST
31NIX_BUILD_CORES=8
32export NIX_BUILD_CORES
33NIX_CC=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0
34export NIX_CC
35NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1
36export NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST
37NIX_CFLAGS_COMPILE=' -isystem /nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev/include -isystem /nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/include -isystem /nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev/include -isystem /nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/include -isystem /nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev/include -isystem /nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev/include -isystem /nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/include -isystem /nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev/include -isystem /nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/include -isystem /nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev/include -isystem /nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev/include -isystem /nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/include -isystem /nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev/include -isystem /nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/include -isystem /nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev/include -isystem /nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev/include -isystem /nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/include -isystem /nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev/include -isystem /nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/include -isystem /nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev/include'
38export NIX_CFLAGS_COMPILE
39NIX_ENFORCE_NO_NATIVE=1
40export NIX_ENFORCE_NO_NATIVE
41NIX_HARDENING_ENABLE='fortify stackprotector pic strictoverflow format relro bindnow'
42export NIX_HARDENING_ENABLE
43NIX_INDENT_MAKE=1
44export NIX_INDENT_MAKE
45NIX_LDFLAGS='-rpath /home/np/code/rust/furby/outputs/out/lib64 -rpath /home/np/code/rust/furby/outputs/out/lib -L/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/lib -L/nix/store/0x3bf23q5lmdq77x5icr7c0ngvz25ms3-openssl-1.1.1g/lib -L/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib -L/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3/lib -L/nix/store/qkpfyg67ff3c0wjsy68a61rx01f1cc31-nghttp2-1.40.0-lib/lib -L/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11/lib -L/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/lib -L/nix/store/fnn6zvyds5sy7mgvl4h2qslmlsaf0dc8-libssh2-1.9.0/lib -L/nix/store/bcqgqdzmhd9smr51snjcy2q2cbrwy47j-curl-7.70.0/lib -L/nix/store/7cj4dviicvhga78l899arar4q5kggbc5-jq-1.6-lib/lib -L/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/lib -L/nix/store/0x3bf23q5lmdq77x5icr7c0ngvz25ms3-openssl-1.1.1g/lib -L/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib -L/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3/lib -L/nix/store/qkpfyg67ff3c0wjsy68a61rx01f1cc31-nghttp2-1.40.0-lib/lib -L/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11/lib -L/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/lib -L/nix/store/fnn6zvyds5sy7mgvl4h2qslmlsaf0dc8-libssh2-1.9.0/lib -L/nix/store/bcqgqdzmhd9smr51snjcy2q2cbrwy47j-curl-7.70.0/lib -L/nix/store/7cj4dviicvhga78l899arar4q5kggbc5-jq-1.6-lib/lib'
46export NIX_LDFLAGS
47NIX_LIB64_IN_SELF_RPATH=1
48NIX_NO_SELF_RPATH=1
49NIX_STORE=/nix/store
50export NIX_STORE
51NM=nm
52export NM
53OBJCOPY=objcopy
54export OBJCOPY
55OBJDUMP=objdump
56export OBJDUMP
57OPTERR=1
58OPTIND=1
59OSTYPE=linux-gnu
60PATH=/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9/bin:/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0/bin:/nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1/bin:/nix/store/hrkc2sf2883l16d5yq3zg0y339kfw4xv-binutils-2.31.1/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0/bin:/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/bin:/nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2/bin:/nix/store/cfkappcqwnk1kmnnqqwxrg73fjdsa2am-openssl-1.1.1g-bin/bin:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/bin:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/bin:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/bin:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/bin:/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/bin:/nix/store/k9f38hll2169jqqj72g7wx16nxavpw04-nghttp2-1.40.0-bin/bin:/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/bin:/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/bin:/nix/store/6vv8yimyaa41iwhwki9y79z8xrl9zwca-curl-7.70.0-bin/bin:/nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0/bin:/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/bin:/nix/store/pdg3mr2vsm7g8sh0q3ysac9dw0pl3c1i-jq-1.6-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin
61export PATH
62PIPESTATUS=([0]="0")
63PKG_CONFIG_PATH=/nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev/lib/pkgconfig:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/pkgconfig:/nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev/lib/pkgconfig:/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/lib/pkgconfig:/nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev/lib/pkgconfig:/nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev/lib/pkgconfig:/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/lib/pkgconfig:/nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev/lib/pkgconfig:/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/lib/pkgconfig
64export PKG_CONFIG_PATH
65PS4='+ '
66PYTHONHASHSEED=0
67export PYTHONHASHSEED
68PYTHONNOUSERSITE=1
69export PYTHONNOUSERSITE
70PYTHONPATH=/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages
71export PYTHONPATH
72RANLIB=ranlib
73export RANLIB
74READELF=readelf
75export READELF
76SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
77export SHELL
78SIZE=size
79export SIZE
80SOURCE_DATE_EPOCH=1
81export SOURCE_DATE_EPOCH
82STRINGS=strings
83export STRINGS
84STRIP=strip
85export STRIP
86_=export
87buildInputs='/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1 /nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3 /nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3 /nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1 /nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2 /nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0 /nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84 /nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2 /nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev /nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0 /nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev /nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0 /nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5 /nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev /nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6'
88export buildInputs
89builder=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
90export builder
91commonStripFlags=--enable-deterministic-archives
92configureFlags=
93export configureFlags
94defaultBuildInputs=
95defaultNativeBuildInputs='/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9 /nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh /nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh /nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh /nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh /nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh /nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0'
96depsBuildBuild=
97export depsBuildBuild
98depsBuildBuildPropagated=
99export depsBuildBuildPropagated
100depsBuildTarget=
101export depsBuildTarget
102depsBuildTargetPropagated=
103export depsBuildTargetPropagated
104depsHostHost=
105export depsHostHost
106depsHostHostPropagated=
107export depsHostHostPropagated
108depsTargetTarget=
109export depsTargetTarget
110depsTargetTargetPropagated=
111export depsTargetTargetPropagated
112doCheck=
113export doCheck
114doInstallCheck=
115export doInstallCheck
116dontAddDisableDepTrack=1
117export dontAddDisableDepTrack
118envHostHostHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars" [2]="addPythonPath" [3]="addPythonPath")
119envHostTargetHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars" [2]="addPythonPath" [3]="addPythonPath")
120envTargetTargetHooks=([0]="addPkgConfigPath")
121fixupOutputHooks=([0]="if [ -z \"\${dontPatchELF-}\" ]; then patchELF \"\$prefix\"; fi" [1]="_makeSymlinksRelative" [2]="if [ -z \"\${dontGzipMan-}\" ]; then compressManPages \"\$prefix\"; fi" [3]="_doStrip" [4]="patchShebangsAuto" [5]="_pruneLibtoolFiles" [6]="if [[ -z \"\${noAuditTmpdir-}\" && -e \"\$prefix\" ]]; then auditTmpdir \"\$prefix\"; fi" [7]="_moveSbin" [8]="_moveLib64")
122initialPath='/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31 /nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0 /nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7 /nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8 /nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4 /nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1 /nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32 /nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10 /nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin /nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1 /nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23 /nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6 /nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin'
123name=furby
124export name
125nativeBuildInputs=
126export nativeBuildInputs
127out=/home/np/code/rust/furby/outputs/out
128export out
129outputBin=out
130outputDev=out
131outputDevdoc=REMOVE
132outputDevman=out
133outputDoc=out
134outputInclude=out
135outputInfo=out
136outputLib=out
137outputMan=out
138outputs=out
139export outputs
140patches=
141export patches
142pkg=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0
143pkgsBuildHost=([0]="/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9" [1]="/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh" [2]="/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh" [3]="/nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh" [4]="/nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh" [5]="/nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh" [6]="/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh" [7]="/nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh" [8]="/nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh" [9]="/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh" [10]="/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh" [11]="/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh" [12]="/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0" [13]="/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1")
144pkgsHostTarget=([0]="/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1" [1]="/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3" [2]="/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3" [3]="/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1" [4]="/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2" [5]="/nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0" [6]="/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84" [7]="/nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2" [8]="/nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev" [9]="/nix/store/cfkappcqwnk1kmnnqqwxrg73fjdsa2am-openssl-1.1.1g-bin" [10]="/nix/store/0x3bf23q5lmdq77x5icr7c0ngvz25ms3-openssl-1.1.1g" [11]="/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0" [12]="/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2" [13]="/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16" [14]="/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6" [15]="/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6" [16]="/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0" [17]="/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8" [18]="/nix/store/qyp3bcn7qq5lryqimd1ddlbbmd6r57zr-python3.7-pyOpenSSL-19.1.0-dev" [19]="/nix/store/pb90x5cn1znp2hpb8jdgnlamv9qwg7za-python3.7-cryptography-2.8-dev" [20]="/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1" [21]="/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6" [22]="/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0" [23]="/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0" [24]="/nix/store/awck465fagj1rl9xgvfg9dnclw8i4w04-python3.7-cffi-1.13.2-dev" [25]="/nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev" [26]="/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3" [27]="/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19" [28]="/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2" [29]="/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8" [30]="/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8" [31]="/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8" [32]="/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0" [33]="/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28" [34]="/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1" [35]="/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4" [36]="/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0" [37]="/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev" [38]="/nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev" [39]="/nix/store/k9f38hll2169jqqj72g7wx16nxavpw04-nghttp2-1.40.0-bin" [40]="/nix/store/qkpfyg67ff3c0wjsy68a61rx01f1cc31-nghttp2-1.40.0-lib" [41]="/nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev" [42]="/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11" [43]="/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev" [44]="/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17" [45]="/nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev" [46]="/nix/store/fnn6zvyds5sy7mgvl4h2qslmlsaf0dc8-libssh2-1.9.0" [47]="/nix/store/6vv8yimyaa41iwhwki9y79z8xrl9zwca-curl-7.70.0-bin" [48]="/nix/store/bcqgqdzmhd9smr51snjcy2q2cbrwy47j-curl-7.70.0" [49]="/nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0" [50]="/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5" [51]="/nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev" [52]="/nix/store/pdg3mr2vsm7g8sh0q3ysac9dw0pl3c1i-jq-1.6-bin" [53]="/nix/store/7cj4dviicvhga78l899arar4q5kggbc5-jq-1.6-lib")
145postFixupHooks=([0]="_multioutPropagateDev")
146postUnpackHooks=([0]="_updateSourceDateEpochFromSourceRoot")
147preConfigureHooks=([0]="_multioutConfig")
148preFixupHooks=([0]="_moveToShare" [1]="_multioutDocs" [2]="_multioutDevs")
149prefix=/home/np/code/rust/furby/outputs/out
150propagatedBuildDepFiles=([0]="propagated-build-build-deps" [1]="propagated-native-build-inputs" [2]="propagated-build-target-deps")
151propagatedBuildInputs=
152export propagatedBuildInputs
153propagatedHostDepFiles=([0]="propagated-host-host-deps" [1]="propagated-build-inputs")
154propagatedNativeBuildInputs=
155export propagatedNativeBuildInputs
156propagatedTargetDepFiles=([0]="propagated-target-target-deps")
157shell=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
158export shell
159src=./.
160export src
161stdenv=/nix/store/sm7kk5n84vaisqvhk1yfsjqls50j8s0m-stdenv-linux
162export stdenv
163strictDeps=
164export strictDeps
165system=x86_64-linux
166export system
167unpackCmdHooks=([0]="_defaultUnpack")
168PATH="$PATH:$nix_saved_PATH"
169_activatePkgs ()
170{
171 local -i hostOffset targetOffset;
172 local pkg;
173 for hostOffset in "${allPlatOffsets[@]}";
174 do
175 local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}";
176 for targetOffset in "${allPlatOffsets[@]}";
177 do
178 (( "$hostOffset" <= "$targetOffset" )) || continue;
179 local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]";
180 local pkgsSlice="${!pkgsRef}[@]";
181 for pkg in ${!pkgsSlice+"${!pkgsSlice}"};
182 do
183 activatePackage "$pkg" "$hostOffset" "$targetOffset";
184 done;
185 done;
186 done
187}
188_addRpathPrefix ()
189{
190 if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then
191 export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}";
192 if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then
193 export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}";
194 fi;
195 if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then
196 export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}";
197 fi;
198 fi
199}
200_addToEnv ()
201{
202 local -i depHostOffset depTargetOffset;
203 local pkg;
204 for depHostOffset in "${allPlatOffsets[@]}";
205 do
206 local hookVar="${pkgHookVarVars[$depHostOffset + 1]}";
207 local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}";
208 for depTargetOffset in "${allPlatOffsets[@]}";
209 do
210 (( "$depHostOffset" <= "$depTargetOffset" )) || continue;
211 local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]";
212 if [[ -z "${strictDeps-}" ]]; then
213 local visitedPkgs="";
214 for pkg in ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} ${pkgsBuildHost+"${pkgsBuildHost[@]}"} ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} ${pkgsHostHost+"${pkgsHostHost[@]}"} ${pkgsHostTarget+"${pkgsHostTarget[@]}"} ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"};
215 do
216 if [[ "$visitedPkgs" = *"$pkg"* ]]; then
217 continue;
218 fi;
219 runHook "${!hookRef}" "$pkg";
220 visitedPkgs+=" $pkg";
221 done;
222 else
223 local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]";
224 local pkgsSlice="${!pkgsRef}[@]";
225 for pkg in ${!pkgsSlice+"${!pkgsSlice}"};
226 do
227 runHook "${!hookRef}" "$pkg";
228 done;
229 fi;
230 done;
231 done
232}
233_allFlags ()
234{
235 for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }');
236 do
237 if (( "${NIX_DEBUG:-0}" >= 1 )); then
238 printf "@%s@ -> %q\n" "${varName}" "${!varName}";
239 fi;
240 args+=("--subst-var" "$varName");
241 done
242}
243_assignFirst ()
244{
245 local varName="$1";
246 local REMOVE=REMOVE;
247 shift;
248 while (( $# )); do
249 if [ -n "${!1-}" ]; then
250 eval "${varName}"="$1";
251 return;
252 fi;
253 shift;
254 done;
255 echo "Error: _assignFirst found no valid variant!";
256 return 1
257}
258_callImplicitHook ()
259{
260 local def="$1";
261 local hookName="$2";
262 if declare -F "$hookName" > /dev/null; then
263 "$hookName";
264 else
265 if type -p "$hookName" > /dev/null; then
266 source "$hookName";
267 else
268 if [ -n "${!hookName:-}" ]; then
269 eval "${!hookName}";
270 else
271 return "$def";
272 fi;
273 fi;
274 fi
275}
276_defaultUnpack ()
277{
278 local fn="$1";
279 if [ -d "$fn" ]; then
280 cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")";
281 else
282 case "$fn" in
283 *.tar.xz | *.tar.lzma | *.txz)
284 xz -d < "$fn" | tar xf -
285 ;;
286 *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
287 tar xf "$fn"
288 ;;
289 *)
290 return 1
291 ;;
292 esac;
293 fi
294}
295_doStrip ()
296{
297 local -ra flags=(dontStripHost dontStripTarget);
298 local -ra stripCmds=(STRIP TARGET_STRIP);
299 if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then
300 dontStripTarget+=1;
301 fi;
302 local i;
303 for i in ${!stripCmds[@]};
304 do
305 local -n flag="${flags[$i]}";
306 local -n stripCmd="${stripCmds[$i]}";
307 if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null; then
308 continue;
309 fi;
310 stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin};
311 if [ -n "$stripDebugList" ]; then
312 stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}";
313 fi;
314 stripAllList=${stripAllList:-};
315 if [ -n "$stripAllList" ]; then
316 stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}";
317 fi;
318 done
319}
320_eval ()
321{
322 if declare -F "$1" > /dev/null 2>&1; then
323 "$@";
324 else
325 eval "$1";
326 fi
327}
328_makeSymlinksRelative ()
329{
330 local symlinkTarget;
331 if [ -n "${dontRewriteSymlinks-}" ]; then
332 return 0;
333 fi;
334 while IFS= read -r -d '' f; do
335 symlinkTarget=$(readlink "$f");
336 if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then
337 continue;
338 fi;
339 if [ ! -e "$symlinkTarget" ]; then
340 echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)";
341 fi;
342 echo "rewriting symlink $f to be relative to $prefix";
343 ln -snrf "$symlinkTarget" "$f";
344 done < <(find $prefix -type l -print0)
345}
346_moveLib64 ()
347{
348 if [ "${dontMoveLib64-}" = 1 ]; then
349 return;
350 fi;
351 if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then
352 return;
353 fi;
354 echo "moving $prefix/lib64/* to $prefix/lib";
355 mkdir -p $prefix/lib;
356 shopt -s dotglob;
357 for i in $prefix/lib64/*;
358 do
359 mv --no-clobber "$i" $prefix/lib;
360 done;
361 shopt -u dotglob;
362 rmdir $prefix/lib64;
363 ln -s lib $prefix/lib64
364}
365_moveSbin ()
366{
367 if [ "${dontMoveSbin-}" = 1 ]; then
368 return;
369 fi;
370 if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then
371 return;
372 fi;
373 echo "moving $prefix/sbin/* to $prefix/bin";
374 mkdir -p $prefix/bin;
375 shopt -s dotglob;
376 for i in $prefix/sbin/*;
377 do
378 mv "$i" $prefix/bin;
379 done;
380 shopt -u dotglob;
381 rmdir $prefix/sbin;
382 ln -s bin $prefix/sbin
383}
384_moveToShare ()
385{
386 forceShare=${forceShare:=man doc info};
387 if [ -z "$forceShare" -o -z "$out" ]; then
388 return;
389 fi;
390 for d in $forceShare;
391 do
392 if [ -d "$out/$d" ]; then
393 if [ -d "$out/share/$d" ]; then
394 echo "both $d/ and share/$d/ exist!";
395 else
396 echo "moving $out/$d to $out/share/$d";
397 mkdir -p $out/share;
398 mv $out/$d $out/share/;
399 fi;
400 fi;
401 done
402}
403_multioutConfig ()
404{
405 if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then
406 return;
407 fi;
408 if [ -z "$shareDocName" ]; then
409 local confScript="$configureScript";
410 if [ -z "$confScript" ] && [ -x ./configure ]; then
411 confScript=./configure;
412 fi;
413 if [ -f "$confScript" ]; then
414 local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")";
415 fi;
416 if [ -n "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then
417 shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')";
418 fi;
419 fi;
420 configureFlags=" --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin --includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info --docdir=${!outputDoc}/share/doc/${shareDocName} --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec --localedir=${!outputLib}/share/locale $configureFlags";
421 installFlags=" pkgconfigdir=${!outputDev}/lib/pkgconfig m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal $installFlags"
422}
423_multioutDevs ()
424{
425 if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then
426 return;
427 fi;
428 moveToOutput include "${!outputInclude}";
429 moveToOutput lib/pkgconfig "${!outputDev}";
430 moveToOutput share/pkgconfig "${!outputDev}";
431 moveToOutput lib/cmake "${!outputDev}";
432 moveToOutput share/aclocal "${!outputDev}";
433 for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc;
434 do
435 echo "Patching '$f' includedir to output ${!outputInclude}";
436 sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f";
437 done
438}
439_multioutDocs ()
440{
441 local REMOVE=REMOVE;
442 moveToOutput share/info "${!outputInfo}";
443 moveToOutput share/doc "${!outputDoc}";
444 moveToOutput share/gtk-doc "${!outputDevdoc}";
445 moveToOutput share/devhelp/books "${!outputDevdoc}";
446 moveToOutput share/man "${!outputMan}";
447 moveToOutput share/man/man3 "${!outputDevman}"
448}
449_multioutPropagateDev ()
450{
451 if [ "$outputs" = "out" ]; then
452 return;
453 fi;
454 local outputFirst;
455 for outputFirst in $outputs;
456 do
457 break;
458 done;
459 local propagaterOutput="$outputDev";
460 if [ -z "$propagaterOutput" ]; then
461 propagaterOutput="$outputFirst";
462 fi;
463 if [ -z "${propagatedBuildOutputs+1}" ]; then
464 local po_dirty="$outputBin $outputInclude $outputLib";
465 set +o pipefail;
466 propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `;
467 set -o pipefail;
468 fi;
469 if [ -z "$propagatedBuildOutputs" ]; then
470 return;
471 fi;
472 mkdir -p "${!propagaterOutput}"/nix-support;
473 for output in $propagatedBuildOutputs;
474 do
475 echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs;
476 done
477}
478_overrideFirst ()
479{
480 if [ -z "${!1-}" ]; then
481 _assignFirst "$@";
482 fi
483}
484_pruneLibtoolFiles ()
485{
486 if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
487 return;
488 fi;
489 find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \;
490}
491_updateSourceDateEpochFromSourceRoot ()
492{
493 if [ -n "$sourceRoot" ]; then
494 updateSourceDateEpoch "$sourceRoot";
495 fi
496}
497activatePackage ()
498{
499 local pkg="$1";
500 local -ri hostOffset="$2";
501 local -ri targetOffset="$3";
502 (( "$hostOffset" <= "$targetOffset" )) || exit -1;
503 if [ -f "$pkg" ]; then
504 source "$pkg";
505 fi;
506 if [[ ( -z "${strictDeps-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then
507 addToSearchPath _PATH "$pkg/bin";
508 fi;
509 if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then
510 addToSearchPath _HOST_PATH "$pkg/bin";
511 fi;
512 if [[ -f "$pkg/nix-support/setup-hook" ]]; then
513 source "$pkg/nix-support/setup-hook";
514 fi
515}
516addEnvHooks ()
517{
518 local depHostOffset="$1";
519 shift;
520 local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]";
521 local pkgHookVar;
522 for pkgHookVar in "${!pkgHookVarsSlice}";
523 do
524 eval "${pkgHookVar}s"'+=("$@")';
525 done
526}
527addPkgConfigPath ()
528{
529 addToSearchPath PKG_CONFIG_PATH $1/lib/pkgconfig;
530 addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig
531}
532addPythonPath ()
533{
534 addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.7/site-packages
535}
536addToSearchPath ()
537{
538 addToSearchPathWithCustomDelimiter ":" "$@"
539}
540addToSearchPathWithCustomDelimiter ()
541{
542 local delimiter="$1";
543 local varName="$2";
544 local dir="$3";
545 if [ -d "$dir" ]; then
546 export "${varName}=${!varName:+${!varName}${delimiter}}${dir}";
547 fi
548}
549auditTmpdir ()
550{
551 local dir="$1";
552 [ -e "$dir" ] || return 0;
553 header "checking for references to $TMPDIR/ in $dir...";
554 local i;
555 while IFS= read -r -d '' i; do
556 if [[ "$i" =~ .build-id ]]; then
557 continue;
558 fi;
559 if isELF "$i"; then
560 if {
561 printf :;
562 patchelf --print-rpath "$i"
563 } | grep -q -F ":$TMPDIR/"; then
564 echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/";
565 exit 1;
566 fi;
567 fi;
568 if isScript "$i"; then
569 if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then
570 if grep -q -F "$TMPDIR/" "$i"; then
571 echo "wrapper script $i contains a forbidden reference to $TMPDIR/";
572 exit 1;
573 fi;
574 fi;
575 fi;
576 done < <(find "$dir" -type f -print0);
577 stopNest
578}
579bintoolsWrapper_addLDVars ()
580{
581 local role_post role_pre;
582 getHostRoleEnvHook;
583 if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then
584 export NIX_${role_pre}LDFLAGS+=" -L$1/lib64";
585 fi;
586 if [[ -d "$1/lib" ]]; then
587 local -a glob=($1/lib/lib*);
588 if [ "${#glob[*]}" -gt 0 ]; then
589 export NIX_${role_pre}LDFLAGS+=" -L$1/lib";
590 fi;
591 fi
592}
593buildPhase ()
594{
595 runHook preBuild;
596 : ${makeFlags=};
597 if [[ -z "$makeFlags" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then
598 echo "no Makefile, doing nothing";
599 else
600 foundMakefile=1;
601 local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"});
602 echoCmd 'build flags' "${flagsArray[@]}";
603 make ${makefile:+-f $makefile} "${flagsArray[@]}";
604 unset flagsArray;
605 fi;
606 runHook postBuild
607}
608ccWrapper_addCVars ()
609{
610 local role_post role_pre;
611 getHostRoleEnvHook;
612 if [ -d "$1/include" ]; then
613 export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include";
614 fi;
615 if [ -d "$1/Library/Frameworks" ]; then
616 export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks";
617 fi
618}
619checkPhase ()
620{
621 runHook preCheck;
622 if [[ -z "${foundMakefile:-}" ]]; then
623 echo "no Makefile or custom buildPhase, doing nothing";
624 runHook postCheck;
625 return;
626 fi;
627 if [[ -z "${checkTarget:-}" ]]; then
628 if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then
629 checkTarget=check;
630 else
631 if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then
632 checkTarget=test;
633 fi;
634 fi;
635 fi;
636 if [[ -z "${checkTarget:-}" ]]; then
637 echo "no check/test target in ${makefile:-Makefile}, doing nothing";
638 else
639 local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget});
640 echoCmd 'check flags' "${flagsArray[@]}";
641 make ${makefile:+-f $makefile} "${flagsArray[@]}";
642 unset flagsArray;
643 fi;
644 runHook postCheck
645}
646closeNest ()
647{
648 true
649}
650compressManPages ()
651{
652 local dir="$1";
653 if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then
654 return;
655 fi;
656 echo "gzipping man pages under $dir/share/man/";
657 find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do
658 if gzip -c -n "$f" > "$f".gz; then
659 rm "$f";
660 else
661 rm "$f".gz;
662 fi;
663 done;
664 find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do
665 local target;
666 target="$(readlink -f "$f")";
667 if [ -f "$target".gz ]; then
668 ln -sf "$target".gz "$f".gz && rm "$f";
669 fi;
670 done
671}
672configurePhase ()
673{
674 runHook preConfigure;
675 : ${configureScript=};
676 : ${configureFlags=};
677 if [[ -z "$configureScript" && -x ./configure ]]; then
678 configureScript=./configure;
679 fi;
680 if [ -z "${dontFixLibtool:-}" ]; then
681 local i;
682 find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do
683 echo "fixing libtool script $i";
684 fixLibtool "$i";
685 done;
686 fi;
687 if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then
688 configureFlags="${prefixKey:---prefix=}$prefix $configureFlags";
689 fi;
690 if [ -z "${dontAddDisableDepTrack:-}" ]; then
691 if [ -f "$configureScript" ] && grep -q dependency-tracking "$configureScript"; then
692 configureFlags="--disable-dependency-tracking $configureFlags";
693 fi;
694 fi;
695 if [ -z "${dontDisableStatic:-}" ]; then
696 if [ -f "$configureScript" ] && grep -q enable-static "$configureScript"; then
697 configureFlags="--disable-static $configureFlags";
698 fi;
699 fi;
700 if [ -n "$configureScript" ]; then
701 local flagsArray=($configureFlags ${configureFlagsArray+"${configureFlagsArray[@]}"});
702 echoCmd 'configure flags' "${flagsArray[@]}";
703 $configureScript "${flagsArray[@]}";
704 unset flagsArray;
705 else
706 echo "no configure script, doing nothing";
707 fi;
708 runHook postConfigure
709}
710consumeEntire ()
711{
712 if IFS='' read -r -N 0 $1; then
713 echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2;
714 return 1;
715 fi
716}
717distPhase ()
718{
719 runHook preDist;
720 local flagsArray=($distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist});
721 echo 'dist flags: %q' "${flagsArray[@]}";
722 make ${makefile:+-f $makefile} "${flagsArray[@]}";
723 if [ "${dontCopyDist:-0}" != 1 ]; then
724 mkdir -p "$out/tarballs";
725 cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs";
726 fi;
727 runHook postDist
728}
729dumpVars ()
730{
731 if [ "${noDumpEnvVars:-0}" != 1 ]; then
732 export > "$NIX_BUILD_TOP/env-vars" || true;
733 fi
734}
735echoCmd ()
736{
737 printf "%s:" "$1";
738 shift;
739 printf ' %q' "$@";
740 echo
741}
742exitHandler ()
743{
744 exitCode="$?";
745 set +e;
746 if [ -n "${showBuildStats:-}" ]; then
747 times > "$NIX_BUILD_TOP/.times";
748 local -a times=($(cat "$NIX_BUILD_TOP/.times"));
749 echo "build time elapsed: " "${times[@]}";
750 fi;
751 if (( "$exitCode" != 0 )); then
752 runHook failureHook;
753 if [ -n "${succeedOnFailure:-}" ]; then
754 echo "build failed with exit code $exitCode (ignored)";
755 mkdir -p "$out/nix-support";
756 printf "%s" "$exitCode" > "$out/nix-support/failed";
757 exit 0;
758 fi;
759 else
760 runHook exitHook;
761 fi;
762 exit "$exitCode"
763}
764findInputs ()
765{
766 local -r pkg="$1";
767 local -ri hostOffset="$2";
768 local -ri targetOffset="$3";
769 (( "$hostOffset" <= "$targetOffset" )) || exit -1;
770 local varVar="${pkgAccumVarVars[$hostOffset + 1]}";
771 local varRef="$varVar[\$targetOffset - \$hostOffset]";
772 local var="${!varRef}";
773 unset -v varVar varRef;
774 local varSlice="$var[*]";
775 case "${!varSlice-}" in
776 *" $pkg "*)
777 return 0
778 ;;
779 esac;
780 unset -v varSlice;
781 eval "$var"'+=("$pkg")';
782 if ! [ -e "$pkg" ]; then
783 echo "build input $pkg does not exist" 1>&2;
784 exit 1;
785 fi;
786 local -i mapOffsetResult;
787 function mapOffset ()
788 {
789 local -ri inputOffset="$1";
790 if (( "$inputOffset" <= 0 )); then
791 local -ri outputOffset="$inputOffset + $hostOffset";
792 else
793 local -ri outputOffset="$inputOffset - 1 + $targetOffset";
794 fi;
795 mapOffsetResult="$outputOffset"
796 };
797 local -i relHostOffset;
798 for relHostOffset in "${allPlatOffsets[@]}";
799 do
800 local files="${propagatedDepFilesVars[$relHostOffset + 1]}";
801 mapOffset relHostOffset;
802 local -i hostOffsetNext="$mapOffsetResult";
803 [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue;
804 local -i relTargetOffset;
805 for relTargetOffset in "${allPlatOffsets[@]}";
806 do
807 (( "$relHostOffset" <= "$relTargetOffset" )) || continue;
808 local fileRef="${files}[$relTargetOffset - $relHostOffset]";
809 local file="${!fileRef}";
810 unset -v fileRef;
811 mapOffset relTargetOffset;
812 local -i targetOffsetNext="$mapOffsetResult";
813 [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue;
814 [[ -f "$pkg/nix-support/$file" ]] || continue;
815 local pkgNext;
816 read -r -d '' pkgNext < "$pkg/nix-support/$file" || true;
817 for pkgNext in $pkgNext;
818 do
819 findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext";
820 done;
821 done;
822 done
823}
824fixLibtool ()
825{
826 sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1"
827}
828fixupPhase ()
829{
830 local output;
831 for output in $outputs;
832 do
833 if [ -e "${!output}" ]; then
834 chmod -R u+w "${!output}";
835 fi;
836 done;
837 runHook preFixup;
838 local output;
839 for output in $outputs;
840 do
841 prefix="${!output}" runHook fixupOutput;
842 done;
843 declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated);
844 declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}");
845 local propagatedInputsIndex;
846 for propagatedInputsIndex in "${!flatVars[@]}";
847 do
848 local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]";
849 local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}";
850 [[ -n "${!propagatedInputsSlice}" ]] || continue;
851 mkdir -p "${!outputDev}/nix-support";
852 printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile";
853 done;
854 if [ -n "${setupHook:-}" ]; then
855 mkdir -p "${!outputDev}/nix-support";
856 substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook";
857 fi;
858 if [ -n "${setupHooks:-}" ]; then
859 mkdir -p "${!outputDev}/nix-support";
860 local hook;
861 for hook in $setupHooks;
862 do
863 local content;
864 consumeEntire content < "$hook";
865 substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook";
866 unset -v content;
867 done;
868 unset -v hook;
869 fi;
870 if [ -n "${propagatedUserEnvPkgs:-}" ]; then
871 mkdir -p "${!outputBin}/nix-support";
872 printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages";
873 fi;
874 runHook postFixup
875}
876genericBuild ()
877{
878 if [ -f "${buildCommandPath:-}" ]; then
879 source "$buildCommandPath";
880 return;
881 fi;
882 if [ -n "${buildCommand:-}" ]; then
883 eval "$buildCommand";
884 return;
885 fi;
886 if [ -z "${phases:-}" ]; then
887 phases="${prePhases:-} unpackPhase patchPhase ${preConfigurePhases:-} configurePhase ${preBuildPhases:-} buildPhase checkPhase ${preInstallPhases:-} installPhase ${preFixupPhases:-} fixupPhase installCheckPhase ${preDistPhases:-} distPhase ${postPhases:-}";
888 fi;
889 for curPhase in $phases;
890 do
891 if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then
892 continue;
893 fi;
894 if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then
895 continue;
896 fi;
897 if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then
898 continue;
899 fi;
900 if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then
901 continue;
902 fi;
903 if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then
904 continue;
905 fi;
906 if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then
907 continue;
908 fi;
909 if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then
910 continue;
911 fi;
912 if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then
913 continue;
914 fi;
915 if [[ -n $NIX_LOG_FD ]]; then
916 echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" 1>&$NIX_LOG_FD;
917 fi;
918 showPhaseHeader "$curPhase";
919 dumpVars;
920 eval "${!curPhase:-$curPhase}";
921 if [ "$curPhase" = unpackPhase ]; then
922 cd "${sourceRoot:-.}";
923 fi;
924 done
925}
926getHostRole ()
927{
928 getRole "$hostOffset"
929}
930getHostRoleEnvHook ()
931{
932 getRole "$depHostOffset"
933}
934getRole ()
935{
936 case $1 in
937 -1)
938 role_pre='BUILD_';
939 role_post='_FOR_BUILD'
940 ;;
941 0)
942 role_pre='';
943 role_post=''
944 ;;
945 1)
946 role_pre='TARGET_';
947 role_post='_FOR_TARGET'
948 ;;
949 *)
950 echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2;
951 return 1
952 ;;
953 esac
954}
955getTargetRole ()
956{
957 getRole "$targetOffset"
958}
959getTargetRoleEnvHook ()
960{
961 getRole "$depTargetOffset"
962}
963getTargetRoleWrapper ()
964{
965 case $targetOffset in
966 -1)
967 export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_BUILD=1
968 ;;
969 0)
970 export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1
971 ;;
972 1)
973 export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_TARGET=1
974 ;;
975 *)
976 echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2;
977 return 1
978 ;;
979 esac
980}
981header ()
982{
983 echo "$1"
984}
985installCheckPhase ()
986{
987 runHook preInstallCheck;
988 if [[ -z "${foundMakefile:-}" ]]; then
989 echo "no Makefile or custom buildPhase, doing nothing";
990 else
991 if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} > /dev/null 2>&1; then
992 echo "no installcheck target in ${makefile:-Makefile}, doing nothing";
993 else
994 local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck});
995 echoCmd 'installcheck flags' "${flagsArray[@]}";
996 make ${makefile:+-f $makefile} "${flagsArray[@]}";
997 unset flagsArray;
998 fi;
999 fi;
1000 runHook postInstallCheck
1001}
1002installPhase ()
1003{
1004 runHook preInstall;
1005 if [ -n "$prefix" ]; then
1006 mkdir -p "$prefix";
1007 fi;
1008 local flagsArray=(SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installFlags ${installFlagsArray+"${installFlagsArray[@]}"} ${installTargets:-install});
1009 echoCmd 'install flags' "${flagsArray[@]}";
1010 make ${makefile:+-f $makefile} "${flagsArray[@]}";
1011 unset flagsArray;
1012 runHook postInstall
1013}
1014isELF ()
1015{
1016 local fn="$1";
1017 local fd;
1018 local magic;
1019 exec {fd}< "$fn";
1020 read -r -n 4 -u "$fd" magic;
1021 exec {fd}>&-;
1022 if [ "$magic" = 'ELF' ]; then
1023 return 0;
1024 else
1025 return 1;
1026 fi
1027}
1028isScript ()
1029{
1030 local fn="$1";
1031 local fd;
1032 local magic;
1033 exec {fd}< "$fn";
1034 read -r -n 2 -u "$fd" magic;
1035 exec {fd}>&-;
1036 if [[ "$magic" =~ \#! ]]; then
1037 return 0;
1038 else
1039 return 1;
1040 fi
1041}
1042mapOffset ()
1043{
1044 local -ri inputOffset="$1";
1045 if (( "$inputOffset" <= 0 )); then
1046 local -ri outputOffset="$inputOffset + $hostOffset";
1047 else
1048 local -ri outputOffset="$inputOffset - 1 + $targetOffset";
1049 fi;
1050 mapOffsetResult="$outputOffset"
1051}
1052moveToOutput ()
1053{
1054 local patt="$1";
1055 local dstOut="$2";
1056 local output;
1057 for output in $outputs;
1058 do
1059 if [ "${!output}" = "$dstOut" ]; then
1060 continue;
1061 fi;
1062 local srcPath;
1063 for srcPath in "${!output}"/$patt;
1064 do
1065 if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then
1066 continue;
1067 fi;
1068 if [ "$dstOut" = REMOVE ]; then
1069 echo "Removing $srcPath";
1070 rm -r "$srcPath";
1071 else
1072 local dstPath="$dstOut${srcPath#${!output}}";
1073 echo "Moving $srcPath to $dstPath";
1074 if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then
1075 rmdir "$srcPath" --ignore-fail-on-non-empty;
1076 if [ -d "$srcPath" ]; then
1077 mv -t "$dstPath" "$srcPath"/*;
1078 rmdir "$srcPath";
1079 fi;
1080 else
1081 mkdir -p "$(readlink -m "$dstPath/..")";
1082 mv "$srcPath" "$dstPath";
1083 fi;
1084 fi;
1085 local srcParent="$(readlink -m "$srcPath/..")";
1086 if rmdir "$srcParent"; then
1087 echo "Removing empty $srcParent/ and (possibly) its parents";
1088 rmdir -p --ignore-fail-on-non-empty "$(readlink -m "$srcParent/..")" 2> /dev/null || true;
1089 fi;
1090 done;
1091 done
1092}
1093patchELF ()
1094{
1095 local dir="$1";
1096 [ -e "$dir" ] || return 0;
1097 header "shrinking RPATHs of ELF executables and libraries in $dir";
1098 local i;
1099 while IFS= read -r -d '' i; do
1100 if [[ "$i" =~ .build-id ]]; then
1101 continue;
1102 fi;
1103 if ! isELF "$i"; then
1104 continue;
1105 fi;
1106 echo "shrinking $i";
1107 patchelf --shrink-rpath "$i" || true;
1108 done < <(find "$dir" -type f -print0);
1109 stopNest
1110}
1111patchPhase ()
1112{
1113 runHook prePatch;
1114 for i in ${patches:-};
1115 do
1116 header "applying patch $i" 3;
1117 local uncompress=cat;
1118 case "$i" in
1119 *.gz)
1120 uncompress="gzip -d"
1121 ;;
1122 *.bz2)
1123 uncompress="bzip2 -d"
1124 ;;
1125 *.xz)
1126 uncompress="xz -d"
1127 ;;
1128 *.lzma)
1129 uncompress="lzma -d"
1130 ;;
1131 esac;
1132 $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1};
1133 done;
1134 runHook postPatch
1135}
1136patchShebangs ()
1137{
1138 local pathName;
1139 if [ "$1" = "--host" ]; then
1140 pathName=HOST_PATH;
1141 shift;
1142 else
1143 if [ "$1" = "--build" ]; then
1144 pathName=PATH;
1145 shift;
1146 fi;
1147 fi;
1148 echo "patching script interpreter paths in $@";
1149 local f;
1150 local oldPath;
1151 local newPath;
1152 local arg0;
1153 local args;
1154 local oldInterpreterLine;
1155 local newInterpreterLine;
1156 if [ $# -eq 0 ]; then
1157 echo "No arguments supplied to patchShebangs" > 0;
1158 return 0;
1159 fi;
1160 local f;
1161 while IFS= read -r -d '' f; do
1162 isScript "$f" || continue;
1163 oldInterpreterLine=$(head -1 "$f" | tail -c+3);
1164 read -r oldPath arg0 args <<< "$oldInterpreterLine";
1165 if [ -z "$pathName" ]; then
1166 if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then
1167 pathName=HOST_PATH;
1168 else
1169 pathName=PATH;
1170 fi;
1171 fi;
1172 if $(echo "$oldPath" | grep -q "/bin/env$"); then
1173 if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
1174 echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" > 0;
1175 exit 1;
1176 fi;
1177 newPath="$(PATH="${!pathName}" command -v "$arg0" || true)";
1178 else
1179 if [ "$oldPath" = "" ]; then
1180 oldPath="/bin/sh";
1181 fi;
1182 newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)";
1183 args="$arg0 $args";
1184 fi;
1185 newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')";
1186 if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
1187 if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
1188 echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\"";
1189 escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g');
1190 timestamp=$(mktemp);
1191 touch -r "$f" "$timestamp";
1192 sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f";
1193 touch -r "$timestamp" "$f";
1194 rm "$timestamp";
1195 fi;
1196 fi;
1197 done < <(find "$@" -type f -perm -0100 -print0);
1198 stopNest
1199}
1200patchShebangsAuto ()
1201{
1202 if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then
1203 if [ "$output" != out ] && [ "$output" = "$outputDev" ]; then
1204 patchShebangs --build "$prefix";
1205 else
1206 patchShebangs --host "$prefix";
1207 fi;
1208 fi
1209}
1210printLines ()
1211{
1212 (( "$#" > 0 )) || return 0;
1213 printf '%s\n' "$@"
1214}
1215printWords ()
1216{
1217 (( "$#" > 0 )) || return 0;
1218 printf '%s ' "$@"
1219}
1220runHook ()
1221{
1222 local hookName="$1";
1223 shift;
1224 local hooksSlice="${hookName%Hook}Hooks[@]";
1225 local hook;
1226 for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"};
1227 do
1228 _eval "$hook" "$@";
1229 done;
1230 return 0
1231}
1232runOneHook ()
1233{
1234 local hookName="$1";
1235 shift;
1236 local hooksSlice="${hookName%Hook}Hooks[@]";
1237 local hook ret=1;
1238 for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"};
1239 do
1240 if _eval "$hook" "$@"; then
1241 ret=0;
1242 break;
1243 fi;
1244 done;
1245 return "$ret"
1246}
1247showPhaseHeader ()
1248{
1249 local phase="$1";
1250 case "$phase" in
1251 unpackPhase)
1252 header "unpacking sources"
1253 ;;
1254 patchPhase)
1255 header "patching sources"
1256 ;;
1257 configurePhase)
1258 header "configuring"
1259 ;;
1260 buildPhase)
1261 header "building"
1262 ;;
1263 checkPhase)
1264 header "running tests"
1265 ;;
1266 installPhase)
1267 header "installing"
1268 ;;
1269 fixupPhase)
1270 header "post-installation fixup"
1271 ;;
1272 installCheckPhase)
1273 header "running install tests"
1274 ;;
1275 *)
1276 header "$phase"
1277 ;;
1278 esac
1279}
1280stopNest ()
1281{
1282 true
1283}
1284stripDirs ()
1285{
1286 local cmd="$1";
1287 local dirs="$2";
1288 local stripFlags="$3";
1289 local dirsNew=;
1290 local d;
1291 for d in ${dirs};
1292 do
1293 if [ -d "$prefix/$d" ]; then
1294 dirsNew="${dirsNew} $prefix/$d ";
1295 fi;
1296 done;
1297 dirs=${dirsNew};
1298 if [ -n "${dirs}" ]; then
1299 header "stripping (with command $cmd and flags $stripFlags) in$dirs";
1300 find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2> /dev/null || true;
1301 stopNest;
1302 fi
1303}
1304stripHash ()
1305{
1306 local strippedName casematchOpt=0;
1307 strippedName="$(basename -- "$1")";
1308 shopt -q nocasematch && casematchOpt=1;
1309 shopt -u nocasematch;
1310 if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then
1311 echo "${strippedName:33}";
1312 else
1313 echo "$strippedName";
1314 fi;
1315 if (( casematchOpt )); then
1316 shopt -s nocasematch;
1317 fi
1318}
1319substitute ()
1320{
1321 local input="$1";
1322 local output="$2";
1323 shift 2;
1324 if [ ! -f "$input" ]; then
1325 echo "substitute(): ERROR: file '$input' does not exist" 1>&2;
1326 return 1;
1327 fi;
1328 local content;
1329 consumeEntire content < "$input";
1330 if [ -e "$output" ]; then
1331 chmod +w "$output";
1332 fi;
1333 substituteStream content "file '$input'" "$@" > "$output"
1334}
1335substituteAll ()
1336{
1337 local input="$1";
1338 local output="$2";
1339 local -a args=();
1340 _allFlags;
1341 substitute "$input" "$output" "${args[@]}"
1342}
1343substituteAllInPlace ()
1344{
1345 local fileName="$1";
1346 shift;
1347 substituteAll "$fileName" "$fileName" "$@"
1348}
1349substituteAllStream ()
1350{
1351 local -a args=();
1352 _allFlags;
1353 substituteStream "$1" "$2" "${args[@]}"
1354}
1355substituteInPlace ()
1356{
1357 local fileName="$1";
1358 shift;
1359 substitute "$fileName" "$fileName" "$@"
1360}
1361substituteStream ()
1362{
1363 local var=$1;
1364 local description=$2;
1365 shift 2;
1366 while (( "$#" )); do
1367 case "$1" in
1368 --replace)
1369 pattern="$2";
1370 replacement="$3";
1371 shift 3;
1372 local savedvar;
1373 savedvar="${!var}";
1374 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}';
1375 if [ "$pattern" != "$replacement" ]; then
1376 if [ "${!var}" == "$savedvar" ]; then
1377 echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2;
1378 fi;
1379 fi
1380 ;;
1381 --subst-var)
1382 local varName="$2";
1383 shift 2;
1384 if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then
1385 echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2;
1386 return 1;
1387 fi;
1388 if [ -z ${!varName+x} ]; then
1389 echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2;
1390 return 1;
1391 fi;
1392 pattern="@$varName@";
1393 replacement="${!varName}";
1394 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'
1395 ;;
1396 --subst-var-by)
1397 pattern="@$2@";
1398 replacement="$3";
1399 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}';
1400 shift 3
1401 ;;
1402 *)
1403 echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2;
1404 return 1
1405 ;;
1406 esac;
1407 done;
1408 printf "%s" "${!var}"
1409}
1410toPythonPath ()
1411{
1412 local paths="$1";
1413 local result=;
1414 for i in $paths;
1415 do
1416 p="$i/lib/python3.7/site-packages";
1417 result="${result}${result:+:}$p";
1418 done;
1419 echo $result
1420}
1421unpackFile ()
1422{
1423 curSrc="$1";
1424 header "unpacking source archive $curSrc" 3;
1425 if ! runOneHook unpackCmd "$curSrc"; then
1426 echo "do not know how to unpack source archive $curSrc";
1427 exit 1;
1428 fi
1429}
1430unpackPhase ()
1431{
1432 runHook preUnpack;
1433 if [ -z "${srcs:-}" ]; then
1434 if [ -z "${src:-}" ]; then
1435 echo 'variable $src or $srcs should point to the source';
1436 exit 1;
1437 fi;
1438 srcs="$src";
1439 fi;
1440 local dirsBefore="";
1441 for i in *;
1442 do
1443 if [ -d "$i" ]; then
1444 dirsBefore="$dirsBefore $i ";
1445 fi;
1446 done;
1447 for i in $srcs;
1448 do
1449 unpackFile "$i";
1450 done;
1451 : ${sourceRoot=};
1452 if [ -n "${setSourceRoot:-}" ]; then
1453 runOneHook setSourceRoot;
1454 else
1455 if [ -z "$sourceRoot" ]; then
1456 for i in *;
1457 do
1458 if [ -d "$i" ]; then
1459 case $dirsBefore in
1460 *\ $i\ *)
1461
1462 ;;
1463 *)
1464 if [ -n "$sourceRoot" ]; then
1465 echo "unpacker produced multiple directories";
1466 exit 1;
1467 fi;
1468 sourceRoot="$i"
1469 ;;
1470 esac;
1471 fi;
1472 done;
1473 fi;
1474 fi;
1475 if [ -z "$sourceRoot" ]; then
1476 echo "unpacker appears to have produced no directories";
1477 exit 1;
1478 fi;
1479 echo "source root is $sourceRoot";
1480 if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then
1481 chmod -R u+w -- "$sourceRoot";
1482 fi;
1483 runHook postUnpack
1484}
1485updateSourceDateEpoch ()
1486{
1487 local path="$1";
1488 local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1));
1489 local time="${res[0]//\.[0-9]*/}";
1490 local newestFile="${res[1]}";
1491 if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then
1492 echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile";
1493 export SOURCE_DATE_EPOCH="$time";
1494 local now="$(date +%s)";
1495 if [ "$time" -gt $((now - 60)) ]; then
1496 echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic";
1497 fi;
1498 fi
1499}
1500
1501export NIX_BUILD_TOP="$(mktemp -d --tmpdir nix-shell.XXXXXX)"
1502export TMP="$NIX_BUILD_TOP"
1503export TMPDIR="$NIX_BUILD_TOP"
1504export TEMP="$NIX_BUILD_TOP"
1505export TEMPDIR="$NIX_BUILD_TOP"
1506eval "$shellHook"
diff --git a/.gitignore b/.gitignore
index 2b728a5..f0d321e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
1/target 1target/
2.envrc 2.envrc
3result 3result
diff --git a/Cargo.lock b/backend/Cargo.lock
index 2f6aaaa..2f6aaaa 100644
--- a/Cargo.lock
+++ b/backend/Cargo.lock
diff --git a/Cargo.toml b/backend/Cargo.toml
index 8ce728b..8ce728b 100644
--- a/Cargo.toml
+++ b/backend/Cargo.toml
diff --git a/diesel.toml b/backend/diesel.toml
index 92267c8..92267c8 100644
--- a/diesel.toml
+++ b/backend/diesel.toml
diff --git a/migrations/.gitkeep b/backend/migrations/.gitkeep
index e69de29..e69de29 100644
--- a/migrations/.gitkeep
+++ b/backend/migrations/.gitkeep
diff --git a/migrations/2020-09-22-104623_create_users/down.sql b/backend/migrations/2020-09-22-104623_create_users/down.sql
index 2c92cb7..2c92cb7 100644
--- a/migrations/2020-09-22-104623_create_users/down.sql
+++ b/backend/migrations/2020-09-22-104623_create_users/down.sql
diff --git a/migrations/2020-09-22-104623_create_users/up.sql b/backend/migrations/2020-09-22-104623_create_users/up.sql
index dfd27d9..dfd27d9 100644
--- a/migrations/2020-09-22-104623_create_users/up.sql
+++ b/backend/migrations/2020-09-22-104623_create_users/up.sql
diff --git a/migrations/2020-11-16-133516_create_products_table/down.sql b/backend/migrations/2020-11-16-133516_create_products_table/down.sql
index 7d99a98..7d99a98 100644
--- a/migrations/2020-11-16-133516_create_products_table/down.sql
+++ b/backend/migrations/2020-11-16-133516_create_products_table/down.sql
diff --git a/migrations/2020-11-16-133516_create_products_table/up.sql b/backend/migrations/2020-11-16-133516_create_products_table/up.sql
index 829c5be..829c5be 100644
--- a/migrations/2020-11-16-133516_create_products_table/up.sql
+++ b/backend/migrations/2020-11-16-133516_create_products_table/up.sql
diff --git a/migrations/2020-12-13-140215_all_tables/down.sql b/backend/migrations/2020-12-13-140215_all_tables/down.sql
index 9c554a2..9c554a2 100644
--- a/migrations/2020-12-13-140215_all_tables/down.sql
+++ b/backend/migrations/2020-12-13-140215_all_tables/down.sql
diff --git a/migrations/2020-12-13-140215_all_tables/up.sql b/backend/migrations/2020-12-13-140215_all_tables/up.sql
index 527b926..527b926 100644
--- a/migrations/2020-12-13-140215_all_tables/up.sql
+++ b/backend/migrations/2020-12-13-140215_all_tables/up.sql
diff --git a/rustfmt.toml b/backend/rustfmt.toml
index be4296e..be4296e 100644
--- a/rustfmt.toml
+++ b/backend/rustfmt.toml
diff --git a/src/bin/server.rs b/backend/src/bin/server.rs
index 7c67e4f..7c67e4f 100644
--- a/src/bin/server.rs
+++ b/backend/src/bin/server.rs
diff --git a/src/handlers/cart_items.rs b/backend/src/handlers/cart_items.rs
index 25baaeb..25baaeb 100644
--- a/src/handlers/cart_items.rs
+++ b/backend/src/handlers/cart_items.rs
diff --git a/src/handlers/mod.rs b/backend/src/handlers/mod.rs
index 9416857..9416857 100644
--- a/src/handlers/mod.rs
+++ b/backend/src/handlers/mod.rs
diff --git a/src/handlers/product.rs b/backend/src/handlers/product.rs
index 41a47a0..41a47a0 100644
--- a/src/handlers/product.rs
+++ b/backend/src/handlers/product.rs
diff --git a/src/handlers/rating.rs b/backend/src/handlers/rating.rs
index dfbeb3e..dfbeb3e 100644
--- a/src/handlers/rating.rs
+++ b/backend/src/handlers/rating.rs
diff --git a/src/handlers/smoke.rs b/backend/src/handlers/smoke.rs
index d0a1038..d0a1038 100644
--- a/src/handlers/smoke.rs
+++ b/backend/src/handlers/smoke.rs
diff --git a/src/handlers/users.rs b/backend/src/handlers/users.rs
index 24fb591..24fb591 100644
--- a/src/handlers/users.rs
+++ b/backend/src/handlers/users.rs
diff --git a/src/lib.rs b/backend/src/lib.rs
index d956a3f..d956a3f 100644
--- a/src/lib.rs
+++ b/backend/src/lib.rs
diff --git a/src/models.rs b/backend/src/models.rs
index a104209..a104209 100644
--- a/src/models.rs
+++ b/backend/src/models.rs
diff --git a/src/schema.rs b/backend/src/schema.rs
index f08221a..f08221a 100644
--- a/src/schema.rs
+++ b/backend/src/schema.rs
diff --git a/tests/product/chair.json b/backend/tests/product/chair.json
index bb13c8b..bb13c8b 100644
--- a/tests/product/chair.json
+++ b/backend/tests/product/chair.json
diff --git a/tests/product/dumb_sofa.json b/backend/tests/product/dumb_sofa.json
index 2b09a58..2b09a58 100644
--- a/tests/product/dumb_sofa.json
+++ b/backend/tests/product/dumb_sofa.json
diff --git a/tests/product/smart_sofa.json b/backend/tests/product/smart_sofa.json
index 5d7f7d4..5d7f7d4 100644
--- a/tests/product/smart_sofa.json
+++ b/backend/tests/product/smart_sofa.json
diff --git a/tests/requests.txt b/backend/tests/requests.txt
index 7e2ca5c..7e2ca5c 100644
--- a/tests/requests.txt
+++ b/backend/tests/requests.txt
diff --git a/tests/users/add_akshay.json b/backend/tests/users/add_akshay.json
index 1d6c405..1d6c405 100644
--- a/tests/users/add_akshay.json
+++ b/backend/tests/users/add_akshay.json
diff --git a/tests/users/add_user.json b/backend/tests/users/add_user.json
index 1f481e9..1f481e9 100644
--- a/tests/users/add_user.json
+++ b/backend/tests/users/add_user.json
diff --git a/default.nix b/default.nix
deleted file mode 100644
index 11d6ca7..0000000
--- a/default.nix
+++ /dev/null
@@ -1,18 +0,0 @@
1let
2 sources = import ./nix/sources.nix;
3 nixpkgs-mozilla = import sources.nixpkgs-mozilla;
4 pkgs = import sources.nixpkgs {
5 overlays =
6 [
7 nixpkgs-mozilla
8 (self: super:
9 {
10 rustc = self.latest.rustChannels.nightly.rust;
11 cargo = self.latest.rustChannels.nightly.rust;
12 }
13 )
14 ];
15 };
16 naersk = pkgs.callPackage sources.naersk {};
17in
18 naersk.buildPackage ./.
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..8a14f41
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,44 @@
1{
2 "nodes": {
3 "mozillapkgs": {
4 "flake": false,
5 "locked": {
6 "lastModified": 1603906276,
7 "narHash": "sha256-RsNPnEKd7BcogwkqhaV5kI/HuNC4flH/OQCC/4W5y/8=",
8 "owner": "mozilla",
9 "repo": "nixpkgs-mozilla",
10 "rev": "8c007b60731c07dd7a052cce508de3bb1ae849b4",
11 "type": "github"
12 },
13 "original": {
14 "owner": "mozilla",
15 "repo": "nixpkgs-mozilla",
16 "type": "github"
17 }
18 },
19 "nixpkgs": {
20 "locked": {
21 "lastModified": 1608136118,
22 "narHash": "sha256-yvnnBQrVsrWkRAEZDM3LiAVPSKBgk9ZgiSaa6NYmJX4=",
23 "owner": "NixOS",
24 "repo": "nixpkgs",
25 "rev": "929768261a3ede470eafb58d5b819e1a848aa8bf",
26 "type": "github"
27 },
28 "original": {
29 "owner": "NixOS",
30 "ref": "nixos-20.03",
31 "repo": "nixpkgs",
32 "type": "github"
33 }
34 },
35 "root": {
36 "inputs": {
37 "mozillapkgs": "mozillapkgs",
38 "nixpkgs": "nixpkgs"
39 }
40 }
41 },
42 "root": "root",
43 "version": 7
44}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..4799770
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,43 @@
1{
2 description = "Frontend and backend for Furby";
3
4 inputs = {
5 nixpkgs.url = github:NixOS/nixpkgs/nixos-20.03;
6 mozillapkgs = {
7 url = "github:mozilla/nixpkgs-mozilla";
8 flake = false;
9 };
10 };
11
12
13 outputs = { self, nixpkgs, mozillapkgs }:
14 let
15 pkgs = import nixpkgs { system = "x86_64-linux"; };
16 mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {};
17 rust = (mozilla.rustChannelOf {
18 date = "2020-12-23"; # get the current date with `date -I`
19 channel = "nightly";
20 sha256 = "LbKHsCOFXWpg/SEyACfzZuWjKbkXdH6EJKOPSGoO01E=";
21 }).rust;
22 frontendPackages = with pkgs; [
23 elmPackages.elm
24 elmPackages.elm-language-server
25 elmPackages.elm-format
26 nodePackages.elm-oracle
27 elmPackages.elm-test
28 ];
29 backendPackages = with pkgs; [
30 cargo rust pkg-config
31 openssl httpie curl diesel-cli
32 libmysqlclient jq python3
33 ];
34 in
35 with pkgs;
36 {
37 defaultPackage.x86_64-linux = stdenv.mkDerivation {
38 name = "furby";
39 src = "./.";
40 buildInputs = frontendPackages ++ backendPackages;
41 };
42 };
43}
diff --git a/frontend/.direnv/flake-profile b/frontend/.direnv/flake-profile
new file mode 120000
index 0000000..6e8a8e9
--- /dev/null
+++ b/frontend/.direnv/flake-profile
@@ -0,0 +1 @@
/nix/store/m4z2i7h8x7xwac09q8gw4km9vhmi88ka-furby-env \ No newline at end of file
diff --git a/frontend/.direnv/flake-profile.rc b/frontend/.direnv/flake-profile.rc
new file mode 100644
index 0000000..dff177f
--- /dev/null
+++ b/frontend/.direnv/flake-profile.rc
@@ -0,0 +1,1473 @@
1unset shellHook
2nix_saved_PATH="$PATH"
3AR=ar
4export AR
5AS=as
6export AS
7BASH=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
8CC=gcc
9export CC
10CONFIG_SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
11export CONFIG_SHELL
12CXX=g++
13export CXX
14DIRSTACK=()
15GROUPS=()
16HOSTTYPE=x86_64
17HOST_PATH=/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin
18export HOST_PATH
19IFS=$' \t\n'
20IN_NIX_SHELL=impure
21export IN_NIX_SHELL
22LD=ld
23export LD
24MACHTYPE=x86_64-unknown-linux-gnu
25NIX_BINTOOLS=/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1
26export NIX_BINTOOLS
27NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1
28export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST
29NIX_BUILD_CORES=8
30export NIX_BUILD_CORES
31NIX_CC=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0
32export NIX_CC
33NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1
34export NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST
35NIX_ENFORCE_NO_NATIVE=1
36export NIX_ENFORCE_NO_NATIVE
37NIX_HARDENING_ENABLE='fortify stackprotector pic strictoverflow format relro bindnow'
38export NIX_HARDENING_ENABLE
39NIX_INDENT_MAKE=1
40export NIX_INDENT_MAKE
41NIX_LDFLAGS='-rpath /home/np/code/elmstuff/app-furby/outputs/out/lib64 -rpath /home/np/code/elmstuff/app-furby/outputs/out/lib '
42export NIX_LDFLAGS
43NIX_LIB64_IN_SELF_RPATH=1
44NIX_NO_SELF_RPATH=1
45NIX_STORE=/nix/store
46export NIX_STORE
47NM=nm
48export NM
49OBJCOPY=objcopy
50export OBJCOPY
51OBJDUMP=objdump
52export OBJDUMP
53OPTERR=1
54OPTIND=1
55OSTYPE=linux-gnu
56PATH=/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9/bin:/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0/bin:/nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1/bin:/nix/store/hrkc2sf2883l16d5yq3zg0y339kfw4xv-binutils-2.31.1/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin
57export PATH
58PIPESTATUS=([0]="0")
59PS4='+ '
60RANLIB=ranlib
61export RANLIB
62READELF=readelf
63export READELF
64SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
65export SHELL
66SIZE=size
67export SIZE
68SOURCE_DATE_EPOCH=1
69export SOURCE_DATE_EPOCH
70STRINGS=strings
71export STRINGS
72STRIP=strip
73export STRIP
74_=export
75buildInputs='/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1 /nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3 /nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3 /nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1 /nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2'
76export buildInputs
77builder=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
78export builder
79commonStripFlags=--enable-deterministic-archives
80configureFlags=
81export configureFlags
82defaultBuildInputs=
83defaultNativeBuildInputs='/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9 /nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh /nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh /nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh /nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh /nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh /nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0'
84depsBuildBuild=
85export depsBuildBuild
86depsBuildBuildPropagated=
87export depsBuildBuildPropagated
88depsBuildTarget=
89export depsBuildTarget
90depsBuildTargetPropagated=
91export depsBuildTargetPropagated
92depsHostHost=
93export depsHostHost
94depsHostHostPropagated=
95export depsHostHostPropagated
96depsTargetTarget=
97export depsTargetTarget
98depsTargetTargetPropagated=
99export depsTargetTargetPropagated
100doCheck=
101export doCheck
102doInstallCheck=
103export doInstallCheck
104dontAddDisableDepTrack=1
105export dontAddDisableDepTrack
106envHostHostHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars")
107envHostTargetHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars")
108fixupOutputHooks=([0]="if [ -z \"\${dontPatchELF-}\" ]; then patchELF \"\$prefix\"; fi" [1]="_makeSymlinksRelative" [2]="if [ -z \"\${dontGzipMan-}\" ]; then compressManPages \"\$prefix\"; fi" [3]="_doStrip" [4]="patchShebangsAuto" [5]="_pruneLibtoolFiles" [6]="if [[ -z \"\${noAuditTmpdir-}\" && -e \"\$prefix\" ]]; then auditTmpdir \"\$prefix\"; fi" [7]="_moveSbin" [8]="_moveLib64")
109initialPath='/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31 /nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0 /nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7 /nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8 /nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4 /nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1 /nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32 /nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10 /nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin /nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1 /nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23 /nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6 /nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin'
110name=furby
111export name
112nativeBuildInputs=
113export nativeBuildInputs
114out=/home/np/code/elmstuff/app-furby/outputs/out
115export out
116outputBin=out
117outputDev=out
118outputDevdoc=REMOVE
119outputDevman=out
120outputDoc=out
121outputInclude=out
122outputInfo=out
123outputLib=out
124outputMan=out
125outputs=out
126export outputs
127patches=
128export patches
129pkg=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0
130pkgsBuildHost=([0]="/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9" [1]="/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh" [2]="/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh" [3]="/nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh" [4]="/nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh" [5]="/nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh" [6]="/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh" [7]="/nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh" [8]="/nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh" [9]="/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh" [10]="/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh" [11]="/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh" [12]="/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0" [13]="/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1")
131pkgsHostTarget=([0]="/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1" [1]="/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3" [2]="/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3" [3]="/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1" [4]="/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2")
132postFixupHooks=([0]="_multioutPropagateDev")
133postUnpackHooks=([0]="_updateSourceDateEpochFromSourceRoot")
134preConfigureHooks=([0]="_multioutConfig")
135preFixupHooks=([0]="_moveToShare" [1]="_multioutDocs" [2]="_multioutDevs")
136prefix=/home/np/code/elmstuff/app-furby/outputs/out
137propagatedBuildDepFiles=([0]="propagated-build-build-deps" [1]="propagated-native-build-inputs" [2]="propagated-build-target-deps")
138propagatedBuildInputs=
139export propagatedBuildInputs
140propagatedHostDepFiles=([0]="propagated-host-host-deps" [1]="propagated-build-inputs")
141propagatedNativeBuildInputs=
142export propagatedNativeBuildInputs
143propagatedTargetDepFiles=([0]="propagated-target-target-deps")
144shell=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash
145export shell
146src=./.
147export src
148stdenv=/nix/store/sm7kk5n84vaisqvhk1yfsjqls50j8s0m-stdenv-linux
149export stdenv
150strictDeps=
151export strictDeps
152system=x86_64-linux
153export system
154unpackCmdHooks=([0]="_defaultUnpack")
155PATH="$PATH:$nix_saved_PATH"
156_activatePkgs ()
157{
158 local -i hostOffset targetOffset;
159 local pkg;
160 for hostOffset in "${allPlatOffsets[@]}";
161 do
162 local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}";
163 for targetOffset in "${allPlatOffsets[@]}";
164 do
165 (( "$hostOffset" <= "$targetOffset" )) || continue;
166 local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]";
167 local pkgsSlice="${!pkgsRef}[@]";
168 for pkg in ${!pkgsSlice+"${!pkgsSlice}"};
169 do
170 activatePackage "$pkg" "$hostOffset" "$targetOffset";
171 done;
172 done;
173 done
174}
175_addRpathPrefix ()
176{
177 if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then
178 export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}";
179 if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then
180 export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}";
181 fi;
182 if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then
183 export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}";
184 fi;
185 fi
186}
187_addToEnv ()
188{
189 local -i depHostOffset depTargetOffset;
190 local pkg;
191 for depHostOffset in "${allPlatOffsets[@]}";
192 do
193 local hookVar="${pkgHookVarVars[$depHostOffset + 1]}";
194 local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}";
195 for depTargetOffset in "${allPlatOffsets[@]}";
196 do
197 (( "$depHostOffset" <= "$depTargetOffset" )) || continue;
198 local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]";
199 if [[ -z "${strictDeps-}" ]]; then
200 local visitedPkgs="";
201 for pkg in ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} ${pkgsBuildHost+"${pkgsBuildHost[@]}"} ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} ${pkgsHostHost+"${pkgsHostHost[@]}"} ${pkgsHostTarget+"${pkgsHostTarget[@]}"} ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"};
202 do
203 if [[ "$visitedPkgs" = *"$pkg"* ]]; then
204 continue;
205 fi;
206 runHook "${!hookRef}" "$pkg";
207 visitedPkgs+=" $pkg";
208 done;
209 else
210 local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]";
211 local pkgsSlice="${!pkgsRef}[@]";
212 for pkg in ${!pkgsSlice+"${!pkgsSlice}"};
213 do
214 runHook "${!hookRef}" "$pkg";
215 done;
216 fi;
217 done;
218 done
219}
220_allFlags ()
221{
222 for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }');
223 do
224 if (( "${NIX_DEBUG:-0}" >= 1 )); then
225 printf "@%s@ -> %q\n" "${varName}" "${!varName}";
226 fi;
227 args+=("--subst-var" "$varName");
228 done
229}
230_assignFirst ()
231{
232 local varName="$1";
233 local REMOVE=REMOVE;
234 shift;
235 while (( $# )); do
236 if [ -n "${!1-}" ]; then
237 eval "${varName}"="$1";
238 return;
239 fi;
240 shift;
241 done;
242 echo "Error: _assignFirst found no valid variant!";
243 return 1
244}
245_callImplicitHook ()
246{
247 local def="$1";
248 local hookName="$2";
249 if declare -F "$hookName" > /dev/null; then
250 "$hookName";
251 else
252 if type -p "$hookName" > /dev/null; then
253 source "$hookName";
254 else
255 if [ -n "${!hookName:-}" ]; then
256 eval "${!hookName}";
257 else
258 return "$def";
259 fi;
260 fi;
261 fi
262}
263_defaultUnpack ()
264{
265 local fn="$1";
266 if [ -d "$fn" ]; then
267 cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")";
268 else
269 case "$fn" in
270 *.tar.xz | *.tar.lzma | *.txz)
271 xz -d < "$fn" | tar xf -
272 ;;
273 *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
274 tar xf "$fn"
275 ;;
276 *)
277 return 1
278 ;;
279 esac;
280 fi
281}
282_doStrip ()
283{
284 local -ra flags=(dontStripHost dontStripTarget);
285 local -ra stripCmds=(STRIP TARGET_STRIP);
286 if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then
287 dontStripTarget+=1;
288 fi;
289 local i;
290 for i in ${!stripCmds[@]};
291 do
292 local -n flag="${flags[$i]}";
293 local -n stripCmd="${stripCmds[$i]}";
294 if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null; then
295 continue;
296 fi;
297 stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin};
298 if [ -n "$stripDebugList" ]; then
299 stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}";
300 fi;
301 stripAllList=${stripAllList:-};
302 if [ -n "$stripAllList" ]; then
303 stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}";
304 fi;
305 done
306}
307_eval ()
308{
309 if declare -F "$1" > /dev/null 2>&1; then
310 "$@";
311 else
312 eval "$1";
313 fi
314}
315_makeSymlinksRelative ()
316{
317 local symlinkTarget;
318 if [ -n "${dontRewriteSymlinks-}" ]; then
319 return 0;
320 fi;
321 while IFS= read -r -d '' f; do
322 symlinkTarget=$(readlink "$f");
323 if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then
324 continue;
325 fi;
326 if [ ! -e "$symlinkTarget" ]; then
327 echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)";
328 fi;
329 echo "rewriting symlink $f to be relative to $prefix";
330 ln -snrf "$symlinkTarget" "$f";
331 done < <(find $prefix -type l -print0)
332}
333_moveLib64 ()
334{
335 if [ "${dontMoveLib64-}" = 1 ]; then
336 return;
337 fi;
338 if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then
339 return;
340 fi;
341 echo "moving $prefix/lib64/* to $prefix/lib";
342 mkdir -p $prefix/lib;
343 shopt -s dotglob;
344 for i in $prefix/lib64/*;
345 do
346 mv --no-clobber "$i" $prefix/lib;
347 done;
348 shopt -u dotglob;
349 rmdir $prefix/lib64;
350 ln -s lib $prefix/lib64
351}
352_moveSbin ()
353{
354 if [ "${dontMoveSbin-}" = 1 ]; then
355 return;
356 fi;
357 if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then
358 return;
359 fi;
360 echo "moving $prefix/sbin/* to $prefix/bin";
361 mkdir -p $prefix/bin;
362 shopt -s dotglob;
363 for i in $prefix/sbin/*;
364 do
365 mv "$i" $prefix/bin;
366 done;
367 shopt -u dotglob;
368 rmdir $prefix/sbin;
369 ln -s bin $prefix/sbin
370}
371_moveToShare ()
372{
373 forceShare=${forceShare:=man doc info};
374 if [ -z "$forceShare" -o -z "$out" ]; then
375 return;
376 fi;
377 for d in $forceShare;
378 do
379 if [ -d "$out/$d" ]; then
380 if [ -d "$out/share/$d" ]; then
381 echo "both $d/ and share/$d/ exist!";
382 else
383 echo "moving $out/$d to $out/share/$d";
384 mkdir -p $out/share;
385 mv $out/$d $out/share/;
386 fi;
387 fi;
388 done
389}
390_multioutConfig ()
391{
392 if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then
393 return;
394 fi;
395 if [ -z "$shareDocName" ]; then
396 local confScript="$configureScript";
397 if [ -z "$confScript" ] && [ -x ./configure ]; then
398 confScript=./configure;
399 fi;
400 if [ -f "$confScript" ]; then
401 local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")";
402 fi;
403 if [ -n "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then
404 shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')";
405 fi;
406 fi;
407 configureFlags=" --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin --includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info --docdir=${!outputDoc}/share/doc/${shareDocName} --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec --localedir=${!outputLib}/share/locale $configureFlags";
408 installFlags=" pkgconfigdir=${!outputDev}/lib/pkgconfig m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal $installFlags"
409}
410_multioutDevs ()
411{
412 if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then
413 return;
414 fi;
415 moveToOutput include "${!outputInclude}";
416 moveToOutput lib/pkgconfig "${!outputDev}";
417 moveToOutput share/pkgconfig "${!outputDev}";
418 moveToOutput lib/cmake "${!outputDev}";
419 moveToOutput share/aclocal "${!outputDev}";
420 for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc;
421 do
422 echo "Patching '$f' includedir to output ${!outputInclude}";
423 sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f";
424 done
425}
426_multioutDocs ()
427{
428 local REMOVE=REMOVE;
429 moveToOutput share/info "${!outputInfo}";
430 moveToOutput share/doc "${!outputDoc}";
431 moveToOutput share/gtk-doc "${!outputDevdoc}";
432 moveToOutput share/devhelp/books "${!outputDevdoc}";
433 moveToOutput share/man "${!outputMan}";
434 moveToOutput share/man/man3 "${!outputDevman}"
435}
436_multioutPropagateDev ()
437{
438 if [ "$outputs" = "out" ]; then
439 return;
440 fi;
441 local outputFirst;
442 for outputFirst in $outputs;
443 do
444 break;
445 done;
446 local propagaterOutput="$outputDev";
447 if [ -z "$propagaterOutput" ]; then
448 propagaterOutput="$outputFirst";
449 fi;
450 if [ -z "${propagatedBuildOutputs+1}" ]; then
451 local po_dirty="$outputBin $outputInclude $outputLib";
452 set +o pipefail;
453 propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `;
454 set -o pipefail;
455 fi;
456 if [ -z "$propagatedBuildOutputs" ]; then
457 return;
458 fi;
459 mkdir -p "${!propagaterOutput}"/nix-support;
460 for output in $propagatedBuildOutputs;
461 do
462 echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs;
463 done
464}
465_overrideFirst ()
466{
467 if [ -z "${!1-}" ]; then
468 _assignFirst "$@";
469 fi
470}
471_pruneLibtoolFiles ()
472{
473 if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
474 return;
475 fi;
476 find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \;
477}
478_updateSourceDateEpochFromSourceRoot ()
479{
480 if [ -n "$sourceRoot" ]; then
481 updateSourceDateEpoch "$sourceRoot";
482 fi
483}
484activatePackage ()
485{
486 local pkg="$1";
487 local -ri hostOffset="$2";
488 local -ri targetOffset="$3";
489 (( "$hostOffset" <= "$targetOffset" )) || exit -1;
490 if [ -f "$pkg" ]; then
491 source "$pkg";
492 fi;
493 if [[ ( -z "${strictDeps-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then
494 addToSearchPath _PATH "$pkg/bin";
495 fi;
496 if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then
497 addToSearchPath _HOST_PATH "$pkg/bin";
498 fi;
499 if [[ -f "$pkg/nix-support/setup-hook" ]]; then
500 source "$pkg/nix-support/setup-hook";
501 fi
502}
503addEnvHooks ()
504{
505 local depHostOffset="$1";
506 shift;
507 local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]";
508 local pkgHookVar;
509 for pkgHookVar in "${!pkgHookVarsSlice}";
510 do
511 eval "${pkgHookVar}s"'+=("$@")';
512 done
513}
514addToSearchPath ()
515{
516 addToSearchPathWithCustomDelimiter ":" "$@"
517}
518addToSearchPathWithCustomDelimiter ()
519{
520 local delimiter="$1";
521 local varName="$2";
522 local dir="$3";
523 if [ -d "$dir" ]; then
524 export "${varName}=${!varName:+${!varName}${delimiter}}${dir}";
525 fi
526}
527auditTmpdir ()
528{
529 local dir="$1";
530 [ -e "$dir" ] || return 0;
531 header "checking for references to $TMPDIR/ in $dir...";
532 local i;
533 while IFS= read -r -d '' i; do
534 if [[ "$i" =~ .build-id ]]; then
535 continue;
536 fi;
537 if isELF "$i"; then
538 if {
539 printf :;
540 patchelf --print-rpath "$i"
541 } | grep -q -F ":$TMPDIR/"; then
542 echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/";
543 exit 1;
544 fi;
545 fi;
546 if isScript "$i"; then
547 if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then
548 if grep -q -F "$TMPDIR/" "$i"; then
549 echo "wrapper script $i contains a forbidden reference to $TMPDIR/";
550 exit 1;
551 fi;
552 fi;
553 fi;
554 done < <(find "$dir" -type f -print0);
555 stopNest
556}
557bintoolsWrapper_addLDVars ()
558{
559 local role_post role_pre;
560 getHostRoleEnvHook;
561 if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then
562 export NIX_${role_pre}LDFLAGS+=" -L$1/lib64";
563 fi;
564 if [[ -d "$1/lib" ]]; then
565 local -a glob=($1/lib/lib*);
566 if [ "${#glob[*]}" -gt 0 ]; then
567 export NIX_${role_pre}LDFLAGS+=" -L$1/lib";
568 fi;
569 fi
570}
571buildPhase ()
572{
573 runHook preBuild;
574 : ${makeFlags=};
575 if [[ -z "$makeFlags" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then
576 echo "no Makefile, doing nothing";
577 else
578 foundMakefile=1;
579 local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"});
580 echoCmd 'build flags' "${flagsArray[@]}";
581 make ${makefile:+-f $makefile} "${flagsArray[@]}";
582 unset flagsArray;
583 fi;
584 runHook postBuild
585}
586ccWrapper_addCVars ()
587{
588 local role_post role_pre;
589 getHostRoleEnvHook;
590 if [ -d "$1/include" ]; then
591 export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include";
592 fi;
593 if [ -d "$1/Library/Frameworks" ]; then
594 export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks";
595 fi
596}
597checkPhase ()
598{
599 runHook preCheck;
600 if [[ -z "${foundMakefile:-}" ]]; then
601 echo "no Makefile or custom buildPhase, doing nothing";
602 runHook postCheck;
603 return;
604 fi;
605 if [[ -z "${checkTarget:-}" ]]; then
606 if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then
607 checkTarget=check;
608 else
609 if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then
610 checkTarget=test;
611 fi;
612 fi;
613 fi;
614 if [[ -z "${checkTarget:-}" ]]; then
615 echo "no check/test target in ${makefile:-Makefile}, doing nothing";
616 else
617 local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget});
618 echoCmd 'check flags' "${flagsArray[@]}";
619 make ${makefile:+-f $makefile} "${flagsArray[@]}";
620 unset flagsArray;
621 fi;
622 runHook postCheck
623}
624closeNest ()
625{
626 true
627}
628compressManPages ()
629{
630 local dir="$1";
631 if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then
632 return;
633 fi;
634 echo "gzipping man pages under $dir/share/man/";
635 find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do
636 if gzip -c -n "$f" > "$f".gz; then
637 rm "$f";
638 else
639 rm "$f".gz;
640 fi;
641 done;
642 find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do
643 local target;
644 target="$(readlink -f "$f")";
645 if [ -f "$target".gz ]; then
646 ln -sf "$target".gz "$f".gz && rm "$f";
647 fi;
648 done
649}
650configurePhase ()
651{
652 runHook preConfigure;
653 : ${configureScript=};
654 : ${configureFlags=};
655 if [[ -z "$configureScript" && -x ./configure ]]; then
656 configureScript=./configure;
657 fi;
658 if [ -z "${dontFixLibtool:-}" ]; then
659 local i;
660 find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do
661 echo "fixing libtool script $i";
662 fixLibtool "$i";
663 done;
664 fi;
665 if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then
666 configureFlags="${prefixKey:---prefix=}$prefix $configureFlags";
667 fi;
668 if [ -z "${dontAddDisableDepTrack:-}" ]; then
669 if [ -f "$configureScript" ] && grep -q dependency-tracking "$configureScript"; then
670 configureFlags="--disable-dependency-tracking $configureFlags";
671 fi;
672 fi;
673 if [ -z "${dontDisableStatic:-}" ]; then
674 if [ -f "$configureScript" ] && grep -q enable-static "$configureScript"; then
675 configureFlags="--disable-static $configureFlags";
676 fi;
677 fi;
678 if [ -n "$configureScript" ]; then
679 local flagsArray=($configureFlags ${configureFlagsArray+"${configureFlagsArray[@]}"});
680 echoCmd 'configure flags' "${flagsArray[@]}";
681 $configureScript "${flagsArray[@]}";
682 unset flagsArray;
683 else
684 echo "no configure script, doing nothing";
685 fi;
686 runHook postConfigure
687}
688consumeEntire ()
689{
690 if IFS='' read -r -N 0 $1; then
691 echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2;
692 return 1;
693 fi
694}
695distPhase ()
696{
697 runHook preDist;
698 local flagsArray=($distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist});
699 echo 'dist flags: %q' "${flagsArray[@]}";
700 make ${makefile:+-f $makefile} "${flagsArray[@]}";
701 if [ "${dontCopyDist:-0}" != 1 ]; then
702 mkdir -p "$out/tarballs";
703 cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs";
704 fi;
705 runHook postDist
706}
707dumpVars ()
708{
709 if [ "${noDumpEnvVars:-0}" != 1 ]; then
710 export > "$NIX_BUILD_TOP/env-vars" || true;
711 fi
712}
713echoCmd ()
714{
715 printf "%s:" "$1";
716 shift;
717 printf ' %q' "$@";
718 echo
719}
720exitHandler ()
721{
722 exitCode="$?";
723 set +e;
724 if [ -n "${showBuildStats:-}" ]; then
725 times > "$NIX_BUILD_TOP/.times";
726 local -a times=($(cat "$NIX_BUILD_TOP/.times"));
727 echo "build time elapsed: " "${times[@]}";
728 fi;
729 if (( "$exitCode" != 0 )); then
730 runHook failureHook;
731 if [ -n "${succeedOnFailure:-}" ]; then
732 echo "build failed with exit code $exitCode (ignored)";
733 mkdir -p "$out/nix-support";
734 printf "%s" "$exitCode" > "$out/nix-support/failed";
735 exit 0;
736 fi;
737 else
738 runHook exitHook;
739 fi;
740 exit "$exitCode"
741}
742findInputs ()
743{
744 local -r pkg="$1";
745 local -ri hostOffset="$2";
746 local -ri targetOffset="$3";
747 (( "$hostOffset" <= "$targetOffset" )) || exit -1;
748 local varVar="${pkgAccumVarVars[$hostOffset + 1]}";
749 local varRef="$varVar[\$targetOffset - \$hostOffset]";
750 local var="${!varRef}";
751 unset -v varVar varRef;
752 local varSlice="$var[*]";
753 case "${!varSlice-}" in
754 *" $pkg "*)
755 return 0
756 ;;
757 esac;
758 unset -v varSlice;
759 eval "$var"'+=("$pkg")';
760 if ! [ -e "$pkg" ]; then
761 echo "build input $pkg does not exist" 1>&2;
762 exit 1;
763 fi;
764 local -i mapOffsetResult;
765 function mapOffset ()
766 {
767 local -ri inputOffset="$1";
768 if (( "$inputOffset" <= 0 )); then
769 local -ri outputOffset="$inputOffset + $hostOffset";
770 else
771 local -ri outputOffset="$inputOffset - 1 + $targetOffset";
772 fi;
773 mapOffsetResult="$outputOffset"
774 };
775 local -i relHostOffset;
776 for relHostOffset in "${allPlatOffsets[@]}";
777 do
778 local files="${propagatedDepFilesVars[$relHostOffset + 1]}";
779 mapOffset relHostOffset;
780 local -i hostOffsetNext="$mapOffsetResult";
781 [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue;
782 local -i relTargetOffset;
783 for relTargetOffset in "${allPlatOffsets[@]}";
784 do
785 (( "$relHostOffset" <= "$relTargetOffset" )) || continue;
786 local fileRef="${files}[$relTargetOffset - $relHostOffset]";
787 local file="${!fileRef}";
788 unset -v fileRef;
789 mapOffset relTargetOffset;
790 local -i targetOffsetNext="$mapOffsetResult";
791 [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue;
792 [[ -f "$pkg/nix-support/$file" ]] || continue;
793 local pkgNext;
794 read -r -d '' pkgNext < "$pkg/nix-support/$file" || true;
795 for pkgNext in $pkgNext;
796 do
797 findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext";
798 done;
799 done;
800 done
801}
802fixLibtool ()
803{
804 sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1"
805}
806fixupPhase ()
807{
808 local output;
809 for output in $outputs;
810 do
811 if [ -e "${!output}" ]; then
812 chmod -R u+w "${!output}";
813 fi;
814 done;
815 runHook preFixup;
816 local output;
817 for output in $outputs;
818 do
819 prefix="${!output}" runHook fixupOutput;
820 done;
821 declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated);
822 declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}");
823 local propagatedInputsIndex;
824 for propagatedInputsIndex in "${!flatVars[@]}";
825 do
826 local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]";
827 local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}";
828 [[ -n "${!propagatedInputsSlice}" ]] || continue;
829 mkdir -p "${!outputDev}/nix-support";
830 printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile";
831 done;
832 if [ -n "${setupHook:-}" ]; then
833 mkdir -p "${!outputDev}/nix-support";
834 substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook";
835 fi;
836 if [ -n "${setupHooks:-}" ]; then
837 mkdir -p "${!outputDev}/nix-support";
838 local hook;
839 for hook in $setupHooks;
840 do
841 local content;
842 consumeEntire content < "$hook";
843 substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook";
844 unset -v content;
845 done;
846 unset -v hook;
847 fi;
848 if [ -n "${propagatedUserEnvPkgs:-}" ]; then
849 mkdir -p "${!outputBin}/nix-support";
850 printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages";
851 fi;
852 runHook postFixup
853}
854genericBuild ()
855{
856 if [ -f "${buildCommandPath:-}" ]; then
857 source "$buildCommandPath";
858 return;
859 fi;
860 if [ -n "${buildCommand:-}" ]; then
861 eval "$buildCommand";
862 return;
863 fi;
864 if [ -z "${phases:-}" ]; then
865 phases="${prePhases:-} unpackPhase patchPhase ${preConfigurePhases:-} configurePhase ${preBuildPhases:-} buildPhase checkPhase ${preInstallPhases:-} installPhase ${preFixupPhases:-} fixupPhase installCheckPhase ${preDistPhases:-} distPhase ${postPhases:-}";
866 fi;
867 for curPhase in $phases;
868 do
869 if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then
870 continue;
871 fi;
872 if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then
873 continue;
874 fi;
875 if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then
876 continue;
877 fi;
878 if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then
879 continue;
880 fi;
881 if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then
882 continue;
883 fi;
884 if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then
885 continue;
886 fi;
887 if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then
888 continue;
889 fi;
890 if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then
891 continue;
892 fi;
893 if [[ -n $NIX_LOG_FD ]]; then
894 echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" 1>&$NIX_LOG_FD;
895 fi;
896 showPhaseHeader "$curPhase";
897 dumpVars;
898 eval "${!curPhase:-$curPhase}";
899 if [ "$curPhase" = unpackPhase ]; then
900 cd "${sourceRoot:-.}";
901 fi;
902 done
903}
904getHostRole ()
905{
906 getRole "$hostOffset"
907}
908getHostRoleEnvHook ()
909{
910 getRole "$depHostOffset"
911}
912getRole ()
913{
914 case $1 in
915 -1)
916 role_pre='BUILD_';
917 role_post='_FOR_BUILD'
918 ;;
919 0)
920 role_pre='';
921 role_post=''
922 ;;
923 1)
924 role_pre='TARGET_';
925 role_post='_FOR_TARGET'
926 ;;
927 *)
928 echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2;
929 return 1
930 ;;
931 esac
932}
933getTargetRole ()
934{
935 getRole "$targetOffset"
936}
937getTargetRoleEnvHook ()
938{
939 getRole "$depTargetOffset"
940}
941getTargetRoleWrapper ()
942{
943 case $targetOffset in
944 -1)
945 export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_BUILD=1
946 ;;
947 0)
948 export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1
949 ;;
950 1)
951 export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_TARGET=1
952 ;;
953 *)
954 echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2;
955 return 1
956 ;;
957 esac
958}
959header ()
960{
961 echo "$1"
962}
963installCheckPhase ()
964{
965 runHook preInstallCheck;
966 if [[ -z "${foundMakefile:-}" ]]; then
967 echo "no Makefile or custom buildPhase, doing nothing";
968 else
969 if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} > /dev/null 2>&1; then
970 echo "no installcheck target in ${makefile:-Makefile}, doing nothing";
971 else
972 local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck});
973 echoCmd 'installcheck flags' "${flagsArray[@]}";
974 make ${makefile:+-f $makefile} "${flagsArray[@]}";
975 unset flagsArray;
976 fi;
977 fi;
978 runHook postInstallCheck
979}
980installPhase ()
981{
982 runHook preInstall;
983 if [ -n "$prefix" ]; then
984 mkdir -p "$prefix";
985 fi;
986 local flagsArray=(SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installFlags ${installFlagsArray+"${installFlagsArray[@]}"} ${installTargets:-install});
987 echoCmd 'install flags' "${flagsArray[@]}";
988 make ${makefile:+-f $makefile} "${flagsArray[@]}";
989 unset flagsArray;
990 runHook postInstall
991}
992isELF ()
993{
994 local fn="$1";
995 local fd;
996 local magic;
997 exec {fd}< "$fn";
998 read -r -n 4 -u "$fd" magic;
999 exec {fd}>&-;
1000 if [ "$magic" = 'ELF' ]; then
1001 return 0;
1002 else
1003 return 1;
1004 fi
1005}
1006isScript ()
1007{
1008 local fn="$1";
1009 local fd;
1010 local magic;
1011 exec {fd}< "$fn";
1012 read -r -n 2 -u "$fd" magic;
1013 exec {fd}>&-;
1014 if [[ "$magic" =~ \#! ]]; then
1015 return 0;
1016 else
1017 return 1;
1018 fi
1019}
1020mapOffset ()
1021{
1022 local -ri inputOffset="$1";
1023 if (( "$inputOffset" <= 0 )); then
1024 local -ri outputOffset="$inputOffset + $hostOffset";
1025 else
1026 local -ri outputOffset="$inputOffset - 1 + $targetOffset";
1027 fi;
1028 mapOffsetResult="$outputOffset"
1029}
1030moveToOutput ()
1031{
1032 local patt="$1";
1033 local dstOut="$2";
1034 local output;
1035 for output in $outputs;
1036 do
1037 if [ "${!output}" = "$dstOut" ]; then
1038 continue;
1039 fi;
1040 local srcPath;
1041 for srcPath in "${!output}"/$patt;
1042 do
1043 if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then
1044 continue;
1045 fi;
1046 if [ "$dstOut" = REMOVE ]; then
1047 echo "Removing $srcPath";
1048 rm -r "$srcPath";
1049 else
1050 local dstPath="$dstOut${srcPath#${!output}}";
1051 echo "Moving $srcPath to $dstPath";
1052 if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then
1053 rmdir "$srcPath" --ignore-fail-on-non-empty;
1054 if [ -d "$srcPath" ]; then
1055 mv -t "$dstPath" "$srcPath"/*;
1056 rmdir "$srcPath";
1057 fi;
1058 else
1059 mkdir -p "$(readlink -m "$dstPath/..")";
1060 mv "$srcPath" "$dstPath";
1061 fi;
1062 fi;
1063 local srcParent="$(readlink -m "$srcPath/..")";
1064 if rmdir "$srcParent"; then
1065 echo "Removing empty $srcParent/ and (possibly) its parents";
1066 rmdir -p --ignore-fail-on-non-empty "$(readlink -m "$srcParent/..")" 2> /dev/null || true;
1067 fi;
1068 done;
1069 done
1070}
1071patchELF ()
1072{
1073 local dir="$1";
1074 [ -e "$dir" ] || return 0;
1075 header "shrinking RPATHs of ELF executables and libraries in $dir";
1076 local i;
1077 while IFS= read -r -d '' i; do
1078 if [[ "$i" =~ .build-id ]]; then
1079 continue;
1080 fi;
1081 if ! isELF "$i"; then
1082 continue;
1083 fi;
1084 echo "shrinking $i";
1085 patchelf --shrink-rpath "$i" || true;
1086 done < <(find "$dir" -type f -print0);
1087 stopNest
1088}
1089patchPhase ()
1090{
1091 runHook prePatch;
1092 for i in ${patches:-};
1093 do
1094 header "applying patch $i" 3;
1095 local uncompress=cat;
1096 case "$i" in
1097 *.gz)
1098 uncompress="gzip -d"
1099 ;;
1100 *.bz2)
1101 uncompress="bzip2 -d"
1102 ;;
1103 *.xz)
1104 uncompress="xz -d"
1105 ;;
1106 *.lzma)
1107 uncompress="lzma -d"
1108 ;;
1109 esac;
1110 $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1};
1111 done;
1112 runHook postPatch
1113}
1114patchShebangs ()
1115{
1116 local pathName;
1117 if [ "$1" = "--host" ]; then
1118 pathName=HOST_PATH;
1119 shift;
1120 else
1121 if [ "$1" = "--build" ]; then
1122 pathName=PATH;
1123 shift;
1124 fi;
1125 fi;
1126 echo "patching script interpreter paths in $@";
1127 local f;
1128 local oldPath;
1129 local newPath;
1130 local arg0;
1131 local args;
1132 local oldInterpreterLine;
1133 local newInterpreterLine;
1134 if [ $# -eq 0 ]; then
1135 echo "No arguments supplied to patchShebangs" > 0;
1136 return 0;
1137 fi;
1138 local f;
1139 while IFS= read -r -d '' f; do
1140 isScript "$f" || continue;
1141 oldInterpreterLine=$(head -1 "$f" | tail -c+3);
1142 read -r oldPath arg0 args <<< "$oldInterpreterLine";
1143 if [ -z "$pathName" ]; then
1144 if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then
1145 pathName=HOST_PATH;
1146 else
1147 pathName=PATH;
1148 fi;
1149 fi;
1150 if $(echo "$oldPath" | grep -q "/bin/env$"); then
1151 if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
1152 echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" > 0;
1153 exit 1;
1154 fi;
1155 newPath="$(PATH="${!pathName}" command -v "$arg0" || true)";
1156 else
1157 if [ "$oldPath" = "" ]; then
1158 oldPath="/bin/sh";
1159 fi;
1160 newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)";
1161 args="$arg0 $args";
1162 fi;
1163 newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')";
1164 if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
1165 if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
1166 echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\"";
1167 escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g');
1168 timestamp=$(mktemp);
1169 touch -r "$f" "$timestamp";
1170 sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f";
1171 touch -r "$timestamp" "$f";
1172 rm "$timestamp";
1173 fi;
1174 fi;
1175 done < <(find "$@" -type f -perm -0100 -print0);
1176 stopNest
1177}
1178patchShebangsAuto ()
1179{
1180 if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then
1181 if [ "$output" != out ] && [ "$output" = "$outputDev" ]; then
1182 patchShebangs --build "$prefix";
1183 else
1184 patchShebangs --host "$prefix";
1185 fi;
1186 fi
1187}
1188printLines ()
1189{
1190 (( "$#" > 0 )) || return 0;
1191 printf '%s\n' "$@"
1192}
1193printWords ()
1194{
1195 (( "$#" > 0 )) || return 0;
1196 printf '%s ' "$@"
1197}
1198runHook ()
1199{
1200 local hookName="$1";
1201 shift;
1202 local hooksSlice="${hookName%Hook}Hooks[@]";
1203 local hook;
1204 for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"};
1205 do
1206 _eval "$hook" "$@";
1207 done;
1208 return 0
1209}
1210runOneHook ()
1211{
1212 local hookName="$1";
1213 shift;
1214 local hooksSlice="${hookName%Hook}Hooks[@]";
1215 local hook ret=1;
1216 for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"};
1217 do
1218 if _eval "$hook" "$@"; then
1219 ret=0;
1220 break;
1221 fi;
1222 done;
1223 return "$ret"
1224}
1225showPhaseHeader ()
1226{
1227 local phase="$1";
1228 case "$phase" in
1229 unpackPhase)
1230 header "unpacking sources"
1231 ;;
1232 patchPhase)
1233 header "patching sources"
1234 ;;
1235 configurePhase)
1236 header "configuring"
1237 ;;
1238 buildPhase)
1239 header "building"
1240 ;;
1241 checkPhase)
1242 header "running tests"
1243 ;;
1244 installPhase)
1245 header "installing"
1246 ;;
1247 fixupPhase)
1248 header "post-installation fixup"
1249 ;;
1250 installCheckPhase)
1251 header "running install tests"
1252 ;;
1253 *)
1254 header "$phase"
1255 ;;
1256 esac
1257}
1258stopNest ()
1259{
1260 true
1261}
1262stripDirs ()
1263{
1264 local cmd="$1";
1265 local dirs="$2";
1266 local stripFlags="$3";
1267 local dirsNew=;
1268 local d;
1269 for d in ${dirs};
1270 do
1271 if [ -d "$prefix/$d" ]; then
1272 dirsNew="${dirsNew} $prefix/$d ";
1273 fi;
1274 done;
1275 dirs=${dirsNew};
1276 if [ -n "${dirs}" ]; then
1277 header "stripping (with command $cmd and flags $stripFlags) in$dirs";
1278 find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2> /dev/null || true;
1279 stopNest;
1280 fi
1281}
1282stripHash ()
1283{
1284 local strippedName casematchOpt=0;
1285 strippedName="$(basename -- "$1")";
1286 shopt -q nocasematch && casematchOpt=1;
1287 shopt -u nocasematch;
1288 if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then
1289 echo "${strippedName:33}";
1290 else
1291 echo "$strippedName";
1292 fi;
1293 if (( casematchOpt )); then
1294 shopt -s nocasematch;
1295 fi
1296}
1297substitute ()
1298{
1299 local input="$1";
1300 local output="$2";
1301 shift 2;
1302 if [ ! -f "$input" ]; then
1303 echo "substitute(): ERROR: file '$input' does not exist" 1>&2;
1304 return 1;
1305 fi;
1306 local content;
1307 consumeEntire content < "$input";
1308 if [ -e "$output" ]; then
1309 chmod +w "$output";
1310 fi;
1311 substituteStream content "file '$input'" "$@" > "$output"
1312}
1313substituteAll ()
1314{
1315 local input="$1";
1316 local output="$2";
1317 local -a args=();
1318 _allFlags;
1319 substitute "$input" "$output" "${args[@]}"
1320}
1321substituteAllInPlace ()
1322{
1323 local fileName="$1";
1324 shift;
1325 substituteAll "$fileName" "$fileName" "$@"
1326}
1327substituteAllStream ()
1328{
1329 local -a args=();
1330 _allFlags;
1331 substituteStream "$1" "$2" "${args[@]}"
1332}
1333substituteInPlace ()
1334{
1335 local fileName="$1";
1336 shift;
1337 substitute "$fileName" "$fileName" "$@"
1338}
1339substituteStream ()
1340{
1341 local var=$1;
1342 local description=$2;
1343 shift 2;
1344 while (( "$#" )); do
1345 case "$1" in
1346 --replace)
1347 pattern="$2";
1348 replacement="$3";
1349 shift 3;
1350 local savedvar;
1351 savedvar="${!var}";
1352 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}';
1353 if [ "$pattern" != "$replacement" ]; then
1354 if [ "${!var}" == "$savedvar" ]; then
1355 echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2;
1356 fi;
1357 fi
1358 ;;
1359 --subst-var)
1360 local varName="$2";
1361 shift 2;
1362 if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then
1363 echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2;
1364 return 1;
1365 fi;
1366 if [ -z ${!varName+x} ]; then
1367 echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2;
1368 return 1;
1369 fi;
1370 pattern="@$varName@";
1371 replacement="${!varName}";
1372 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'
1373 ;;
1374 --subst-var-by)
1375 pattern="@$2@";
1376 replacement="$3";
1377 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}';
1378 shift 3
1379 ;;
1380 *)
1381 echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2;
1382 return 1
1383 ;;
1384 esac;
1385 done;
1386 printf "%s" "${!var}"
1387}
1388unpackFile ()
1389{
1390 curSrc="$1";
1391 header "unpacking source archive $curSrc" 3;
1392 if ! runOneHook unpackCmd "$curSrc"; then
1393 echo "do not know how to unpack source archive $curSrc";
1394 exit 1;
1395 fi
1396}
1397unpackPhase ()
1398{
1399 runHook preUnpack;
1400 if [ -z "${srcs:-}" ]; then
1401 if [ -z "${src:-}" ]; then
1402 echo 'variable $src or $srcs should point to the source';
1403 exit 1;
1404 fi;
1405 srcs="$src";
1406 fi;
1407 local dirsBefore="";
1408 for i in *;
1409 do
1410 if [ -d "$i" ]; then
1411 dirsBefore="$dirsBefore $i ";
1412 fi;
1413 done;
1414 for i in $srcs;
1415 do
1416 unpackFile "$i";
1417 done;
1418 : ${sourceRoot=};
1419 if [ -n "${setSourceRoot:-}" ]; then
1420 runOneHook setSourceRoot;
1421 else
1422 if [ -z "$sourceRoot" ]; then
1423 for i in *;
1424 do
1425 if [ -d "$i" ]; then
1426 case $dirsBefore in
1427 *\ $i\ *)
1428
1429 ;;
1430 *)
1431 if [ -n "$sourceRoot" ]; then
1432 echo "unpacker produced multiple directories";
1433 exit 1;
1434 fi;
1435 sourceRoot="$i"
1436 ;;
1437 esac;
1438 fi;
1439 done;
1440 fi;
1441 fi;
1442 if [ -z "$sourceRoot" ]; then
1443 echo "unpacker appears to have produced no directories";
1444 exit 1;
1445 fi;
1446 echo "source root is $sourceRoot";
1447 if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then
1448 chmod -R u+w -- "$sourceRoot";
1449 fi;
1450 runHook postUnpack
1451}
1452updateSourceDateEpoch ()
1453{
1454 local path="$1";
1455 local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1));
1456 local time="${res[0]//\.[0-9]*/}";
1457 local newestFile="${res[1]}";
1458 if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then
1459 echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile";
1460 export SOURCE_DATE_EPOCH="$time";
1461 local now="$(date +%s)";
1462 if [ "$time" -gt $((now - 60)) ]; then
1463 echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic";
1464 fi;
1465 fi
1466}
1467
1468export NIX_BUILD_TOP="$(mktemp -d --tmpdir nix-shell.XXXXXX)"
1469export TMP="$NIX_BUILD_TOP"
1470export TMPDIR="$NIX_BUILD_TOP"
1471export TEMP="$NIX_BUILD_TOP"
1472export TEMPDIR="$NIX_BUILD_TOP"
1473eval "$shellHook"
diff --git a/frontend/elm-stuff/0.19.1/Cart.elmi b/frontend/elm-stuff/0.19.1/Cart.elmi
new file mode 100644
index 0000000..60bb740
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Cart.elmi
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Cart.elmo b/frontend/elm-stuff/0.19.1/Cart.elmo
new file mode 100644
index 0000000..0500a15
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Cart.elmo
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Catalog.elmi b/frontend/elm-stuff/0.19.1/Catalog.elmi
new file mode 100644
index 0000000..0610f11
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Catalog.elmi
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Catalog.elmo b/frontend/elm-stuff/0.19.1/Catalog.elmo
new file mode 100644
index 0000000..c5146fc
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Catalog.elmo
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Login.elmi b/frontend/elm-stuff/0.19.1/Login.elmi
new file mode 100644
index 0000000..75c4629
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Login.elmi
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Login.elmo b/frontend/elm-stuff/0.19.1/Login.elmo
new file mode 100644
index 0000000..9a173e3
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Login.elmo
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Main.elmi b/frontend/elm-stuff/0.19.1/Main.elmi
new file mode 100644
index 0000000..295ad17
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Main.elmi
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Main.elmo b/frontend/elm-stuff/0.19.1/Main.elmo
new file mode 100644
index 0000000..0dc3269
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Main.elmo
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Product.elmi b/frontend/elm-stuff/0.19.1/Product.elmi
new file mode 100644
index 0000000..396a174
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Product.elmi
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Product.elmo b/frontend/elm-stuff/0.19.1/Product.elmo
new file mode 100644
index 0000000..c387bed
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Product.elmo
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Signup.elmi b/frontend/elm-stuff/0.19.1/Signup.elmi
new file mode 100644
index 0000000..190d9de
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Signup.elmi
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/Signup.elmo b/frontend/elm-stuff/0.19.1/Signup.elmo
new file mode 100644
index 0000000..bcdb43d
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/Signup.elmo
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/d.dat b/frontend/elm-stuff/0.19.1/d.dat
new file mode 100644
index 0000000..244afff
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/d.dat
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/i.dat b/frontend/elm-stuff/0.19.1/i.dat
new file mode 100644
index 0000000..d1d1ac1
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/i.dat
Binary files differ
diff --git a/frontend/elm-stuff/0.19.1/lock b/frontend/elm-stuff/0.19.1/lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/lock
diff --git a/frontend/elm-stuff/0.19.1/o.dat b/frontend/elm-stuff/0.19.1/o.dat
new file mode 100644
index 0000000..f25f55b
--- /dev/null
+++ b/frontend/elm-stuff/0.19.1/o.dat
Binary files differ
diff --git a/frontend/elm.json b/frontend/elm.json
new file mode 100644
index 0000000..64ee788
--- /dev/null
+++ b/frontend/elm.json
@@ -0,0 +1,27 @@
1{
2 "type": "application",
3 "source-directories": [
4 "src"
5 ],
6 "elm-version": "0.19.1",
7 "dependencies": {
8 "direct": {
9 "elm/browser": "1.0.2",
10 "elm/core": "1.0.5",
11 "elm/html": "1.0.0",
12 "elm/http": "2.0.0",
13 "elm/json": "1.1.3",
14 "elm/url": "1.0.0"
15 },
16 "indirect": {
17 "elm/bytes": "1.0.8",
18 "elm/file": "1.0.5",
19 "elm/time": "1.0.0",
20 "elm/virtual-dom": "1.0.2"
21 }
22 },
23 "test-dependencies": {
24 "direct": {},
25 "indirect": {}
26 }
27}
diff --git a/frontend/src/Cart.elm b/frontend/src/Cart.elm
new file mode 100644
index 0000000..a1750f6
--- /dev/null
+++ b/frontend/src/Cart.elm
@@ -0,0 +1,164 @@
1module Cart exposing (..)
2
3import Browser
4import Browser.Navigation as Nav
5import Html exposing (..)
6import Html.Attributes exposing (..)
7import Html.Events exposing (..)
8import Http
9import Json.Decode as D
10import Json.Encode as Encode
11import Url
12import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
13
14
15type alias Product =
16 { id : Int
17 , name : String
18 , kind : Maybe String
19 , price : Float
20 , description : Maybe String
21 }
22
23
24type alias Model =
25 { pageStatus : Status
26 , products : List Product
27 }
28
29
30type Status
31 = Loading
32 | Loaded
33 | NotLoaded
34
35
36type Msg
37 = CartLoaded (Result Http.Error (List Product))
38 | FetchCartItems
39 | RemoveFromCart Int
40 | CartItemRemoved (Result Http.Error ())
41
42
43init : Model
44init =
45 Model NotLoaded []
46
47
48update : Msg -> Model -> ( Model, Cmd Msg )
49update msg model =
50 case msg of
51 CartLoaded res ->
52 case res of
53 Ok s ->
54 ( { model | products = s, pageStatus = Loaded }, Cmd.none )
55
56 Err e ->
57 let
58 _ =
59 Debug.log "error" e
60 in
61 ( { model | pageStatus = NotLoaded }, Cmd.none )
62
63 RemoveFromCart id ->
64 ( model, removeProduct id )
65
66 CartItemRemoved _ ->
67 ( { model | pageStatus = Loading }, fetchCartItems )
68
69 FetchCartItems ->
70 ( { model | pageStatus = Loading }, fetchCartItems )
71
72
73decodeProduct : D.Decoder Product
74decodeProduct =
75 D.map5 Product
76 (D.field "id" D.int)
77 (D.field "name" D.string)
78 (D.field "kind" (D.nullable D.string))
79 (D.field "price" D.float)
80 (D.field "description" (D.nullable D.string))
81
82
83decodeResponse : D.Decoder (List Product)
84decodeResponse =
85 D.list decodeProduct
86
87
88removeProduct : Int -> Cmd Msg
89removeProduct id =
90 let
91 _ =
92 Debug.log "cart" "fetching cart items"
93 in
94 Http.riskyRequest
95 { method = "POST"
96 , headers = []
97 , url = "http://127.0.0.1:7878/cart/remove"
98 , body = Http.stringBody "application/json" <| String.fromInt id
99 , expect = Http.expectWhatever CartItemRemoved
100 , timeout = Nothing
101 , tracker = Nothing
102 }
103
104
105fetchCartItems : Cmd Msg
106fetchCartItems =
107 let
108 _ =
109 Debug.log "cart" "fetching cart items"
110 in
111 Http.riskyRequest
112 { method = "GET"
113 , headers = []
114 , url = "http://127.0.0.1:7878/cart/items"
115 , body = Http.emptyBody
116 , expect = Http.expectJson CartLoaded decodeResponse
117 , timeout = Nothing
118 , tracker = Nothing
119 }
120
121
122viewStatus : Status -> String
123viewStatus s =
124 case s of
125 Loading ->
126 "Loading"
127
128 Loaded ->
129 "Ready!"
130
131 NotLoaded ->
132 "Not loaded ..."
133
134
135viewProduct : Product -> Html Msg
136viewProduct p =
137 div []
138 [ text p.name
139 , div [] [ text <| Maybe.withDefault "" p.kind ]
140 , div [] [ text <| Maybe.withDefault "" p.description ]
141 , div [] [ text <| String.fromFloat p.price ]
142 , div [] [ button [ onClick (RemoveFromCart p.id) ] [ text "Remove" ] ]
143 , div [] [ a [ href ("/product/" ++ String.fromInt p.id) ] [ text "View Product" ] ]
144 ]
145
146
147view : Model -> Html Msg
148view model =
149 case model.pageStatus of
150 Loading ->
151 div [] [ text <| viewStatus Loading ]
152
153 _ ->
154 div []
155 [ let
156 cart =
157 List.map viewProduct model.products
158 in
159 if List.isEmpty cart then
160 text "No items in cart"
161
162 else
163 ul [] cart
164 ]
diff --git a/frontend/src/Catalog.elm b/frontend/src/Catalog.elm
new file mode 100644
index 0000000..80e5e38
--- /dev/null
+++ b/frontend/src/Catalog.elm
@@ -0,0 +1,125 @@
1module Catalog exposing (..)
2
3import Browser
4import Browser.Navigation as Nav
5import Html exposing (..)
6import Html.Attributes exposing (..)
7import Html.Events exposing (..)
8import Http
9import Json.Decode as D
10import Json.Encode as Encode
11import Url
12import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
13
14
15type alias Product =
16 { id : Int
17 , name : String
18 , kind : Maybe String
19 , price : Float
20 , description : Maybe String
21 }
22
23
24type alias Model =
25 { pageStatus : Status
26 , products : List Product
27 }
28
29
30type Status
31 = Loading
32 | Loaded
33 | NotLoaded
34
35
36type Msg
37 = ProductsLoaded (Result Http.Error (List Product))
38 | FetchProducts
39
40
41init : Model
42init =
43 Model NotLoaded []
44
45
46update : Msg -> Model -> ( Model, Cmd Msg )
47update msg model =
48 case msg of
49 ProductsLoaded res ->
50 case res of
51 Ok s ->
52 ( { model | products = s, pageStatus = Loaded }, Cmd.none )
53
54 Err e ->
55 let
56 _ =
57 Debug.log "error" e
58 in
59 ( { model | pageStatus = NotLoaded }, Cmd.none )
60
61 FetchProducts ->
62 ( { model | pageStatus = Loading }, fetchProducts )
63
64
65decodeProduct : D.Decoder Product
66decodeProduct =
67 D.map5 Product
68 (D.field "id" D.int)
69 (D.field "name" D.string)
70 (D.field "kind" (D.nullable D.string))
71 (D.field "price" D.float)
72 (D.field "description" (D.nullable D.string))
73
74
75decodeResponse : D.Decoder (List Product)
76decodeResponse =
77 D.list decodeProduct
78
79
80fetchProducts : Cmd Msg
81fetchProducts =
82 let
83 _ =
84 Debug.log "err" "fetching products"
85 in
86 Http.get
87 { url = "http://127.0.0.1:7878/product/catalog"
88 , expect = Http.expectJson ProductsLoaded decodeResponse
89 }
90
91
92viewStatus : Status -> String
93viewStatus s =
94 case s of
95 Loading ->
96 "Loading"
97
98 Loaded ->
99 "Ready!"
100
101 NotLoaded ->
102 "Not loaded ..."
103
104
105viewProduct : Product -> Html Msg
106viewProduct p =
107 div []
108 [ text p.name
109 , text <| Maybe.withDefault "" p.kind
110 , text <| Maybe.withDefault "" p.description
111 , text <| String.fromFloat p.price
112 , a [ href ("/product/" ++ String.fromInt p.id) ] [ text "View Product" ]
113 ]
114
115
116view : Model -> Html Msg
117view model =
118 case model.pageStatus of
119 Loading ->
120 div [] [ text <| viewStatus Loading ]
121
122 _ ->
123 div []
124 [ ul [] (List.map viewProduct model.products)
125 ]
diff --git a/frontend/src/Login.elm b/frontend/src/Login.elm
new file mode 100644
index 0000000..dd168f0
--- /dev/null
+++ b/frontend/src/Login.elm
@@ -0,0 +1,119 @@
1module Login exposing (..)
2
3import Browser
4import Browser.Navigation as Nav
5import Html exposing (..)
6import Html.Attributes exposing (..)
7import Html.Events exposing (..)
8import Http
9import Json.Encode as Encode
10import Url
11import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
12
13
14type alias Model =
15 { username : String
16 , password : String
17 , loginStatus : LoginStatus
18 }
19
20
21type LoginStatus
22 = NotLoggedIn
23 | LoggedIn
24 | InvalidLogin
25 | LoggingIn
26
27
28type Msg
29 = PassEntered String
30 | UserEntered String
31 | LoginPressed
32 | LoginSuccess (Result Http.Error ())
33 | LoginFail
34
35
36init : Model
37init =
38 Model "" "" NotLoggedIn
39
40
41update : Msg -> Model -> ( Model, Cmd Msg )
42update msg model =
43 case msg of
44 PassEntered s ->
45 ( { model | password = s }
46 , Cmd.none
47 )
48
49 UserEntered s ->
50 ( { model | username = s }
51 , Cmd.none
52 )
53
54 LoginPressed ->
55 ( { model | loginStatus = LoggingIn }, tryLogin model )
56
57 LoginSuccess res ->
58 case res of
59 Ok s ->
60 ( { model | loginStatus = LoggedIn }, Cmd.none )
61
62 Err e ->
63 ( { model | loginStatus = InvalidLogin }, Cmd.none )
64
65 LoginFail ->
66 ( { model | loginStatus = InvalidLogin }, Cmd.none )
67
68
69encodeLogin : Model -> Encode.Value
70encodeLogin model =
71 Encode.object
72 [ ( "username", Encode.string model.username )
73 , ( "password", Encode.string model.password )
74 ]
75
76
77tryLogin : Model -> Cmd Msg
78tryLogin model =
79 Http.riskyRequest
80 { method = "POST"
81 , headers = []
82 , url = "http://127.0.0.1:7878/user/login"
83 , body = model |> encodeLogin |> Http.jsonBody
84 , expect = Http.expectWhatever LoginSuccess
85 , timeout = Nothing
86 , tracker = Nothing
87 }
88
89
90viewStatus : LoginStatus -> String
91viewStatus ls =
92 case ls of
93 NotLoggedIn ->
94 "Not Logged In"
95
96 InvalidLogin ->
97 "Invalid Login"
98
99 LoggedIn ->
100 "Logged in!"
101
102 LoggingIn ->
103 "Logging In ..."
104
105
106viewInput : String -> String -> String -> (String -> msg) -> Html msg
107viewInput t p v toMsg =
108 input [ type_ t, placeholder p, value v, onInput toMsg ] []
109
110
111view : Model -> Html Msg
112view model =
113 div []
114 [ div [] [ viewInput "text" "Enter name here" model.username UserEntered ]
115 , div [] [ viewInput "password" "Password" model.password PassEntered ]
116 , div [] [ button [ onClick LoginPressed ] [ text "Login" ] ]
117 , div [] [ text (viewStatus model.loginStatus) ]
118 , div [] [ text "Don't have an account? ", a [ href "/signup" ] [ text "Register now!" ] ]
119 ]
diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm
new file mode 100644
index 0000000..bf1583c
--- /dev/null
+++ b/frontend/src/Main.elm
@@ -0,0 +1,339 @@
1module Main exposing (Model, Msg(..), init, main, subscriptions, update, view, viewLink)
2
3import Browser
4import Browser.Navigation as Nav
5import Cart
6import Catalog
7import Html exposing (..)
8import Html.Attributes exposing (..)
9import Html.Events exposing (..)
10import Http
11import Json.Encode as Encode
12import Login
13import Product
14import Signup
15import Url
16import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
17
18
19
20-- MAIN
21
22
23main : Program () Model Msg
24main =
25 Browser.application
26 { init = init
27 , view = view
28 , update = update
29 , subscriptions = subscriptions
30 , onUrlChange = UrlChanged
31 , onUrlRequest = LinkClicked
32 }
33
34
35
36-- MODEL
37
38
39type Route
40 = LoginPage
41 | SignupPage
42 | HomePage
43 | CatalogPage
44 | CartPage
45 | ProductPage Int
46 | NotFoundPage
47
48
49parseRoute : Parser (Route -> a) a
50parseRoute =
51 oneOf
52 [ P.map LoginPage (P.s "login")
53 , P.map HomePage P.top
54 , P.map CatalogPage (P.s "catalog")
55 , P.map CartPage (P.s "cart")
56 , P.map SignupPage (P.s "signup")
57 , P.map ProductPage (P.s "product" </> P.int)
58
59 --, P.map ProductPage (P.s "product" </> int)
60 ]
61
62
63type alias Model =
64 { key : Nav.Key
65 , url : Url.Url
66 , location : Route
67 , loginModel : Login.Model
68 , catalogModel : Catalog.Model
69 , productModel : Product.Model
70 , signupModel : Signup.Model
71 , cartModel : Cart.Model
72 }
73
74
75init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg )
76init flags url key =
77 let
78 start =
79 HomePage
80
81 login =
82 Login.init
83
84 catalog =
85 Catalog.init
86
87 product =
88 Product.init
89
90 signup =
91 Signup.init
92
93 cart =
94 Cart.init
95 in
96 ( Model key url start login catalog product signup cart, Cmd.none )
97
98
99
100-- UPDATE
101
102
103type Msg
104 = LinkClicked Browser.UrlRequest
105 | UrlChanged Url.Url
106 | LoginMessage Login.Msg
107 | CatalogMessage Catalog.Msg
108 | ProductMessage Product.Msg
109 | SignupMessage Signup.Msg
110 | CartMessage Cart.Msg
111 | LogoutPressed
112 | LogoutSuccess (Result Http.Error ())
113
114
115update : Msg -> Model -> ( Model, Cmd Msg )
116update msg model =
117 case msg of
118 LinkClicked urlRequest ->
119 case urlRequest of
120 Browser.Internal url ->
121 ( model, Nav.pushUrl model.key (Url.toString url) )
122
123 Browser.External href ->
124 ( model, Nav.load href )
125
126 LogoutPressed ->
127 ( model, tryLogout )
128
129 LogoutSuccess _ ->
130 ( model, Nav.replaceUrl model.key "/login" )
131
132 UrlChanged url ->
133 let
134 parsedUrl =
135 P.parse parseRoute url
136 in
137 case parsedUrl of
138 Just CatalogPage ->
139 ( { model | location = CatalogPage }, Cmd.map CatalogMessage Catalog.fetchProducts )
140
141 Just (ProductPage id) ->
142 let
143 cmds =
144 List.map (Cmd.map ProductMessage)
145 [ Product.fetchListing id
146 , Product.fetchRatings id
147 ]
148 in
149 ( { model | location = ProductPage id }, Cmd.batch cmds )
150
151 Just CartPage ->
152 let
153 cmd =
154 Cmd.map CartMessage Cart.fetchCartItems
155 in
156 ( { model | location = CartPage }, cmd )
157
158 Just p ->
159 ( { model | location = p }, Cmd.none )
160
161 Nothing ->
162 ( { model | location = NotFoundPage }, Cmd.none )
163
164 LoginMessage lm ->
165 let
166 ( lmn, cmd ) =
167 Login.update lm model.loginModel
168
169 redir =
170 case lmn.loginStatus of
171 Login.LoggedIn ->
172 Nav.replaceUrl model.key "/catalog"
173
174 _ ->
175 Cmd.none
176 in
177 ( { model | loginModel = lmn }, Cmd.batch [ Cmd.map LoginMessage cmd, redir ] )
178
179 SignupMessage sm ->
180 let
181 ( smn, cmd ) =
182 Signup.update sm model.signupModel
183
184 redir =
185 case smn.status of
186 Signup.CreatedSuccessfully ->
187 Nav.replaceUrl model.key "/login"
188
189 _ ->
190 Cmd.none
191 in
192 ( { model | signupModel = smn }, Cmd.batch [ Cmd.map SignupMessage cmd, redir ] )
193
194 CatalogMessage cm ->
195 let
196 ( cmn, cmd ) =
197 Catalog.update cm model.catalogModel
198 in
199 ( { model | catalogModel = cmn }, Cmd.map CatalogMessage cmd )
200
201 CartMessage cm ->
202 let
203 ( cmn, cmd ) =
204 Cart.update cm model.cartModel
205 in
206 ( { model | cartModel = cmn }, Cmd.map CartMessage cmd )
207
208 ProductMessage pm ->
209 let
210 ( pmn, cmd ) =
211 Product.update pm model.productModel
212
213 redir =
214 case pm of
215 Product.AddToCartSuccess _ ->
216 Nav.replaceUrl model.key "/cart"
217
218 _ ->
219 Cmd.none
220 in
221 ( { model | productModel = pmn }, Cmd.batch [ Cmd.map ProductMessage cmd, redir ] )
222
223
224tryLogout : Cmd Msg
225tryLogout =
226 Http.riskyRequest
227 { method = "POST"
228 , headers = []
229 , url = "http://127.0.0.1:7878/user/logout"
230 , body = Http.emptyBody
231 , expect = Http.expectWhatever LogoutSuccess
232 , timeout = Nothing
233 , tracker = Nothing
234 }
235
236
237
238-- SUBSCRIPTIONS
239
240
241subscriptions : Model -> Sub Msg
242subscriptions _ =
243 Sub.none
244
245
246
247-- VIEW
248
249
250view : Model -> Browser.Document Msg
251view model =
252 case model.location of
253 LoginPage ->
254 { title = "Login"
255 , body = [ Html.map LoginMessage (Login.view model.loginModel) ]
256 }
257
258 SignupPage ->
259 { title = "Signup"
260 , body = [ Html.map SignupMessage (Signup.view model.signupModel) ]
261 }
262
263 HomePage ->
264 { title = "URL Interceptor"
265 , body =
266 [ text "The current URL is: "
267 , b [] [ text (Url.toString model.url) ]
268 , ul []
269 [ viewLink "/login"
270 , viewLink "/catalog"
271 , viewLink "/cart"
272 , viewLink "/signup"
273 ]
274 ]
275 }
276
277 NotFoundPage ->
278 { title = "404 - Not Found"
279 , body =
280 [ text "404 - Not Found"
281 , a [ href "/" ] [ text "Go back >" ]
282 ]
283 }
284
285 CatalogPage ->
286 { title = "Catalog"
287 , body = pageWrap model (Html.map CatalogMessage (Catalog.view model.catalogModel))
288 }
289
290 CartPage ->
291 { title = "Cart"
292 , body = pageWrap model (Html.map CartMessage (Cart.view model.cartModel))
293 }
294
295 ProductPage item ->
296 { title = "Product " ++ String.fromInt item
297 , body = pageWrap model (Html.map ProductMessage (Product.view model.productModel))
298 }
299
300
301viewHeader : Model -> Html Msg
302viewHeader model =
303 let
304 links =
305 [ ( "Home", "/" )
306 , ( "Catalog", "/catalog" )
307 , ( "Cart", "/cart" )
308 ]
309 in
310 div []
311 [ List.map
312 (\( name, loc ) ->
313 li []
314 [ a [ href loc ] [ text name ]
315 ]
316 )
317 links
318 ++ [ if model.loginModel.loginStatus /= Login.LoggedIn then
319 li [] [ a [ href "/login" ] [ text "Login" ] ]
320
321 else
322 button [ onClick LogoutPressed ] [ text "Logout" ]
323 ]
324 |> ul []
325 ]
326
327
328pageWrap : Model -> Html Msg -> List (Html Msg)
329pageWrap model page =
330 [ div []
331 [ viewHeader model
332 , page
333 ]
334 ]
335
336
337viewLink : String -> Html msg
338viewLink path =
339 li [] [ a [ href path ] [ text path ] ]
diff --git a/frontend/src/Product.elm b/frontend/src/Product.elm
new file mode 100644
index 0000000..0ea0ce1
--- /dev/null
+++ b/frontend/src/Product.elm
@@ -0,0 +1,302 @@
1module Product exposing (..)
2
3import Browser
4import Browser.Navigation as Nav
5import Html exposing (..)
6import Html.Attributes exposing (..)
7import Html.Events exposing (..)
8import Http
9import Json.Decode as D
10import Json.Encode as Encode
11import Url
12import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
13
14
15type SubmitStatus
16 = SubmitSuccess
17 | SubmitFail
18 | Submitting
19 | NotSubmitted
20
21
22type alias Product =
23 { id : Int
24 , name : String
25 , kind : Maybe String
26 , price : Float
27 , description : Maybe String
28 }
29
30
31emptyProduct =
32 Product -1 "" Nothing 0 Nothing
33
34
35type alias Rating =
36 { commentDate : String
37 , commentText : Maybe String
38 , customerName : String
39 , productName : String
40 , stars : Int
41 }
42
43
44type alias Model =
45 { pageStatus : Status
46 , listing : Product
47 , ratings : List Rating
48 , ratingStars : Int
49 , ratingText : String
50 , addRatingStatus : SubmitStatus
51 }
52
53
54type Status
55 = Loading
56 | Loaded
57 | NotLoaded
58
59
60type Msg
61 = ListingLoaded (Result Http.Error Product)
62 | RatingsLoaded (Result Http.Error (List Rating))
63 | FetchProduct Int
64 | FetchRatings Int
65 | AddRatingStars Int
66 | AddRatingComment String
67 | AddRatingPressed
68 | AddRatingSuccess (Result Http.Error ())
69 | AddRatingFail
70 | AddToCartSuccess (Result Http.Error ())
71 | AddToCartPressed
72
73
74init : Model
75init =
76 Model NotLoaded emptyProduct [] 0 "" NotSubmitted
77
78
79update : Msg -> Model -> ( Model, Cmd Msg )
80update msg model =
81 case msg of
82 ListingLoaded res ->
83 case res of
84 Ok s ->
85 ( { model | listing = s, pageStatus = Loaded }, Cmd.none )
86
87 Err e ->
88 let
89 _ =
90 Debug.log "error" e
91 in
92 ( { model | pageStatus = NotLoaded }, Cmd.none )
93
94 RatingsLoaded res ->
95 case res of
96 Ok s ->
97 ( { model | ratings = s, pageStatus = Loaded }, Cmd.none )
98
99 Err e ->
100 let
101 _ =
102 Debug.log "error" e
103 in
104 ( { model | pageStatus = NotLoaded }, Cmd.none )
105
106 FetchProduct id ->
107 ( { model | pageStatus = Loading }, fetchListing id )
108
109 FetchRatings id ->
110 ( { model | pageStatus = Loading }, fetchRatings id )
111
112 AddRatingStars i ->
113 ( { model | ratingStars = i }, Cmd.none )
114
115 AddRatingComment s ->
116 ( { model | ratingText = s }, Cmd.none )
117
118 AddRatingPressed ->
119 ( { model | addRatingStatus = Submitting }
120 , submitRating model
121 )
122
123 AddRatingSuccess res ->
124 case res of
125 Ok _ ->
126 ( { model | addRatingStatus = SubmitSuccess }, fetchRatings model.listing.id )
127
128 Err _ ->
129 ( { model | addRatingStatus = SubmitFail }, Cmd.none )
130
131 AddRatingFail ->
132 ( { model | addRatingStatus = SubmitFail }, Cmd.none )
133
134 AddToCartPressed ->
135 ( model, addToCart model )
136
137 AddToCartSuccess _ ->
138 ( model, Cmd.none )
139
140
141decodeProduct : D.Decoder Product
142decodeProduct =
143 D.map5 Product
144 (D.field "id" D.int)
145 (D.field "name" D.string)
146 (D.field "kind" (D.nullable D.string))
147 (D.field "price" D.float)
148 (D.field "description" (D.nullable D.string))
149
150
151decodeRating : D.Decoder Rating
152decodeRating =
153 D.map5 Rating
154 (D.field "comment_date" D.string)
155 (D.field "comment_text" (D.nullable D.string))
156 (D.field "customer_name" D.string)
157 (D.field "product_name" D.string)
158 (D.field "stars" D.int)
159
160
161decodeRatings : D.Decoder (List Rating)
162decodeRatings =
163 D.list decodeRating
164
165
166fetchListing : Int -> Cmd Msg
167fetchListing id =
168 let
169 _ =
170 Debug.log "err" <| "fetching listing " ++ String.fromInt id
171 in
172 Http.get
173 { url = "http://127.0.0.1:7878/product/" ++ String.fromInt id
174 , expect = Http.expectJson ListingLoaded decodeProduct
175 }
176
177
178fetchRatings : Int -> Cmd Msg
179fetchRatings id =
180 let
181 _ =
182 Debug.log "err" <| "fetching ratings " ++ String.fromInt id
183 in
184 Http.get
185 { url = "http://127.0.0.1:7878/product/reviews/" ++ String.fromInt id
186 , expect = Http.expectJson RatingsLoaded decodeRatings
187 }
188
189
190encodeRatingForm : Model -> Encode.Value
191encodeRatingForm model =
192 Encode.object
193 [ ( "product_id", Encode.int model.listing.id )
194 , ( "stars", Encode.int model.ratingStars )
195 , ( "comment_text", Encode.string model.ratingText )
196 ]
197
198
199submitRating : Model -> Cmd Msg
200submitRating model =
201 let
202 _ =
203 Debug.log "err" <| "submitting rating for" ++ String.fromInt model.listing.id
204 in
205 Http.riskyRequest
206 { method = "POST"
207 , headers = []
208 , url = "http://127.0.0.1:7878/rating/add"
209 , body = model |> encodeRatingForm |> Http.jsonBody
210 , expect = Http.expectWhatever AddRatingSuccess
211 , timeout = Nothing
212 , tracker = Nothing
213 }
214
215
216addToCart : Model -> Cmd Msg
217addToCart model =
218 let
219 _ =
220 Debug.log "err" <| "adding to cart: " ++ String.fromInt model.listing.id
221 in
222 Http.riskyRequest
223 { method = "POST"
224 , headers = []
225 , url = "http://127.0.0.1:7878/cart/add"
226 , body = Http.stringBody "applcation/json" <| String.fromInt <| model.listing.id
227 , expect = Http.expectWhatever AddToCartSuccess
228 , timeout = Nothing
229 , tracker = Nothing
230 }
231
232
233viewStatus : Status -> String
234viewStatus s =
235 case s of
236 Loading ->
237 "Loading"
238
239 Loaded ->
240 "Ready!"
241
242 NotLoaded ->
243 "Not loaded ..."
244
245
246viewProduct : Product -> Html Msg
247viewProduct p =
248 div []
249 [ text p.name
250 , text <| Maybe.withDefault "" p.kind
251 , text <| Maybe.withDefault "" p.description
252 , text <| String.fromFloat p.price
253 ]
254
255
256viewRating : Rating -> Html Msg
257viewRating r =
258 div []
259 [ text <| r.customerName ++ " posted on "
260 , text <| r.commentDate ++ " "
261 , text <| Maybe.withDefault "" r.commentText
262 , text <| " Stars: " ++ String.fromInt r.stars
263 ]
264
265
266viewInput : String -> String -> String -> (String -> msg) -> Html msg
267viewInput t p v toMsg =
268 input [ type_ t, placeholder p, value v, onInput toMsg ] []
269
270
271viewStars : Html Msg
272viewStars =
273 ul []
274 (List.map
275 (\i -> button [ onClick (AddRatingStars i) ] [ text <| String.fromInt i ])
276 [ 0, 1, 2, 3, 4, 5 ]
277 )
278
279
280view : Model -> Html Msg
281view model =
282 case model.pageStatus of
283 Loading ->
284 div [] [ text <| viewStatus Loading ]
285
286 _ ->
287 div []
288 [ div [] [ viewProduct model.listing ]
289 , ul [] (List.map viewRating model.ratings)
290 , div [] [ text "Add Rating: " ]
291 , div []
292 [ viewStars
293 , viewInput "text" "Enter Comment Text" model.ratingText AddRatingComment
294 , button [ onClick AddRatingPressed ] [ text "Submit Rating" ]
295 ]
296 , div []
297 [ button [ onClick AddToCartPressed ] [ text "Add To Cart" ]
298 ]
299 , div []
300 [ a [ href "/catalog" ] [ text "Back to catalog" ]
301 ]
302 ]
diff --git a/frontend/src/Signup.elm b/frontend/src/Signup.elm
new file mode 100644
index 0000000..6395b57
--- /dev/null
+++ b/frontend/src/Signup.elm
@@ -0,0 +1,194 @@
1module Signup exposing (..)
2
3import Browser
4import Browser.Navigation as Nav
5import Html exposing (..)
6import Html.Attributes exposing (..)
7import Html.Events exposing (..)
8import Http
9import Json.Encode as Encode
10import Url
11import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
12
13
14type alias Model =
15 { username : String
16 , password : String
17 , phoneNumber : String
18 , emailId : String
19 , address : Maybe String
20 , status : Status
21 }
22
23
24type Status
25 = UsernameTaken
26 | InvalidPhone
27 | InvalidEmail
28 | CreatedSuccessfully
29 | CreatingUser
30 | Empty
31
32
33type Msg
34 = UserEntered String
35 | PassEntered String
36 | PhoneEntered String
37 | EmailEntered String
38 | AddressEntered String
39 | CreatePressed
40 | CreationSuccess (Result Http.Error ())
41 | UsernameExists (Result Http.Error String)
42 | CreationFail
43
44
45init : Model
46init =
47 Model "" "" "" "" Nothing Empty
48
49
50update : Msg -> Model -> ( Model, Cmd Msg )
51update msg model =
52 case msg of
53 UserEntered s ->
54 ( { model | username = s }
55 , Cmd.none
56 )
57
58 PassEntered s ->
59 ( { model | password = s }
60 , Cmd.none
61 )
62
63 PhoneEntered s ->
64 let
65 status =
66 if String.length s /= 10 || (List.all (not << Char.isDigit) <| String.toList s) then
67 InvalidPhone
68
69 else
70 Empty
71 in
72 ( { model | phoneNumber = s, status = status }
73 , Cmd.none
74 )
75
76 EmailEntered s ->
77 let
78 status =
79 if not <| String.contains "@" s then
80 InvalidEmail
81
82 else
83 Empty
84 in
85 ( { model | emailId = s, status = status }
86 , Cmd.none
87 )
88
89 AddressEntered s ->
90 ( { model | address = Just s }
91 , Cmd.none
92 )
93
94 CreatePressed ->
95 ( { model | status = CreatingUser }, checkExists model )
96
97 CreationSuccess res ->
98 case res of
99 Ok _ ->
100 ( { model | status = CreatedSuccessfully }, Cmd.none )
101
102 Err _ ->
103 ( model, Cmd.none )
104
105 CreationFail ->
106 ( init, Cmd.none )
107
108 UsernameExists res ->
109 case res of
110 Ok "true" ->
111 ( { model | status = UsernameTaken }, Cmd.none )
112
113 Ok "false" ->
114 let
115 _ =
116 Debug.log "signup" "Hit create user ..."
117 in
118 ( { model | status = CreatingUser }, createUser model )
119
120 _ ->
121 ( model, Cmd.none )
122
123
124encodeCreateUser : Model -> Encode.Value
125encodeCreateUser model =
126 Encode.object
127 [ ( "username", Encode.string model.username )
128 , ( "password", Encode.string model.password )
129 , ( "phone_number", Encode.string model.phoneNumber )
130 , ( "email_id", Encode.string model.emailId )
131 , ( "address", Encode.string <| Maybe.withDefault "" model.address )
132 ]
133
134
135checkExists : Model -> Cmd Msg
136checkExists model =
137 Http.post
138 { url = "http://127.0.0.1:7878/user/existing"
139 , body = Http.stringBody "application/json" model.username
140 , expect = Http.expectString UsernameExists
141 }
142
143
144createUser : Model -> Cmd Msg
145createUser model =
146 Http.riskyRequest
147 { method = "POST"
148 , headers = []
149 , url = "http://127.0.0.1:7878/user/new"
150 , body = model |> encodeCreateUser |> Http.jsonBody
151 , expect = Http.expectWhatever CreationSuccess
152 , timeout = Nothing
153 , tracker = Nothing
154 }
155
156
157viewStatus : Status -> String
158viewStatus s =
159 case s of
160 UsernameTaken ->
161 "This username is taken!"
162
163 InvalidPhone ->
164 "Invalid phone number!"
165
166 InvalidEmail ->
167 "Invalid email address!"
168
169 CreatedSuccessfully ->
170 "User created successfully"
171
172 CreatingUser ->
173 "Creating user ..."
174
175 Empty ->
176 ""
177
178
179viewInput : String -> String -> String -> (String -> msg) -> Html msg
180viewInput t p v toMsg =
181 input [ type_ t, placeholder p, value v, onInput toMsg ] []
182
183
184view : Model -> Html Msg
185view model =
186 div []
187 [ viewInput "text" "Enter Username" model.username UserEntered
188 , viewInput "password" "Password" model.password PassEntered
189 , viewInput "text" "Email" model.emailId EmailEntered
190 , viewInput "text" "Enter your Phone number" model.phoneNumber PhoneEntered
191 , viewInput "text" "Enter Shipping address" (Maybe.withDefault "" model.address) AddressEntered
192 , button [ onClick CreatePressed ] [ text "Create" ]
193 , text (viewStatus model.status)
194 ]
diff --git a/nix/sources.json b/nix/sources.json
deleted file mode 100644
index e2299f7..0000000
--- a/nix/sources.json
+++ /dev/null
@@ -1,50 +0,0 @@
1{
2 "naersk": {
3 "branch": "master",
4 "description": "Build rust crates in Nix. No configuration, no code generation, no IFD. Sandbox friendly.",
5 "homepage": "",
6 "owner": "nmattia",
7 "repo": "naersk",
8 "rev": "529e910a3f423a8211f8739290014b754b2555b6",
9 "sha256": "0bcy9nmyaan5jvp0wg80wkizc9j166ns685rdr1kbhkvdpywv46y",
10 "type": "tarball",
11 "url": "https://github.com/nmattia/naersk/archive/529e910a3f423a8211f8739290014b754b2555b6.tar.gz",
12 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13 },
14 "niv": {
15 "branch": "master",
16 "description": "Easy dependency management for Nix projects",
17 "homepage": "https://github.com/nmattia/niv",
18 "owner": "nmattia",
19 "repo": "niv",
20 "rev": "29ddaaf4e099c3ac0647f5b652469dfc79cd3b53",
21 "sha256": "1va6myp07gkspgxfch8z3rs9nyvys6jmgzkys6a2c4j09qxp1bs0",
22 "type": "tarball",
23 "url": "https://github.com/nmattia/niv/archive/29ddaaf4e099c3ac0647f5b652469dfc79cd3b53.tar.gz",
24 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25 },
26 "nixpkgs": {
27 "branch": "release-20.03",
28 "description": "Nix Packages collection",
29 "homepage": null,
30 "owner": "NixOS",
31 "repo": "nixpkgs",
32 "rev": "13a15f262a2b348d6aa976017f2cd88e3a18405d",
33 "sha256": "1xcfwqhvs8ai45dahlmqvvkhjf0gdk7nlnxrf7wvmzc50l90akgn",
34 "type": "tarball",
35 "url": "https://github.com/NixOS/nixpkgs/archive/13a15f262a2b348d6aa976017f2cd88e3a18405d.tar.gz",
36 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37 },
38 "nixpkgs-mozilla": {
39 "branch": "master",
40 "description": "mozilla related nixpkgs (extends nixos/nixpkgs repo)",
41 "homepage": null,
42 "owner": "mozilla",
43 "repo": "nixpkgs-mozilla",
44 "rev": "efda5b357451dbb0431f983cca679ae3cd9b9829",
45 "sha256": "11wqrg86g3qva67vnk81ynvqyfj0zxk83cbrf0p9hsvxiwxs8469",
46 "type": "tarball",
47 "url": "https://github.com/mozilla/nixpkgs-mozilla/archive/efda5b357451dbb0431f983cca679ae3cd9b9829.tar.gz",
48 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
49 }
50}
diff --git a/nix/sources.nix b/nix/sources.nix
deleted file mode 100644
index b64b8f8..0000000
--- a/nix/sources.nix
+++ /dev/null
@@ -1,148 +0,0 @@
1# This file has been generated by Niv.
2
3let
4
5 #
6 # The fetchers. fetch_<type> fetches specs of type <type>.
7 #
8
9 fetch_file = pkgs: spec:
10 if spec.builtin or true then
11 builtins_fetchurl { inherit (spec) url sha256; }
12 else
13 pkgs.fetchurl { inherit (spec) url sha256; };
14
15 fetch_tarball = pkgs: name: spec:
16 let
17 ok = str: ! builtins.isNull (builtins.match "[a-zA-Z0-9+-._?=]" str);
18 # sanitize the name, though nix will still fail if name starts with period
19 name' = stringAsChars (x: if ! ok x then "-" else x) "${name}-src";
20 in
21 if spec.builtin or true then
22 builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
23 else
24 pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
25
26 fetch_git = spec:
27 builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
28
29 fetch_local = spec: spec.path;
30
31 fetch_builtin-tarball = name: throw
32 ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
33 $ niv modify ${name} -a type=tarball -a builtin=true'';
34
35 fetch_builtin-url = name: throw
36 ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
37 $ niv modify ${name} -a type=file -a builtin=true'';
38
39 #
40 # Various helpers
41 #
42
43 # The set of packages used when specs are fetched using non-builtins.
44 mkPkgs = sources:
45 let
46 sourcesNixpkgs =
47 import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
48 hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
49 hasThisAsNixpkgsPath = <nixpkgs> == ./.;
50 in
51 if builtins.hasAttr "nixpkgs" sources
52 then sourcesNixpkgs
53 else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
54 import <nixpkgs> {}
55 else
56 abort
57 ''
58 Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
59 add a package called "nixpkgs" to your sources.json.
60 '';
61
62 # The actual fetching function.
63 fetch = pkgs: name: spec:
64
65 if ! builtins.hasAttr "type" spec then
66 abort "ERROR: niv spec ${name} does not have a 'type' attribute"
67 else if spec.type == "file" then fetch_file pkgs spec
68 else if spec.type == "tarball" then fetch_tarball pkgs name spec
69 else if spec.type == "git" then fetch_git spec
70 else if spec.type == "local" then fetch_local spec
71 else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
72 else if spec.type == "builtin-url" then fetch_builtin-url name
73 else
74 abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
75
76 # If the environment variable NIV_OVERRIDE_${name} is set, then use
77 # the path directly as opposed to the fetched source.
78 replace = name: drv:
79 let
80 saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
81 ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
82 in
83 if ersatz == "" then drv else ersatz;
84
85 # Ports of functions for older nix versions
86
87 # a Nix version of mapAttrs if the built-in doesn't exist
88 mapAttrs = builtins.mapAttrs or (
89 f: set: with builtins;
90 listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
91 );
92
93 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
94 range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
95
96 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
97 stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
98
99 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
100 stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
101 concatStrings = builtins.concatStringsSep "";
102
103 # fetchTarball version that is compatible between all the versions of Nix
104 builtins_fetchTarball = { url, name, sha256 }@attrs:
105 let
106 inherit (builtins) lessThan nixVersion fetchTarball;
107 in
108 if lessThan nixVersion "1.12" then
109 fetchTarball { inherit name url; }
110 else
111 fetchTarball attrs;
112
113 # fetchurl version that is compatible between all the versions of Nix
114 builtins_fetchurl = { url, sha256 }@attrs:
115 let
116 inherit (builtins) lessThan nixVersion fetchurl;
117 in
118 if lessThan nixVersion "1.12" then
119 fetchurl { inherit url; }
120 else
121 fetchurl attrs;
122
123 # Create the final "sources" from the config
124 mkSources = config:
125 mapAttrs (
126 name: spec:
127 if builtins.hasAttr "outPath" spec
128 then abort
129 "The values in sources.json should not have an 'outPath' attribute"
130 else
131 spec // { outPath = replace name (fetch config.pkgs name spec); }
132 ) config.sources;
133
134 # The "config" used by the fetchers
135 mkConfig =
136 { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
137 , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
138 , pkgs ? mkPkgs sources
139 }: rec {
140 # The sources, i.e. the attribute set of spec name to spec
141 inherit sources;
142
143 # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
144 inherit pkgs;
145 };
146
147in
148mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
diff --git a/shell.nix b/shell.nix
deleted file mode 100644
index 9167821..0000000
--- a/shell.nix
+++ /dev/null
@@ -1,34 +0,0 @@
1{ pkgs ? import <nixpkgs> {} }:
2
3let
4 sources = import ./nix/sources.nix;
5 nixpkgs-mozilla = import sources.nixpkgs-mozilla;
6 pkgs = import sources.nixpkgs {
7 overlays =
8 [
9 nixpkgs-mozilla
10 (self: super:
11 {
12 rustc = self.latest.rustChannels.stable.rust;
13 cargo = self.latest.rustChannels.stable.rust;
14 }
15 )
16 ];
17 };
18in
19 pkgs.mkShell {
20 buildInputs = with pkgs; [
21 cargo
22 rustc
23 rustfmt
24 pkg-config
25 openssl
26 httpie
27 curl
28 diesel-cli
29 libmysqlclient
30 jq
31 python3
32 insomnia
33 ];
34 }