Created
March 30, 2025 01:46
-
-
Save roosemberth/b3ca14eb72b38ab8661884d78a6eaa1e to your computer and use it in GitHub Desktop.
Two NixOS VMs with COSMIC desktop, one works the other crashes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "Example NixOS configuration crashing COSMIC"; | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/698214a32beb4f4c8e3942372c694f40848b360d"; | |
nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic/c709db4b95e58f410978bb49c87cb74214d03e78"; | |
nixos-cosmic.inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
outputs = { self, nixpkgs, nixos-cosmic }: let | |
systemBase = { pkgs, ... }: { | |
environment.systemPackages = with pkgs; [ vulkan-tools mesa-demos ]; | |
services.journald.console = "/dev/ttyS0"; | |
services.getty.autologinUser = "nixos"; | |
system.stateVersion = "24.11"; | |
users.extraUsers.nixos.password = "nixos"; | |
users.extraUsers.nixos.isNormalUser = true; | |
virtualisation.vmVariant.virtualisation = { | |
cores = 2; | |
memorySize = 4096; | |
qemu.options = [ | |
"-device virtio-gpu-gl,blob=on,hostmem=256M,venus=on" | |
"-display gtk,gl=on" | |
"-serial stdio" | |
]; | |
useEFIBoot = true; | |
}; | |
}; | |
in { | |
apps.x86_64-linux = builtins.mapAttrs | |
(name: config: { | |
type = "app"; | |
program = "${config.config.system.build.vm}/bin/run-nixos-vm"; | |
}) | |
self.nixosConfigurations; | |
nixosConfigurations.cosmic-612 = nixpkgs.lib.nixosSystem { | |
system = "x86_64-linux"; | |
modules = [ | |
nixos-cosmic.nixosModules.default | |
({pkgs, ...}: { | |
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_12; | |
services.desktopManager.cosmic.enable = true; | |
services.greetd.enable = true; | |
services.greetd.settings.default_session = { | |
command = "start-cosmic"; | |
user = "nixos"; | |
}; | |
}) | |
systemBase | |
]; | |
}; | |
nixosConfigurations.cosmic-614 = nixpkgs.lib.nixosSystem { | |
system = "x86_64-linux"; | |
modules = [ | |
nixos-cosmic.nixosModules.default | |
({pkgs, ...}: { | |
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_14; | |
services.desktopManager.cosmic.enable = true; | |
services.greetd.enable = true; | |
services.greetd.settings.default_session = { | |
command = "start-cosmic"; | |
user = "nixos"; | |
}; | |
}) | |
systemBase | |
]; | |
}; | |
}; | |
nixConfig = { | |
extra-substituters = ["https://cosmic.cachix.org/"]; | |
extra-trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment