1

General codestyle changes

This commit is contained in:
2024-06-03 20:37:24 +02:00
parent 26ea3f3f00
commit 1df9bf4011
9 changed files with 214 additions and 272 deletions

View File

@ -35,10 +35,6 @@
# adwaita-for-steam.url = "github:tkashkin/Adwaita-for-Steam";
# adwaita-for-steam.flake = false;
# hyprland.url = "github:hyprwm/Hyprland"; # NOTE: only for Home-Manager, NixOS includes hyprland
# hyprpaper.url = "github:hyprwm/hyprpaper"; # NOTE: replaced with hyprpaper package
# hyprpicker.url = "github:hyprwm/hyprpicker"; # NOTE: replaced with hyprpicker package
};
# Outputs is a function that takes the inputs as arguments.
@ -57,7 +53,7 @@
# I don't know how to extend the nixpkgs.lib directly so just propagate mylib to the config modules as argument
mylib = import ./lib {
inherit inputs pkgs;
lib = nixpkgs.lib;
inherit (nixpkgs) lib; # Equal to "lib = nixpkgs.lib;"
};
# Set overlays + unfree globally
@ -86,7 +82,7 @@
};
# The rec expression turns a basic set into a set where self-referencing is possible.
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
in rec {
in {
# Local shell for NixFlake directory
devShells."${system}".default = import ./shell.nix {inherit pkgs;};
@ -103,8 +99,6 @@
username = "christoph";
extraModules = [
# hyprland.nixosModules.default # NOTE: NixOS includes system module
# inputs.nix-flatpak.nixosModules.nix-flatpak
];
};
@ -116,8 +110,6 @@
username = "christoph";
extraModules = [
# hyprland.nixosModules.default # NOTE: NixOS includes system module
# inputs.nix-flatpak.nixosModules.nix-flatpak
];
};
};

View File

