aboutsummaryrefslogtreecommitdiff
path: root/build-turris.sh
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-07-19 13:34:10 +0200
committerKarel Kočí <cynerd@email.cz>2022-07-19 13:34:10 +0200
commit8226f71c349be248f251656a6316c09bbb794557 (patch)
treef38179d695fdca825b48688d87aa86a5f5b2c73f /build-turris.sh
parent027bcf9b43546063e62578858eee50ac278334f3 (diff)
downloadnixos-personal-8226f71c349be248f251656a6316c09bbb794557.tar.gz
nixos-personal-8226f71c349be248f251656a6316c09bbb794557.tar.bz2
nixos-personal-8226f71c349be248f251656a6316c09bbb794557.zip
build-turris.sh: rework cross-compile
Diffstat (limited to 'build-turris.sh')
-rwxr-xr-xbuild-turris.sh29
1 files changed, 17 insertions, 12 deletions
diff --git a/build-turris.sh b/build-turris.sh
index bb9ebe6..860dbad 100755
--- a/build-turris.sh
+++ b/build-turris.sh
@@ -1,18 +1,23 @@
-#!/bin/sh
-omnia_hash="17b62c338f2a0862a58bb6951556beecd98ccda9"
-moxes=( "spt-mox2" )
-omnias=( "spt-omnia" )
+#!/usr/bin/env bash
+set -eu
+omnia_hash="bd7ac5d8c08538ec1f126d34b765f0362427fe17"
+routers=( "spt-mox2" "spt-omnia" )
cd "${0%/*}" || exit
-for system in "${moxes[@]}"; do
- echo "Building $system"
- nix build -o "result-${system}" ".#nixosConfigurations.${system}.config.system.build.toplevel"
-done
-for system in "${omnias[@]}"; do
+for system in "${routers[@]}"; do
echo "Building $system"
+ declare -a args
+ toplevel=".config.system.build.toplevel"
+ if [[ "$system" == *omnia ]]; then
+ toplevel=".config.system.build.cross.x86_64-linux${toplevel}"
+ args=( \
+ "--override-input" "nixpkgs" "github:NixOS/nixpkgs/${omnia_hash}"
+ "--override-input" "nixturris/nixpkgs" "github:NixOS/nixpkgs/${omnia_hash}"
+ "--override-input" "nixturris" "/home/cynerd/projects/nixturris"
+ )
+ fi
nix build \
- --override-input nixpkgs "github:NixOS/nixpkgs/${omnia_hash}" \
- --override-input nixturris/nixpkgs "github:NixOS/nixpkgs/${omnia_hash}" \
-o "result-${system}" \
- ".#nixosConfigurations.${system}.config.system.build.toplevel"
+ "${args[@]}" \
+ ".#nixosConfigurations.${system}${toplevel}"
done