Skip to content

Commit

Permalink
Add test VM (#982)
Browse files Browse the repository at this point in the history
This gives me a way to quickly test changes to PaperWM, such as pull
requests, without touching my existing configuration.

Ideally, this config can also be adapted to test combinations of PaperWM
settings (see programs.dconf = ... in vm.nix), maybe automate testing
too!
  • Loading branch information
Thesola10 authored Jan 8, 2025
2 parents 9243afd + 099fae5 commit 00f9173
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ [email protected]
node_modules/
package.json
package-lock.json

# generated disk image for test VM
nixos.qcow2
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,33 @@ from the repository. The installer will create a link to the repo in
>
> After logging back in, you can then enable PaperWM via the `Extensions` application, or by running the following command from the command-line:
>
> ```bash
> /usr/bin/gnome-extensions enable [email protected]
> ```
> `/usr/bin/gnome-extensions enable [email protected]`
>
> if you have run into issues, delete any older `paperwm@...` symlinks from `~/.local/share/gnome-shell/extensions` and re-run the `install.sh` script.
#### Uninstall PaperWM (if installed via source)

To uninstall simply run `./uninstall.sh`.

Running the extension will automatically install a user config file as described in [User configuration & development](#user-configuration--development).


### Try without installing

This repo provides a lightweight VM based on [NixOS](https://nixos.org) to try PaperWM and aid with development. You can launch it if [Nix](https://nixos.org/nix) is installed on your system using this command:

```sh
nix run .\#vm
```

Alternatively, the VM can also be launched with GPU acceleration, by installing [NixGL](https://github.com/nix-community/nixgl) first:

```sh
nixGLIntel nix run .\#vm -- -device virtio-gpu-gl -display gtk,gl=on
# or nixGLNvidia depending on your host GPU
```

## Contributing
Users are encouraged to submit [issues](https://github.com/paperwm/PaperWM/issues/new/choose) and [Pull Requests](https://github.com/paperwm/PaperWM/pulls)!

Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,25 @@
let pkgs = import nixpkgs { inherit system; };
in
{ packages.default = pkgs.callPackage ./default.nix {};
});
packages.vm = let hostConfig = self.nixosConfigurations.testbox.config;
localConfig = hostConfig // {
virtualisation = hostConfig.virtualisation // {
host.pkgs = pkgs; # Use host system's Qemu
};
};
in localConfig.system.build.vm;
}) // {
nixosConfigurations."testbox" =
let system = "x86_64-linux";
in nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./vm.nix
{ nixpkgs.overlays = [
(s: super: { paperwm = self.packages.${system}.default; })
];
}
];
};
};
}
48 changes: 48 additions & 0 deletions vm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{ pkgs, config, lib, ... }:

{
### Make PaperWM available in system environment
environment.systemPackages = with pkgs;
[ paperwm
];

### Set graphical session to auto-login GNOME
services.xserver =
{ enable = true;
displayManager.autoLogin =
{ enable = true;
user = "user";
};
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};

### Set dconf to enable PaperWM out of the box
programs.dconf =
{ enable = true;
profiles."user".databases = [
{ settings =
{ "org/gnome/shell" =
{ enabled-extensions = [ "[email protected]" ];
};
};
}
];
};

### Set default user
users.users."user" =
{ isNormalUser = true;
createHome = true;
home = "/home";
description = "PaperWM test user";
extraGroups = [ "wheel" ];
password = "paperwm";
};

### No-password sudo
security.sudo =
{ enable = true;
extraConfig = "%wheel ALL=(ALL) NOPASSWD: ALL";
};
}

0 comments on commit 00f9173

Please sign in to comment.