Compare commits

..

2 Commits

Author SHA1 Message Date
def3826dd5 readd common components 2024-03-24 16:59:47 +01:00
a10f8af167 update some stuff 2024-03-24 10:16:04 +01:00
23 changed files with 925 additions and 161 deletions

48
common/firefox.nix Normal file
View File

@ -0,0 +1,48 @@
{ inputs, pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && firefox.enable) {
environment.systemPackages = []
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
programs.firefox = {
# package = grimm-shared-inputs.ff_nightly.packages.${pkgs.system}.firefox-nightly-bin;
enable = true;
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
"passff@invicem.pro" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed";
};
})
];
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
};
};
};
}

47
common/gaming.nix Normal file
View File

@ -0,0 +1,47 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && gaming) {
programs.steam = {
enable = true;
gamescopeSession.enable = true;
gamescopeSession.env = {
DRI_PRIME = "1";
};
};
programs.gamemode = {
enable = true;
settings = {
general = {
inhibit_screensaver=0;
renice = 10;
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
services.udev.packages = [ pkgs.wooting-udev-rules ];
environment.sessionVariables = {
GAMEMODERUNEXEC="env DRI_PRIME=1";
};
environment.systemPackages = with pkgs; [
heroic
prismlauncher
wootility
(pkgs.symlinkJoin {
name = "osu";
paths = [
(pkgs.writeShellScriptBin "osu!" ''exec gamemoderun ${pkgs.osu-lazer-bin}/bin/'osu!'
'')
pkgs.osu-lazer-bin
];
})
];
};
}

29
common/localisation.nix Normal file
View File

@ -0,0 +1,29 @@
{ config, lib, ... }: let
cfg = config.grimmShared;
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";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
console.keyMap = "de";
services.xserver.xkb = {
layout = "de";
variant = "";
};
};
}

29
common/networking.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = lib.mkMerge [
(with cfg; lib.mkIf (enable && network) {
networking.networkmanager.enable = true;
networking.useDHCP = lib.mkDefault true;
networking.firewall.enable = true;
hardware.bluetooth.enable = true;
environment.systemPackages = with pkgs; [
wireguard-tools
bluetuith
];
})
(with cfg; lib.mkIf (enable && network && graphical) {
services.blueman.enable = true;
})
(with cfg; lib.mkIf (enable && network && sound) {
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = [ "network.target" "sound.target" ];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
})
];
}

29
common/opengl.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && graphical) {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
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";
};
environment.systemPackages = with pkgs; [
glfw
];
};
}

28
common/pass.nix Normal file
View File

@ -0,0 +1,28 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && tooling.enable && tooling.pass) {
security.polkit.enable = true;
environment.systemPackages = with pkgs; [
mkpasswd
pinentry
gnupg
pass
libsecret
(writeShellScriptBin "passw" "pass $@")
] ++ lib.optionals cfg.graphical [
lxqt.lxqt-policykit
];
services.passSecretService.enable = true;
programs.gnupg.agent = {
settings = {
# default-cache-ttl = 6000;
};
pinentryPackage = lib.mkForce pkgs.pinentry;
enable = true;
# enableSSHSupport = true;
};
};
}

22
common/portals.nix Normal file
View File

@ -0,0 +1,22 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && portals) {
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-kde
xdg-desktop-portal-gtk
];
};
environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0";
};
fonts.fontDir.enable = true;
};
}

20
common/printing.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && printing) {
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = with pkgs; [ brgenml1lpr brgenml1cupswrapper ];
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.printing.cups-pdf.enable = true;
hardware.sane.brscan4.enable = true; # enables support for SANE scanners
environment.systemPackages = with pkgs; [
skanpage
];
};
}

24
common/sound.nix Normal file
View File

@ -0,0 +1,24 @@
{ grimm-shared-inputs, pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && sound) {
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true; # osu uses jack
lowLatency.enable = true;
systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user
};
environment.systemPackages = with pkgs; [
pavucontrol
playerctl
pulseaudio
];
};
}

190
common/sway-defaults.nix Normal file
View File

