summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2024-06-25 11:33:40 +0200
committerMike Vink <mike@pionative.com>2024-06-25 11:33:40 +0200
commitc7cb36d521a8d2b9a2f87cc02ed5f8ba9df39656 (patch)
treeb132f7b2d31ec5c8ddb71b0a9bd91fa78ce32eed
parentbb0cb5b43f4c709bde7d4ea1c5a090a071b77d54 (diff)
first version with arm vm
-rw-r--r--ivi/ivi.nix1
-rw-r--r--justfile26
-rw-r--r--machines/vm-aarch64.nix14
m---------mut/dwm0
-rw-r--r--overlays/suckless.nix10
-rw-r--r--profiles/graphical/suckless.nix92
-rw-r--r--profiles/vmware-guest.nix91
7 files changed, 215 insertions, 19 deletions
diff --git a/ivi/ivi.nix b/ivi/ivi.nix
index c2b36d3..5fbd6d6 100644
--- a/ivi/ivi.nix
+++ b/ivi/ivi.nix
@@ -123,6 +123,7 @@ self: lib: with lib; let
isStation = true;
profiles = [
"core"
+ "graphical"
];
syncthing = {
enable = false;
diff --git a/justfile b/justfile
index 01f2683..9b40b62 100644
--- a/justfile
+++ b/justfile
@@ -30,18 +30,18 @@ NIXNAME := "vm-aarch64"
"
@vm-secrets ip:
- # GPG keyring
- rsync -av -e 'ssh {{SSH_OPTIONS}}' \
- --exclude='.#*' \
- --exclude='S.*' \
- --exclude='*.conf' \
- $HOME/.gnupg/ root@{{ip}}:~/.gnupg
- # SSH keys
- rsync -av -e 'ssh {{SSH_OPTIONS}}' \
- --exclude='environment' \
- $HOME/.ssh/ root@{{ip}}:~/.ssh
- # Sops keys
- rsync -avr -e 'ssh {{SSH_OPTIONS}}' --relative ~/./.config/sops root@{{ip}}:~
+ # GPG keyring
+ rsync -av -e 'ssh {{SSH_OPTIONS}}' \
+ --exclude='.#*' \
+ --exclude='S.*' \
+ $HOME/.gnupg/ root@{{ip}}:~/.gnupg
+ # SSH keys
+ rsync -av -e 'ssh {{SSH_OPTIONS}}' \
+ --exclude='environment' \
+ --exclude='ssh_auth_sock' \
+ $HOME/.ssh/ root@{{ip}}:~/.ssh
+ # Sops keys
+ rsync -avr -e 'ssh {{SSH_OPTIONS}}' --relative ~/./.config/sops root@{{ip}}:~
# copy the Nix configurations into the VM.
@vm-copy ip:
@@ -54,7 +54,7 @@ NIXNAME := "vm-aarch64"
# have to run vm/copy before.
@vm-switch ip: (vm-copy ip) (vm-secrets ip)
ssh {{SSH_OPTIONS}} -p22 root@{{ip}} " \
- sudo NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nixos-rebuild switch --flake \"/nix-config#{{NIXNAME}}\" \
+ sudo NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nixos-rebuild switch --impure --flake \"/nix-config#{{NIXNAME}}\" \
"
# after bootstrap0, run this to finalize. After this, do everything else
diff --git a/machines/vm-aarch64.nix b/machines/vm-aarch64.nix
index 9832eb2..768e669 100644
--- a/machines/vm-aarch64.nix
+++ b/machines/vm-aarch64.nix
@@ -1,8 +1,20 @@
# https://github.com/mitchellh/nixos-config/blob/main/machines/vm-aarch64-prl.nix
-{ config, pkgs, lib, ... }: {
+{ self, config, pkgs, lib, ... }: {
+ imports =
+ [ (self + "/profiles/vmware-guest.nix")
+ ];
system.stateVersion = "24.05";
+ virtualisation.vmware.guest.enable = true;
sops.age.keyFile = "${config.hm.xdg.configHome}/sops/age/keys.txt";
+ users.users.${lib.ivi.username} = {
+ shell = pkgs.zsh;
+ };
+ environment.shells = [pkgs.bashInteractive pkgs.zsh];
+ environment.pathsToLink = [ "/share/zsh" ];
+ programs.zsh.enable = true;
+ services.xserver.displayManager.sessionCommands = ''
+ '';
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = true;
diff --git a/mut/dwm b/mut/dwm
-Subproject 04c767c276cf4bbdd9bfdb6d2e8e05a1ca2909a
+Subproject 501ca89515ee9319d6fad338b553b1c42226483
diff --git a/overlays/suckless.nix b/overlays/suckless.nix
index f49357b..e22e81c 100644
--- a/overlays/suckless.nix
+++ b/overlays/suckless.nix
@@ -1,17 +1,17 @@
{pkgs, home, ...}: (final: prev: {
st = (prev.st.overrideAttrs (oldAttrs: {
- src = /. + home + "/flake/mut/st";
+ src = home + "/mut/st";
version = "0.3.2";
buildInputs = oldAttrs.buildInputs ++ [prev.harfbuzz];
}));
dwm = (prev.dwm.overrideAttrs (oldAttrs: {
- src = /. + home + "/flake/mut/dwm";
- version = "0.1.4";
+ src = home + "/mut/dwm";
+ version = "0.1.5";
}));
dwmblocks =(prev.stdenv.mkDerivation {
pname = "dwmblocks";
- version = "1.1.3";
- src = /. + home + "/flake/mut/dwmblocks";
+ version = "1.1.4";
+ src = home + "/mut/dwmblocks";
buildInputs = [prev.xorg.libX11];
installPhase = ''
install -m755 -D dwmblocks $out/bin/dwmblocks
diff --git a/profiles/graphical/suckless.nix b/profiles/graphical/suckless.nix
new file mode 100644
index 0000000..b918494
--- /dev/null
+++ b/profiles/graphical/suckless.nix
@@ -0,0 +1,92 @@
+{
+ self,
+ config,
+ pkgs,
+ lib,
+ machine,
+ ...
+}: with lib; mkIf (!machine.isDarwin) {
+ nixpkgs.overlays = [(import (self + "/overlays/suckless.nix") {inherit pkgs; home = self;})];
+ services.xserver.enable = true;
+ services.xserver.displayManager.startx.enable = true;
+ services.xserver.libinput.enable = true;
+ hm = {
+ xsession = {
+ enable = true;
+ initExtra = ''
+ ${pkgs.xorg.xset}/bin/xset r rate 230 30
+ [ -z "$(lsusb | grep microdox)" ] && ${pkgs.xorg.setxkbmap}/bin/setxkbmap -option "ctrl:swapcaps"
+ ${pkgs.open-vm-tools}/bin/vmware-user-suid-wrapper
+ wal -R
+ dwm
+ '';
+ };
+ services.picom = {
+ enable = true;
+ activeOpacity = 0.99;
+ inactiveOpacity = 0.7;
+ opacityRules = [
+ "100:class_g = 'Wfica'"
+ "100:class_g = 'dwm'"
+ "100:class_g = 'Zathura'"
+ "100:name *= 'Firefox'"
+ "100:name *= 'mpv'"
+ "100:name *= 'LibreWolf'"
+ "100:name *= 'Steam'"
+ "100:name *= 'Risk of Rain'"
+ "100:name *= 'KVM'"
+ ];
+ settings = {
+ inactive-opacity-override = false;
+ frame-opacity = 1;
+ };
+ };
+ services.dunst = {
+ enable = true;
+ settings = {
+ global = {
+ monitor = 0;
+ follow = "keyboard";
+ width = 370;
+ height = 350;
+ offset = "0x19";
+ padding = 2;
+ horizontal_padding = 2;
+ transparency = 0;
+ font = "Monospace 12";
+ format = "<b>%s</b>\\n%b";
+ };
+ urgency_low = {
+ background = "#1d2021";
+ foreground = "#928374";
+ timeout = 3;
+ };
+ urgency_normal = {
+ foreground = "#ebdbb2";
+ background = "#458588";
+ timeout = 5;
+ };
+ urgency_critical = {
+ background = "#1cc24d";
+ foreground = "#ebdbb2";
+ frame_color = "#fabd2f";
+ timeout = 10;
+ };
+ };
+ };
+ home.packages = with pkgs; [
+ libnotify
+ sxiv
+ st
+ dwm
+ dwmblocks
+ pywal
+ inotify-tools
+
+ (nerdfonts.override {fonts = ["FiraCode" "JetBrainsMono"];})
+ dmenu
+ librewolf
+ xclip
+ ];
+ };
+}
diff --git a/profiles/vmware-guest.nix b/profiles/vmware-guest.nix
new file mode 100644
index 0000000..7dc8ef2
--- /dev/null
+++ b/profiles/vmware-guest.nix
@@ -0,0 +1,91 @@
+# This is based on the official vmware-guest module, but modified
+# for aarch64 to disable certain features and add support. I'm unsure
+# how to upstream this because I just don't use certain features... maybe
+# making them toggle-able? I'm not sure.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.virtualisation.vmware.guest;
+ open-vm-tools = if cfg.headless then pkgs.open-vm-tools-headless else pkgs.open-vm-tools;
+in
+{
+ imports = [
+ (mkRenamedOptionModule [ "services" "vmwareGuest" ] [ "virtualisation" "vmware" "guest" ])
+ ];
+
+ options.virtualisation.vmware.guest = {
+ enable = mkEnableOption "VMWare Guest Support";
+ headless = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to disable X11-related features.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions = [ {
+ assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 || pkgs.stdenv.isAarch64;
+ message = "VMWare guest is not currently supported on ${pkgs.stdenv.hostPlatform.system}";
+ } ];
+
+ boot.initrd.availableKernelModules = [ "mptspi" ];
+ # boot.initrd.kernelModules = [ "vmw_pvscsi" ];
+
+ environment.systemPackages = [ open-vm-tools ];
+
+ systemd.services.vmware =
+ { description = "VMWare Guest Service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "display-manager.service" ];
+ unitConfig.ConditionVirtualization = "vmware";
+ serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd";
+ };
+
+ # Mount the vmblock for drag-and-drop and copy-and-paste.
+ systemd.mounts = [
+ {
+ description = "VMware vmblock fuse mount";
+ documentation = [ "https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/vmblock-fuse/design.txt" ];
+ unitConfig.ConditionVirtualization = "vmware";
+ what = "${open-vm-tools}/bin/vmware-vmblock-fuse";
+ where = "/run/vmblock-fuse";
+ type = "fuse";
+ options = "subtype=vmware-vmblock,default_permissions,allow_other";
+ wantedBy = [ "multi-user.target" ];
+ }
+ ];
+
+ security.wrappers.vmware-user-suid-wrapper =
+ { setuid = true;
+ owner = "root";
+ group = "root";
+ source = "${open-vm-tools}/bin/vmware-user-suid-wrapper";
+ };
+
+ environment.etc.vmware-tools.source = "${open-vm-tools}/etc/vmware-tools/*";
+
+ services.xserver = {
+ # TODO: does not build on aarch64
+ # modules = [ xf86inputvmmouse ];
+
+ config = ''
+ Section "InputClass"
+ Identifier "VMMouse"
+ MatchDevicePath "/dev/input/event*"
+ MatchProduct "ImPS/2 Generic Wheel Mouse"
+ Driver "vmmouse"
+ EndSection
+ '';
+
+ displayManager.sessionCommands = ''
+ ${open-vm-tools}/bin/vmware-user-suid-wrapper
+ '';
+ };
+
+ services.udev.packages = [ open-vm-tools ];
+ };
+}
+