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;
in {
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'';
sync_server = "https://${config.grimmShared.cloudSync.server}";
in {
environment.systemPackages = with pkgs; [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
nextcloud-client
];
in
{
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'';
sync_server = "https://${config.grimmShared.cloudSync.server}";
in
{
environment.systemPackages = with pkgs; [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
nextcloud-client
];
systemd.services = lib.mkMerge (lib.mapAttrsToList (local_user: user_conf: let
paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (map ({local, remote}: let
remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote);
in "${cloud_cmd} /${remote_clean} ${local} ${sync_server}" ) paths);
in { # user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf ( paths != [] ) {
description = "Auto sync Nextcloud";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig.Type = "simple";
serviceConfig.User = local_user;
serviceConfig.Group= "users";
script= sync_script;
# TimeoutStopSec = "180";
# KillMode = "process";
# KillSignal = "SIGINT";
wantedBy = ["multi-user.target"];
enable=true;
};
}) config.users.users );
systemd.services = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
let
paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (map
({ local, remote }:
let
remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote);
in
"${cloud_cmd} /${remote_clean} ${local} ${sync_server}")
paths);
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Auto sync Nextcloud";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig.Type = "simple";
serviceConfig.User = local_user;
serviceConfig.Group = "users";
script = sync_script;
# TimeoutStopSec = "180";
# KillMode = "process";
# KillSignal = "SIGINT";
wantedBy = [ "multi-user.target" ];
enable = true;
};
})
config.users.users);
systemd.timers = lib.mkMerge (lib.mapAttrsToList (local_user: user_conf: let
paths = user_conf.syncPaths;
in { # 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";
timerConfig.OnBootSec = "5min";
timerConfig.OnUnitActiveSec = "60min";
wantedBy = ["multi-user.target" "timers.target"];
enable = true;
};
}) config.users.users );
});
systemd.timers = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
let
paths = user_conf.syncPaths;
in
{
# 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";
timerConfig.OnBootSec = "5min";
timerConfig.OnUnitActiveSec = "60min";
wantedBy = [ "multi-user.target" "timers.target" ];
enable = true;
};
})
config.users.users);
}
);
}

View File

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

View File

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

View File

