Simple application VMs (hypervisor-based sandbox) based on Nix package manager.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package main
  2. import (
  3. "io/ioutil"
  4. )
  5. // Builtin VMs
  6. type app struct {
  7. Name string
  8. Nix []byte
  9. }
  10. var builtin_chromium_nix = app{
  11. Name: "chromium",
  12. Nix: []byte(`
  13. {pkgs, ...}:
  14. let
  15. application = "${pkgs.chromium}/bin/chromium";
  16. appRunner = pkgs.writeShellScriptBin "app" ''
  17. ARGS_FILE=/home/user/.args
  18. ARGS=$(cat $ARGS_FILE)
  19. rm $ARGS_FILE
  20. ${application} $ARGS
  21. systemctl poweroff
  22. '';
  23. in {
  24. imports = [
  25. <nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
  26. <nix/base.nix>
  27. ];
  28. programs.chromium = {
  29. enable = true;
  30. extensions = [
  31. "cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
  32. "gcbommkclmclpchllfjekcdonpmejbdp" # HTTPS Everywhere
  33. "fihnjjcciajhdojfnbdddfaoknhalnja" # I don't care about cookies
  34. ];
  35. };
  36. services.xserver.displayManager.sessionCommands = "${appRunner}/bin/app &";
  37. }
  38. `),
  39. }
  40. func writeBuiltinApps(path string) (err error) {
  41. for _, f := range []app{
  42. builtin_chromium_nix,
  43. } {
  44. err = ioutil.WriteFile(configDir+"/nix/"+f.Name+".nix", f.Nix, 0644)
  45. if err != nil {
  46. return
  47. }
  48. }
  49. return
  50. }