From f2766d8636b524dc7af7fb3e0c1f65a40760c42e Mon Sep 17 00:00:00 2001 From: Wittano Bonarotti Date: Sat, 2 Nov 2024 12:26:35 +0100 Subject: [PATCH] refactor: reduced and finally finished reoganization of dotfiles - removed femttano user from configuration - I don't need it - set up only openbox desktop - simplified syncthing config - I replaced magic config variables by hardcoded $HOME path to my main user - converted wacom home-manager service -> nixos systemd service - added gaming disk to steam.nix - simplified grub theme - I write a hardcorded theme, cause I don't often need to change - extend Golang extraConfig - fixes for other commites files --- home-manager/fish.nix | 11 -- home-manager/games.nix | 12 +- home-manager/ide.nix | 29 ++-- home-manager/lutris.nix | 16 +- home-manager/rofi.nix | 27 ++- hosts/pc/configuration.nix | 272 ++++++++++++++++++++----------- nixos/desktop/xmonad/default.nix | 4 +- nixos/hardware/bootloader.nix | 15 +- nixos/programs/steam.nix | 7 + nixos/services/syncthing.nix | 2 + nixos/services/wacom.nix | 17 +- 11 files changed, 235 insertions(+), 177 deletions(-) diff --git a/home-manager/fish.nix b/home-manager/fish.nix index d37079bf..3b5be531 100644 --- a/home-manager/fish.nix +++ b/home-manager/fish.nix @@ -52,16 +52,6 @@ in options.programs.fish.wittano = { enable = mkEnableOption "Enable custom fish shell config"; enableDirenv = mkEnableOption "Enable direnv"; - systemConfigPath = mkOption { - type = with types; nullOr str; - description = "Location to nix-dotfiles directory"; - default = null; - }; - profileName = mkOption { - type = with types; nullOr str; - description = "System profile name"; - default = null; - }; completions = mkOption { type = with types; attrsOf (either str path); default = { }; @@ -106,7 +96,6 @@ in in { xc = "xprop | grep CLASS"; - re = mkIf (cfg.systemConfigPath != null && cfg.profileName != null) "sudo nixos-rebuild switch --flake ${cfg.systemConfigPath}#${profileName}"; # Programs neofetch = "nix run nixpkgs#neofetch"; diff --git a/home-manager/games.nix b/home-manager/games.nix index 54607548..cd607881 100644 --- a/home-manager/games.nix +++ b/home-manager/games.nix @@ -22,7 +22,7 @@ let runtimeInputs = with pkgs; [ wget cabextract coreutils sudo ]; text = builtins.readFile ./scripts/fixAge2Sync.sh; runtimeEnv = { - STEAM_GAME_DIR = gamingCfg.disk.path; + STEAM_GAME_DIR = "/mnt/gaming/SteamLibrary"; }; }; fixSteamSystemTray = pkgs.writeScriptBin "fixSteamSystemTray" @@ -59,11 +59,6 @@ in options.programs.games = { enable = mkEnableOption "Install unrelated(with Steam, lutris or other launchers) games"; enableDev = mkEnableOption "Enable developer tools to moddling games"; - picomExceptions = mkOption { - type = with types; listOf (either str package); - default = [ ]; - description = "List of installed games or games related staff, which picom should avoid override window properties e.g. rounded corners, window transparency"; - }; }; config = mkIf cfg.enable { @@ -77,10 +72,5 @@ in "\.exe$" "XIVlauncher.Core" ]; - - programs.jetbrains.ides = mkIf cfg.enableDev [ "dotnet" ]; - - # Install wacom drivers if osu-lazor is installed - # modules.hardware.wacom.enable = lists.any (x: strings.hasPrefix "osu" x.name) games; }; } diff --git a/home-manager/ide.nix b/home-manager/ide.nix index 36c2c164..c6a083fb 100644 --- a/home-manager/ide.nix +++ b/home-manager/ide.nix @@ -1,4 +1,4 @@ -{ config, lib, unstable, pkgs, ... }: +{ config, lib, unstable ? pkgs, pkgs, ... }: with lib; with lib.my; let @@ -55,24 +55,27 @@ let }; cpp.package = clion; zig = cpp; - go.package = goland.overrideAttrs (attrs: { - postFixup = (attrs.postFixup or "") + lib.optionalString pkgs.stdenv.isLinux '' - if [ -f $out/goland/plugins/go-plugin/lib/dlv/linux/dlv ]; then - rm $out/goland/plugins/go-plugin/lib/dlv/linux/dlv - fi - - ln -s ${unstable.delve}/bin/dlv $out/goland/plugins/go-plugin/lib/dlv/linux/dlv - ''; - }); + go = { + package = goland.overrideAttrs (attrs: { + postFixup = (attrs.postFixup or "") + lib.optionalString pkgs.stdenv.isLinux '' + if [ -f $out/goland/plugins/go-plugin/lib/dlv/linux/dlv ]; then + rm $out/goland/plugins/go-plugin/lib/dlv/linux/dlv + fi + + ln -s ${unstable.delve}/bin/dlv $out/goland/plugins/go-plugin/lib/dlv/linux/dlv + ''; + }); + extraConfig = { + home.packages = with pkgs; [ golangci-lint ]; + }; + }; dotnet.package = rider; rust.package = rust-rover; jvm.package = idea-ultimate; sql.package = datagrip; web.package = webstorm; andorid.package = unstable.andorid-studio; - haskell.extraConfig = { - programs.nixvim.enable = true; - }; + haskell.extraConfig = fork.extraConfig; fork.extraConfig = { programs.nixvim.enable = true; }; diff --git a/home-manager/lutris.nix b/home-manager/lutris.nix index f0fa6b2e..fba4a134 100644 --- a/home-manager/lutris.nix +++ b/home-manager/lutris.nix @@ -1,16 +1,9 @@ { lib, config, unstable, ... }: with lib; -let - cfg = config.modules.desktop.gaming.lutris; -in { - options = { - modules.desktop.gaming.lutris = { - enable = mkEnableOption "Enable lutris and utilties to run games"; - }; - }; + options.programs.lutris.enable = mkEnableOption "Enable lutris and utilties to run games"; - config = mkIf cfg.enable { + config = mkIf config.programs.lutris.enable { home.packages = with unstable; [ # Lutris lutris @@ -23,10 +16,5 @@ in # FSH steam-run ]; - - # services.picom.wittano.excpetions = home.packages ++ [ - # "wine" - # "\.exe$" - # ]; }; } diff --git a/home-manager/rofi.nix b/home-manager/rofi.nix index ce9da611..f1ea9160 100644 --- a/home-manager/rofi.nix +++ b/home-manager/rofi.nix @@ -1,7 +1,7 @@ -{ config, pkgs, lib, desktopName, ... }: +{ config, pkgs, lib, ... }: with lib; -with lib.my; let + cfg = config.programs.rofi.wittano; toybox = pkgs.toybox; systemd = pkgs.systemd; @@ -20,9 +20,9 @@ let ${systemd}/bin/poweroff ;; "$LOGOUT") - DESKTOP=$(${toybox}/bin/pgrep ${desktopName}) + DESKTOP=$(${toybox}/bin/pgrep ${cfg.desktopName}) if [ -n "$DESKTOP" ]; then - echo "Kill ${desktopName} $DESKTOP" + echo "Kill ${cfg.desktopName} $DESKTOP" kill -9 "$DESKTOP" fi ;; @@ -38,12 +38,25 @@ let }; in { - options.programs.rofi.wittano.enable = mkEnableOption "Enable custom rofi config"; + options.programs.rofi.wittano = { + enable = mkEnableOption "Enable custom rofi config"; + desktopName = mkOption { + type = with types; nullOr str; + default = null; + }; + }; - config = mkIf config.programs.rofi.wittano.enable { + config = mkIf cfg.enable { fonts.fontconfig.enable = true; - home.packages = with pkgs; [ nerdfonts switchOffScript oranchelo-icon-theme ]; + home.packages = + let + script = + if cfg.desktopName != null + then [ switchOffScript ] + else [ ]; + in + with pkgs; [ nerdfonts oranchelo-icon-theme ] ++ script; programs.rofi = { enable = true; diff --git a/hosts/pc/configuration.nix b/hosts/pc/configuration.nix index 35d35499..500535ae 100644 --- a/hosts/pc/configuration.nix +++ b/hosts/pc/configuration.nix @@ -17,6 +17,13 @@ let notify-send -t 2000 "Volume: $(amixer sget Master | awk -F"[][]" '/Left:/ { print $2 }')"; ''; }; + + fixedSignal = pkgs.signal-desktop.overrideAttrs (oldAttrs: { + preFixup = oldAttrs.preFixup + '' + substituteInPlace $out/share/applications/${oldAttrs.pname}.desktop \ + --replace "$out/bin/${oldAttrs.pname}" "$out/bin/${oldAttrs.pname} --use-tray-icon" + ''; + }); in rec { @@ -67,7 +74,6 @@ rec { keyMap = services.xserver.xkb.layout; }; - services.xserver.xkb.layout = "pl"; # Fonts fonts.packages = with pkgs; [ @@ -100,14 +106,23 @@ rec { # Linux Kernel settings boot = { - supportedFilesystems.ntfs = true; + supportedFilesystems = { + ntfs = true; + nfs = true; + }; initrd.availableKernelModules = [ "ahci" "xhci_pci" "sd_mod" "sr_mod" ]; tmp.cleanOnBoot = true; - loader.efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; + loader = { + grub.wittano = { + enable = true; + enableMultiBoot = true; + }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; }; plymouth = { @@ -130,6 +145,7 @@ rec { nvidia.enable = true; samba.enable = true; printers.wittano.enable = true; + bluetooth.wittano.enable = true; }; # Network @@ -149,19 +165,6 @@ rec { extraGroups = [ "wheel" ]; shell = pkgs.fish; }; - - femttano = { - isNormalUser = true; - uid = mkDefault 2137; - shell = pkgs.fish; - extraGroups = [ "gaming" ]; - }; - - labottano = { - isNormalUser = true; - shell = pkgs.fish; - uid = mkDefault 1003; - }; }; catppuccin = { @@ -170,7 +173,17 @@ rec { flavor = "frappe"; }; - programs.fish.enable = true; + programs = { + fish.enable = true; + file-roller.enable = true; # Archive explorer + evince.enable = true; # PDF viever + droidcam.enable = true; + steam.wittano.enable = true; + mihoyo = { + enable = true; + games = [ "honkai-railway" ]; + }; + }; # Home-manager home-manager = @@ -191,7 +204,11 @@ rec { enable = true; enableDirenv = true; }; + + fish.shellAliases.open = "xdg-open"; + mpv.enable = true; }; + qt.wittano.enable = true; gtk.wittano.enable = true; @@ -210,71 +227,129 @@ rec { frequency = "daily"; }; }; + + home.packages = with pkgs; [ + # Utils + flameshot + + # Folder Dialog menu + gnome.zenity + + # Web browser + vivaldi + + # Utils + thunderbird # Mail + gnome.eog # Image viewer + onlyoffice-bin # Office staff + cinnamon.nemo + + # Apps + spotify + logseq + # unstable.joplin-desktop # Notebook + # unstable.vscodium # VS code + minder # Mind maps + # insomnia # REST API Client + gnome.pomodoro + unstable.figma-linux # Figma + + # Security + bitwarden + ]; }; in { extraSpecialArgs = { inherit pkgs unstable lib inputs; }; useUserPackages = true; backupFileExtension = "backup"; - users.wittano = { - programs = { - jetbrains.ides = [ "go" "fork" "python" "cpp" "jvm" ]; - git.wittano.enable = true; - tmux.wittano.enable = true; - neovim.wittano.enable = true; - fish.wittano = { - systemConfigPath = environment.variables.NIX_DOTFILES; - profileName = hostName; + users.wittano = mkMerge [ + { + programs = { + jetbrains.ides = [ "go" "fork" "python" "cpp" "jvm" ]; + git.wittano.enable = true; + rofi.wittano.enable = true; + + games.enable = true; + lutris.enable = true; + + tmux.wittano.enable = true; + neovim.wittano.enable = true; + + fish.shellAliases = { + re = "sudo nixos-rebuild switch --flake ${environment.variables.NIX_DOTFILES}#${hostname}"; + # Projects + pnix = "cd $HOME/nix-dotfiles"; + plab = "cd $HOME/projects/server/home-lab"; + + # Nix + nfu = "nix flake update"; + nfc = "nix flake check"; + repl = "nix repl -f ''"; + + # systemd + scs = "sudo systemctl status"; + scst = "sudo systemctl stop"; + scsta = "sudo systemctl start"; + sce = "sudo systemctl enable --now"; + scr = "sudo systemctl restart"; + sdb = "systemd-analyze blame"; + }; }; - }; - desktop.autostart.desktopName = "xmonad"; + desktop.autostart = { + desktopName = "openbox"; + scriptPath = ".config/openbox/autostart"; + programs = [ + "vivaldi" + "spotify" + ]; + }; - gtk.gtk3.bookmarks = [ - "file://${environment.variables.NIX_DOTFILES} Nix configuration" - "file://${environment.variables.NIX_DOTFILES}/dotfiles Dotfiles" - ]; - home.packages = with pkgs; [ sshs timeNotify showVolume ]; - } // commonConfig; - users.femttano = { - programs = { - games.enable = true; - lutris.wittano.enable = true; - }; - desktop.autostart.desktopName = "openbox"; - services.picom.wittano.exceptions = [ - config.programs.steam.package - ]; - } // commonConfig; - users.labottano = { - home.packages = with pkgs; [ teams ]; - desktop.autostart.desktopName = "openbox"; - } // commonConfig; + gtk.gtk3.bookmarks = [ + "file://${environment.variables.NIX_DOTFILES} Nix configuration" + "file://${environment.variables.NIX_DOTFILES}/dotfiles Dotfiles" + ]; + + home.packages = with pkgs; [ + # Utilities + sshs + + # Tilling WM + timeNotify + showVolume + + # Apps + unstable.figma-linux # Figma + # Web browser + vivaldi + + # Apps + gnome.pomodoro + + # Social media + # telegram-desktop + unstable.freetube # Youtube desktop + fixedSignal # Signal desktop + # element-desktop # matrix communicator + vesktop + # irssi # IRC chat + unstable.streamlink-twitch-gui-bin + ]; + } + commonConfig + ]; }; - services.udisks2 = { - enable = true; - mountOnMedia = true; - }; - - services.devmon.enable = true; - services.gvfs.enable = true; - # Programs services.locate = { enable = true; interval = "21:37"; }; - desktop = { - xmonad = { - enable = true; - users = [ "wittano" ]; - }; - openbox = { - enable = true; - users = [ "femttano" "labottano" ]; - }; + desktop.openbox = { + enable = true; + users = [ "wittano" ]; }; # System @@ -287,47 +362,46 @@ rec { }; }; - services.xserver.xrandrHeads = [ - { - primary = true; - output = "DVI-D-0"; - monitorConfig = '' - Option "PreferredMode" "1920x1080" - ''; - } - { - primary = false; - output = "HDMI-0"; - monitorConfig = '' - Option "PreferredMode" "1920x1080" - Option "RightOf" "DVI-D-0" - ''; - } - ]; - - boot.supportedFilesystems.nfs = true; + virtualisation.docker.wittano.enable = true; - programs = { - droidcam.enable = true; - steam.wittano.enable = true; - mihoyo = { + services = { + udisks2 = { enable = true; - games = [ "honkai-railway" ]; + mountOnMedia = true; }; - }; - boot.loader.grub.wittano = { - enable = true; - theme = inputs.honkai-railway-grub-theme.packages.${system}.dr_ratio-grub-theme; - enableMultiBoot = true; - }; + devmon.enable = true; + gvfs.enable = true; + xserver = { + xkb.layout = "pl"; + xrandrHeads = [ + { + primary = true; + output = "DVI-D-0"; + monitorConfig = '' + Option "PreferredMode" "1920x1080" + ''; + } + { + primary = false; + output = "HDMI-0"; + monitorConfig = '' + Option "PreferredMode" "1920x1080" + Option "RightOf" "DVI-D-0" + ''; + } + ]; + wacom.wittano.enable = true; + }; - virtualisation.docker.wittano.enable = true; - services = { boinc.wittano.enable = true; backup.enable = true; rss.enable = true; syncthing.wittano.enable = true; filebot.wittano.enable = true; + displayManager.sddm.wittano = { + enable = true; + package = pkgs.catppuccin-sddm-corners; + }; }; } diff --git a/nixos/desktop/xmonad/default.nix b/nixos/desktop/xmonad/default.nix index 8e6c8d9a..f2577b66 100644 --- a/nixos/desktop/xmonad/default.nix +++ b/nixos/desktop/xmonad/default.nix @@ -41,8 +41,8 @@ in config = ./src/Main.hs; libFiles = trivial.pipe ./src [ builtins.readDir - (attrsets.filterAttrs (n: v: builtins.typeOf v == "set" && strings.hasPrefix "Main" n == false)) - (builtins.mapAttrs (n: v: pkgs.writeText n (builtins.readFile v.source))) + (attrsets.filterAttrs (n: v: strings.hasPrefix "Main" n == false)) + (builtins.mapAttrs (n: v: pkgs.writeText n (builtins.readFile (./src + "/${n}")))) ]; }; }; diff --git a/nixos/hardware/bootloader.nix b/nixos/hardware/bootloader.nix index bbcba432..099178a0 100644 --- a/nixos/hardware/bootloader.nix +++ b/nixos/hardware/bootloader.nix @@ -1,27 +1,22 @@ -{ config, pkgs, lib, ... }: +{ config, lib, inputs, ... }: with lib; -with lib.my; let cfg = config.boot.loader.grub.wittano; + theme = inputs.honkai-railway-grub-theme.packages.x86_64-linux.dr_ratio-grub-theme; in { options.boot.loader.grub.wittano = { enable = mkEnableOption "Enable GRUB2 as bootloader"; - theme = mkOption { - type = types.nullOr types.package; - default = null; - example = pkgs.nixos-grub2-theme; - description = "Set GRUB theme"; - }; enableMultiBoot = mkEnableOption "Enable os-probe to detect other systems"; }; config = { boot.loader.grub = rec { - splashImage = mkIf (cfg.theme != null) "${cfg.theme}/background.png"; + inherit theme; + + splashImage = "${theme}/background.png"; efiSupport = enable; enable = cfg.enable; - theme = cfg.theme; device = "nodev"; useOSProber = cfg.enableMultiBoot; }; diff --git a/nixos/programs/steam.nix b/nixos/programs/steam.nix index bf0f876c..1ae1b05a 100644 --- a/nixos/programs/steam.nix +++ b/nixos/programs/steam.nix @@ -35,6 +35,13 @@ in wineWowPackages.full ]; }; + + fileSystems = { + "/mnt/gaming" = { + device = "/dev/disk/by-label/GAMING"; + fsType = "ext4"; + }; + }; }; } diff --git a/nixos/services/syncthing.nix b/nixos/services/syncthing.nix index b0dda400..a1b64046 100644 --- a/nixos/services/syncthing.nix +++ b/nixos/services/syncthing.nix @@ -11,6 +11,8 @@ in services.syncthing = { enable = cfg.enable; systemService = true; + dataDir = "/home/wittano/.cache/syncthing"; + configDir = "/home/wittano/.config/syncthing"; user = "wittano"; settings = { folders = { diff --git a/nixos/services/wacom.nix b/nixos/services/wacom.nix index b2932793..ecb6f7ba 100644 --- a/nixos/services/wacom.nix +++ b/nixos/services/wacom.nix @@ -36,19 +36,16 @@ in environment.systemPackages = [ setupWacom ]; systemd.user.services.${name} = { - unit = { - Description = "Map tablet to primary display"; - After = [ "graphical-session-pre.target" ]; - PartOf = [ "graphical-session.target" ]; - }; + description = "Map tablet to primary display"; + after = [ "graphical-session-pre.target" ]; + partOf = [ "graphical-session.target" ]; - service = { - Type = "oneshot"; - ExecStart = meta.getExe setupWacom; - Environment = [ ''DISPLAY=":0"'' ]; + environment = { + DISPLAY = ''":0"''; }; + script = meta.getExe setupWacom; - install.WantedBy = [ "graphical-session.target" ]; + wantedBy = [ "graphical-session.target" ]; }; }; }