@ -1,12 +1,14 @@
{ config, lib, ... }: let
{ config, lib, ... }:
let
cfg = config.grimmShared;
in {
in
{
config = with cfg; lib.mkIf (enable && locale) {
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";

View File

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
in
{
config = lib.mkMerge [
(with cfg; lib.mkIf (enable && network) {
networking.networkmanager.enable = true;
@ -8,7 +10,7 @@ in {
networking.firewall.enable = true;
hardware.bluetooth.enable = true;
environment.systemPackages = with pkgs; [
wireguard-tools
bluetuith

View File

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

View File

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

View File

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
in
{
config = with cfg; lib.mkIf (enable && portals) {
xdg.portal = {
enable = true;
@ -14,7 +16,7 @@ in {
environment.sessionVariables = {
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;

View File

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
in
{
config = with cfg; lib.mkIf (enable && printing) {
# Enable CUPS to print documents.
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;
in {
in
{
config = with cfg; lib.mkIf (enable && sound) {
sound.enable = true;
hardware.pulseaudio.enable = false;

View File

@ -1,106 +1,112 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
config = let
waybar_full = pkgs.writeShellScriptBin "waybar-full" (
"${config.programs.waybar.package}/bin/waybar"
in
{
config =
let
waybar_full = pkgs.writeShellScriptBin "waybar-full" (
"${config.programs.waybar.package}/bin/waybar"
+ (if isNull cfg.sway.bar.config then "" else " -c ${cfg.sway.bar.config}")
+ (if isNull cfg.sway.bar.style then "" else " -s ${cfg.sway.bar.style}")
);
bar_config = ''
bar {
swaybar_command ${waybar_full}/bin/waybar-full
}
'';
build_conf = sway_conf : let
build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = map (item: "exec " + item);
build_mode_lines = lib.mapAttrsToList (name: value: ''
mode "${name}" {
${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
in ([]
++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds)
++ (build_exec_lines sway_conf.autolaunch)
++ (build_mode_lines sway_conf.modes)
++ lib.optional (sway_conf.extraConfig != "") sway_conf.extraConfig
);
text = lib.strings.concatLines (
(build_conf cfg.sway.config)
++ lib.optional cfg.sway.bar.enable bar_config
);
sway_conf = pkgs.writeText "sway.conf" text;
in with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."sway.conf" = {
source = sway_conf;
};
environment.systemPackages = [
waybar_full
] ++ (with pkgs; [
procps
slurp
libnotify
]);
systemd.services.reload-sway = {
description = "Reload all running sway instances";
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
script =''
for pid in $(${pkgs.procps}/bin/pgrep sway -x)
do
uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid))
export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock"
if [[ -e "$SWAYSOCK" ]] ; then
echo "sock is $SWAYSOCK"
${config.programs.sway.package}/bin/swaymsg reload
fi
done
'';
reloadTriggers = [ text ];
};
programs.waybar.enable = true;
programs.sway = {
enable = true;
wrapperFeatures = {
gtk = true;
base = true;
};
extraPackages = with pkgs; [
swaylock
swayidle
wl-clipboard
wf-recorder
dmenu
wmenu
waybar-mpris
];
extraOptions = [
"--unsupported-gpu"
"--config"
"/etc/sway.conf"
];
extraSessionCommands = ''
export XDG_CURRENT_DESKTOP=sway
export SDL_VIDEODRIVER=wayland
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export _JAVA_AWT_WM_NONREPARENTING=1
export MOZ_ENABLE_WAYLAND=1
# export WLR_RENDERER=vulkan
# export DRI_PRIME=1
# export MESA_LOADER_DRIVER_OVERRIDE="zink"
bar_config = ''
bar {
swaybar_command ${waybar_full}/bin/waybar-full
}
'';
build_conf = sway_conf:
let
build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = map (item: "exec " + item);
build_mode_lines = lib.mapAttrsToList (name: value: ''
mode "${name}" {
${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
in
([ ]
++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds)
++ (build_exec_lines sway_conf.autolaunch)
++ (build_mode_lines sway_conf.modes)
++ lib.optional (sway_conf.extraConfig != "") sway_conf.extraConfig
);
text = lib.strings.concatLines (
(build_conf cfg.sway.config)
++ lib.optional cfg.sway.bar.enable bar_config
);
sway_conf = pkgs.writeText "sway.conf" text;
in
with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."sway.conf" = {
source = sway_conf;
};
environment.systemPackages = [
waybar_full
] ++ (with pkgs; [
procps
slurp
libnotify
]);
systemd.services.reload-sway = {
description = "Reload all running sway instances";
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
script = ''
for pid in $(${pkgs.procps}/bin/pgrep sway -x)
do
uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid))
export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock"
if [[ -e "$SWAYSOCK" ]] ; then
echo "sock is $SWAYSOCK"
${config.programs.sway.package}/bin/swaymsg reload
fi
done
'';
reloadTriggers = [ text ];
};
programs.waybar.enable = true;
programs.sway = {
enable = true;
wrapperFeatures = {
gtk = true;
base = true;
};
extraPackages = with pkgs; [
swaylock
swayidle
wl-clipboard
wf-recorder
dmenu
wmenu
waybar-mpris
];
extraOptions = [
"--unsupported-gpu"
"--config"
"/etc/sway.conf"
];
extraSessionCommands = ''
export XDG_CURRENT_DESKTOP=sway
export SDL_VIDEODRIVER=wayland
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export _JAVA_AWT_WM_NONREPARENTING=1
export MOZ_ENABLE_WAYLAND=1
# export WLR_RENDERER=vulkan
# export DRI_PRIME=1
# export MESA_LOADER_DRIVER_OVERRIDE="zink"
'';
};
};
};
}

View File

@ -1,16 +1,19 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
in
{
config = with cfg; lib.mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
nixpkgs-fmt
gcc
jdk17
python3
pkg-config
tea
acpi
@ -29,7 +32,7 @@ in {
lm_sensors
imagemagick
nmap
hyfetch
acpi
lshw
@ -60,39 +63,39 @@ in {
user.email = cfg.tooling.git_email;
};
};
programs.tmux = {
enable = true;
historyLimit = 42000;
#keyMode = "vi";
};
virtualisation.docker.enable = true;
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
configure = {
customRC = ''
set number
set hidden
set fileencodings=utf-8
set nocompatible
set clipboard+=unnamedplus
if filereadable($HOME . "/.vimrc")
source ~/.vimrc
endif
'';
customRC = ''
set number
set hidden
set fileencodings=utf-8
set nocompatible
set clipboard+=unnamedplus
if filereadable($HOME . "/.vimrc")
source ~/.vimrc
endif
'';
packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on launch
start = [
start = [
vim-nix
vim-scala
fugitive
];
# manually loadable by calling `:packadd $plugin-name`
opt = [ ];
};
@ -102,7 +105,7 @@ in {
programs.xonsh = {
enable = true;
package = pkgs.xonsh.override {
extraPackages = ps: with ps; [
extraPackages = ps: with ps; [
requests
matplotlib
numpy

View File

@ -5,7 +5,8 @@
{ config, fetchpatch, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
[
# Include the results of the hardware scan.
./modules/fonts.nix
./modules/tabletdriver.nix
./sway/sway-conf.nix
@ -71,10 +72,10 @@
};
environment.sessionVariables = {
NIXPKGS_ALLOW_UNFREE="1";
MOZ_ENABLE_WAYLAND="1";
# QT_QPA_PLATFORM="wayland-egl";
OCI_CLI_RC_FILE="/home/grimmauld/.oci/config";
NIXPKGS_ALLOW_UNFREE = "1";
MOZ_ENABLE_WAYLAND = "1";
# QT_QPA_PLATFORM="wayland-egl";
OCI_CLI_RC_FILE = "/home/grimmauld/.oci/config";
};
# Allow unfree packages
@ -83,7 +84,7 @@
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# nix.package = pkgs.nixVersions.unstable;
programs.dconf.enable = true;
}

View File

@ -19,32 +19,32 @@
};
};
outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, chaotic, ... }: let
system = "x86_64-linux";
in {
nixosConfigurations = {
grimmauld-nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs system; };
modules = [
agenix.nixosModules.default
chaotic.nixosModules.default
nix-gaming.nixosModules.pipewireLowLatency
./load_common.nix
./specific/grimm-nixos-laptop/configuration.nix
outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, chaotic, ... }:
let
system = "x86_64-linux";
in
{
nixosConfigurations = {
grimmauld-nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs system; };
modules = [
agenix.nixosModules.default
chaotic.nixosModules.default
nix-gaming.nixosModules.pipewireLowLatency
./load_common.nix
./specific/grimm-nixos-laptop/configuration.nix
./configuration.nix
./modules/users.nix
# ./modules/tlp.nix
./modules/spotify-tui.nix
./modules/xserver.nix
./modules/system-packages.nix
./modules/kvm.nix
{ environment.systemPackages = [ agenix.packages.${system}.default ]; }
];
./configuration.nix
./modules/users.nix
# ./modules/tlp.nix
./modules/spotify-tui.nix
./modules/xserver.nix
./modules/system-packages.nix
./modules/kvm.nix
{ environment.systemPackages = [ agenix.packages.${system}.default ]; }
];
};
};
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
};
}

View File

@ -2,13 +2,13 @@
with lib;
let
cfg = config.grimmShared;
sync_mod = types.submodule ({config, ...} : {
sync_mod = types.submodule ({ config, ... }: {
options = {
remote = mkOption {
type = types.nonEmptyStr;
description = "path on the cloud server";
};
local = mkOption {
type = types.nonEmptyStr;
default = "$HOME/" + (lib.strings.concatStrings (builtins.match "/*(.+)" config.remote));
@ -17,17 +17,17 @@ let
};
});
sway_conf = types.submodule ({config, ...} : rec {
sway_conf = types.submodule ({ config, ... }: rec {
options = {
keybinds = mkOption {
type = types.attrsOf types.str;
default = {};
default = { };
description = "set of keybinds assigning key combo to action";
};
autolaunch = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = "set of commands to be run at sway startup";
};
@ -39,21 +39,22 @@ let
definitions = mkOption {
type = types.attrsOf types.str;
default = {};
default = { };
description = "set of definitions assigning variable to value";
};
modes = mkOption {
type = types.attrsOf sway_conf;
default = {};
default = { };
description = "possible modes to switch to, e.g. resize";
};
};
});
in {
in
{
options.grimmShared = {
enable = mkEnableOption "grimm-shared-common";
locale = mkOption {
type = types.bool;
default = true;
@ -80,7 +81,7 @@ in {
tooling = {
enable = mkEnableOption "grimm-tooling";
pass = mkOption {
type = types.bool;
default = true;
@ -123,7 +124,7 @@ in {
plugins = mkOption {
type = types.attrsOf types.str;
default = {};
default = { };
description = "set of plugins to install. Format: guid = short-id";
};
@ -139,7 +140,7 @@ in {
bar = {
enable = mkEnableOption "grimm-sway-bar";
style = mkOption {
type = types.nullOr types.path;
default = null;
@ -184,7 +185,7 @@ in {
options = {
syncPaths = mkOption {
type = types.listOf sync_mod;
default = [];
default = [ ];
description = "paths to sync via nextcloud";
};
};

View File

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

View File

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

View File

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

View File

@ -1,15 +1,15 @@
{pkgs, ...}: {
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
spice-gtk
kate
oci-cli
xcb-util-cursor
krfb
kdePackages.audiocd-kio
(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; [
opentabletdriver

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
let
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 ];
"nextcloud_pass.age".publicKeys = [ laptop_pub ];
}

View File

@ -1,11 +1,12 @@
{ pkgs, ... }: {
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
./screenshare-select.nix
];
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./screenshare-select.nix
];
age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ];
networking.hostName = "grimmauld-nixos";
environment.sessionVariables = {

View File

@ -5,9 +5,10 @@
{
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.kernelModules = [ ];
@ -15,19 +16,21 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac";
{
device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D20D-B5B0";
{
device = "/dev/disk/by-uuid/D20D-B5B0";
fsType = "vfat";
};
swapDevices = [ {
swapDevices = [{
device = "/var/lib/swapfile";
size = 48*1024;
} ];
size = 48 * 1024;
}];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";

View File

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

View File

@ -1,25 +1,25 @@
{ inputs, system, pkgs, config, lib, ... }: {
environment.systemPackages = with pkgs; [
alacritty
rmenu
grim
slurp
brightnessctl
wl-clipboard
swaymux
dunst
];
environment.systemPackages = with pkgs; [
alacritty
rmenu
grim
slurp
brightnessctl
wl-clipboard
swaymux
dunst
];
grimmShared.sway = {
grimmShared.sway = {
enable = true;
bar = {
enable = true;
config = ./bar/config;
style = ./bar/style.css;
};
bar = {
enable = true;
config = ./bar/config;
style = ./bar/style.css;
};
config = {
config = {
definitions = {
mod = "Mod4";
left = "h";
@ -47,79 +47,79 @@
"$mod+Shift+c" = "reload";
"$mod+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'";
# Move your focus around
"$mod+$left" = "focus left";
"$mod+$down" = "focus down";
"$mod+$up" = "focus up";
"$mod+$right" = "focus right";
# Or use $mod+[up|down|left|right]
"$mod+Left" = "focus left";
"$mod+Down" = "focus down";
"$mod+Up" = "focus up";
"$mod+Right" = "focus right";
# Move your focus around
"$mod+$left" = "focus left";
"$mod+$down" = "focus down";
"$mod+$up" = "focus up";
"$mod+$right" = "focus right";
# Or use $mod+[up|down|left|right]
"$mod+Left" = "focus left";
"$mod+Down" = "focus down";
"$mod+Up" = "focus up";
"$mod+Right" = "focus right";
# Move the focused window with the same, but add Shift
"$mod+Shift+$left" = "move left";
"$mod+Shift+$down" = "move down";
"$mod+Shift+$up" = "move up";
"$mod+Shift+$right" = "move right";
# Ditto, with arrow keys
"$mod+Shift+Left" = "move left";
"$mod+Shift+Down" = "move down";
"$mod+Shift+Up" = "move up";
"$mod+Shift+Right" = "move right";
#
# Workspaces:
#
# Switch to workspace
"$mod+1" = "workspace number 1";
"$mod+2" = "workspace number 2";
"$mod+3" = "workspace number 3";
"$mod+4" = "workspace number 4";
"$mod+5" = "workspace number 5";
"$mod+6" = "workspace number 6";
"$mod+7" = "workspace number 7";
"$mod+8" = "workspace number 8";
"$mod+9" = "workspace number 9";
"$mod+0" = "workspace number 10";
# Move focused container to workspace
"$mod+Shift+1" = "move container to workspace number 1";
"$mod+Shift+2" = "move container to workspace number 2";
"$mod+Shift+3" = "move container to workspace number 3";
"$mod+Shift+4" = "move container to workspace number 4";
"$mod+Shift+5" = "move container to workspace number 5";
"$mod+Shift+6" = "move container to workspace number 6";
"$mod+Shift+7" = "move container to workspace number 7";
"$mod+Shift+8" = "move container to workspace number 8";
"$mod+Shift+9" = "move container to workspace number 9";
"$mod+Shift+0" = "move container to workspace number 10";
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
"$mod+b" = "splith";
"$mod+v" = "splitv";
# Move the focused window with the same, but add Shift
"$mod+Shift+$left" = "move left";
"$mod+Shift+$down" = "move down";
"$mod+Shift+$up" = "move up";
"$mod+Shift+$right" = "move right";
# Ditto, with arrow keys
"$mod+Shift+Left" = "move left";
"$mod+Shift+Down" = "move down";
"$mod+Shift+Up" = "move up";
"$mod+Shift+Right" = "move right";
#
# Workspaces:
#
# Switch to workspace
"$mod+1" = "workspace number 1";
"$mod+2" = "workspace number 2";
"$mod+3" = "workspace number 3";
"$mod+4" = "workspace number 4";
"$mod+5" = "workspace number 5";
"$mod+6" = "workspace number 6";
"$mod+7" = "workspace number 7";
"$mod+8" = "workspace number 8";
"$mod+9" = "workspace number 9";
"$mod+0" = "workspace number 10";
# Move focused container to workspace
"$mod+Shift+1" = "move container to workspace number 1";
"$mod+Shift+2" = "move container to workspace number 2";
"$mod+Shift+3" = "move container to workspace number 3";
"$mod+Shift+4" = "move container to workspace number 4";
"$mod+Shift+5" = "move container to workspace number 5";
"$mod+Shift+6" = "move container to workspace number 6";
"$mod+Shift+7" = "move container to workspace number 7";
"$mod+Shift+8" = "move container to workspace number 8";
"$mod+Shift+9" = "move container to workspace number 9";
"$mod+Shift+0" = "move container to workspace number 10";
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
"$mod+b" = "splith";
"$mod+v" = "splitv";
# Switch the current container between different layout styles
"$mod+s" = "layout stacking";
"$mod+w" = "layout tabbed";
"$mod+e" = "layout toggle split";
# Switch the current container between different layout styles
"$mod+s" = "layout stacking";
"$mod+w" = "layout tabbed";
"$mod+e" = "layout toggle split";
# Make the current focus fullscreen
"$mod+f" = "fullscreen";
# Make the current focus fullscreen
"$mod+f" = "fullscreen";
# Toggle the current focus between tiling and floating mode
"$mod+Shift+space" = "floating toggle";
# Toggle the current focus between tiling and floating mode
"$mod+Shift+space" = "floating toggle";
# Swap focus between the tiling area and the floating area
"$mod+space" = "focus mode_toggle";
# Swap focus between the tiling area and the floating area
"$mod+space" = "focus mode_toggle";
# Move focus to the parent container
"$mod+a" = "focus parent";
# Move focus to the parent container
"$mod+a" = "focus parent";
"$mod+Shift+minus" = "move scratchpad";
"$mod+minus" = "scratchpad show";
@ -138,7 +138,8 @@
XF86MonBrightnessUp = "exec brightnessctl s 10+%";
XF86MonBrightnessDown = "exec brightnessctl s 10-%";
};
autolaunch = [ # fixme: absolute paths
autolaunch = [
# fixme: absolute paths
"blueman-applet"
"lxqt-policykit-agent"
"otd-daemon"
@ -146,47 +147,47 @@
"systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP"
];
extraConfig = ''
output * bg ${./wallpapers/switzerland.jpg} fill
output HDMI-A-1 mode 1920x1080@60Hz position 0,0
for_window [app_id="lxqt-policykit-agent"] floating enable;
floating_modifier $mod normal
output * bg ${./wallpapers/switzerland.jpg} fill
output HDMI-A-1 mode 1920x1080@60Hz position 0,0
for_window [app_id="lxqt-policykit-agent"] floating enable;
floating_modifier $mod normal
input type:keyboard xkb_numlock enabled
include /etc/sway/config.d/*
input type:keyboard xkb_numlock enabled
include /etc/sway/config.d/*
# Borders, gaps, titlebars, behavior
default_border pixel 3
default_floating_border pixel 3
gaps inner 5
titlebar_padding 5 5
# Borders, gaps, titlebars, behavior
default_border pixel 3
default_floating_border pixel 3
gaps inner 5
titlebar_padding 5 5
#5Smart things
smart_gaps on
hide_edge_borders --i3 smart
#5Smart things
smart_gaps on
hide_edge_borders --i3 smart
input * {
xkb_layout "de"
}
input * {
xkb_layout "de"
}
for_window [app_id="swaymux"] floating enable
for_window [app_id="rmenu"] floating enable
'';
for_window [app_id="swaymux"] floating enable
for_window [app_id="rmenu"] floating enable
'';
modes.resize.keybinds = {
"$left" = "resize shrink width 10px";
"$down" = "resize grow height 10px";
"$up" = "resize shrink height 10px";
"$right" = "resize grow width 10px";
modes.resize.keybinds = {
"$left" = "resize shrink width 10px";
"$down" = "resize grow height 10px";
"$up" = "resize shrink height 10px";
"$right" = "resize grow width 10px";
Left = "resize shrink width 10px";
Down = "resize grow height 10px";
Up = "resize shrink height 10px";
Right = "resize grow width 10px";
Left = "resize shrink width 10px";
Down = "resize grow height 10px";
Up = "resize shrink height 10px";
Right = "resize grow width 10px";
Return = "mode \"default\"";
Escape = "mode \"default\"";
};
Return = "mode \"default\"";
Escape = "mode \"default\"";
};
};
};
}