@ -0,0 +1,190 @@
{ inputs, system, pkgs, config, lib, ... }: let
cfg = config.grimmShared;
swaymux_pkg = inputs.swaymux.packages."${system}".default;
in {
config = with cfg; lib.mkIf (enable && sway.enable && sway.populateDefaultConfig ) {
environment.systemPackages = (with pkgs; [
alacritty
wmenu
grim
slurp
wl-clipboard
])
++ [ swaymux_pkg ];
grimmShared.sway = {
definitions = {
mod = "Mod4";
left = "h";
down = "j";
up = "k";
right = "l";
term = "alacritty";
menu = "dmenu_path | wmenu | xargs swaymsg exec --";
primecol = "#8800FF";
accentcol = "#5700a0";
splitcol = "#69507f";
actsplitcol = "#cd97fc";
darkcol = "#202020";
urgentcol = "#9e3c3c";
realwhite = "#C7D3E3";
};
keybinds = {
"$mod+d" = "exec $menu";
"$mod+Shift+s" = ''exec grim -g "$(slurp -d)" - | wl-copy'';
"$mod+Return" = "exec $term";
"$mod+Shift+q" = "kill";
"$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 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";
# Make the current focus fullscreen
"$mod+f" = "fullscreen";
# 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";
# Move focus to the parent container
"$mod+a" = "focus parent";
"$mod+Shift+minus" = "move scratchpad";
"$mod+minus" = "scratchpad show";
"$mod+r" = ''mode "resize"'';
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioPlay" = "exec playerctl play-pause";
"XF86AudioNext" = "exec playerctl next";
"XF86AudioPrev" = "exec playerctl previous";
"$mod+c" = "exec swaymux";
};
autolaunch = [ # fixme: absolute paths
"blueman-applet"
"lxqt-policykit-agent"
"otd-daemon"
"dunst"
"systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP"
];
extraConfig = ''
# fixme: wallpaper
output * bg ${./wallpapers/spain.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
bar {
swaybar_command waybar
}
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
#5Smart things
smart_gaps on
hide_edge_borders --i3 smart
input * {
xkb_layout "de"
}
for_window [app_id="swaymux"] floating enable
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrrnk width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
# test
'';
};
};
}

80
common/sway.nix Normal file
View File

@ -0,0 +1,80 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = 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);
text = lib.strings.concatLines [
(lib.strings.concatLines (build_definition_lines cfg.sway.definitions))
(lib.strings.concatLines (build_keybind_lines cfg.sway.keybinds))
(lib.strings.concatLines (build_exec_lines cfg.sway.autolaunch))
cfg.sway.extraConfig
];
sway_conf = pkgs.writeText "sway.conf" text;
in with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."sway.conf" = {
source = sway_conf;
};
environment.systemPackages = 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
];
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 MESA_LOADER_DRIVER_OVERRIDE="zink"
'';
};
};
}

106
common/toolchains.nix Normal file
View File

@ -0,0 +1,106 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
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 $@")
gcc
jdk17
python3
pkg-config
tea
acpi
fbcat
gomuks
gotop
ranger
nix-search-cli
wget
tree
file
util-linux
visualvm
ffmpeg-full
lm_sensors
imagemagick
pypy3
nmap
hyfetch
acpi
lshw
pciutils
usbutils
powertop
parted
] ++ lib.optionals cfg.graphical [
qdirstat
libva-utils
glxinfo
alacritty
vulkan-tools
pdfarranger
nomacs
gparted
];
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "main";
credential.username = cfg.tooling.git_user;
core.editor = "${pkgs.neovim}/bin/nvim";
user.name = cfg.tooling.git_user;
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
'';
packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on launch
start = [
vim-nix
vim-scala
fugitive
];
# manually loadable by calling `:packadd $plugin-name`
opt = [ ];
};
};
};
programs.xonsh.enable = true;
programs.ssh.startAgent = true;
programs.thefuck.enable = true;
};
}

BIN
common/wallpapers/spain.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

View File

