collab/polyglot-riscv-arm

what if the same machine code was valid riscv and arm asm

git clone https://git.julia.blue/collab/polyglot-riscv-arm

Julia Ryanstart on decoder9692cf7

main
2.0 KiB64 linesraw
1{
2  inputs = {
3    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4    flake-utils.url = "github:numtide/flake-utils";
5  };
6  outputs = { self, nixpkgs, flake-utils }:
7    flake-utils.lib.eachDefaultSystem (system:
8      let
9        pkgs = import nixpkgs { inherit system; };
10        npmDepsHash = "sha256-etm87fsOnQc6KFl/yaLUtDyw4gc4rL27Zzpr4w5ndMU=";
11
12        nativeBuildInputs = with pkgs; [
13          cargo
14          rustc
15          lld
16        ];
17        buildInputs = with pkgs; [ nodejs wasm-pack ];
18
19        dev = with pkgs;
20          writeScriptBin "dev" ''
21            npx rollup --config --watch
22          '';
23        prefetch = with pkgs;
24          writeScriptBin "prefetch" ''
25            nix run nixpkgs#prefetch-npm-deps package-lock.json
26          '';
27        nerdfonts =
28          pkgs.nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; };
29      in
30      with pkgs; rec {
31        packages = rec {
32          website = pkgs.buildNpmPackage {
33            name = "polyglot-riscv-arm";
34            version = "22-05-2024";
35            src = ./.;
36            inherit nativeBuildInputs buildInputs npmDepsHash;
37            configurePhase = ''
38              mkdir -p ./dist/fonts
39              ln -sf ${nerdfonts}/share/fonts/truetype/NerdFonts/* ./dist/fonts/
40              ln -sf ${pkgs.fira}/share/fonts/opentype/* ./dist/fonts/
41              ln -sf ${pkgs.jetbrains-mono}/share/fonts/truetype/* ./dist/fonts/
42              ln -sf ${pkgs.fira-mono}/share/fonts/opentype/* ./dist/fonts/
43            '';
44            buildPhase = ''
45              npx rollup --config
46            '';
47            installPhase = ''
48              cp -pr dist $out/
49            '';
50          };
51          default = website;
52        };
53        devShells.default = mkShell {
54          buildInputs = buildInputs ++ [ prefetch ];
55          inherit nativeBuildInputs;
56          packages = with pkgs; [
57            lychee
58            dev
59            rust-analyzer
60          ];
61          shellHook = packages.website.configurePhase;
62        };
63      });
64}