Comments (14)
looks good, I like how simple the script is
from bud.
I happen to do a refactoring of the testing framwork in nixpkgs and as a result am currently familiar with the qemu instrumentation.
The thing you could have a look at is startVM
.
At the end it receives a QEMU_OPTIONS
env var and even $@
.
A couple of lines back, cores and memory are already defined, so I'd hope later flags would peacefully override them. (Hoping only)
If my hope is in vain, I'd argue that this might be something that needs to be addressed upstream (it doesn't appear to be an exotic use case to run a vm with different ram settings during runtime).
So we could run the vm with something ./start-script -m 1024
.
If that dynamic is not needed it might suffice to put config.virtualisation.memorySize
/ config.virtualisation.cores
in the host config (but without enabling virtualization itself). Like saying: "if this where to be a VM, it needs so much resources."
from bud.
Thanks for the help @blaggacao!
Here is the script I have made to launch the one-shot vm with a custom memory size and cpu count:
#!/usr/bin/env bash
set -euo pipefail
export QEMU_OPTS="-m 4G -smp 8"
../devos/digga/src/pkgs-lib/shell/flk.sh vm run NixOS
the last line is because I am using my local develop digga repository so that I have flk vm run
.
For reference in case someone stumbles upon this issue later, here is a script that should work for anyone on devos if put at the root of devos and if the flk vm run
command is present:
#!/usr/bin/env bash
set -euo pipefail
export QEMU_OPTS="-m 4G -smp 8" # Here you change the memory (-m) and the number of cores (-smp)
flk vm run NixOS # Here you change the HOST you want to run
These options could most probably be added to the vm run
command.
from bud.
also one can add -vga virtio
to the QEMU_OPTS
to have a way better resolution for the machine, I highly recommend it!
from bud.
Maybe we could ask @zimbatm for a friendly review of https://github.com/divnix/digga/blob/develop/src/pkgs-lib/shell/flk.sh.
zimbatm by definition (with devshell
) counts as family member, I guess
from bud.
We should also be able to choose how much resources we put for the vm, now it is static (I didn't check how much memory and cpu there is but I think not much). It makes it unusable to test out a plasma based setup :/
I'm going to add that to the tracking comment. Do you happen to know if there is something I can do to specify the ram and number of threads as of now?
from bud.
@blaggacao my method is not enough and I happen to notice that in the file you linked, there are some options:
https://github.com/NixOS/nixpkgs/blob/690496c4e545e68482b5c162a03f0a4f97d35373/nixos/modules/virtualisation/qemu-vm.nix#L267
however, where can I set them?
If we answer this question, there would be no need for a bash script and the user would be able to set it in their config directly which would be awesome!
from bud.
This seems to be relevant:
https://github.com/NixOS/nixpkgs/blob/690496c4e545e68482b5c162a03f0a4f97d35373/nixos/default.nix#L12-L43
from bud.
I guess it's:
{
config.virtualization = {
memorySize = 1024;
cores = 4;
};
}
Didn't find from my cel phone where those options are defined.
from bud.
I went to the manual and saw this:
I'm going to try and set them in my core profile and see if it has any effect, it would be rather strange if it works as these options are not findable in the option search site. if it works I will probably file an issue about it.
from bud.
well no it's not as simple as to put it in the config of the host
that is really strange, I'll make an issue on nixpkgs and see
from bud.
Well, it is actually possible to use the options as is but you have to check if you are in a vm or not, that was the missing thing!
virtualisation = {
kvmgt.enable = true;
libvirtd.enable = true;
docker.enable = true;
} //
(lib.optionalAttrs (builtins.hasAttr "qemu" options.virtualisation) {
memorySize = 16 * 1024;
msize = 16 * 1024;
cores = 8;
qemu = {
options = [ "-vga virtio" ];
};
});
so here I set my normal virtualisation options for my host and if we are in a vm, then some other options are added on top.
for reference if someone stumbles upon this while searching on the net, here are the options:
https://github.com/NixOS/nixpkgs/blob/fcc1f7752ed71b0c94e5bf70e0a9c964a41073c7/nixos/modules/virtualisation/qemu-vm.nix#L267-L538
this should be way easier to do indeed. having something in digga to help the user setup these options would be awesome!
from bud.
@Narice Do we still want to pursue this or could we close it in the meanwhile and re-open once the underlaying need regains momentum?
from bud.
Yes if someone has an issue with the current implementation, they should open an issue ;)
from bud.
Related Issues (17)
- Pass a generalized reference to `self` HOT 1
- Revising `flk`
- Issue: `pkgs.nixos-install-tools` does not build on darwin
- Add complete `check-devos` check the same as in `digga`
- Make scripts reproducible
- bud is unable to detect hostname on macOS HOT 5
- Have an ex-post discussion about the design of this HOT 5
- bud rebuild errors with: unrecognised flag '--extra-experimental-features'
- bud can't build portable user HOT 2
- Revise "layer violations" HOT 2
- readme
- bud is deprecated HOT 3
- Properly add `fup-repl` here.
- up acessors suites.core. Now it's suites.base
- Implement Tests & BORS HOT 1
- Impelement contextual reference to flake, hostname and user where possible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bud.