diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index 256de92..8139139 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -22,6 +22,7 @@ ./roles/docker ./roles/ecc ./roles/emacs + ./roles/emulate_isa ./roles/firefox ./roles/firewall ./roles/flux diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 5379805..6776c31 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -71,6 +71,7 @@ me.docker.enable = false; me.ecc.enable = false; me.emacs_flavor = "full"; + me.emulate_isa.enable = true; me.firefox.enable = true; me.flux.enable = true; me.gcloud.enable = true; diff --git a/nix/configuration/hosts/quark/default.nix b/nix/configuration/hosts/quark/default.nix index 09a61c9..25d8df7 100644 --- a/nix/configuration/hosts/quark/default.nix +++ b/nix/configuration/hosts/quark/default.nix @@ -64,6 +64,7 @@ me.docker.enable = false; me.ecc.enable = true; me.emacs_flavor = "full"; + me.emulate_isa.enable = true; me.firefox.enable = true; me.flux.enable = true; me.gcloud.enable = true; diff --git a/nix/configuration/roles/emulate_isa/default.nix b/nix/configuration/roles/emulate_isa/default.nix new file mode 100644 index 0000000..183eb4e --- /dev/null +++ b/nix/configuration/roles/emulate_isa/default.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + options.me = { + emulate_isa.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to enable emulating other CPU architectures."; + }; + }; + + config = lib.mkIf config.me.emulate_isa.enable ( + lib.mkMerge [ + { + boot.binfmt.emulatedSystems = [ + "aarch64-linux" # Raspberry Pi gen 3 + "riscv64-linux" + # TODO: Should "x86_64-linux" be in this list or should this list be dependent on the host CPU? + "armv6l-linux" # Raspberry Pi gen 1 + ]; + } + ] + ); +} +# NOTE: build nixosConfigurations..config.system.build.sdImage