Compare commits

...

4 Commits

13 changed files with 165 additions and 135 deletions

View File

@ -16,7 +16,12 @@
}; };
"/mnt/Storage" = { "/mnt/Storage" = {
device = "/dev/disk/by-label/storage"; device = "/dev/disk/by-label/storage";
fsType = "ext4"; fsType = "btrfs";
options = [
"noatime"
"nodev"
"nosuid"
];
}; };
}; };
@ -24,31 +29,37 @@
gajim-mainwindow gajim-mainwindow
virt-manager qemu scream virt-manager qemu scream
replaysorcery # Custom package replaysorcery # Custom package
#evdev-proxy # Custom package
vfio-isolate # Custom Package vfio-isolate # Custom Package
steam-wrapped discord-wrapped # Custom package steam-wrapped discord-wrapped # Custom package
mumble mumble
piper piper trackma # Custom package
trackma # Custom package
anime-dl # Custom package anime-dl # Custom package
thunderbird thunderbird
#multimc-wrapped # Custom package
#nwg-launchers #nwg-launchers
gnome-podcasts gnome-podcasts
cantata cantata
newsflash newsflash
sublime-music-no-test sublime-music
anki anki
#psst #psst
]; ];
ptw = { ptw = {
programs = { programs = {
mpv = { mpv = {
primaryScreen = "C27F398"; primaryScreen = "C27F398";
enable = true; enable = true;
}; };
sway.enable = true; sway = {
enable = true;
extraSessionCommands = ''
# Pick the dGPU as the first one
#DGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:01:00.0/drm | grep card)
#IGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:08:00.0/drm | grep card)
#export WLR_DRM_DEVICES=/dev/dri/$DGPU_DRM_NODE:/dev/dri/$IGPU_DRM_NODE
'';
};
alacritty.enable = true; alacritty.enable = true;
emacs.enable = true; emacs.enable = true;
firefox.enable = true; firefox.enable = true;
@ -67,7 +78,17 @@
}; };
services = { services = {
gamemode.enable = true; gamemode.enable = true;
gnome.enable = true; #gnome.enable = true;
greetd = {
enable = false;
/*
swayExtra = ''
output HDMI-A-3 transform 90 anticlockwise
workspace 1 output HDMI-A-3
'';
*/
};
kanshi = let kanshi = let
horizontal = "Samsung Electric Company C27F398 H4ZR101145"; horizontal = "Samsung Electric Company C27F398 H4ZR101145";
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600"; vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
@ -105,7 +126,7 @@
swaync.enable = true; swaync.enable = true;
input-remapper = { input-remapper = {
enable = true; enable = true;
postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0"; postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"";
}; };
}; };
system = { system = {
@ -149,7 +170,7 @@
}; };
kernelParams = [ kernelParams = [
"amd_iommu=on" "amd_iommu=on"
"iommu=pt" "iommu=on"
"sysrq_always_enabled=1" "sysrq_always_enabled=1"
"kvm.ignore_msrs=1" "kvm.ignore_msrs=1"
"kvm.report_ignored_msrs=N" "kvm.report_ignored_msrs=N"
@ -160,6 +181,7 @@
"nospec" "nospec"
"clocksource=tsc" "clocksource=tsc"
"tsc=reliable" "tsc=reliable"
"pci=noaer"
]; ];
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ]; extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
@ -185,6 +207,7 @@
wayland = true; wayland = true;
enable = true; enable = true;
}; };
desktopManager.plasma5.enable = true;
}; };
}; };
@ -206,15 +229,6 @@
}; };
}; };
user.services = { user.services = {
scream = {
description = "Audio receiver for the Scream virtual network sound card";
#wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scream}/bin/scream -i virbr0 -o pulse";
Restart = "always";
};
};
replaysorcery-kms = { replaysorcery-kms = {
description = "An open-source, instant-replay solution for Linux; KMS service"; description = "An open-source, instant-replay solution for Linux; KMS service";
#wantedBy = [ "default.target" ]; #wantedBy = [ "default.target" ];

View File

@ -43,6 +43,8 @@ in inputs.nixpkgs.lib.nixosSystem {
emacs.overlay emacs.overlay
(import ../packages) (import ../packages)
(import ../overlays/simple.nix) (import ../overlays/simple.nix)
# Always keep sandbox.nix as the last overlay
(import ../overlays/sandbox.nix) (import ../overlays/sandbox.nix)
]; ];
} }

View File

@ -28,6 +28,7 @@
./services/input-remapper ./services/input-remapper
./services/gamemode ./services/gamemode
./services/i18n ./services/i18n
./services/greetd
# User # User
#./users/default.nix #./users/default.nix

View File

