Created
March 29, 2023 02:46
-
-
Save fud/7a72c38c599dd55e7bfdda699a974f14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
outputs = { | |
self, | |
nixpkgs, | |
}: { | |
nixosModules.base = {pkgs, ...}: { | |
system.stateVersion = "22.05"; | |
# Configure networking | |
networking.useDHCP = false; | |
networking.interfaces.eth0.useDHCP = true; | |
# Create user "test" | |
services.getty.autologinUser = "test"; | |
users.users.test.isNormalUser = true; | |
# Enable passwordless ‘sudo’ for the "test" user | |
users.users.test.extraGroups = ["wheel"]; | |
security.sudo.wheelNeedsPassword = false; | |
}; | |
nixosConfigurations.linuxBase = nixpkgs.lib.nixosSystem { | |
system = "x86_64-linux"; | |
modules = [ | |
self.nixosModules.base | |
]; | |
}; | |
nixosModules.vm = {...}: { | |
# Make VM output to the terminal instead of a separate window | |
virtualisation.vmVariant.virtualisation.graphics = false; | |
}; | |
nixosConfigurations.linuxVM = nixpkgs.lib.nixosSystem { | |
system = "x86_64-linux"; | |
modules = [ | |
self.nixosModules.base | |
self.nixosModules.vm | |
]; | |
}; | |
nixosConfigurations.darwinVM = nixpkgs.lib.nixosSystem { | |
system = "aarch64-linux"; | |
modules = [ | |
self.nixosModules.base | |
self.nixosModules.vm | |
{ | |
virtualisation.vmVariant.virtualisation.host.pkgs = nixpkgs.legacyPackages.aarch64-darwin; | |
} | |
]; | |
}; | |
packages.aarch64-darwin.darwinVM = self.nixosConfigurations.darwinVM.config.system.build.vm; | |
packages.x86_64-linux.linuxVM = self.nixosConfigurations.linuxVM.config.system.build.vm; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
error: a 'aarch64-linux' with features {} is required to build '/nix/store/pr53dvbv21q1ajp3fhrk5zy1d5qpy8gj-append-initrd-secrets.drv', but I am a 'aarch64-darwin' with features {benchmark, big-parallel, nixos-test, recursive-nix}