diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-05 21:31:36 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-07 02:46:04 +0900 |
| commit | 72a931a71a4722c0e56b231d07787bef608ceedc (patch) | |
| tree | 7de0a75a8d091ceb78f89a040af79f9c806710f3 /test/interactive/configuration.nix | |
| parent | 9a25542c6d23fd4dc12f25fa914e6f560f4d7324 (diff) | |
nix: interactive nixos vm
This is useful for quickly spinning up an ephemeral hakurei environment for testing changes or reproducing vm test failures.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/interactive/configuration.nix')
| -rw-r--r-- | test/interactive/configuration.nix | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/interactive/configuration.nix b/test/interactive/configuration.nix new file mode 100644 index 00000000..49c90343 --- /dev/null +++ b/test/interactive/configuration.nix @@ -0,0 +1,60 @@ +{ pkgs, ... }: +{ + system.stateVersion = "23.05"; + + users.users = { + alice = { + isNormalUser = true; + description = "Alice Foobar"; + password = "foobar"; + uid = 1000; + extraGroups = [ "wheel" ]; + }; + untrusted = { + isNormalUser = true; + description = "Untrusted user"; + password = "foobar"; + uid = 1001; + }; + }; + + home-manager.users.alice.home.stateVersion = "24.11"; + + security = { + sudo.wheelNeedsPassword = false; + rtkit.enable = true; + }; + + services = { + getty.autologinUser = "alice"; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + }; + + environment.variables = { + SWAYSOCK = "/tmp/sway-ipc.sock"; + WLR_RENDERER = "pixman"; + }; + + programs = { + sway.enable = true; + + bash.loginShellInit = '' + if [ "$(tty)" = "/dev/tty1" ]; then + set -e + + mkdir -p ~/.config/sway + (sed s/Mod4/Mod1/ /etc/sway/config && + echo 'output * bg ${pkgs.nixos-artwork.wallpapers.simple-light-gray.gnomeFilePath} fill') > ~/.config/sway/config + + sway --validate + systemd-cat --identifier=session sway && touch /tmp/sway-exit-ok + fi + ''; + }; +} |