@ -66,7 +66,7 @@ in {
desktopManager.gnome.enable = true; desktopManager.gnome.enable = true;
displayManager.gdm = { displayManager.gdm = {
enable = true; enable = false;
wayland = true; wayland = true;
}; };
}; };

View File

@ -35,6 +35,10 @@ let
in { in {
options.ptw.programs.sway = { options.ptw.programs.sway = {
enable = lib.mkEnableOption "Configure sway using HomeManager"; enable = lib.mkEnableOption "Configure sway using HomeManager";
extraSessionCommands = lib.mkOption {
description = "Commands to be run before sway is started. See programs.sway.extraSessionCommands";
default = "";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -61,10 +65,14 @@ in {
}; };
}; };
programs.sway.enable = true; programs.sway = {
enable = true;
extraSessionCommands = cfg.extraSessionCommands;
};
home-manager.users."${config.ptw.system.singleUser}" = { home-manager.users."${config.ptw.system.singleUser}" = {
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
extraSessionCommands = cfg.extraSessionCommands;
config = { config = {
bars = [ ]; bars = [ ];
startup = [ startup = [

View File

@ -0,0 +1,53 @@
{ lib, config, pkgs, ... }:
let
cfg = config.ptw.services.greetd;
in {
options.ptw.services.greetd = {
enable = lib.mkEnableOption "Enable greetd with gtkgreet";
swayExtra = lib.mkOption {
description = "Extra options to include in the sway config";
default = "";
};
};
config = lib.mkIf cfg.enable {
users.users.greeter = {
isSystemUser = lib.mkForce false;
isNormalUser = true;
createHome = true;
uid = 992;
};
services = {
greetd = {
enable = true;
restart = true;
settings = {
default_session = let
swayConfig = pkgs.writeText "login-sway-config" ''
exec ${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; ${pkgs.sway}/bin/swaymsg exit;
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
input "*" {
xkb_layout de
}
${cfg.swayExtra}
include /etc/sway/config.d/*
'';
in {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
user = "greeter";
};
};
};
};
};
}

View File

@ -23,12 +23,9 @@ in {
"/dev/random", "/dev/urandom", "/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu", "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc","/dev/hpet", "/dev/rtc","/dev/hpet",
"/dev/input/by-id/usb-Logitech_G700s_Rechargeable_Gaming_Mouse_93DF48160007-event-mouse",
"/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse",
"/dev/input/by-id/usb-Razer_Razer_Tartarus_V2-event-kbd",
"/dev/input/by-id/virtual-event-EvdevProxyMouse", "/dev/input/by-id/virtual-event-EvdevProxyMouse",
"/dev/input/by-id/virtual-event-EvdevProxyTartarus", "/dev/input/by-id/virtual-event-EvdevProxyKeyboard",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd" "/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse"
] ]
''; '';
}; };

View File

@ -24,7 +24,7 @@ in {
USBIDClass = {vendor=0x046d, model=0xc07c, class="Mouse"} USBIDClass = {vendor=0x046d, model=0xc07c, class="Mouse"}
[[device]] [[device]]
[device.Simple] [device.Simple]
name = "EvdevProxyTartarus" name = "EvdevProxyKeyboard"
vendor = 0x1337 vendor = 0x1337
model = 0x1338 model = 0x1338
class = "Keyboard" class = "Keyboard"
@ -32,7 +32,9 @@ in {
# the mapped version of the Tartarus evdev node. # the mapped version of the Tartarus evdev node.
# (Useful for qemu) # (Useful for qemu)
[[device.Simple.selector]] [[device.Simple.selector]]
EVDEVClass = {phys="\"key-mapper\""} EVDEVClass = {phys="\"input-remapper\""}
[[device.Simple.selector]]
USBIDClass = {vendor=0x1532, model=0x011a, class="Keyboard"}
''; '';
"libvirt/hooks/qemu".source = let "libvirt/hooks/qemu".source = let
vfio-isolate-state = "/tmp/vfio-isolate-state"; vfio-isolate-state = "/tmp/vfio-isolate-state";
@ -43,16 +45,14 @@ in {
phase=$3 phase=$3
extra=$4 extra=$4
if [[ "$guest" = "win10" ]]; then echo "called with $1 $2 $3 $4" > /dev/stderr
if [[ "$guest" = "win10-gaming" ]]; then
case "$action" in case "$action" in
prepare) prepare)
# Only do this while in preparation # Only do this while in preparation
[[ ! "$phase" = "prepare" ]] && exit 0 [[ ! "$phase" = "prepare" ]] && exit 0
sudo -u alexander systemctl --user start evdev-proxy.service GUEST_CORES="C1-3,5-7"
sudo -u alexander systemctl --user start scream.service
sleep 2
${pkgs.vfio-isolate}/bin/vfio-isolate \ ${pkgs.vfio-isolate}/bin/vfio-isolate \
-u ${vfio-isolate-state} \ -u ${vfio-isolate-state} \
cpu-governor performance "$GUEST_CORES" \ cpu-governor performance "$GUEST_CORES" \
@ -64,9 +64,6 @@ in {
stopped) stopped)
# Only run when the VM is fully stopped # Only run when the VM is fully stopped
[[ ! "$phase" = "end" ]] && exit 0 [[ ! "$phase" = "end" ]] && exit 0
sudo -u alexander systemctl --user stop evdev-proxy.service
sudo -u alexander systemctl --user stop scream.service
${pkgs.vfio-isolate}/bin/vfio-isolate \ ${pkgs.vfio-isolate}/bin/vfio-isolate \
restore ${vfio-isolate-state} restore ${vfio-isolate-state}
esac esac
@ -83,10 +80,13 @@ in {
services.udev.packages = with pkgs; [ evdev-proxy ]; services.udev.packages = with pkgs; [ evdev-proxy ];
systemd = { systemd = {
services.libvirtd.path = with pkgs; [ vfio-isolate systemd bash ]; services = {
libvirtd.path = with pkgs; [ vfio-isolate systemd bash ];
};
user.services.evdev-proxy = { user.services.evdev-proxy = {
description = "Creates virtual device to proxy evdev devices events"; description = "Creates virtual device to proxy evdev devices events";
#wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.evdev-proxy}/bin/evdev-proxy"; ExecStart = "${pkgs.evdev-proxy}/bin/evdev-proxy";

View File

@ -89,4 +89,13 @@ final: prev:
sha256 = "1d17lvydlny9pvaxa9xy53wxs7i6d563lp5r9g3r1xpgnb7zli8v"; sha256 = "1d17lvydlny9pvaxa9xy53wxs7i6d563lp5r9g3r1xpgnb7zli8v";
}; };
}); });
# TODO: Remove when updated in nixos-unstable
discord = prev.discord.overrideAttrs (old: {
version = "0.0.17";
src = prev.fetchurl {
url = "https://dl.discordapp.net/apps/linux/0.0.17/discord-0.0.17.tar.gz";
sha256 = "sha256-NGJzLl1dm7dfkB98pQR3gv4vlldrII6lOMWTuioDExU=";
};
});
} }

View File

@ -1,91 +0,0 @@
{ fetchFromGitLab
, lib
, python3Packages
, gobject-introspection
, gtk3
, pango
, wrapGAppsHook
, xvfb-run
, chromecastSupport ? false
, serverSupport ? false
, keyringSupport ? true
, notifySupport ? true, libnotify
, networkSupport ? true, networkmanager
}:
python3Packages.buildPythonApplication rec {
pname = "sublime-music";
version = "0.11.16";
format = "pyproject";
src = fetchFromGitLab {
owner = "sublime-music";
repo = pname;
rev = "v${version}";
sha256 = "0n06x7l4i9nqbc74yhrjgg10zffdb75jz43mbxd03hr5057fdglz";
};
nativeBuildInputs = [
gobject-introspection
python3Packages.poetry-core
wrapGAppsHook
];
buildInputs = [
gtk3
pango
]
++ lib.optional notifySupport libnotify
++ lib.optional networkSupport networkmanager
;
propagatedBuildInputs = with python3Packages; [
bleach
dataclasses-json
deepdiff
fuzzywuzzy
mpv
peewee
pygobject3
python-Levenshtein
python-dateutil
requests
semver
]
++ lib.optional chromecastSupport PyChromecast
++ lib.optional keyringSupport keyring
++ lib.optional serverSupport bottle
;
# hook for gobject-introspection doesn't like strictDeps
# https://github.com/NixOS/nixpkgs/issues/56943
strictDeps = false;
# Use the test suite provided by the upstream project.
doCheck = false;
checkInputs = with python3Packages; [
pytest
pytest-cov
];
checkPhase = "${xvfb-run}/bin/xvfb-run pytest";
# Also run the python import check for sanity
#pythonImportsCheck = [ "sublime_music" ];
postInstall = ''
install -Dm444 sublime-music.desktop -t $out/share/applications
install -Dm444 sublime-music.metainfo.xml -t $out/share/metainfo
for size in 16 22 32 48 64 72 96 128 192 512 1024; do
install -Dm444 logo/rendered/"$size".png \
$out/share/icons/hicolor/"$size"x"$size"/apps/sublime-music.png
done
'';
meta = with lib; {
description = "GTK3 Subsonic/Airsonic client";
homepage = "https://sublimemusic.app/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ albakham sumnerevans ];
};
}

View File

@ -1,16 +1,17 @@
{ {
lib, stdenv, pkgs lib, stdenv, pkgs
, extraStartupArgs ? "" , extraStartupArgs ? ""
, upstreamElectron ? pkgs.electron
}: }:
pkgs.unstable.discord.overrideAttrs (old: let pkgs.discord.overrideAttrs (old: let
asar = pkgs.nodePackages.asar; asar = pkgs.nodePackages.asar;
gtk3 = pkgs.gtk3; gtk3 = pkgs.gtk3;
binaryName = "Discord"; binaryName = "Discord";
system-electron = "$out/opt/${binaryName}/system-electron.sh"; system-electron = "$out/opt/${binaryName}/system-electron.sh";
in rec { in rec {
version = "0.0.16"; version = "0.0.16";
nativeBuildInputs = with pkgs.unstable; old.nativeBuildInputs ++ [ electron asar ]; nativeBuildInputs = with pkgs.unstable; old.nativeBuildInputs ++ [ upstreamElectron asar ];
buildPhase = '' buildPhase = ''
${asar}/bin/asar e resources/app.asar resources/app ${asar}/bin/asar e resources/app.asar resources/app
rm resources/app.asar rm resources/app.asar

View File

@ -6,10 +6,13 @@ let
discord-system-electron = prev.callPackage ./applications/networking/instant-messengers/discord { discord-system-electron = prev.callPackage ./applications/networking/instant-messengers/discord {
# Wayland # Wayland
# NOTE: electron under Wayland has no window titlebars # NOTE: electron under Wayland has no window titlebars
upstreamElectron = prev.electron_16;
extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland"; extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland";
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer";
}; };
in { in {
inherit discord-system-electron;
input-remapper = prev.callPackage ./tools/games/input-remapper {}; input-remapper = prev.callPackage ./tools/games/input-remapper {};
vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {}; vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {};
mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {}; mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {};
@ -20,6 +23,7 @@ in {
replaysorcery = prev.callPackage ./tools/games/replaysorcery {}; replaysorcery = prev.callPackage ./tools/games/replaysorcery {};
evdev-proxy = prev.callPackage ./tools/virtualisation/evdev-proxy {}; evdev-proxy = prev.callPackage ./tools/virtualisation/evdev-proxy {};
virtiofsd = prev.callPackage ./tools/virtualisation/virtiofsd {};
anime4k = prev.callPackage ./misc/video/anime4k {}; anime4k = prev.callPackage ./misc/video/anime4k {};
anime-dl = prev.callPackage ./tools/video/animedl { anime-dl = prev.callPackage ./tools/video/animedl {
pySmartDL = pySmartDL; pySmartDL = pySmartDL;
@ -46,13 +50,13 @@ in {
swaync = prev.callPackage ./tools/desktop/swaync {}; swaync = prev.callPackage ./tools/desktop/swaync {};
# TODO: Remove once NixOS has version 0.11.16 in their repos
sublime-music-no-test = prev.callPackage ./applications/audio/sublime-music {};
sound-gambit = prev.callPackage tools/audio/sound-gambit {}; sound-gambit = prev.callPackage tools/audio/sound-gambit {};
ebu-norm = prev.callPackage tools/audio/ebu-norm {}; ebu-norm = prev.callPackage tools/audio/ebu-norm {};
payload-dumper = prev.callPackage tools/system/payload-dumper {}; payload-dumper = prev.callPackage tools/system/payload-dumper {};
psst = prev.callPackage tools/audio/psst {}; psst = prev.callPackage tools/audio/psst {};
wlrootsqt = prev.libsForQt5.callPackage ./wlrootsqt.nix {};
qtgreet = prev.libsForQt5.callPackage ./qtgreet.nix {};
} }

View File

@ -0,0 +1,32 @@
{
lib
, rustPlatform
, pkgconfig, libcap_ng, libseccomp
, fetchFromGitLab
}:
rustPlatform.buildRustPackage rec {
pname = "virtiofsd";
version = "1.1.0";
src = fetchFromGitLab {
owner = "virtio-fs";
repo = "virtiofsd";
rev = "a31ad19efc302836a364fd6d79bda63160404b01";
sha256 = "12nxm40sjx2jzl1j2czzanmk9b922dvfh64ndvgf5z4g4cviv33x";
};
cargoSha256 = "sha256-uRPmZE/xc0yeurBZ4rnrZua5d4lbPwStMUacFgbquuk=";
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libcap_ng libseccomp ];
meta = with lib; {
description = "vhost-user virtio-fs device backend written in Rust";
homepage = "https://gitlab.com/virtio-fs/virtiofsd";
license = licenses.bsd3;
maintainers = [];
platforms = platforms.linux;
};
}