@ -6,29 +6,26 @@
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
nix.settings.system-features = [
"gccarch-icelake-client"
"kvm"
"big-parallel"
"benchmark"
"nixos-test"
./modules/fonts.nix
./modules/tabletdriver.nix
];
# Bootloader.
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
kernelParams = [ "quiet" ];
kernelPackages = pkgs.linuxPackagesFor ( pkgs.linux_6_7 );
kernelParams = [ "quiet" "intel_iommu=on" "iommu=force" "pcie_acs_override=downstream" "pcie_aspm=off" ]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ];
kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_drm" "kvm-intel" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ];
kernelPackages = pkgs.linuxPackages_zen;
};
# Enable flatpaks
services.flatpak.enable = true;
chaotic.mesa-git.enable = true;
services.ddccontrol.enable = true;
powerManagement.scsiLinkPolicy = "min_power";
hardware.i2c.enable = true;
grimmShared = {
enable = true;
@ -41,7 +38,6 @@
};
sound = true;
graphical = true;
gaming = true;
firefox = {
enable = true;
plugins = {
@ -66,13 +62,8 @@
platformTheme = "kde";
};
age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ];
networking.hostName = "grimmauld-nixos";
environment.sessionVariables = {
NIXPKGS_ALLOW_UNFREE="1";
OMP_NUM_THREADS = "12";
MOZ_ENABLE_WAYLAND="1";
# QT_QPA_PLATFORM="wayland-egl";
OCI_CLI_RC_FILE="/home/grimmauld/.oci/config";
@ -83,26 +74,6 @@
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # "23.05"; # Did you read the comment?
programs.dconf.enable = true;

View File

@ -78,11 +78,11 @@
"yafas": "yafas"
},
"locked": {
"lastModified": 1710717798,
"narHash": "sha256-KrZbpo83wnKbUXy0hnmENJTNy/mOCF3Un+nml67e+dU=",
"lastModified": 1711229481,
"narHash": "sha256-mugLPd8wlCx1s1PDv/sIFJq5xK3sycf+fROFHvE8boE=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "cd5052eba475afc01072ebc239896a68edc17f95",
"rev": "1520b69fa40d96c5e95b6e0da65831d3c7130fb0",
"type": "github"
},
"original": {
@ -138,11 +138,11 @@
]
},
"locked": {
"lastModified": 1710562188,
"narHash": "sha256-KHlb4sK9fvp+9DoYWHLyaegoeLV7w8s7CsNMmNlKu1U=",
"lastModified": 1710821861,
"narHash": "sha256-Y+x3q7VkPpRok7Om2bwB2v1JDK/OCZmiFaBrIOJRojY=",
"owner": "girlbossceo",
"repo": "conduwuit",
"rev": "8d8467a4eafd264adb9c710e0638c08ae547dec4",
"rev": "7809f0a6aee6900de59b720bf966d4a0315276bc",
"type": "github"
},
"original": {
@ -229,22 +229,6 @@
"url": "https://flakehub.com/f/edolstra/flake-compat/%2A.tar.gz"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@ -347,11 +331,11 @@
]
},
"locked": {
"lastModified": 1710404304,
"narHash": "sha256-tYsUAsZgt9TT7d+r1KRYHWyBRWedJ39SXNBVSCQVsGQ=",
"lastModified": 1710915975,
"narHash": "sha256-yOc0AD6ba7mbialNciZGzuSQLMo4CopoZGEfcUugA4I=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "ffa51458aec4d53aac85b6dee1ee2ec29f4e953f",
"rev": "179d73fbe14c5bdb835d10bcc1c783466112bfa6",
"type": "github"
},
"original": {
@ -373,11 +357,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1710563757,
"narHash": "sha256-H5SZIo7O4zg/NqSdM71V2gYH4ex5WbBf6s9ue5s4nL4=",
"lastModified": 1710898409,
"narHash": "sha256-vk+NUeKBb8pyTkZvHVq7+or25fpnSeaaSBGHSGKXL44=",
"owner": "martinvonz",
"repo": "jj",
"rev": "8600750fceafbf489d42a99b36b1f48bbc1e416b",
"rev": "4fbe6aecc95152eda44cb4b185ab369e23e1393f",
"type": "github"
},
"original": {
@ -410,11 +394,11 @@
]
},
"locked": {
"lastModified": 1710525749,
"narHash": "sha256-LpV/mJLeShTPecVQZnIAb9PTCGziuMuGOJQUeAb2u/w=",
"lastModified": 1710858553,
"narHash": "sha256-CHSkAhNaWIMXlJX7skC2t5wr/qaNlMgWQsezNqr15mw=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "0c57815fbf47c69af9ed11fa8ebc1b52158a3ba2",
"rev": "db49deb7fd2fbe805ceec060aa4dec65009ad7a7",
"type": "github"
},
"original": {
@ -442,16 +426,15 @@
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"shared",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710637843,
"narHash": "sha256-NVszlVTM0sEe8yZuOShitwOhNdl2juD7032SQg2dV+U=",
"lastModified": 1711242788,
"narHash": "sha256-6m6hw6uoIIvoAMR5RLhw7kGfNu3Govof9vnPAzveUgI=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "da2c09734818d85ef4d112997b5188b62cfdd0fd",
"rev": "04028200841ec3b4ce163de4d136296d03123001",
"type": "github"
},
"original": {
@ -485,11 +468,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1710631334,
"narHash": "sha256-rL5LSYd85kplL5othxK5lmAtjyMOBg390sGBTb3LRMM=",
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c75037bbf9093a2acb617804ee46320d6d1fea5a",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
@ -537,8 +520,9 @@
"inputs": {
"agenix": "agenix",
"chaotic": "chaotic",
"nix-gaming": "nix-gaming",
"nixpkgs": "nixpkgs",
"shared": "shared"
"swaymux": "swaymux"
}
},
"rust-analyzer-src": {
@ -585,34 +569,9 @@
"type": "github"
}
},
"shared": {
"inputs": {
"flake-compat": "flake-compat_2",
"nix-gaming": "nix-gaming",
"nixpkgs": [
"nixpkgs"
],
"swaymux": "swaymux",
"utils": "utils"
},
"locked": {
"lastModified": 1710718492,
"narHash": "sha256-CZgpU2fSJC0HAp6+pAdmAze28t7E2ch6Q+YnFonADUQ=",
"ref": "refs/heads/main",
"rev": "154b9aa8ec511edf7c3a62c94f5d04f5d070e36e",
"revCount": 31,
"type": "git",
"url": "https://git.grimmauld.de/Grimmauld/grimm-nix-shared"
},
"original": {
"type": "git",
"url": "https://git.grimmauld.de/Grimmauld/grimm-nix-shared"
}
},
"swaymux": {
"inputs": {
"nixpkgs": [
"shared",
"nixpkgs"
]
},
@ -660,39 +619,6 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"yafas": {
"inputs": {
"flake-schemas": [

View File

@ -13,14 +13,17 @@
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
shared = {
url = "git+https://git.grimmauld.de/Grimmauld/grimm-nix-shared";
# url = "git+file:///home/grimmauld/shared";
nix-gaming = {
url = "github:fufexan/nix-gaming";
inputs.nixpkgs.follows = "nixpkgs";
};
swaymux = {
url = "git+https://git.grimmauld.de/Grimmauld/swaymux";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, agenix, shared, nixpkgs, chaotic, ... }: let
outputs = inputs @ { self, swaymux, nix-gaming, agenix, nixpkgs, chaotic, ... }: let
system = "x86_64-linux";
in {
nixosConfigurations = {
@ -30,18 +33,19 @@
modules = [
agenix.nixosModules.default
chaotic.nixosModules.default
shared.nixosModules.default
inputs.nix-gaming.nixosModules.pipewireLowLatency
./load_common.nix
./specific/grimm-nixos-laptop.nix
# ./kernel.nix
./configuration.nix
./modules/users.nix
./modules/tlp.nix
./modules/fonts.nix
# ./modules/tlp.nix
./modules/screenshare_select.nix
# ./modules/spotify-tui.nix
./modules/tabletdriver.nix
./modules/spotify-tui.nix
./modules/xserver.nix
./modules/system-packages.nix
# ./modules/kvm.nix
./modules/kvm.nix
./modules/cloudsync.nix
{ environment.systemPackages = [ agenix.packages.${system}.default ]; }
];

138
load_common.nix Normal file
View File

@ -0,0 +1,138 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.grimmShared;
in {
options.grimmShared = {
enable = mkEnableOption "grimm-shared-common";
locale = mkOption {
type = types.bool;
default = true;
description = "Sets german units but english language";
};
printing = mkOption {
type = types.bool;
default = false;
description = "Enables print and scan related options";
};
portals = mkOption {
type = types.bool;
default = false;
description = "Enables portals for wlr, gtk and kde as well as fixes fonts";
};
network = mkOption {
type = types.bool;
default = false;
description = "Enables network manager, wifi and bluetooth";
};
tooling = {
enable = mkEnableOption "grimm-tooling";
pass = mkOption {
type = types.bool;
default = true;
description = "Enables password-store, gnupg and such secret handling";
};
git_user = mkOption {
type = types.str;
default = "Grimmauld";
description = "Username for git to use";
};
git_email = mkOption {
type = types.str;
default = "${config.grimmShared.tooling.git_user}@grimmauld.de";
description = "Email for git to use";
};
};
sound = mkOption {
type = types.bool;
default = false;
description = "whether to enable sound";
};
graphical = mkOption {
type = types.bool;
default = false;
description = "whether to enable graphical components";
};
gaming = mkOption {
type = types.bool;
default = false;
description = "enables steam, heroic, prism and gamemoded";
};
firefox = {
enable = mkEnableOption "grimm-firefox";
plugins = mkOption {
type = types.attrsOf types.str;
default = {};
description = "set of plugins to install. Format: guid = short-id";
};
disableUserPlugins = mkOption {
type = types.bool;
default = false;
description = "disables user controlled plugins";
};
};
sway = {
enable = mkEnableOption "grimm-sway";
definitions = mkOption {
type = types.attrsOf types.str;
default = {};
description = "set of definitions assigning variable to value";
};
keybinds = mkOption {
type = types.attrsOf types.str;
default = {};
description = "set of keybinds assigning key combo to action";
};
autolaunch = mkOption {
type = types.listOf types.str;
default = [];
description = "set of commands to be run at sway startup";
};
extraConfig = mkOption {
type = types.str;
default = "";
description = "additional sway config to be included";
};
populateDefaultConfig = mkOption {
type = types.bool;
default = false;
description = "puts my personal config in place using above methods";
};
};
};
imports = [
./common/localisation.nix
./common/printing.nix
./common/portals.nix
./common/networking.nix
./common/toolchains.nix
./common/sound.nix
./common/opengl.nix
./common/gaming.nix
./common/firefox.nix
./common/pass.nix
./common/sway.nix
./common/sway-defaults.nix
];
}

View File

@ -1,18 +1,74 @@
{ pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
virtualisation.libvirtd.qemu.ovmf.packages = [
{ pkgs, ... }: let
loadvfio = pkgs.writeShellScriptBin "loadvfio" ''
udevadm trigger --verbose --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=1"
sleep 2
rmmod -f nvidia_drm nvidia_modeset nvidia_uvm nvidia
echo -n 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo -n 0000:01:00.1 > /sys/bus/pci/drivers/vfio-pci/bind
echo -n 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
'';
loadnvidia = pkgs.writeShellScriptBin "loadnvidia" ''
echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo 0000:01:00.1 > /sys/bus/pci/devices/0000:01:00.1/driver/unbind
modprobe nvidia
modprobe nvidia_drm
modprobe nvidia_modeset
echo -n 0000:01:00.0 > /sys/bus/pci/drivers/snd_hda_intel/bind
nvidia-smi -i 0 -pm 1
'';
qemuHook = pkgs.writeShellScript "qemu" ''
#
# Author: Sebastiaan Meijer (sebastiaan@passthroughpo.st)
#
# Copy this file to /etc/libvirt/hooks, make sure it's called "qemu".
# After this file is installed, restart libvirt.
# From now on, you can easily add per-guest qemu hooks.
# Add your hooks in /etc/libvirt/hooks/qemu.d/vm_name/hook_name/state_name.
# For a list of available hooks, please refer to https://www.libvirt.org/hooks.html
#
GUEST_NAME="$1"
HOOK_NAME="$2"
STATE_NAME="$3"
MISC="''${@:4}"
BASEDIR="$(dirname $0)"
HOOKPATH="$BASEDIR/qemu.d/$GUEST_NAME/$HOOK_NAME/$STATE_NAME"
set -e # If a script exits with an error, we should as well.
# check if it's a non-empty executable file
if [ -f "$HOOKPATH" ] && [ -s "$HOOKPATH"] && [ -x "$HOOKPATH" ]; then
eval \"$HOOKPATH\" "$@"
elif [ -d "$HOOKPATH" ]; then
while read file; do
# check for null string
if [ ! -z "$file" ]; then
eval \"$file\" "$@"
fi
done <<< "$(find -L "$HOOKPATH" -maxdepth 1 -type f -executable -print;)"
fi
'';
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 = {
enable = true;
qemu = {
runAsRoot = false;
ovmf = {
enable = true;
packages = [
# pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd # AAVMF
pkgs.OVMF.fd
];
};
};
onBoot = "ignore";
onShutdown = "shutdown";
};
programs.virt-manager.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
# security.wrappers.spice-client-glib-usb-acl-helper.source = "${pkgs.spice_gtk}/bin/spice-client-glib-usb-acl-helper";
# home manager
# dconf.settings = {
# "org/virt-manager/virt-manager/connections" = {
# autoconnect = ["qemu:///system"];
# uris = ["qemu:///system"];
# };
# };
}

View File

@ -28,7 +28,7 @@ END
];
environment.systemPackages = with pkgs; [
spotify-tui
ncspot
spotifyd
];

View File

@ -3,7 +3,7 @@
isNormalUser = true;
shell = pkgs.xonsh;
description = "grimmauld";
extraGroups = [ "networkmanager" "wheel" "input" "video" "lp" "scanner" "libvirtd" "pipewire" "gamemode" ];
extraGroups = [ "networkmanager" "kvm" "wheel" "input" "video" "lp" "scanner" "libvirt" "libvirt-qemu" "libvirtd" "pipewire" "gamemode" ];
packages = with pkgs; [
webcord
discord

View File

@ -0,0 +1,17 @@
{ pkgs, ... }: {
imports = [ # Include the results of the hardware scan.
./grimm-nixos-laptop-hardware.nix
];
age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ];
networking.hostName = "grimmauld-nixos";
environment.sessionVariables = {
OMP_NUM_THREADS = "12";
};
system.stateVersion = "23.05";
grimmShared.gaming = true;
}