@ -3,7 +3,6 @@
# The nixosConfig allows to access the toplevel system configuration from within home manager
# https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19
{
inputs,
hostname,
username,
lib,
@ -100,6 +99,7 @@ rec {
bindings = {
"$mainMod, T" = ["exec, kitty"];
"$mainMod, E" = ["exec, kitty"];
"$mainMod, N" = ["exec, neovide"];
# "$mainMod, T" = ["exec, alacritty -o font.size=12 -e tmux"];
# "$mainMod, E" = ["exec, alacritty -o font.size=12 -e tmux"];
@ -112,34 +112,44 @@ rec {
};
};
autostart = [
# NOTE: The sleep 15s is a hack for tray icons,
# they need to be launched after waybar
"hyprctl dispatch exec \"sleep 15s && kdeconnect-indicator\""
"hyprctl dispatch exec \"sleep 15s && nextcloud --background\""
"hyprctl dispatch exec \"sleep 15s && keepassxc\""
# "alacritty -o font.size=12 -e tmux"
"kitty"
# "md.obsidian.Obsidian"
# "firefox"
];
autostart = {
immediate = [
"kitty"
];
delayed = [
# "kdeconnect-indicator"
"nextcloud --background"
"keepassxc"
];
};
workspacerules = {
"2" = [
"jetbrains-clion"
"code-url-handler"
"neovide"
"jetbrains-clion"
"jetbrains-idea"
"jetbrains-pycharm"
"jetbrains-rustrover"
"code-url-handler"
];
"3" = [
"obsidian"
];
"4" = [
"firefox"
"chromium-browser"
"Google-chrome"
];
"10" = [
"discord"
"7" = [
"signal"
];
"8" = [
"Spotify"
];
"9" = [
"discord"
];
};
floating = [
@ -159,6 +169,9 @@ rec {
"Spotify"
"obsidian"
"jetbrains-clion"
"jetbrains-idea"
"jetbrains-pycharm"
"jetbrains-rustrover"
"code-url-handler"
"neovide"
];
@ -186,11 +199,11 @@ rec {
neovide = true;
};
lazyvim = {
# enable = true;
alias = true;
neovide = true;
};
# lazyvim = {
# enable = true;
# alias = true;
# neovide = true;
# };
nextcloud = {
enable = true;
@ -261,11 +274,12 @@ rec {
enable = true;
associations.added = nixosConfig.xdg.mime.addedAssociations;
associations.removed = nixosConfig.xdg.mime.removedAssociations;
defaultApplications = nixosConfig.xdg.mime.defaultApplications;
inherit (nixosConfig.xdg.mime) defaultApplications; # Equal to "defaultApplications = nixosConfig.xdg.mime.defaultApplications"
};
home = {
username = username; # Inherited from flake.nix
inherit username; # Inherited from flake.nix
homeDirectory = "/home/${home.username}";
enableNixpkgsReleaseCheck = true;
@ -323,20 +337,16 @@ rec {
nvd # nix rebuild diff
file
# spotdl # TODO: Borked
# geteltorito # extreact boot image from iso
# gitbatch # overview over multiple repos
# Hardware/Software info
pciutils # lspci
glxinfo # opengl info
wayland-utils # wayland-info
aha # ansi html adapter? TODO: Why did I install this?
# radeontop
clinfo # OpenCL info
vulkan-tools # vulkaninfo
libva-utils # vainfo
vdpauinfo
# rocminfo # radeon comptute platform info
hwloc
lm_sensors
acpica-tools # Dump ACPI tables etc.
@ -349,17 +359,13 @@ rec {
ueberzugpp # Display images in terminal (alacritty)
# Document utils
# TODO: Latex module with individual packages or HomeManager
texlive.combined.scheme-full
poppler_utils # pdfunite
graphviz # generate graphs from code
# xdot # .dot file viewer
# kgraphviewer # dot graph viewer
# d2 # generate diagrams from code
plantuml
gnuplot # generate function plots
pdf2svg
# TODO: Latex module with individual packages
texlive.combined.scheme-full
# tikzit
pandoc # document converting madness
# Networking
@ -411,30 +417,15 @@ rec {
hunspell # I cna't type
hunspellDicts.en_US
hunspellDicts.de_DE
obsidian # knowledge-base # Use flatpak for now, as I can't use window splitting with this version for some reason
obsidian # knowledge-base
# logseq # knowledge-base
# zotero # Citation/source research assistant
# jabref # manage bibilography # NOTE: Uses jdk18 which is EOL, so can't build, use flatpak instead
# kbibtex # bibtex editor
# vale # Why not lint everything (including english)?
# TODO: Development module, I need multiple modules to be able to add python packages to a single python install...
(python312.withPackages (p:
with p; [
# p.rich
# p.numpy
# p.scipy
# p.matplotlib
# p.pillow # for ranger
# p.pygments # for emacs
# flake8 # Linter
# black
]))
# TODO: Module, I need to add python packages from multiple modules to the same interpreter
python312
jetbrains.clion
jetbrains.rust-rover
jetbrains.pycharm-professional
jetbrains.idea-ultimate
# jetbrains-toolbox # TODO: Difficult to make work
# Media
wacomtablet

View File

@ -1,16 +1,5 @@
{
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# Here goes the stuff that will only be enabled on the desktop
rec {
{...}: {
imports = [
../../modules
];
@ -46,9 +35,11 @@ rec {
"DP-1" = [10];
};
autostart = [
"hyprctl dispatch exec \"sleep 15s && fcitx5\""
];
autostart = {
delayed = [
"fcitx5"
];
};
floating = [
{
@ -102,8 +93,8 @@ rec {
waybar.monitor = "HDMI-A-1";
};
home.packages = with pkgs; [
# quartus-prime-lite # Intel FPGA design software
];
# home.packages = with pkgs; [
# quartus-prime-lite # Intel FPGA design software
# ];
};
}

View File

@ -1,16 +1,5 @@
{
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# Here goes the stuff that will only be enabled on the laptop
rec {
{...}: {
imports = [
../../modules
];
@ -42,7 +31,6 @@ rec {
waybar.monitor = "eDP-1";
};
home.packages = with pkgs; [
];
# home.packages = with pkgs; [];
};
}

View File

@ -1,12 +1,4 @@
{
inputs,
config,
nixosConfig,
lib,
pkgs,
mylib,
...
}: {
{inputs, ...}: {
imports = [
./audio
./chromium

123
shell.nix
View File

@ -13,16 +13,16 @@ pkgs.devshell.mkShell {
# help = "Launch clion in this folder";
# command = "clion ./ &>/dev/null &";
# }
{
name = "util-watch-flatpak";
help = "Show running flatpak operations";
command = "watch -n 0.5 -d procs flatpak";
}
{
name = "util-watch-doom";
help = "Show running doom operations";
command = "watch -n 0.5 -d procs doom";
}
# {
# name = "util-watch-flatpak";
# help = "Show running flatpak operations";
# command = "watch -n 0.5 -d procs flatpak";
# }
# {
# name = "util-watch-doom";
# help = "Show running doom operations";
# command = "watch -n 0.5 -d procs doom";
# }
{
name = "util-pkgs-sys";
help = "List currently installed system packages";
@ -33,11 +33,11 @@ pkgs.devshell.mkShell {
help = "List currently installed user packages";
command = "bat ~/.local/share/current-user-packages";
}
{
name = "util-diff-system";
help = "Compare current system to ./result";
command = "nvd diff /run/current-system result";
}
# {
# name = "util-diff-system";
# help = "Compare current system to ./result";
# command = "nvd diff /run/current-system result";
# }
{
name = "util-data-dirs";
help = "List XDG_DATA_DIRS in a readable format";
@ -65,7 +65,8 @@ pkgs.devshell.mkShell {
{
name = "store-gc";
help = "Run NixOS garbage collector";
command = "nix-store --gc && sudo nix-collect-garbage -d && flatpak uninstall --unused";
# command = "nix-store --gc && sudo nix-collect-garbage -d && flatpak uninstall --unused";
command = "nh clean all";
}
{
name = "store-optimise";
@ -79,51 +80,51 @@ pkgs.devshell.mkShell {
}
# Rebuild
{
name = "rebuild-switch-nixinator";
help = "Rebuild and activate the nixinator config";
command = "sudo nixos-rebuild switch --flake .#nixinator";
}
{
name = "rebuild-build-nixinator";
help = "Rebuild the nixinator config (to diff systems)";
command = "sudo nixos-rebuild build --flake .#nixinator";
}
{
name = "rebuild-boot-nixinator";
help = "Rebuild and activate config on next boot";
command = "sudo nixos-rebuild boot --flake .#nixinator";
}
{
name = "rebuild-switch-nixtop";
help = "Rebuild and activate the nixtop config";
command = "sudo nixos-rebuild switch --flake .#nixtop";
}
{
name = "rebuild-build-nixtop";
help = "Rebuild and diff the nixtop config (to diff systems)";
command = "sudo nixos-rebuild build --flake .#nixtop";
}
{
name = "rebuild-boot-nixtop";
help = "Rebuild and activate config on next boot";
command = "sudo nixos-rebuild boot --flake .#nixtop";
}
{
name = "rebuild-switch-servenix";
help = "Rebuild and activate the servenix config";
command = "sudo nixos-rebuild switch --flake .#servenix";
}
{
name = "rebuild-build-servenix";
help = "Rebuild and diff the servenix config (to diff systems)";
command = "sudo nixos-rebuild build --flake .#servenix";
}
{
name = "rebuild-boot-servenix";
help = "Rebuild and activate config on next boot";
command = "sudo nixos-rebuild boot --flake .#servenix";
}
# {
# name = "rebuild-switch-nixinator";
# help = "Rebuild and activate the nixinator config";
# command = "sudo nixos-rebuild switch --flake .#nixinator";
# }
# {
# name = "rebuild-build-nixinator";
# help = "Rebuild the nixinator config (to diff systems)";
# command = "sudo nixos-rebuild build --flake .#nixinator";
# }
# {
# name = "rebuild-boot-nixinator";
# help = "Rebuild and activate config on next boot";
# command = "sudo nixos-rebuild boot --flake .#nixinator";
# }
# {
# name = "rebuild-switch-nixtop";
# help = "Rebuild and activate the nixtop config";
# command = "sudo nixos-rebuild switch --flake .#nixtop";
# }
# {
# name = "rebuild-build-nixtop";
# help = "Rebuild and diff the nixtop config (to diff systems)";
# command = "sudo nixos-rebuild build --flake .#nixtop";
# }
# {
# name = "rebuild-boot-nixtop";
# help = "Rebuild and activate config on next boot";
# command = "sudo nixos-rebuild boot --flake .#nixtop";
# }
# {
# name = "rebuild-switch-servenix";
# help = "Rebuild and activate the servenix config";
# command = "sudo nixos-rebuild switch --flake .#servenix";
# }
# {
# name = "rebuild-build-servenix";
# help = "Rebuild and diff the servenix config (to diff systems)";
# command = "sudo nixos-rebuild build --flake .#servenix";
# }
# {
# name = "rebuild-boot-servenix";
# help = "Rebuild and activate config on next boot";
# command = "sudo nixos-rebuild boot --flake .#servenix";
# }
# Help text (this is pretty stupid)
{

View File

@ -25,8 +25,8 @@ with mylib.networking; {
polkit.enable = true;
systemd-networkd = {
inherit hostname;
enable = true;
hostname = hostname;
networks = {
# Default wildcard ethernet network for all hosts
@ -69,7 +69,7 @@ with mylib.networking; {
# keep-derivations = true
# Auto garbage-collect and optimize store
gc.automatic = true;
# gc.automatic = true; # NOTE: Disabled for "nh clean"
gc.options = "--delete-older-than 5d";
settings.auto-optimise-store = true;
optimise.automatic = true;
@ -90,10 +90,12 @@ with mylib.networking; {
# plymouth.enable = true;
loader = {
timeout = 120;
systemd-boot.enable = true;
systemd-boot.configurationLimit = 5;
systemd-boot.editor = false;
systemd-boot.consoleMode = "max";
systemd-boot = {
enable = true;
configurationLimit = 5;
editor = false;
consoleMode = "max";
};
efi.canTouchEfiVariables = true;
efi.efiSysMountPoint = "/boot/efi";
};
@ -132,62 +134,33 @@ with mylib.networking; {
];
};
documentation.enable = true;
documentation.man.enable = true;
documentation.dev.enable = true;
documentation = {
enable = true;
man.enable = true;
dev.enable = true;
};
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
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";
};
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";
};
# https://github.com/NixOS/nixpkgs/issues/179486
i18n.supportedLocales = ["en_US.UTF-8/UTF-8" "de_DE.UTF-8/UTF-8"];
# Enable the X11 windowing system.
services.xserver = {
enable = true;
# Startx replaces the displaymanager so default (lightdm) isn't used, start to shell
# Sadly using this with gnome-session doesn't really work
displayManager.startx.enable = true;
# Plasma
# TODO: Had problems with wayland last time, hopefully I get it to work now
# displayManager.sddm.enable = true;
# desktopManager.plasma5.enable = true;
# desktopManager.plasma5.runUsingSystemd = true;
# Gnome (Wayland)
# NOTE: Not a fan of the overly simplistic nature, also made problems with the audio devices...
# displayManager.gdm.enable = true;
# I had problems with gdm defaulting to X11, after I added this it stopped although I don't know if this was the sole reason
# displayManager.defaultSession = "gnome";
# displayManager.gdm.wayland = true; # This is actually the default
# desktopManager.gnome.enable = true;
wacom.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
programs.hyprland = {
enable = true;
# enableNvidiaPatches = false; # NOTE: Enabled only in nixinator config
# https://github.com/NixOS/nixpkgs/issues/179486
supportedLocales = ["en_US.UTF-8/UTF-8" "de_DE.UTF-8/UTF-8"];
};
# XDG
@ -258,20 +231,6 @@ with mylib.networking; {
addedAssociations = defaultApplications;
};
# Enable sound with pipewire.
sound.enable = false; # Alsa, seems to conflict with PipeWire
hardware.pulseaudio.enable = false; # Get off my lawn
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = false; # TODO: Was needed for low latency but probably not anymore (?) as Bitwig supports Pipewire now
wireplumber.enable = true; # Probably the default
# media-session.enable = false; # Removed upstream
};
fonts = {
enableDefaultPackages = true; # Some default fonts for unicode coverage
fontDir.enable = true; # Puts fonts to /run/current-system/sw/share/X11/fonts
@ -391,21 +350,66 @@ with mylib.networking; {
fuse.userAllowOther = true; # Allow users to mount e.g. samba shares (cifs)
hyprland = {
enable = true;
# enableNvidiaPatches = false; # NOTE: Enabled only in nixinator config
};
nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep 3";
flake = "/home/christoph/NixFlake";
};
# ausweisapp.openFirewall = true; # Directly set port in firewall
};
sound.enable = false; # Alsa, seems to conflict with PipeWire
hardware.pulseaudio.enable = false; # Get off my lawn
# List services that you want to enable:
services = {
# Enable sound with pipewire.
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = false;
wireplumber.enable = true; # Probably the default
# media-session.enable = false; # Removed upstream
};
# Enable the X11 windowing system.
xserver = {
enable = true;
# Startx replaces the displaymanager so default (lightdm) isn't used, start to shell
# Sadly using this with gnome-session doesn't really work
displayManager.startx.enable = true;
wacom.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
libinput.enable = true;
# Enable CUPS to print documents.
printing.enable = true;
printing.drivers = with pkgs; [
# gutenprint
# gutenprintBin
# foomatic-db-ppds-withNonfreeDb
# dell-b1160w # TODO: Broken
];
avahi.enable = true; # Network printers
avahi.nssmdns4 = true;
printing = {
enable = false;
drivers = with pkgs; [
gutenprint
gutenprintBin
foomatic-db-ppds-withNonfreeDb
dell-b1160w # TODO: Broken
];
};
avahi = {
enable = false; # Network printers
nssmdns4 = true;
};
# Enable the OpenSSH daemon.
openssh.enable = true;
@ -441,7 +445,6 @@ with mylib.networking; {
];
};
# TODO: Find a way to organize this better as it's split from the Gnome module, Gnome system module?
gnome.gnome-keyring.enable = true; # TODO: Is probably also needed for Plasma (some apps require it)
# gnome.sushi.enable = true;
# gnome.gnome-settings-daemon.enable = true;

View File

@ -1,11 +1,8 @@
{
inputs,
config,
lib,
mylib,
pkgs,
...
}: rec {
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@ -42,37 +39,33 @@
};
wireguard-tunnels = {
wg0-de-115 = (
wg0-de-115 =
mylib.networking.mkWireguardService
"wg0-de-115"
"proton-de-115.key"
"9+CorlxrTsQR7qjIOVKsEkk8Z7UUS5WT3R1ccF7a0ic="
"194.126.177.14"
);
"194.126.177.14";
wg0-lu-16 = (
wg0-lu-16 =
mylib.networking.mkWireguardService
"wg0-lu-16"
"proton-lu-16.key"
"asu9KtQoZ3iKwELsDTgjPEiFNcD1XtgGgy3O4CZFg2w="
"92.223.89.133"
);
"92.223.89.133";
wg0-kh-8 = (
wg0-kh-8 =
mylib.networking.mkWireguardService
"wg0-kh-8"
"proton-kh-8.key"
"D4M0O60wCBf1nYWOmXRfK7IpgG7VBBwQLeWVFLIqFG4="
"188.215.235.82"
);
"188.215.235.82";
wg0-ch-70 = (
wg0-ch-70 =
mylib.networking.mkWireguardService
"wg0-ch-70"
"proton-ch-70.key"
"17I34jHOMcmI7LKBqxosTfLgwGjO5OKApLcRSPlyymM="
"185.159.157.13"
);
"185.159.157.13";
};
};
};

View File

@ -1,11 +1,4 @@
{
inputs,
config,
lib,
mylib,
pkgs,
...
}: rec {
{mylib, ...}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@ -15,21 +8,19 @@
modules = {
systemd-networkd = {
wireguard-tunnels = {
wg0-de-74 = (
wg0-de-74 =
mylib.networking.mkWireguardService
"wg0-de-74"
"proton-de-74.key"
"fvHmPj3wAKolN80+/KJ3a/DFjMToCsr3iPGwX8+og1g="
"194.126.177.7"
);
"194.126.177.7";
wg0-lu-6 = (
wg0-lu-6 =
mylib.networking.mkWireguardService
"wg0-lu-6"
"proton-lu-6.key"
"EAZS8FTE2sXm8NFD8ViqcO5PMzvnyIHD1ScxX8UxIzE="
"92.223.89.141"
);
"92.223.89.141";
};
};
};