dotfiles/nixos/systems/saw/default.nix
magic_rb ef38ff156f
Add saw the media bedside PC
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-11-17 16:24:38 +01:00

209 lines
5.6 KiB
Nix

# SPDX-FileCopyrightText: 2024 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
inputs,
lib',
config,
...
}: let
inherit
(lib')
flip
mapAttrs
singleton
;
config' = config;
in {
flake.nixosConfigurations.saw = inputs.nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
# lib = lib';
specialArgs = {
config' = config';
inputs' = inputs;
secret = lib'.loadSecrets inputs.secret;
};
modules =
singleton
({
pkgs,
config,
lib,
...
}: let
river-gtk = pkgs.river.overrideAttrs (final: prev: {
nativeBuildInputs =
prev.nativeBuildInputs
++ (with pkgs; [
makeWrapper
wrapGAppsHook3
]);
buildInputs =
prev.buildInputs
++ (with pkgs; [
gdk-pixbuf
gsettings-desktop-schemas
glib
gtk3
]);
postFixup = ''
gappsWrapperArgsHook
wrapProgram $out/bin/river \
"''${gappsWrapperArgs[@]}"
'';
});
squeekboard = pkgs.squeekboard.overrideAttrs (final: prev: {
patches =
(prev.patches or [])
++ [
inputs.self.patches.squeekboard-layer-overlay
];
});
kodi-wayland = pkgs.kodi-wayland.withPackages (ps: [
pkgs.kodi-wayland.pythonPackages.pillow
]);
in {
imports = [
inputs.disko.nixosModules.default
inputs.impermenance.nixosModules.impermanence
./nixpkgs.nix
./users.nix
../../common/remote_access.nix
./disko.nix
];
security.rtkit.enable = true;
services.pipewire = {
enable = true;
wireplumber.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
jack.enable = true;
pulse.enable = true;
};
programs.river = {
enable = true;
package = river-gtk;
};
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${lib.getExe pkgs.cage} -s -- ${lib.getExe pkgs.greetd.regreet}";
};
};
};
xdg.portal = {
config.common.default = [
"gtk"
];
enable = true;
xdgOpenUsePortal = true;
extraPortals = singleton pkgs.xdg-desktop-portal-gtk;
};
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/var/log"
"/var/lib/nixos"
];
files = [
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
];
users.main = {
directories = [
".kodi"
];
};
};
home-manager.users.main = {
home.file.".config/river/init".executable = true;
home.file.".config/river/init".text = ''
# riverctl default-layout rivercarro
# ${lib.getExe pkgs.rivercarro} -outer-gaps 0 &
# riverctl send-layout-cmd rivercarro "main-location monocle"
# riverctl spawn ${lib.getExe squeekboard}
riverctl spawn ${lib.getExe kodi-wayland}
'';
home.file.".config/lavalauncher/active.conf".text = let
launch = {
jellyfin = pkgs.writeShellScript "launch-jellyfin" ''
${lib.getExe pkgs.librewolf} http://jellyfin.in.redalder.org --kiosk
'';
pavucontrol = pkgs.writeShellScript "launch-pavucontrol" ''
${lib.getExe pkgs.pavucontrol} & disown
sleep 0.1
riverctl toggle-fullscreen
'';
next = pkgs.writeShellScript "show-next" ''
riverctl toggle-fullscreen
riverctl focus-view next
riverctl toggle-fullscreen
'';
};
in ''
global-settings
{
watch-config-file = true;
}
bar {
exclusive-zone = off;
alignment = center;
position = right;
layer = overlay;
button {
command = ${launch.jellyfin};
}
button {
command = ${launch.pavucontrol};
}
button {
command = ${launch.next};
}
}
'';
};
# xdg.portal.config.common = {
# # Use xdg-desktop-portal-gtk for every portal interface...
# default = "gtk";
# # ... except for the ScreenCast, Screenshot and Secret
# "org.freedesktop.impl.portal.ScreenCast" = "wlr";
# "org.freedesktop.impl.portal.Screenshot" = "wlr";
# # ignore inhibit bc gtk portal always returns as success,
# # despite sway/the wlr portal not having an implementation,
# # stopping firefox from using wayland idle-inhibit
# "org.freedesktop.impl.portal.Inhibit" = "none";
# };
# services.cage.program = "${lib.getExe pkgs.ungoogled-chromium} --kiosk --new-window --noerrdialogs --disable-infobars http://jellyfin.in.redalder.org";
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_6;
time.timeZone = "Europe/Amsterdam";
system.stateVersion = "24.05";
});
};
}