refactor: make the whole thing more generic

This commit is contained in:
2024-04-02 16:28:57 +02:00
parent 7b648e1955
commit 651f3ad808
193 changed files with 763 additions and 521 deletions

View File

@@ -1,4 +1,6 @@
# Home Manager Configuration
# TheaninOS
A NixOS based OS you can configure.
Rebuild the configuration
@@ -36,14 +38,3 @@ After that reload the shell
nix flake update
sudo nixos-rebuild switch --flake .#
```
## Adapting the config
Few not so obvious things you might wanna adjust (non-exhaustive):
- The default layout is configured for my [CharaChorder 1](https://www.charachorder.com/en-de/products/charachorder-one).
You probably don't want that, though most you won't notice.
- **Subpixel rendering is set up for a BGR layout.** Most likely you'll have an RGB layout.
- Hyprland is configured with a layout that works on a 43" screen. You'll probably want to adjust that.a
- Keybinds in Hyprland are made to work on my [CharaChorder 1](https://www.charachorder.com/en-de/products/charachorder-one).
They'll be horrible to use on a qwerty keyboard.

View File

@@ -49,6 +49,7 @@
ags = ags.packages.${prev.system}.default;
gbmonctl = prev.callPackage ./overlays/gbmonctl { };
lpc21isp = prev.callPackage ./overlays/lpc21isp { };
darkman = prev.callPackage ./overlays/darkman { };
cura = prev.appimageTools.wrapType2 rec {
name = "cura";
version = "5.6.0";
@@ -63,24 +64,24 @@
];
});
mkHost = { hostname, username, desktop, system, stateVersion, }:
mkHost = { hostname, username, system }:
nixpkgs.lib.nixosSystem {
pkgs = legacyPackages.${system};
modules = [
./modules/nixos/gbmonctl
./modules/nixos
./hosts/${hostname}
home-manager.nixosModules.home-manager
{
_module.args = { inherit username; };
networking.hostName = hostname;
system.stateVersion = stateVersion;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit username desktop stateVersion inputs;
extraSpecialArgs = { inherit username inputs; };
users.${username} = {
imports =
[ ./modules/home-manager ./hosts/${hostname}/home.nix ];
};
users.${username} = import ./home;
};
}
];
@@ -90,9 +91,7 @@
nixosConfigurations.MONSTER = mkHost {
hostname = "MONSTER";
username = "theaninova";
desktop = "hyprland";
system = "x86_64-linux";
stateVersion = "23.05";
};
};
}

View File

@@ -1,71 +0,0 @@
{ pkgs, config, ... }: {
services.darkman = let
wallpaperPath = "${config.home.homeDirectory}/.local/state/wallpaper.jpg";
in {
enable = false;
package = pkgs.buildGoModule rec {
pname = "darkman";
version = "1.5.4";
src = pkgs.fetchFromGitLab {
owner = "WhyNotHugo";
repo = "darkman";
rev = "5332193777fb0c5dbde6cbfd015a16697d6a0c8e";
hash = "sha256-3TGDy7hiI+z0IrA+d/Q+rMFlew6gipdpXyJ5eVLCmds=";
};
vendorHash = "sha256-xEPmNnaDwFU4l2G4cMvtNeQ9KneF5g9ViQSFrDkrafY=";
nativeBuildInputs = [ pkgs.scdoc ];
postPatch = ''
substituteInPlace darkman.service \
--replace "/usr/bin/darkman" "$out/bin/darkman"
substituteInPlace contrib/dbus/nl.whynothugo.darkman.service \
--replace "/usr/bin/darkman" "$out/bin/darkman"
substituteInPlace contrib/dbus/org.freedesktop.impl.portal.desktop.darkman.service \
--replace "/usr/bin/darkman" "$out/bin/darkman"
'';
buildPhase = ''
runHook preBuild
make build
runHook postBuild
'';
installPhase = ''
runHook preInstall
make PREFIX=$out install
runHook postInstall
'';
meta = with pkgs.lib; {
description =
"Framework for dark-mode and light-mode transitions on Linux desktop";
homepage = "https://gitlab.com/WhyNotHugo/darkman";
license = licenses.isc;
maintainers = [ maintainers.ajgrf ];
platforms = platforms.linux;
mainProgram = "darkman";
};
};
settings = {
lat = 52.52;
lng = 13.405;
};
darkModeScripts = {
kitty-theme =
# bash
''
${pkgs.kitty}/bin/kitty +kitten themes --reload-in=all --config-file-name ${config.home.homeDirectory}/.config/kitty/current-colors.conf Catppuccin-Frappe
'';
};
lightModeScripts = {
kitty-theme =
# bash
''
${pkgs.kitty}/bin/kitty +kitten themes --reload-in=all --config-file-name ${config.home.homeDirectory}/.config/kitty/current-colors.conf Catppuccin-Latte
'';
};
};
}

View File

@@ -1,243 +0,0 @@
{ config, pkgs, lib, ... }: {
imports = [ ./darkman.nix ];
wayland.windowManager.hyprland = {
enable = true;
systemd = {
enable = true;
variables = [ "--all" ];
};
settings = {
env = [
"LIBVA_DRIVER_NAME,nvidia"
"XDG_SESSION_TYPE,wayland"
"GBM_BACKEND,nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
"WLR_NO_HARDWARE_CURSORS,1"
"NIXOS_OZONE_WL,1"
# Gnome file manager fix
"GIO_EXTRA_MODULES,${pkgs.gnome.gvfs}/lib/gio/modules"
];
exec-once = [
"systemctl --user start hyprland-session.target"
"gnome-keyring-daemon --start --components=secrets"
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
];
general = {
layout = "master";
resize_on_border = true;
};
master = {
orientation = "center";
new_is_master = true;
always_center_master = true;
mfact = 0.4;
};
input = {
accel_profile = "flat";
kb_layout = "cc1-thea";
};
bind = import ./keybinds.nix;
bindm = import ./mousebinds.nix;
bindr = [ "SUPER,SUPER_L,exec,pkill anyrun || anyrun" ];
monitor = [ "DP-1,highrr,0x0,1" "DP-1,addreserved,250,0,0,0" ];
workspace = [
"special:calc,border:false,gapsout:200,on-created-empty:[noanim;silent] kitty -e qalc"
];
windowrulev2 = let
firefoxPip = "class:^(firefox)$,title:^(Picture-in-Picture)$";
firefoxPipInitial = "class:^(firefox)$,title:^(Firefox)$";
in [
"keepaspectratio,${firefoxPip}"
"noborder,${firefoxPip}"
"float,${firefoxPip}"
"float,${firefoxPipInitial}"
"pin,${firefoxPip}"
"pin,${firefoxPipInitial}"
"fakefullscreen,${firefoxPip}"
"fakefullscreen,${firefoxPipInitial}"
"move 22 72,${firefoxPip}"
"move 22 72,${firefoxPipInitial}"
# For some reason it really wants to be maximized
"suppressevent maximize,class:^(neovide)$"
# pinentry
"dimaround,class:^(gcr-prompter)$"
"noborder,class:^(gcr-prompter)$"
"rounding 10,class:^(gcr-prompter)$"
"animation slide,class:^(gcr-prompter)$"
# Flameshot fixes
"float,class:^(flameshot)$"
"animation fade,class:^(flameshot)$"
];
xwayland.force_zero_scaling = true;
misc = {
layers_hog_keyboard_focus = false;
disable_splash_rendering = true;
force_default_wallpaper = 0;
vrr = 1;
};
layerrule = [ "blur, anyrun" "ignorealpha 0.3, anyrun" ];
decoration = {
drop_shadow = "yes";
shadow_range = 16;
"col.shadow" = "rgba(00000044)";
dim_inactive = false;
blur = {
enabled = true;
size = 8;
passes = 3;
noise = 1.0e-2;
contrast = 0.9;
brightness = 0.8;
};
};
opengl.nvidia_anti_flicker = true;
animations = {
enabled = "yes";
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
animation = [
"windows, 1, 5, myBezier"
"windowsOut, 1, 7, default, popin 80%"
"border, 1, 10, default"
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
};
};
services.kdeconnect = {
enable = true;
indicator = true;
};
services.flameshot = {
enable = true;
package = pkgs.flameshot.overrideAttrs (final: prev: {
cmakeFlags = [ "-DUSE_WAYLAND_CLIPBOARD=1" "-DUSE_WAYLAND_GRIM=true" ];
nativeBuildInputs = prev.nativeBuildInputs
++ [ pkgs.libsForQt5.kguiaddons ];
});
settings = {
General = {
uiColor = "#99d1db";
showDesktopNotification = false;
disabledTrayIcon = true;
};
};
};
programs.ags = {
enable = true;
configDir = ./ags;
};
xdg.configFile.ags.onChange = ''
${pkgs.procps}/bin/pkill -u $USER -USR2 ags || true
'';
systemd.user.services.ags = {
Unit = {
Description = "ags";
PartOf = [ "graphical-session.target" "tray.target" ];
};
Service = {
ExecStart = "${pkgs.ags}/bin/ags";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
Restart = "always";
KillMode = "mixed";
Environment = "PATH=/run/current-system/sw/bin/:${
with pkgs;
lib.makeBinPath [
swww
sassc
glib
brightnessctl
ydotool
kitty
hyprpicker
]
}";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
programs.kitty = import ./kitty.nix { inherit pkgs; };
programs.anyrun = import ./anyrun.nix { inherit pkgs; };
services.udiskie.enable = true;
services.udiskie.tray = "never";
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
# fonts
noto-fonts
# essentials
hyprpicker
grim
slurp
wl-clipboard
polkit_gnome
xdg-desktop-portal-gtk
# qt/kde packages
qt6.qtwayland
qt5.qtwayland
kdePackages.breeze-icons
# gnome packages
evince
gnome.gvfs
gnome.gnome-keyring
gnome.nautilus
gnome.gnome-calendar
gnome.gnome-characters
gnome.gnome-contacts
gnome.gnome-clocks
gnome.gnome-calculator
gnome.simple-scan
gnome.eog
gnome.geary
gnome.ghex
gnome.gnome-weather
gnome.gnome-keyring
gnome.gnome-disk-utility
# fixes
xorg.xrandr
];
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
gtk = {
enable = true;
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
#gtk3.extraCss = builtins.readFile ./gtk.css;
#gtk4.extraCss = builtins.readFile ./gtk.css;
iconTheme = {
name = "Tela";
package = pkgs.tela-icon-theme;
};
};
qt = {
enable = true;
platformTheme = "qtct";
};
programs.fish.loginShellInit =
# fish
''
Hyprland && echo "goodbye" && exit 0 \
|| echo "$status couldn't launch Hyprland" && tty | grep tty1 \
&& echo "refusing to autologin without Hyprland on tty1" && exit 0 \
|| echo "not on tty1, letting in"
'';
home = {
pointerCursor = {
gtk.enable = true;
package = pkgs.capitaine-cursors;
name = "capitaine-cursors";
};
file.".config/hypr/shaders" = {
source = ./hypr/shaders;
recursive = true;
};
};
}

View File

@@ -1,8 +1,5 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, username, ... }: {
imports = [ ./nvidia.nix ./hardware-configuration.nix ];
imports = [ ./hardware-configuration.nix ];
nix = {
settings.experimental-features = [ "nix-command" "flakes" ];
@@ -15,118 +12,47 @@
# Bootloader.
boot = {
quiet.enable = true;
kernelPackages = pkgs.linuxPackages_latest;
loader = {
timeout = 0;
systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
consoleMode = "max";
};
efi.canTouchEfiVariables = true;
};
supportedFilesystems = [ "ntfs" ];
# Silent Boot
kernelParams = [
# Redirect all kernel messages to a console off screen
#"fbcon=vc:2-6"
#"console=tty1"
"video=3840x2160@144"
# "splash"
# "quiet"
#"rd.udev.log_level=3"
#"rd.systemd.show_status=false"
#"udev.log_priority=3"
#"boot.shell_on_fail"
#"vt.global_cursor_default=0" # no cursor blinking
];
consoleLogLevel = 0;
initrd.verbose = false;
# Virtual Camera/Mic
kernelModules = [ "v4l2loopback" "snd-aloop" "sg" ];
extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback.out ];
extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 card_label="Virtual Camera"
'';
};
# Audio
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
desktops.hyprland.enable = true;
locale.preset.theaninova.enable = true;
hardware = {
nvidia.preset.proprietary.enable = true;
audio.preset.pipewire.enable = true;
cc1.enable = true;
fv43u.enable = true;
virtual-camera.enable = true;
# https://github.com/NixOS/nixpkgs/pull/300682
# hid-fanatecff.enable = true;
};
# https://github.com/NixOS/nixpkgs/pull/300682
# hardware.hid-fanatecff.enable = true;
hardware.gbmonctl.enable = true;
hardware.sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
};
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.dbus.enable = true;
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-kde ];
};
time.timeZone = "Europe/Berlin";
i18n = {
inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ anthy ];
fonts = {
fira-code = {
enable = true;
default = true;
};
defaultLocale = "en_GB.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";
noto-sans = {
enable = true;
default = true;
};
nerdfonts.enable = true;
};
# Configure keymap in X11
console.useXkbConfig = true;
services.xserver.xkb = {
layout = "cc1-thea";
extraLayouts.cc1-thea = {
description = "A CC1 optimized layout";
languages = [ "eng" "ger" ];
symbolsFile = ../../modules/cc1-thea;
};
};
services.pcscd.enable = true;
# nautilus on non-gnome
services.gvfs.enable = true;
# fix pinentry on non-gnome
services.dbus.packages = with pkgs; [ gcr ];
services.gnome.gnome-online-accounts.enable = true;
services.gnome.evolution-data-server.enable = true;
services.airprint.enable = true;
services.udev.packages = with pkgs; [ oversteer android-udev-rules ];
@@ -135,14 +61,7 @@
setSocketVariable = true;
};
# Define a user account. Don't forget to set a password with passwd.
services.getty.autologinUser = "${username}";
services.getty.extraArgs = [ "--noclear" "--noissue" "--nonewline" ];
services.getty.loginOptions = "-p -f -- \\u"; # preserve environment
programs.hyprland.enable = true;
programs.fish.enable = true;
programs.kdeconnect.enable = true;
security.sudo.configFile = ''
Defaults env_reset,pwfeedback,passprompt="󰟵 "
'';
@@ -154,7 +73,6 @@
"wheel"
"audio"
"video"
"dialout"
"plugdev"
"scanner"
"lp"
@@ -165,7 +83,6 @@
};
# List packages installed in system profile. To search, run:
environment.sessionVariables.NIXOS_OZONE_WL = "1";
environment.systemPackages = with pkgs; [
gamemode
# Essential utils
@@ -194,26 +111,6 @@
docker-compose
];
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
fira-code
(nerdfonts.override {
fonts = [ "FiraCode" "JetBrainsMono" "Noto" "NerdFontsSymbolsOnly" ];
})
];
fontconfig = {
defaultFonts = {
monospace = [ "FiraCode Nerd Font" ];
sansSerif = [ "Noto Sans Nerd Font" ];
};
localConf = builtins.readFile ./fontconfig.xml;
subpixel.rgba = "bgr";
};
};
networking = {
firewall = {
allowedTCPPorts = [ 8100 5037 5173 ];
@@ -246,4 +143,6 @@
device = "/dev/sda2";
fsType = "ntfs";
};
system.stateVersion = "23.05";
}

View File

@@ -1,17 +0,0 @@
<match target="font">
<test name="family" compare="contains">
<string>Fira</string>
</test>
<!-- https://github.com/tonsky/FiraCode/wiki/How-to-enable-stylistic-sets -->
<edit name="fontfeatures" mode="append">
<string>zero</string>
<string>onum</string>
<string>ss04</string>
<string>cv19</string>
<string>cv23</string>
<string>ss09</string>
<string>ss06</string>
<string>ss07</string>
<string>ss10</string>
</edit>
</match>

View File

@@ -1,38 +0,0 @@
{ config, lib, pkgs, ... }: {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [ libvdpau-va-gl nvidia-vaapi-driver ];
};
services.xserver.videoDrivers = [ "nvidia" ];
boot.kernelParams = [ "nvidia_drm.fbdev=1" ];
boot.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
boot.initrd.kernelModules =
[ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
hardware.nvidia = {
modesetting.enable = true;
# seems to cause crashes on sleep
powerManagement.enable = false;
open = true;
nvidiaSettings = false;
# no idea if this actually does anything...
nvidiaPersistenced = false;
};
environment = {
variables = {
VDPAU_DRIVER = "va_gl";
LIBVA_DRIVER_NAME = "nvidia";
};
systemPackages = with pkgs; [
glxinfo
nvtopPackages.nvidia
libva-utils
vulkan-tools
];
};
}

View File

@@ -1,6 +1,7 @@
{ username, desktop, stateVersion, osConfig, inputs, ... }: rec {
{ username, desktop, stateVersion, osConfig, inputs, ... }: {
home = {
inherit username stateVersion;
stateVersion = osConfig.system.stateVersion;
inherit username;
homeDirectory = "/home/${username}";
};
imports = [
@@ -13,6 +14,6 @@
./packages
./programs
./services
./desktops/${desktop}
./desktops/hyprland
];
}

View File

Before

Width:  |  Height:  |  Size: 428 KiB

After

Width:  |  Height:  |  Size: 428 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 127 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Some files were not shown because too many files have changed in this diff Show More