nixpkgs-fmt

This commit is contained in:
LordGrimmauld 2024-04-10 16:51:28 +02:00
parent e8abbd0c1f
commit 36252de722
28 changed files with 502 additions and 438 deletions

View file

@ -1,47 +1,66 @@
{pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
config = with cfg; lib.mkIf (enable && cloudSync.enable) (let {
config = with cfg; lib.mkIf (enable && cloudSync.enable) (
let
cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${config.grimmShared.cloudSync.username} -p "$(cat ${config.grimmShared.cloudSync.passwordFile})" -h -n --path''; cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${config.grimmShared.cloudSync.username} -p "$(cat ${config.grimmShared.cloudSync.passwordFile})" -h -n --path'';
sync_server = "https://${config.grimmShared.cloudSync.server}"; sync_server = "https://${config.grimmShared.cloudSync.server}";
in { in
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server)) (writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
nextcloud-client nextcloud-client
]; ];
systemd.services = lib.mkMerge (lib.mapAttrsToList (local_user: user_conf: let systemd.services = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
let
paths = user_conf.syncPaths; paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (map ({local, remote}: let sync_script = lib.strings.concatLines (map
({ local, remote }:
let
remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote); remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote);
in "${cloud_cmd} /${remote_clean} ${local} ${sync_server}" ) paths); in
in { # user-specific sync jobs "${cloud_cmd} /${remote_clean} ${local} ${sync_server}")
"nextcloud-autosync-${local_user}" = lib.mkIf ( paths != [] ) { paths);
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Auto sync Nextcloud"; description = "Auto sync Nextcloud";
after = [ "network-online.target" ]; after = [ "network-online.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
serviceConfig.Type = "simple"; serviceConfig.Type = "simple";
serviceConfig.User = local_user; serviceConfig.User = local_user;
serviceConfig.Group= "users"; serviceConfig.Group = "users";
script= sync_script; script = sync_script;
# TimeoutStopSec = "180"; # TimeoutStopSec = "180";
# KillMode = "process"; # KillMode = "process";
# KillSignal = "SIGINT"; # KillSignal = "SIGINT";
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
enable=true; enable = true;
}; };
}) config.users.users ); })
config.users.users);
systemd.timers = lib.mkMerge (lib.mapAttrsToList (local_user: user_conf: let systemd.timers = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
let
paths = user_conf.syncPaths; paths = user_conf.syncPaths;
in { # user-specific sync jobs in
"nextcloud-autosync-${local_user}" = lib.mkIf ( paths != [] ) { {
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes"; description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes";
timerConfig.OnBootSec = "5min"; timerConfig.OnBootSec = "5min";
timerConfig.OnUnitActiveSec = "60min"; timerConfig.OnUnitActiveSec = "60min";
wantedBy = ["multi-user.target" "timers.target"]; wantedBy = [ "multi-user.target" "timers.target" ];
enable = true; enable = true;
}; };
}) config.users.users ); })
}); config.users.users);
}
);
} }

View file

