Skip to content

Commit 00f9173

Browse files
authored
Add test VM (#982)
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!
2 parents 9243afd + 099fae5 commit 00f9173

File tree

5 files changed

+94
-7
lines changed

5 files changed

+94
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ [email protected]
88
node_modules/
99
package.json
1010
package-lock.json
11+
12+
# generated disk image for test VM
13+
nixos.qcow2

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,33 @@ from the repository. The installer will create a link to the repo in
3737
>
3838
> After logging back in, you can then enable PaperWM via the `Extensions` application, or by running the following command from the command-line:
3939
>
40-
> ```bash
41-
> /usr/bin/gnome-extensions enable [email protected]
42-
> ```
40+
> `/usr/bin/gnome-extensions enable [email protected]`
41+
>
4342
4443
> if you have run into issues, delete any older `paperwm@...` symlinks from `~/.local/share/gnome-shell/extensions` and re-run the `install.sh` script.
4544
4645
#### Uninstall PaperWM (if installed via source)
46+
4747
To uninstall simply run `./uninstall.sh`.
4848

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

51+
52+
### Try without installing
53+
54+
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:
55+
56+
```sh
57+
nix run .\#vm
58+
```
59+
60+
Alternatively, the VM can also be launched with GPU acceleration, by installing [NixGL](https://github.com/nix-community/nixgl) first:
61+
62+
```sh
63+
nixGLIntel nix run .\#vm -- -device virtio-gpu-gl -display gtk,gl=on
64+
# or nixGLNvidia depending on your host GPU
65+
```
66+
5167
## Contributing
5268
Users are encouraged to submit [issues](https://github.com/paperwm/PaperWM/issues/new/choose) and [Pull Requests](https://github.com/paperwm/PaperWM/pulls)!
5369

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,25 @@
88
let pkgs = import nixpkgs { inherit system; };
99
in
1010
{ packages.default = pkgs.callPackage ./default.nix {};
11-
});
11+
packages.vm = let hostConfig = self.nixosConfigurations.testbox.config;
12+
localConfig = hostConfig // {
13+
virtualisation = hostConfig.virtualisation // {
14+
host.pkgs = pkgs; # Use host system's Qemu
15+
};
16+
};
17+
in localConfig.system.build.vm;
18+
}) // {
19+
nixosConfigurations."testbox" =
20+
let system = "x86_64-linux";
21+
in nixpkgs.lib.nixosSystem {
22+
inherit system;
23+
modules = [
24+
./vm.nix
25+
{ nixpkgs.overlays = [
26+
(s: super: { paperwm = self.packages.${system}.default; })
27+
];
28+
}
29+
];
30+
};
31+
};
1232
}

vm.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{ pkgs, config, lib, ... }:
2+
3+
{
4+
### Make PaperWM available in system environment
5+
environment.systemPackages = with pkgs;
6+
[ paperwm
7+
];
8+
9+
### Set graphical session to auto-login GNOME
10+
services.xserver =
11+
{ enable = true;
12+
displayManager.autoLogin =
13+
{ enable = true;
14+
user = "user";
15+
};
16+
displayManager.gdm.enable = true;
17+
desktopManager.gnome.enable = true;
18+
};
19+
20+
### Set dconf to enable PaperWM out of the box
21+
programs.dconf =
22+
{ enable = true;
23+
profiles."user".databases = [
24+
{ settings =
25+
{ "org/gnome/shell" =
26+
{ enabled-extensions = [ "[email protected]" ];
27+
};
28+
};
29+
}
30+
];
31+
};
32+
33+
### Set default user
34+
users.users."user" =
35+
{ isNormalUser = true;
36+
createHome = true;
37+
home = "/home";
38+
description = "PaperWM test user";
39+
extraGroups = [ "wheel" ];
40+
password = "paperwm";
41+
};
42+
43+
### No-password sudo
44+
security.sudo =
45+
{ enable = true;
46+
extraConfig = "%wheel ALL=(ALL) NOPASSWD: ALL";
47+
};
48+
}

0 commit comments

Comments
 (0)