From 4394c123191c235a85af7eb4f47dec7e57bd2e7b Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Tue, 7 Jan 2025 22:23:06 +0530 Subject: [PATCH 1/4] Working on a built-in test virtual machine --- flake.nix | 13 +++++++++++++ vm.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 vm.nix diff --git a/flake.nix b/flake.nix index 95ffb67e4..a970a6586 100644 --- a/flake.nix +++ b/flake.nix @@ -8,5 +8,18 @@ let pkgs = import nixpkgs { inherit system; }; in { packages.default = pkgs.callPackage ./default.nix {}; + packages.vm = self.nixosConfigurations.testbox.config.system.build.vm; + + nixosConfigurations."testbox" = + nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + ./vm.nix + { nixpkgs.overlays = [ + (self: super: { paperwm = self.packages.${system}.default; }) + ]; + } + ]; + }; }); } diff --git a/vm.nix b/vm.nix new file mode 100644 index 000000000..4c21ccd2b --- /dev/null +++ b/vm.nix @@ -0,0 +1,47 @@ +{ 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"; + }; + 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 = [ "paperwm@paperwm.github.com" ]; + }; + }; + } + ]; + }; + + ### 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"; + }; +} From 3d782a4d4bf1314b9b027a3fa9e561d2e225b403 Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Wed, 8 Jan 2025 15:41:40 +0530 Subject: [PATCH 2/4] Working VM for PaperWM --- .gitignore | 3 +++ flake.nix | 17 ++++++++++++----- vm.nix | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 06f397096..d366ed98a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ paperwm@paperwm.github.com.zip node_modules/ package.json package-lock.json + +# generated disk image for test VM +nixos.qcow2 diff --git a/flake.nix b/flake.nix index a970a6586..af73f304c 100644 --- a/flake.nix +++ b/flake.nix @@ -8,18 +8,25 @@ let pkgs = import nixpkgs { inherit system; }; in { packages.default = pkgs.callPackage ./default.nix {}; - packages.vm = self.nixosConfigurations.testbox.config.system.build.vm; - + 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" = - nixpkgs.lib.nixosSystem { + let system = "x86_64-linux"; + in nixpkgs.lib.nixosSystem { inherit system; modules = [ ./vm.nix { nixpkgs.overlays = [ - (self: super: { paperwm = self.packages.${system}.default; }) + (s: super: { paperwm = self.packages.${system}.default; }) ]; } ]; }; - }); + }; } diff --git a/vm.nix b/vm.nix index 4c21ccd2b..cfb0c2072 100644 --- a/vm.nix +++ b/vm.nix @@ -13,6 +13,7 @@ { enable = true; user = "user"; }; + displayManager.gdm.enable = true; desktopManager.gnome.enable = true; }; From 98ab6e13895a8254631f45217a82c1bffc17fe0e Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Wed, 8 Jan 2025 16:10:39 +0530 Subject: [PATCH 3/4] bump to latest GNOME --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index f7a64fc7e..77ffa29ee 100644 --- a/flake.lock +++ b/flake.lock @@ -19,11 +19,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719492850, - "narHash": "sha256-koLuAz11nFcQ8DADmt15XEqEV8c1WcJ2S0JpSRTUxKo=", + "lastModified": 1736331163, + "narHash": "sha256-3mcSChVm6bWdYaTbUSHBpErhkVmfgJ39emO1TW+erjM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "69bee9866a4e2708b3153fdb61c1425e7857d6b8", + "rev": "e09d079fe4b202c1b7c1153b229f35ee83e81275", "type": "github" }, "original": { From 099fae58be5836393bf4941f0e13d0e6beaf423d Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Wed, 8 Jan 2025 16:15:16 +0530 Subject: [PATCH 4/4] update README --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae93621d5..5cf20513e 100644 --- a/README.md +++ b/README.md @@ -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 paperwm@paperwm.github.com -> ``` +> `/usr/bin/gnome-extensions enable paperwm@paperwm.github.com` +> > 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)!