@ -1,26 +1,32 @@
{ inputs, pkgs, config, lib, ... }: let { inputs, pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && firefox.enable) { config = with cfg; lib.mkIf (enable && firefox.enable) {
environment.systemPackages = [] environment.systemPackages = [ ]
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ]; ++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
programs.firefox = { programs.firefox = {
package = pkgs.firefox-beta; package = pkgs.firefox-beta;
enable = true; enable = true;
nativeMessagingHosts.packages = [] nativeMessagingHosts.packages = [ ]
++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ]; ++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ];
languagePacks = [ "de" "en-US" ]; languagePacks = [ "de" "en-US" ];
policies = { policies = {
ExtensionSettings = lib.mkMerge [ ExtensionSettings = lib.mkMerge [
(lib.mkIf cfg.firefox.disableUserPlugins { (lib.mkIf cfg.firefox.disableUserPlugins {
"*".installation_mode = "blocked"; "*".installation_mode = "blocked";
} ) })
(lib.mapAttrs (guid: shortId: { # explicit plugins by config (lib.mapAttrs
(guid: shortId: {
# explicit plugins by config
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
} ) cfg.firefox.plugins ) })
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) { # password-store support cfg.firefox.plugins)
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) {
# password-store support
"passff@invicem.pro" = { "passff@invicem.pro" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
@ -42,8 +48,8 @@ in {
OverrideFirstRunPage = ""; OverrideFirstRunPage = "";
OverridePostUpdatePage = ""; OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true; DontCheckDefaultBrowser = true;
Preferences = lib.mkMerge ([] Preferences = lib.mkMerge ([ ]
++ lib.optionals cfg.sway.enable [ {"browser.tabs.inTitlebar" = 0; } ]); ++ lib.optionals cfg.sway.enable [{ "browser.tabs.inTitlebar" = 0; }]);
}; };
}; };
}; };

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && gaming) { config = with cfg; lib.mkIf (enable && gaming) {
programs.steam = { programs.steam = {
enable = true; enable = true;
@ -14,7 +16,7 @@ in {
enable = true; enable = true;
settings = { settings = {
general = { general = {
inhibit_screensaver=0; inhibit_screensaver = 0;
renice = 10; renice = 10;
}; };
custom = { custom = {
@ -27,7 +29,7 @@ in {
services.udev.packages = [ pkgs.wooting-udev-rules ]; services.udev.packages = [ pkgs.wooting-udev-rules ];
environment.sessionVariables = { environment.sessionVariables = {
GAMEMODERUNEXEC="env DRI_PRIME=1"; GAMEMODERUNEXEC = "env DRI_PRIME=1";
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -1,6 +1,8 @@
{ config, lib, ... }: let { config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && locale) { config = with cfg; lib.mkIf (enable && locale) {
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = lib.mkMerge [ config = lib.mkMerge [
(with cfg; lib.mkIf (enable && network) { (with cfg; lib.mkIf (enable && network) {
networking.networkmanager.enable = true; networking.networkmanager.enable = true;

View file

@ -1,13 +1,15 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && graphical) { config = with cfg; lib.mkIf (enable && graphical) {
# Enable OpenGL # Enable OpenGL
hardware.opengl = { hardware.opengl = {
enable = true; enable = true;
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
extraPackages = with pkgs; []; extraPackages = with pkgs; [ ];
}; };
boot.kernelParams = [ "nouveau.config=NvGspRm=1" ]; boot.kernelParams = [ "nouveau.config=NvGspRm=1" ];
@ -18,8 +20,8 @@ in {
__GL_SYNC_TO_VBLANK = "0"; __GL_SYNC_TO_VBLANK = "0";
__GL_THREADED_OPTIMIZATIONS = "1"; __GL_THREADED_OPTIMIZATIONS = "1";
__GL_VRR_ALLOWED = "1"; __GL_VRR_ALLOWED = "1";
# MESA_LOADER_DRIVER_OVERRIDE="zink"; # MESA_LOADER_DRIVER_OVERRIDE="zink";
# FLATPAK_GL_DRIVERS="mesa-git"; # FLATPAK_GL_DRIVERS="mesa-git";
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && tooling.enable && tooling.pass) { config = with cfg; lib.mkIf (enable && tooling.enable && tooling.pass) {
security.polkit.enable = true; security.polkit.enable = true;
@ -18,7 +20,7 @@ in {
services.passSecretService.enable = true; services.passSecretService.enable = true;
programs.gnupg.agent = { programs.gnupg.agent = {
settings = { settings = {
# default-cache-ttl = 6000; # default-cache-ttl = 6000;
}; };
pinentryPackage = lib.mkForce pkgs.pinentry; pinentryPackage = lib.mkForce pkgs.pinentry;
enable = true; enable = true;

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && portals) { config = with cfg; lib.mkIf (enable && portals) {
xdg.portal = { xdg.portal = {
enable = true; enable = true;
@ -14,7 +16,7 @@ in {
environment.sessionVariables = { environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config"; XDG_CONFIG_HOME = "$HOME/.config";
FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"; FREETYPE_PROPERTIES = "cff:no-stem-darkening=0 autofitter:no-stem-darkening=0";
}; };
fonts.fontDir.enable = true; fonts.fontDir.enable = true;

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && printing) { config = with cfg; lib.mkIf (enable && printing) {
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;

View file

@ -1,6 +1,8 @@
{ grimm-shared-inputs, pkgs, config, lib, ... }: let { grimm-shared-inputs, pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && sound) { config = with cfg; lib.mkIf (enable && sound) {
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;

View file

@ -1,7 +1,10 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
config = let {
config =
let
waybar_full = pkgs.writeShellScriptBin "waybar-full" ( waybar_full = pkgs.writeShellScriptBin "waybar-full" (
"${config.programs.waybar.package}/bin/waybar" "${config.programs.waybar.package}/bin/waybar"
+ (if isNull cfg.sway.bar.config then "" else " -c ${cfg.sway.bar.config}") + (if isNull cfg.sway.bar.config then "" else " -c ${cfg.sway.bar.config}")
@ -9,19 +12,21 @@ in {
); );
bar_config = '' bar_config = ''
bar { bar {
swaybar_command ${waybar_full}/bin/waybar-full swaybar_command ${waybar_full}/bin/waybar-full
} }
''; '';
build_conf = sway_conf : let build_conf = sway_conf:
let
build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}"); build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}"); build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = map (item: "exec " + item); build_exec_lines = map (item: "exec " + item);
build_mode_lines = lib.mapAttrsToList (name: value: '' build_mode_lines = lib.mapAttrsToList (name: value: ''
mode "${name}" { mode "${name}" {
${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}''); ${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
in ([] in
([ ]
++ (build_definition_lines sway_conf.definitions) ++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds) ++ (build_keybind_lines sway_conf.keybinds)
++ (build_exec_lines sway_conf.autolaunch) ++ (build_exec_lines sway_conf.autolaunch)
@ -35,7 +40,8 @@ ${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
); );
sway_conf = pkgs.writeText "sway.conf" text; sway_conf = pkgs.writeText "sway.conf" text;
in with cfg; lib.mkIf (enable && sway.enable) { in
with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."sway.conf" = { environment.etc."sway.conf" = {
source = sway_conf; source = sway_conf;
}; };
@ -53,17 +59,17 @@ ${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
script ='' script = ''
for pid in $(${pkgs.procps}/bin/pgrep sway -x) for pid in $(${pkgs.procps}/bin/pgrep sway -x)
do do
uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid)) uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid))
export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock" export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock"
if [[ -e "$SWAYSOCK" ]] ; then if [[ -e "$SWAYSOCK" ]] ; then
echo "sock is $SWAYSOCK" echo "sock is $SWAYSOCK"
${config.programs.sway.package}/bin/swaymsg reload ${config.programs.sway.package}/bin/swaymsg reload
fi fi
done done
''; '';
reloadTriggers = [ text ]; reloadTriggers = [ text ];
}; };
@ -97,9 +103,9 @@ done
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
export MOZ_ENABLE_WAYLAND=1 export MOZ_ENABLE_WAYLAND=1
# export WLR_RENDERER=vulkan # export WLR_RENDERER=vulkan
# export DRI_PRIME=1 # export DRI_PRIME=1
# export MESA_LOADER_DRIVER_OVERRIDE="zink" # export MESA_LOADER_DRIVER_OVERRIDE="zink"
''; '';
}; };
}; };

View file

@ -1,11 +1,14 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && tooling.enable) { config = with cfg; lib.mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@") (writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@") (writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@") (writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
nixpkgs-fmt
gcc gcc
jdk17 jdk17
python3 python3
@ -84,7 +87,7 @@ in {
if filereadable($HOME . "/.vimrc") if filereadable($HOME . "/.vimrc")
source ~/.vimrc source ~/.vimrc
endif endif
''; '';
packages.myVimPackage = with pkgs.vimPlugins; { packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on launch # loaded on launch
start = [ start = [

View file

@ -5,7 +5,8 @@
{ config, fetchpatch, pkgs, ... }: { config, fetchpatch, pkgs, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [
# Include the results of the hardware scan.
./modules/fonts.nix ./modules/fonts.nix
./modules/tabletdriver.nix ./modules/tabletdriver.nix
./sway/sway-conf.nix ./sway/sway-conf.nix
@ -71,10 +72,10 @@
}; };
environment.sessionVariables = { environment.sessionVariables = {
NIXPKGS_ALLOW_UNFREE="1"; NIXPKGS_ALLOW_UNFREE = "1";
MOZ_ENABLE_WAYLAND="1"; MOZ_ENABLE_WAYLAND = "1";
# QT_QPA_PLATFORM="wayland-egl"; # QT_QPA_PLATFORM="wayland-egl";
OCI_CLI_RC_FILE="/home/grimmauld/.oci/config"; OCI_CLI_RC_FILE = "/home/grimmauld/.oci/config";
}; };
# Allow unfree packages # Allow unfree packages

View file

@ -19,9 +19,11 @@
}; };
}; };
outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, chaotic, ... }: let outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, chaotic, ... }:
let
system = "x86_64-linux"; system = "x86_64-linux";
in { in
{
nixosConfigurations = { nixosConfigurations = {
grimmauld-nixos = nixpkgs.lib.nixosSystem { grimmauld-nixos = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
@ -35,7 +37,7 @@
./configuration.nix ./configuration.nix
./modules/users.nix ./modules/users.nix
# ./modules/tlp.nix # ./modules/tlp.nix
./modules/spotify-tui.nix ./modules/spotify-tui.nix
./modules/xserver.nix ./modules/xserver.nix
./modules/system-packages.nix ./modules/system-packages.nix
@ -44,7 +46,5 @@
]; ];
}; };
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
}; };
} }

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
cfg = config.grimmShared; cfg = config.grimmShared;
sync_mod = types.submodule ({config, ...} : { sync_mod = types.submodule ({ config, ... }: {
options = { options = {
remote = mkOption { remote = mkOption {
type = types.nonEmptyStr; type = types.nonEmptyStr;
@ -17,17 +17,17 @@ let
}; };
}); });
sway_conf = types.submodule ({config, ...} : rec { sway_conf = types.submodule ({ config, ... }: rec {
options = { options = {
keybinds = mkOption { keybinds = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = {}; default = { };
description = "set of keybinds assigning key combo to action"; description = "set of keybinds assigning key combo to action";
}; };
autolaunch = mkOption { autolaunch = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [ ];
description = "set of commands to be run at sway startup"; description = "set of commands to be run at sway startup";
}; };
@ -39,18 +39,19 @@ let
definitions = mkOption { definitions = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = {}; default = { };
description = "set of definitions assigning variable to value"; description = "set of definitions assigning variable to value";
}; };
modes = mkOption { modes = mkOption {
type = types.attrsOf sway_conf; type = types.attrsOf sway_conf;
default = {}; default = { };
description = "possible modes to switch to, e.g. resize"; description = "possible modes to switch to, e.g. resize";
}; };
}; };
}); });
in { in
{
options.grimmShared = { options.grimmShared = {
enable = mkEnableOption "grimm-shared-common"; enable = mkEnableOption "grimm-shared-common";
@ -123,7 +124,7 @@ in {
plugins = mkOption { plugins = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = {}; default = { };
description = "set of plugins to install. Format: guid = short-id"; description = "set of plugins to install. Format: guid = short-id";
}; };
@ -184,7 +185,7 @@ in {
options = { options = {
syncPaths = mkOption { syncPaths = mkOption {
type = types.listOf sync_mod; type = types.listOf sync_mod;
default = []; default = [ ];
description = "paths to sync via nextcloud"; description = "paths to sync via nextcloud";
}; };
}; };

View file

@ -1,4 +1,4 @@
{pkgs, fonts, ...}: { pkgs, fonts, ... }:
{ {
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
noto-fonts noto-fonts

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: let { pkgs, ... }:
let
loadvfio = pkgs.writeShellScriptBin "loadvfio" '' loadvfio = pkgs.writeShellScriptBin "loadvfio" ''
udevadm trigger --verbose --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=1" udevadm trigger --verbose --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=1"
sleep 2 sleep 2
@ -48,7 +49,8 @@
fi fi
''; '';
in { in
{
environment.systemPackages = [ loadnvidia loadvfio ]; environment.systemPackages = [ loadnvidia loadvfio ];
security.sudo.extraConfig = "grimmauld ALL=(ALL) NOPASSWD:/run/current-system/sw/bin/loadnvidia, /run/current-system/sw/bin/loadvfio"; security.sudo.extraConfig = "grimmauld ALL=(ALL) NOPASSWD:/run/current-system/sw/bin/loadnvidia, /run/current-system/sw/bin/loadvfio";
virtualisation.libvirtd = { virtualisation.libvirtd = {
@ -58,7 +60,7 @@ in {
ovmf = { ovmf = {
enable = true; enable = true;
packages = [ packages = [
# pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd # AAVMF # pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd # AAVMF
pkgs.OVMF.fd pkgs.OVMF.fd
]; ];
}; };

View file

@ -1,17 +1,20 @@
{config, pkgs, ...}: { config, pkgs, ... }:
let let
spotifyd_cache_dir = "/tmp/spotifyd"; spotifyd_cache_dir = "/tmp/spotifyd";
in { in
nixpkgs.overlays = [ (final: prev: { spotifyd = prev.spotifyd.overrideAttrs (old: { {
nixpkgs.overlays = [
(final: prev: {
spotifyd = prev.spotifyd.overrideAttrs (old: {
postInstall = '' postInstall = ''
mkdir -p $out/share/dbus-1/system.d/ mkdir -p $out/share/dbus-1/system.d/
tee $out/share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf <<END tee $out/share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf <<END
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- --> <?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
<!DOCTYPE busconfig PUBLIC <!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig> <busconfig>
<policy user="spotifyd"> <policy user="spotifyd">
<allow own_prefix="org.mpris.MediaPlayer2.spotifyd"/> <allow own_prefix="org.mpris.MediaPlayer2.spotifyd"/>
<allow send_destination_prefix="org.mpris.MediaPlayer2.spotifyd"/> <allow send_destination_prefix="org.mpris.MediaPlayer2.spotifyd"/>
@ -21,10 +24,11 @@ tee $out/share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf <<END
<allow send_destination_prefix="org.mpris.MediaPlayer2.spotifyd"/> <allow send_destination_prefix="org.mpris.MediaPlayer2.spotifyd"/>
<allow receive_sender="org.mpris.MediaPlayer2"/> <allow receive_sender="org.mpris.MediaPlayer2"/>
</policy> </policy>
</busconfig> </busconfig>
END END
''; '';
});}) });
})
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -48,7 +52,7 @@ END
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
script ='' script = ''
mkdir -p ${spotifyd_cache_dir} mkdir -p ${spotifyd_cache_dir}
chown spotifyd:spotifyd -R ${spotifyd_cache_dir} chown spotifyd:spotifyd -R ${spotifyd_cache_dir}
''; '';
@ -67,7 +71,7 @@ END
device = "default"; device = "default";
control = "default"; control = "default";
volume_controller = "softvol"; volume_controller = "softvol";
# no_audio_cache = true; # no_audio_cache = true;
spotifyd_cache_dir = spotifyd_cache_dir; spotifyd_cache_dir = spotifyd_cache_dir;
max_cache_size = 10000000000; max_cache_size = 10000000000;
initial_volume = "90"; initial_volume = "90";
@ -88,5 +92,5 @@ END
}; };
# spotifyd is also a group # spotifyd is also a group
users.groups = { spotifyd = {}; }; users.groups = { spotifyd = { }; };
} }

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
spice-gtk spice-gtk
kate kate
@ -10,6 +10,6 @@
(writeShellScriptBin "rebuild" '' (writeShellScriptBin "rebuild" ''
pkexec nixos-rebuild switch --flake /home/grimmauld/grimm-nixos-laptop pkexec nixos-rebuild switch --flake /home/grimmauld/grimm-nixos-laptop
'') '')
]; ];
} }

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
opentabletdriver opentabletdriver

View file

@ -1,23 +1,23 @@
{pkgs, ...}: { pkgs, ... }:
{ {
services.power-profiles-daemon.enable = false; services.power-profiles-daemon.enable = false;
services.tlp = { services.tlp = {
enable = true; enable = true;
settings = { settings = {
USB_AUTOSUSPEND=1; USB_AUTOSUSPEND = 1;
USB_EXCLUDE_BTUSB=1; USB_EXCLUDE_BTUSB = 1;
USB_EXCLUDE_PHONE=1; USB_EXCLUDE_PHONE = 1;
SOUND_POWER_SAVE_ON_AC=0; SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT=1; SOUND_POWER_SAVE_ON_BAT = 1;
SATA_LINKPWR_ON_AC="max_performance"; SATA_LINKPWR_ON_AC = "max_performance";
SATA_LINKPWR_ON_BAT="min_power"; SATA_LINKPWR_ON_BAT = "min_power";
MAX_LOST_WORK_SECS_ON_BAT=15; MAX_LOST_WORK_SECS_ON_BAT = 15;
CPU_ENERGY_PERF_POLICY_ON_AC="performance"; CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT="power"; CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_BOOST_ON_AC=1; CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT=0; CPU_BOOST_ON_BAT = 0;
RUNTIME_PM_ON_AC="on"; RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT="auto"; RUNTIME_PM_ON_BAT = "auto";
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{lib, config, pkgs, ...}: { { lib, config, pkgs, ... }: {
users.users.grimmauld = { users.users.grimmauld = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.xonsh; shell = pkgs.xonsh;

View file

@ -3,9 +3,9 @@
services.xserver = { services.xserver = {
enable = true; enable = true;
videoDrivers = [ "nouveau" "fbdev" "modesetting" ]; videoDrivers = [ "nouveau" "fbdev" "modesetting" ];
# videoDrivers = [ "nouveau" ]; # videoDrivers = [ "nouveau" ];
displayManager = { displayManager = {
# lightdm.enable = true; # lightdm.enable = true;
sddm = { sddm = {
enable = true; enable = true;
wayland.enable = true; wayland.enable = true;
@ -13,13 +13,13 @@
defaultSession = "sway"; defaultSession = "sway";
}; };
desktopManager = { desktopManager = {
# xfce.enable = true; # xfce.enable = true;
}; };
}; };
services.desktopManager = { services.desktopManager = {
plasma6.enable = true; plasma6.enable = true;
# xfce.enable = true; # xfce.enable = true;
}; };
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).

View file

@ -1,6 +1,7 @@
let let
laptop_pub = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCy7X5ByG4/9y2XkQSnXcpMGnV5WPGUd+B6FaYCDNmPQ7xIZEteS+kCpu9oiMP6C/H/FT+i9DZvCflkzgdFAyujYLKRYaZbZ3K6F60qN0rkJ0z/ZO5c6rqwIwR6BEoB7dq5inkyH9fZ8/SI+PXxELmeWF9ehT7kkQC+o9Ujpcjd7ZuZllbAz4UQZFRbbpwdVJCEDenu9/63yuYbvMupgGk0edaTiFT0Q9MSzs/3pNP8xlAxmmZ3HzSjeF7gUzBF7CaIroTeguiUjSVybUEx48P8fy878t7dUZf4anEno9MS0B3aqfZvCKuuPdAUdeBfCbFHRqN7GuCylFIXGPe95Mxl grimmauld@grimmauld-nixos"; laptop_pub = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCy7X5ByG4/9y2XkQSnXcpMGnV5WPGUd+B6FaYCDNmPQ7xIZEteS+kCpu9oiMP6C/H/FT+i9DZvCflkzgdFAyujYLKRYaZbZ3K6F60qN0rkJ0z/ZO5c6rqwIwR6BEoB7dq5inkyH9fZ8/SI+PXxELmeWF9ehT7kkQC+o9Ujpcjd7ZuZllbAz4UQZFRbbpwdVJCEDenu9/63yuYbvMupgGk0edaTiFT0Q9MSzs/3pNP8xlAxmmZ3HzSjeF7gUzBF7CaIroTeguiUjSVybUEx48P8fy878t7dUZf4anEno9MS0B3aqfZvCKuuPdAUdeBfCbFHRqN7GuCylFIXGPe95Mxl grimmauld@grimmauld-nixos";
in { in
{
"spotify_pass.age".publicKeys = [ laptop_pub ]; "spotify_pass.age".publicKeys = [ laptop_pub ];
"nextcloud_pass.age".publicKeys = [ laptop_pub ]; "nextcloud_pass.age".publicKeys = [ laptop_pub ];
} }

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ # Include the results of the hardware scan. imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./screenshare-select.nix ./screenshare-select.nix
]; ];

View file

@ -5,8 +5,9 @@
{ {
imports = imports =
[ (modulesPath + "/installer/scan/not-detected.nix") [
# ./modules/nvidia.nix (modulesPath + "/installer/scan/not-detected.nix")
# ./modules/nvidia.nix
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
@ -15,19 +16,21 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac"; {
device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D20D-B5B0"; {
device = "/dev/disk/by-uuid/D20D-B5B0";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ { swapDevices = [{
device = "/var/lib/swapfile"; device = "/var/lib/swapfile";
size = 48*1024; size = 48 * 1024;
} ]; }];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; powerManagement.cpuFreqGovernor = lib.mkDefault "performance";

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { pkgs, ... }:
{ {
xdg.portal.wlr.settings = { xdg.portal.wlr.settings = {
screencastExternal = { screencastExternal = {

View file

@ -68,9 +68,9 @@
"$mod+Shift+Down" = "move down"; "$mod+Shift+Down" = "move down";
"$mod+Shift+Up" = "move up"; "$mod+Shift+Up" = "move up";
"$mod+Shift+Right" = "move right"; "$mod+Shift+Right" = "move right";
# #
# Workspaces: # Workspaces:
# #
# Switch to workspace # Switch to workspace
"$mod+1" = "workspace number 1"; "$mod+1" = "workspace number 1";
"$mod+2" = "workspace number 2"; "$mod+2" = "workspace number 2";
@ -95,9 +95,9 @@
"$mod+Shift+0" = "move container to workspace number 10"; "$mod+Shift+0" = "move container to workspace number 10";
# Note: workspaces can have any name you want, not just numbers. # Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default. # We just use 1-10 as the default.
# #
# Layout stuff: # Layout stuff:
# #
# You can "split" the current object of your focus with # You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits # $mod+b or $mod+v, for horizontal and vertical splits
# respectively. # respectively.
@ -138,7 +138,8 @@
XF86MonBrightnessUp = "exec brightnessctl s 10+%"; XF86MonBrightnessUp = "exec brightnessctl s 10+%";
XF86MonBrightnessDown = "exec brightnessctl s 10-%"; XF86MonBrightnessDown = "exec brightnessctl s 10-%";
}; };
autolaunch = [ # fixme: absolute paths autolaunch = [
# fixme: absolute paths
"blueman-applet" "blueman-applet"
"lxqt-policykit-agent" "lxqt-policykit-agent"
"otd-daemon" "otd-daemon"
@ -146,31 +147,31 @@
"systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP" "systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP"
]; ];
extraConfig = '' extraConfig = ''
output * bg ${./wallpapers/switzerland.jpg} fill output * bg ${./wallpapers/switzerland.jpg} fill
output HDMI-A-1 mode 1920x1080@60Hz position 0,0 output HDMI-A-1 mode 1920x1080@60Hz position 0,0
for_window [app_id="lxqt-policykit-agent"] floating enable; for_window [app_id="lxqt-policykit-agent"] floating enable;
floating_modifier $mod normal floating_modifier $mod normal
input type:keyboard xkb_numlock enabled input type:keyboard xkb_numlock enabled
include /etc/sway/config.d/* include /etc/sway/config.d/*
# Borders, gaps, titlebars, behavior # Borders, gaps, titlebars, behavior
default_border pixel 3 default_border pixel 3
default_floating_border pixel 3 default_floating_border pixel 3
gaps inner 5 gaps inner 5
titlebar_padding 5 5 titlebar_padding 5 5
#5Smart things #5Smart things
smart_gaps on smart_gaps on
hide_edge_borders --i3 smart hide_edge_borders --i3 smart
input * { input * {
xkb_layout "de" xkb_layout "de"
} }
for_window [app_id="swaymux"] floating enable for_window [app_id="swaymux"] floating enable
for_window [app_id="rmenu"] floating enable for_window [app_id="rmenu"] floating enable
''; '';
modes.resize.keybinds = { modes.resize.keybinds = {