successfully deployed mize for the first time
This commit is contained in:
34
deploy
34
deploy
@@ -1,23 +1,43 @@
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
|
||||
if [[ "$1" == "a" ]]
|
||||
then
|
||||
ssh acern mkdir -p /tmp/victorinix
|
||||
rsync -rv --exclude="target" --exclude="gitignore" ./* acern:/tmp/victorinix/
|
||||
path=$(ssh acern nix build /tmp/victorinix#webfiles -L --print-out-paths)
|
||||
ssh acern mkdir -p /tmp/mize-src
|
||||
ssh acern mkdir -p ~/work/modules
|
||||
rsync -rv --exclude="target" --exclude="gitignore" ./* acern:/tmp/mize-src/
|
||||
rsync -rv --exclude="target" --exclude="gitignore" --exclude="node_modules" ~/work/modules acern:work/
|
||||
path=$(ssh acern /home/me/out/nix/bin/nix build /tmp/mize-src#webfiles -L --print-out-paths)
|
||||
|
||||
echo doneeeeeeeeeeeeeee
|
||||
echo doneeeeeeeeeeeeeee building
|
||||
echo path: $path
|
||||
|
||||
#scp -r acern:$path/* ocih:host/webserver/webfiles
|
||||
rsync -rv $path/* ocih:host/webserver/webfiles --rsync-path="sudo rsync"
|
||||
tmp=$(mktemp -d)
|
||||
[[ "$path" != "" ]] && rsync -rv -p --chmod=u+w acern:$path/* $tmp
|
||||
[[ "$path" != "" ]] && rsync -rv $tmp/* ocih:host/webserver/webfiles/ --rsync-path="sudo rsync"
|
||||
|
||||
|
||||
|
||||
elif [[ "$1" == "c" ]] # only copy files to acern
|
||||
then
|
||||
ssh acern mkdir -p /tmp/mize-src
|
||||
ssh acern mkdir -p ~/work/modules
|
||||
rsync -rv --exclude="target" --exclude="gitignore" ./* acern:/tmp/mize-src/
|
||||
rsync -rv --exclude="target" --exclude="gitignore" --exclude="node_modules" ~/work/modules acern:work/
|
||||
|
||||
|
||||
|
||||
else
|
||||
path=$(nix build .#webfiles -L -v --print-out-paths $@)
|
||||
|
||||
echo doneeeeeeeeeeeeeee
|
||||
echo doneeeeeeeeeeeeeee building
|
||||
echo path: $path
|
||||
|
||||
#scp -r $path/* ocih:host/webserver/webfiles
|
||||
rsync -rv $path/* ocih:host/webserver/webfiles --rsync-path="sudo rsync"
|
||||
[[ "$path" != "" ]] && rsync -rv $path/* ocih:host/webserver/webfiles --rsync-path="sudo rsync"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
2
flake.lock
generated
2
flake.lock
generated
@@ -60,7 +60,7 @@
|
||||
"dirtyRev": "fa3b462cbe3e63fc9ecada6c4445d366e58a6f86-dirty",
|
||||
"dirtyShortRev": "fa3b462-dirty",
|
||||
"lastModified": 1725362504,
|
||||
"narHash": "sha256-uL7SRKxrCpS/9sXVOdClijqdxXNLIuiHZ54YYZck42E=",
|
||||
"narHash": "sha256-whgym05xZUVEtO6/F4id2XN7MBQTs7VUEhF8PEJV41E=",
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "file:///home/me/work/modules"
|
||||
|
||||
@@ -71,6 +71,7 @@ let
|
||||
inherit inputs nixpkgs pkgs self osCrane defaultMizeConfig mize_modules;
|
||||
inherit rust-overlay crane fenix;
|
||||
localSystem = system;
|
||||
stdenv = pkgs.stdenv;
|
||||
};
|
||||
|
||||
in {
|
||||
@@ -110,10 +111,7 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
webfiles = pkgs.callPackage ./webfiles.nix {
|
||||
inherit (mizeLib) buildMizeForSystem mkInstallPhase;
|
||||
inherit systems;
|
||||
};
|
||||
webfiles = mizeLib.webfiles systems;
|
||||
|
||||
default = osCrane.buildPackage {
|
||||
src = "${self}";
|
||||
|
||||
82
lib.nix
82
lib.nix
@@ -8,6 +8,7 @@
|
||||
, rust-overlay
|
||||
, crane
|
||||
, fenix
|
||||
, stdenv
|
||||
, ...
|
||||
}:
|
||||
rec {
|
||||
@@ -65,9 +66,10 @@ rec {
|
||||
if crossSystem.kernel.name == "windows"
|
||||
then
|
||||
(crane.mkLib pkgs).overrideToolchain (fenix.packages.${localSystem}.combine [
|
||||
fenix.packages.${localSystem}.minimal.rustc
|
||||
fenix.packages.${localSystem}.minimal.cargo
|
||||
fenix.packages.${localSystem}.targets."${crossSystem.cpu.name}-pc-windows-gnu".latest.rust-std
|
||||
#fenix.packages.${localSystem}.minimal.rustc
|
||||
#fenix.packages.${localSystem}.minimal.cargo
|
||||
fenix.packages.${localSystem}.stable.toolchain
|
||||
fenix.packages.${localSystem}.targets."${crossSystem.cpu.name}-pc-windows-gnu".stable.toolchain
|
||||
])
|
||||
|
||||
else if crossSystem.cpu.name == "wasm32"
|
||||
@@ -80,43 +82,51 @@ rec {
|
||||
then
|
||||
builtins.trace "x86_64-linux-gnu hackfix...."
|
||||
(crane.mkLib pkgs).overrideToolchain (fenix.packages.${localSystem}.combine [
|
||||
fenix.packages.${localSystem}.latest.toolchain
|
||||
fenix.packages.${localSystem}.stable.toolchain
|
||||
])
|
||||
|
||||
else
|
||||
(crane.mkLib pkgsCross).overrideToolchain (p: p.rust-bin.stable.latest.default)
|
||||
;
|
||||
|
||||
toolchain_version_drv = pkgs.stdenv.mkDerivation {
|
||||
name = "toolchain_version_drv";
|
||||
dontUnpack = true;
|
||||
configurePhase = "";
|
||||
buildPhase = ''
|
||||
mkdir -p $out
|
||||
touch $out/rustc-version
|
||||
|
||||
echo hiiiiiiiiiiiiiiiiiiiiiiii
|
||||
#echo 'rustc 1.80.1 (3f5fd8dd4 2024-08-06)' > $out/rustc-version
|
||||
${craneLib.cargo}/bin/rustc --version > $out/rustc-version
|
||||
|
||||
exit 0
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
|
||||
mkSelString = attrs: builtins.toJSON (attrs // {
|
||||
inherit toolchain_version;
|
||||
system = crossSystem.nameFull;
|
||||
mize_version = main-default.version;
|
||||
});
|
||||
|
||||
toolchain_version_drv = pkgs.stdenv.mkDerivation {
|
||||
name = "toolchain_version_drv";
|
||||
dontUnpack = true;
|
||||
configurePhase = "";
|
||||
buildPhase = ''
|
||||
mkdir -p $out
|
||||
touch $out/rustc-version
|
||||
|
||||
echo hiiiiiiiiiiiiiiiiiiiiiiii
|
||||
echo 'rustc 1.80.1 (3f5fd8dd4 2024-08-06)' > $out/rustc-version
|
||||
${craneLib.cargo}/bin/rustc --version > $out/rustc-version
|
||||
|
||||
exit 0
|
||||
'';
|
||||
};
|
||||
toolchain_version = pkgs.lib.strings.removeSuffix "\n" (builtins.readFile "${toolchain_version_drv}/rustc-version");
|
||||
|
||||
mkMizeModule = attrs: pkgsCross.stdenv.mkDerivation (attrs // {
|
||||
selector_string = mkSelString attrs.select;
|
||||
selector_string = mkSelString (attrs.select or {} // {
|
||||
inherit (attrs) modName;
|
||||
});
|
||||
});
|
||||
|
||||
########## build Rust Module
|
||||
mkMizeRustModule = attrs: craneLib.buildPackage (attrs // {
|
||||
MIZE_BUILD_CONFIG = mizeBildConfig;
|
||||
selector_string = mkSelString (attrs.select or {} // {
|
||||
inherit (attrs) modName;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -175,6 +185,7 @@ rec {
|
||||
});
|
||||
};
|
||||
|
||||
####### build mize
|
||||
main-default = craneLib.buildPackage ({
|
||||
src = "${self}";
|
||||
cargoExtraArgs = "--bin mize --features os-target";
|
||||
@@ -230,8 +241,15 @@ rec {
|
||||
src = "${self}";
|
||||
CARGO_BUILD_TARGET = "wasm32-unknown-unknown";
|
||||
doCheck = false;
|
||||
cargoExtraArgs = "--features wasm-target";
|
||||
cargoExtraArgs = "--features wasm-target --no-default-features";
|
||||
MIZE_BUILD_CONFIG = mizeBildConfig;
|
||||
|
||||
# env vars
|
||||
#CC = "${stdenv.cc.nativePrefix}cc";
|
||||
#AR = "${stdenv.cc.nativePrefix}ar";
|
||||
#CC_wasm32_unknown_unknown = "${pkgs.llvmPackages_14.clang-unwrapped}/bin/clang-14";
|
||||
#CFLAGS_wasm32_unknown_unknown = "-I ${pkgs.llvmPackages_14.libclang.lib}/lib/clang/14.0.6/include/";
|
||||
#AR_wasm32_unknown_unknown = "${pkgs.llvmPackages_14.llvm}/bin/llvm-ar";
|
||||
};
|
||||
|
||||
in rec {
|
||||
@@ -274,13 +292,33 @@ rec {
|
||||
|
||||
mkModuleInstallPhase = module: ''
|
||||
echo got module: ${module.name}
|
||||
echo out: $out
|
||||
hash=$(echo ${module.selector_string} | sha256sum | cut -c -32)
|
||||
mkdir -p $out/mize/dist/$hash
|
||||
cp -r ${module}/* $out/mize/dist/$hash
|
||||
cp --no-preserve=mode,ownership -r ${module}/* $out/mize/dist/$hash
|
||||
echo '${module.selector_string}' > $out/mize/dist/$hash/selector
|
||||
'';
|
||||
|
||||
webfiles = systems: stdenv.mkDerivation {
|
||||
name = "mize-webfiles";
|
||||
dontUnpack = true;
|
||||
|
||||
# so that those binaries run on average linux-gnu systems
|
||||
dontPatchShebangs = true;
|
||||
|
||||
buildPhase = ''
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
mkdir -p $out/mize
|
||||
mkdir -p $out/mize/dist
|
||||
|
||||
'' + pkgs.lib.concatStringsSep "\n" (map mkInstallPhase (map buildMizeForSystem systems));
|
||||
|
||||
|
||||
nativeBuildInputs = [
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
[config]
|
||||
namespace = "test.c2vi.dev"
|
||||
module_dir = "/home/me/work/mize/modules"
|
||||
test = "hello from test item"
|
||||
|
||||
[config.module_dir]
|
||||
|
||||
37
webfiles.nix
37
webfiles.nix
@@ -1,37 +0,0 @@
|
||||
{ stdenv
|
||||
, pkgs
|
||||
, mkInstallPhase
|
||||
, buildMizeForSystem
|
||||
, systems
|
||||
, ...
|
||||
}: let
|
||||
|
||||
# list of systems, we build mize for for webfiles
|
||||
#systems = [ "x86_64-linux" "aarch64-linux" "wasm32" ];
|
||||
#systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
|
||||
list_of_mizes = map buildMizeForSystem systems;
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "mize-webfiles";
|
||||
dontUnpack = true;
|
||||
|
||||
# so that /bin/sh does not get patched to a nix store path in victorinix-s
|
||||
dontPatchShebangs = true;
|
||||
|
||||
buildPhase = ''
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
mkdir -p $out/mize
|
||||
mkdir -p $out/mize/dist
|
||||
|
||||
'' + pkgs.lib.concatStringsSep "\n" (map mkInstallPhase list_of_mizes);
|
||||
|
||||
|
||||
nativeBuildInputs = [
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user