From 0bbfe28abfdc1409f299391898496985c11041ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 1 Jul 2024 11:42:52 +0200 Subject: [PATCH] feat: add hyprland image --- README.md | 5 ++++- common.nix | 32 ++++++++++++++++++++++++++++++++ flake.nix | 48 +++++++++++++++++------------------------------- 3 files changed, 53 insertions(+), 32 deletions(-) create mode 100644 common.nix diff --git a/README.md b/README.md index d78742c..0d86691 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # Usage -Run `nixos-rebuild build-vm --flake .#default` and then execute `result/bin/run-nixos-vm`. +Run `nixos-rebuild build-vm --flake .#plasma` or `nixos-rebuild build-vm --flake .#hyprland`. + +Then execute `result/bin/run-nixos-vm -device virtio-vga`. + You should get logged in an can start `synology-drive-client`. diff --git a/common.nix b/common.nix new file mode 100644 index 0000000..923e65d --- /dev/null +++ b/common.nix @@ -0,0 +1,32 @@ +{ lib, pkgs, ... }: +{ + nixpkgs.hostPlatform = "x86_64-linux"; + + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.systemd-boot.enable = true; + + users.users.test = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + initialPassword = "test"; + }; + + services.xserver = { + enable = true; + displayManager = { + autoLogin.enable = true; + autoLogin.user = "test"; + }; + }; + + virtualisation.vmVariant.virtualisation = { + memorySize = 2048; + cores = 3; + }; + + environment.systemPackages = with pkgs; [ synology-drive-client ]; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "synology-drive-client" + ]; +} diff --git a/flake.nix b/flake.nix index ac59a5b..6aa40c4 100644 --- a/flake.nix +++ b/flake.nix @@ -26,42 +26,28 @@ # The usual flake attributes can be defined here, including system- # agnostic ones like nixosModule and system-enumerating ones, although # those are more easily expressed in perSystem. - nixosConfigurations.default = inputs.nixpkgs.lib.nixosSystem { + nixosConfigurations.plasma = inputs.nixpkgs.lib.nixosSystem { modules = [ - ({ lib, pkgs, ... }: + ./common.nix + (_: { - nixpkgs.hostPlatform = "x86_64-linux"; - - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.systemd-boot.enable = true; - - users.users.test = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - initialPassword = "test"; - }; - services.xserver = { - enable = true; - displayManager = { - sddm.enable = true; - autoLogin.enable = true; - autoLogin.user = "test"; - }; - + displayManager.sddm.enable = true; desktopManager.plasma6.enable = true; }; - - virtualisation.vmVariant.virtualisation = { - memorySize = 2048; - cores = 3; - }; - - environment.systemPackages = with pkgs; [ synology-drive-client ]; - - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "synology-drive-client" - ]; + }) + ]; + }; + nixosConfigurations.hyprland = inputs.nixpkgs.lib.nixosSystem { + modules = [ + ./common.nix + ({ pkgs, ... }: + { + services.xserver.displayManager.lightdm.enable = true; + services.xserver.displayManager.defaultSession = "hyprland"; + programs.hyprland.enable = true; + hardware.opengl.enable = true; + users.users.test.packages = with pkgs; [ kitty ]; }) ]; };