From d9ba963dadc2c0e0c566046fab5ee83829d56c5b Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 30 May 2024 13:07:50 +0200 Subject: [PATCH] Migrate explicit imports to home manager imports That way I do not need to explicitly provide dependencies. But home-manager will pass all the special args. --- home.nix | 72 +--- home/accounts.nix | Bin 2855 -> 2871 bytes home/dconf.nix | 53 +-- home/files.nix | 8 +- home/gtk.nix | 54 +-- home/home.nix | 4 +- home/packages.nix | 161 ++++---- home/packages/custom/default.nix | 33 +- home/programs.nix | 101 ++--- home/programs/nix.nix | 34 +- home/qt.nix | 11 +- home/services.nix | 37 +- home/systemd.nix | 19 +- home/windowManager/i3.nix | 653 ++++++++++++++++--------------- home/xdg.nix | 236 +++++------ home/xsession.nix | 29 +- 16 files changed, 751 insertions(+), 754 deletions(-) diff --git a/home.nix b/home.nix index 4411f48..e46b0d5 100644 --- a/home.nix +++ b/home.nix @@ -5,10 +5,10 @@ ,... }: -let - hostName = builtins.replaceStrings ["\n"] [""] (builtins.readFile /etc/hostname); - -in { +{ + _module.args = { + hostName = builtins.replaceStrings ["\n"] [""] (builtins.readFile /etc/hostname); + }; imports = [ ./home/modules/programs/cmus.nix @@ -16,6 +16,22 @@ in { ./home/modules/programs/languagetool.nix ./home/modules/programs/mailhog.nix ./home/modules/programs/my-pidgin.nix + + ./home/accounts.nix + ./home/programs/nix.nix + ./home/files.nix + ./home/packages.nix + ./home/packages/custom + ./home/home.nix + ./home/programs.nix + ./home/xsession.nix + ./home/windowManager/i3.nix + ./home/xdg.nix + ./home/dconf.nix + ./home/qt.nix + ./home/gtk.nix + ./home/services.nix + ./home/systemd.nix ]; disabledModules = [ @@ -38,64 +54,16 @@ in { # changes in each release. stateVersion = "22.05"; - packages = import ./home/packages.nix { - inherit pkgs hostName; - }; - - file = import ./home/files.nix { }; - - } // import ./home/home.nix { - inherit config pkgs hostName; }; targets.genericLinux.enable = true; - accounts = import ./home/accounts.nix { - inherit config pkgs; - }; - - nix = import ./home/programs/nix.nix { - inherit pkgs; - }; - - programs = import ./home/programs.nix { - inherit config pkgs hostName; - }; - fonts.fontconfig.enable = true; - xsession = import ./home/xsession.nix { - inherit config pkgs hostName; - }; - - xdg = import ./home/xdg.nix { - inherit pkgs; - }; - - dconf = import ./home/dconf.nix { - inherit lib; - }; - - qt = import ./home/qt.nix { - inherit pkgs; - }; - gtk = import ./home/gtk.nix { - inherit config pkgs; - }; - - services = import ./home/services.nix { - inherit config hostName pkgs; - }; - - systemd.user = import ./home/systemd.nix { - inherit config pkgs; - }; - nixpkgs.config = { allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ ]; permittedInsecurePackages = [ ]; }; - } diff --git a/home/accounts.nix b/home/accounts.nix index 265ce85b2fffe2ba871ca1744fb78bfee37130fc..58da549e2e704471676255c1e0e3fb8b7572e265 100644 GIT binary patch literal 2871 zcmV-73&`{UM@dveQdv+`0AjGFC1N2PH*KaK)G$s=!y>yeBbw|H7nc3R2(w!Hkx8R8>mqf3N4=oOVW!;to!cJCGkqW!1s( z_b(!xR}&Xs%>}o3turNnZ9+bU0i9<>8aOl3|Efa|)3r>-VXrU?LQMGP8()XsW#~fj z1CbHa>qFneYtaGfnY!GN{6-TUJAxwQITJqyViVXdKu_8aGhE%L&gF)=TebB2en^qV z9OS$hc=*|l2UOH`lNhj6k=$kBb?fV;$jhdt>^Z((D+PvbxETs?3?95h7lr5qkk>6$ zdFB?4kWY@`^3=G*fdl3Kg@DNx)eQL|0gD2VyjvD#DB_b`)QC5p34kga$fj1pi@dY7 z`{TtAZf?&?<5S8M_y5LgOY^>;Jhy^Tkopf4zY7C(-{hJ8ADmS1>iMP1QK%ynj9Rne zciEJ<;m!)&i>8u~N_OZ3L&>&R00-E8K)*pmD!Pg=lumXG&d?ec96nb*@{|`oFxL)_ z_Mb%Sc$oHkxF3?^Srw8mf_w4zlXpQJ92Ofc%k7uD8HW4@+~!!_9AUu!#W%<9Y@x?d zy=pQG0X?D}lB``iHv7xVnMLekT5r>5A?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mjVBq*(#sQWZUV)4+E`FW$!hAXoB`CN z`v4u=x$ewl)ZwQHpFp~6v$8aX1?yWXqj!-ai>emkb-dPFXm)p#=o!Q{v~DwDTP{;& zSu0n3$Cq5}PB=sfV#%@kkk6m%7?)y< zIML-hv|-jKeg)buH2T^GOSScSt$6=VvmzF3aP|5(Dop-*BmoO*MNO`@oXzDrU|D^U zTD?AMN|MKl+p7nt$~6b&^5De;>z;DedL#)2%R6 zlW^y&%N^UiRsGBU*;y!YD*1UeEI!0=1tPqlOSnPW$2OIWLHOJMre@&OA`)pnCh)*8 zR3%u%ct~zG8hqjBtQZ87+p&BV-h@}gjg^M)We5W2?`e${111v^jo<#R(fcu?nnp^} z-$Z{%tTSMCwPmx~Z;vGbRqn`bpn{lES#*eFOKYKnSXS$|;1Hbk6T*DeNGl{e(c1d; FP*)snlf(c3 diff --git a/home/dconf.nix b/home/dconf.nix index dc90c13..16b14cd 100644 --- a/home/dconf.nix +++ b/home/dconf.nix @@ -1,34 +1,37 @@ { lib + ,... }: { - enable = true; - settings = { - "org/gtk/settings/file-chooser" = { - date-format = "with-time"; - location-mode = "path-bar"; - show-hidden = false; - show-size-column = true; - show-type-column = true; - sidebar-width = 249; - sort-column = "size"; - sort-directories-first = true; - sort-order = "ascending"; - type-format = "category"; - window-position = lib.hm.gvariant.mkTuple [652 415]; - window-size = lib.hm.gvariant.mkTuple [1256 634]; - }; + dconf = { + enable = true; + settings = { + "org/gtk/settings/file-chooser" = { + date-format = "with-time"; + location-mode = "path-bar"; + show-hidden = false; + show-size-column = true; + show-type-column = true; + sidebar-width = 249; + sort-column = "size"; + sort-directories-first = true; + sort-order = "ascending"; + type-format = "category"; + window-position = lib.hm.gvariant.mkTuple [652 415]; + window-size = lib.hm.gvariant.mkTuple [1256 634]; + }; - "org/gnome/sound-juicer" = { - audio-profile = "audio/mpeg"; - base-uri = "file:///home/daniels/Music"; - device = "/dev/sr0"; - eject = true; - file-pattern = "%dn - %tt"; - path-pattern = "%aa/%at"; - strip-special = true; - volume = 1.0; + "org/gnome/sound-juicer" = { + audio-profile = "audio/mpeg"; + base-uri = "file:///home/daniels/Music"; + device = "/dev/sr0"; + eject = true; + file-pattern = "%dn - %tt"; + path-pattern = "%aa/%at"; + strip-special = true; + volume = 1.0; + }; }; }; } diff --git a/home/files.nix b/home/files.nix index 2565430..3fd7c8b 100644 --- a/home/files.nix +++ b/home/files.nix @@ -1,7 +1,9 @@ _: { - ".nix-channels".source = ./files/nix-channels; - ".profile".source = ./files/profile; - ".myclirc".source = ./files/myclirc; + home.file = { + ".nix-channels".source = ./files/nix-channels; + ".profile".source = ./files/profile; + ".myclirc".source = ./files/myclirc; + }; } diff --git a/home/gtk.nix b/home/gtk.nix index 9211fd7..eac7c50 100644 --- a/home/gtk.nix +++ b/home/gtk.nix @@ -1,6 +1,7 @@ { config ,pkgs + ,... }: # Possible alternatives: @@ -9,39 +10,40 @@ # And maybe use https://github.com/themix-project/oomox to adjust the color to follow my color scheme { - enable = true; + gtk = { + enable = true; - theme = { - package = pkgs.qogir-theme; - name = "Qogir-Dark"; - }; + theme = { + package = pkgs.qogir-theme; + name = "Qogir-Dark"; + }; - iconTheme = { - package = pkgs.qogir-icon-theme; - name = "Qogir-dark"; - }; + iconTheme = { + package = pkgs.qogir-icon-theme; + name = "Qogir-dark"; + }; - font = { - package = pkgs.roboto-mono; - name = "Roboto Mono"; - size = 14; - }; + font = { + package = pkgs.roboto-mono; + name = "Roboto Mono"; + size = 14; + }; - gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; - gtk3 = { - bookmarks = [ - "file:///home/daniels/Downloads Downloads" - ]; - extraConfig = { + gtk3 = { + bookmarks = [ + "file:///home/daniels/Downloads Downloads" + ]; + extraConfig = { + gtk-application-prefer-dark-theme = 1; + gtk-enable-animations = 0; + }; + }; + + gtk4.extraConfig = { gtk-application-prefer-dark-theme = 1; gtk-enable-animations = 0; }; }; - - gtk4.extraConfig = { - gtk-application-prefer-dark-theme = 1; - gtk-enable-animations = 0; - }; - } diff --git a/home/home.nix b/home/home.nix index baa6384..5bebd66 100644 --- a/home/home.nix +++ b/home/home.nix @@ -2,6 +2,7 @@ config ,pkgs ,hostName + ,... }: let @@ -9,7 +10,7 @@ let deLocale = "de_DE.utf8"; in { - + home = { language = { # English @@ -104,4 +105,5 @@ in { }; enableNixpkgsReleaseCheck = true; + }; } diff --git a/home/packages.nix b/home/packages.nix index 22d6b8a..11d9010 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -1,101 +1,102 @@ { pkgs ,hostName + ,... }: -with pkgs; [ - nix - cacert - nvd +{ + home.packages = with pkgs; [ + nix + cacert + nvd - # System tools - dmenu - gnome.gnome-screenshot - libnotify # Provide notify-send command + # System tools + dmenu + gnome.gnome-screenshot + libnotify # Provide notify-send command - networkmanager_dmenu - i3blocks - st - ncdu - tree + networkmanager_dmenu + i3blocks + st + ncdu + tree - borgbackup - keepassxc - # Git itself is installed via git module - git-crypt + borgbackup + keepassxc + # Git itself is installed via git module + git-crypt - rclone + rclone - # Dev tools - litecli - sqlite - mycli - mkcert # TODO: Create own wrapper script to create new certs - tig - universal-ctags - ripgrep - curl - wget - # Can be installed ad-hock, I don't need it that often. - # kcachegrind - # Should be part of shell.nix for corresponding projects - # geckodriver + # Dev tools + litecli + sqlite + mycli + mkcert # TODO: Create own wrapper script to create new certs + tig + universal-ctags + ripgrep + curl + wget + # Can be installed ad-hock, I don't need it that often. + # kcachegrind + # Should be part of shell.nix for corresponding projects + # geckodriver - podman-compose - # Dependencies of podman-compose - podman + podman-compose + # Dependencies of podman-compose + podman - # Coding / Neovim - # Does not provide any autocompletion yet, don't know why - # Use in conjuncion with https://github.com/autozimu/LanguageClient-neovim - # rnix-lsp + # Coding / Neovim + # Does not provide any autocompletion yet, don't know why + # Use in conjuncion with https://github.com/autozimu/LanguageClient-neovim + # rnix-lsp - # Communication - thunderbird + # Communication + thunderbird - # Media - vlc - # gtkpod - feh - # python311Packages.mutagen - # spotdl - # tenacity - # Typical download looks like: yt-dlp -S 'res:700,ext:mp4' - # Output file name can be improved: -o 'Staffel-04/S04E%(video_autonumber+9)2.0d - %(fulltitle)s.%(ext)s' - yt-dlp - # Start Google Chrome: NIXPKGS_ALLOW_UNFREE=1 nix-shell -p google-chrome --run google-chrome-stable - ffmpeg-full # full in order to grab x11 - # Recording system audio while keeping audio quite: - # ffmpeg -f pulse -i default output.mp3 - # Change recording from output to monitor: https://askubuntu.com/questions/682144/capturing-only-desktop-audio-with-ffmpeg/682793#682793 - # Split large file into chunks (https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks): - # ffmpeg -i output.mp3 -c copy -map 0 -segment_time 00:15:00 -f segment output%03d.mp3 - # Combine multiple files: https://trac.ffmpeg.org/wiki/Concatenate - # Record audio and video on ubuntu: ffmpeg -f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -f x11grab -y -framerate 30 -s 1280x720 -i :0.0 -c:v libx264 -preset superfast -crf 18 output.mkv - # Find list of audio on ubuntu: pactl list | grep -A2 'Source #' | grep 'Name: ' + # Media + vlc + # gtkpod + feh + # python311Packages.mutagen + # spotdl + # tenacity + # Typical download looks like: yt-dlp -S 'res:700,ext:mp4' + # Output file name can be improved: -o 'Staffel-04/S04E%(video_autonumber+9)2.0d - %(fulltitle)s.%(ext)s' + yt-dlp + # Start Google Chrome: NIXPKGS_ALLOW_UNFREE=1 nix-shell -p google-chrome --run google-chrome-stable + ffmpeg-full # full in order to grab x11 + # Recording system audio while keeping audio quite: + # ffmpeg -f pulse -i default output.mp3 + # Change recording from output to monitor: https://askubuntu.com/questions/682144/capturing-only-desktop-audio-with-ffmpeg/682793#682793 + # Split large file into chunks (https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks): + # ffmpeg -i output.mp3 -c copy -map 0 -segment_time 00:15:00 -f segment output%03d.mp3 + # Combine multiple files: https://trac.ffmpeg.org/wiki/Concatenate + # Record audio and video on ubuntu: ffmpeg -f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -f x11grab -y -framerate 30 -s 1280x720 -i :0.0 -c:v libx264 -preset superfast -crf 18 output.mkv + # Find list of audio on ubuntu: pactl list | grep -A2 'Source #' | grep 'Name: ' - chromium + chromium - unzip + unzip - gtk-engine-murrine -] ++ (if hostName == "hikari" then [ - # hikari + gtk-engine-murrine + ] ++ (if hostName == "hikari" then [ + # hikari - acpilight # Used to support xbacklight + acpilight # Used to support xbacklight - (callPackage ./packages/custom/update-nixos-system { }) - handbrake - # Needs to be installed by ubuntu on ubuntu, therefore only add on hikari - sound-juicer + (callPackage ./packages/custom/update-nixos-system { }) + handbrake + # Needs to be installed by ubuntu on ubuntu, therefore only add on hikari + sound-juicer -] else [ - # hikari 2 + ] else [ + # hikari 2 - (callPackage ./packages/custom/update-ubuntu-system { }) - # TODO: Right now only for Ubuntu (hikari2) system - (callPackage ./packages/custom/backup { }) - (callPackage ./packages/custom/vpn-reuter-dynamics { }) -]) ++ (callPackage ./packages/custom { - inherit hostName; -}) + (callPackage ./packages/custom/update-ubuntu-system { }) + # TODO: Right now only for Ubuntu (hikari2) system + (callPackage ./packages/custom/backup { }) + (callPackage ./packages/custom/vpn-reuter-dynamics { }) + ]); +} diff --git a/home/packages/custom/default.nix b/home/packages/custom/default.nix index 895a991..576212a 100644 --- a/home/packages/custom/default.nix +++ b/home/packages/custom/default.nix @@ -1,19 +1,22 @@ { - callPackage + pkgs ,hostName + ,... }: -[ - (callPackage ./dmenu-scripts { }) - (callPackage ./update-system { }) - (callPackage ./nextcloud-sync/from-local.nix { }) - (callPackage ./nextcloud-sync/from-remote.nix { }) - (callPackage ./typo3-documentation-rendering { }) - (callPackage ./typo3-documentation-rendering-old { }) - (callPackage ./typo3-serve-testing-instance { }) - (callPackage ./typo3-push-core { }) - (callPackage ./zcat-progress { }) - (callPackage ./project { - inherit hostName; - }) -] +{ + home.packages = [ + (pkgs.callPackage ./dmenu-scripts { }) + (pkgs.callPackage ./update-system { }) + (pkgs.callPackage ./nextcloud-sync/from-local.nix { }) + (pkgs.callPackage ./nextcloud-sync/from-remote.nix { }) + (pkgs.callPackage ./typo3-documentation-rendering { }) + (pkgs.callPackage ./typo3-documentation-rendering-old { }) + (pkgs.callPackage ./typo3-serve-testing-instance { }) + (pkgs.callPackage ./typo3-push-core { }) + (pkgs.callPackage ./zcat-progress { }) + (pkgs.callPackage ./project { + inherit hostName; + }) + ]; +} diff --git a/home/programs.nix b/home/programs.nix index 7e8b2dd..9268d4d 100644 --- a/home/programs.nix +++ b/home/programs.nix @@ -2,6 +2,7 @@ config ,pkgs ,hostName + ,... }: let @@ -10,55 +11,57 @@ let }; in { - # Let Home Manager install and manage itself. - home-manager.enable = true; + programs = { + # Let Home Manager install and manage itself. + home-manager.enable = true; - neovim = import ./programs/neovim.nix { - inherit pkgs sqlformat; + neovim = import ./programs/neovim.nix { + inherit pkgs sqlformat; + }; + + git = import ./programs/git.nix { + inherit pkgs; + }; + + htop = import ./programs/htop.nix { + inherit config; + }; + + tmux = import ./programs/tmux.nix { + inherit pkgs; + }; + + jq = import ./programs/jq.nix { + inherit config; + }; + + fzf = import ./programs/fzf.nix { + }; + + zsh = import ./programs/zsh.nix { + inherit config pkgs; + }; + + gpg = import ./programs/gpg.nix { + inherit config; + }; + + ssh = import ./programs/ssh.nix { + }; + + zathura = import ./programs/zathura.nix { + }; + + firefox = import ./programs/firefox.nix { + inherit pkgs hostName; + }; + + vdirsyncer.enable = true; + khal = import ./programs/khal.nix { + inherit config; + }; + + # Media + cmus.enable = true; }; - - git = import ./programs/git.nix { - inherit pkgs; - }; - - htop = import ./programs/htop.nix { - inherit config; - }; - - tmux = import ./programs/tmux.nix { - inherit pkgs; - }; - - jq = import ./programs/jq.nix { - inherit config; - }; - - fzf = import ./programs/fzf.nix { - }; - - zsh = import ./programs/zsh.nix { - inherit config pkgs; - }; - - gpg = import ./programs/gpg.nix { - inherit config; - }; - - ssh = import ./programs/ssh.nix { - }; - - zathura = import ./programs/zathura.nix { - }; - - firefox = import ./programs/firefox.nix { - inherit pkgs hostName; - }; - - vdirsyncer.enable = true; - khal = import ./programs/khal.nix { - inherit config; - }; - - # Media - cmus.enable = true; } diff --git a/home/programs/nix.nix b/home/programs/nix.nix index 20a6bed..7876f65 100644 --- a/home/programs/nix.nix +++ b/home/programs/nix.nix @@ -1,29 +1,31 @@ { pkgs + ,... }: { - enable = true; + nix = { + enable = true; - package = pkgs.nix; + package = pkgs.nix; - settings = { + settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; + experimental-features = [ + "nix-command" + "flakes" + ]; - substituters = [ - "https://cache.nixos.org" - "https://fossar.cachix.org" - ]; + substituters = [ + "https://cache.nixos.org" + "https://fossar.cachix.org" + ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE=" - ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE=" + ]; + }; }; - } diff --git a/home/qt.nix b/home/qt.nix index 9b57677..419aa6d 100644 --- a/home/qt.nix +++ b/home/qt.nix @@ -1,12 +1,15 @@ { pkgs + ,... }: { - enable = true; + qt = { + enable = true; - platformTheme = { - # Re use existing gtk theme - name = "gtk"; + platformTheme = { + # Re use existing gtk theme + name = "gtk"; + }; }; } diff --git a/home/services.nix b/home/services.nix index 81ea1a7..c88080b 100644 --- a/home/services.nix +++ b/home/services.nix @@ -2,27 +2,28 @@ config ,hostName ,pkgs + ,... }: { + services = { + dunst = import ./services/dunst.nix { + inherit config; + }; - dunst = import ./services/dunst.nix { - inherit config; - }; + gpg-agent = import ./services/gpg-agent.nix { + inherit pkgs; + }; - gpg-agent = import ./services/gpg-agent.nix { - inherit pkgs; - }; + vdirsyncer = { + enable = true; + frequency = "Mon..Thu *-*-* 15,12,8:00"; + }; - vdirsyncer = { - enable = true; - frequency = "Mon..Thu *-*-* 15,12,8:00"; - }; - - languagetool.enable = true; - mailhog.enable = true; - -} // (if hostName == "hikari" then { - network-manager-applet.enable = true; -} else { -}) + languagetool.enable = true; + mailhog.enable = true; + } // (if hostName == "hikari" then { + network-manager-applet.enable = true; + } else { + }); +} diff --git a/home/systemd.nix b/home/systemd.nix index b74bd08..c51c874 100644 --- a/home/systemd.nix +++ b/home/systemd.nix @@ -1,17 +1,20 @@ { config ,pkgs + ,... }: { - services = { - batteryicon = import ./services/batteryicon.nix { - inherit pkgs; + systemd.user = { + services = { + batteryicon = import ./services/batteryicon.nix { + inherit pkgs; + }; }; - }; - tmpfiles.rules = [ - "L ${config.xdg.dataHome}/themes - - - - ${config.home.profileDirectory}/share/themes" - "L ${config.xdg.dataHome}/icons/${config.gtk.iconTheme.name} - - - - ${config.home.profileDirectory}/share/icons/${config.gtk.iconTheme.name}" - ]; + tmpfiles.rules = [ + "L ${config.xdg.dataHome}/themes - - - - ${config.home.profileDirectory}/share/themes" + "L ${config.xdg.dataHome}/icons/${config.gtk.iconTheme.name} - - - - ${config.home.profileDirectory}/share/icons/${config.gtk.iconTheme.name}" + ]; + }; } diff --git a/home/windowManager/i3.nix b/home/windowManager/i3.nix index 6da4fbb..c1a51a8 100644 --- a/home/windowManager/i3.nix +++ b/home/windowManager/i3.nix @@ -2,13 +2,14 @@ config ,pkgs ,hostName + ,... }: # Use `xbindkeys --key` to find key name, see: https://wiki.archlinux.org/title/Xbindkeys # Use `xset -dpms` to disable black out screen for power saving let - modifier = config.xsession.windowManager.i3.config.modifier; + inherit(config.xsession.windowManager.i3.config) modifier; soundSwitcherForHikari2 = if hostName == "hikari" then "" else "-D pulse"; keyboardBrightnessDevice = if hostName == "hikari" then "--device smc::kbd_backlight" else ""; @@ -16,366 +17,368 @@ let displayBuiltInOutput = if hostName == "hikari" then "eDP-1" else "eDP1"; displayDefaults = if hostName == "hikari" then "--output ${displayBuiltInOutput} --mode 1366x768 --scale 1.25x1.25" else ""; in { - enable = true; - config = { + xsession.windowManager.i3 = { + enable = true; + config = { - modifier = "Mod4"; + modifier = "Mod4"; - workspaceLayout = "tabbed"; - workspaceAutoBackAndForth = true; + workspaceLayout = "tabbed"; + workspaceAutoBackAndForth = true; - defaultWorkspace = "workspace 1"; + defaultWorkspace = "workspace 1"; - menu = "i3-dmenu-desktop"; - - fonts = { - names = [ "monospace" ]; - style = "Bold"; - size = 12.0; - }; - - colors = { - background = "#2E3436"; - focused = { - border = "#000000"; - background = "#000000"; - text = "#72B3CC"; - indicator = "#72B3CC"; - childBorder = "#000000"; - }; - focusedInactive = { - border = "#000000"; - background = "#000000"; - text = "#B0B0B0"; - indicator = "#5D5D5D"; - childBorder = "#000000"; - }; - unfocused = { - border = "#000000"; - background = "#000000"; - text = "#B0B0B0"; - indicator = "#5D5D5D"; - childBorder = "#000000"; - }; - urgent = { - border = "#72B3CC"; - background = "#72B3CC"; - text = "#FFFFFF"; - indicator = "#72B3CC"; - childBorder = "#72B3CC"; - }; - placeholder = { - border = "#000000"; - background = "#000000"; - text = "#D3D7CF"; - indicator = "#000000"; - childBorder = "#000000"; - }; - }; - - bars = [{ - mode = "hide"; - position = "top"; - - workspaceButtons = true; - workspaceNumbers = true; - - statusCommand = "i3blocks"; + menu = "i3-dmenu-desktop"; fonts = { - names = ["monospace"]; + names = [ "monospace" ]; style = "Bold"; size = 12.0; }; colors = { - background = "#000000"; - statusline = "#72B3CC"; - separator = "#72B3CC"; - focusedWorkspace = { - border = "#72B3CC"; - background = "#000000"; - text = "#72B3CC"; - }; - activeWorkspace = { + background = "#2E3436"; + focused = { border = "#000000"; background = "#000000"; text = "#72B3CC"; + indicator = "#72B3CC"; + childBorder = "#000000"; }; - inactiveWorkspace = { + focusedInactive = { border = "#000000"; background = "#000000"; - text = "#72B3CC"; + text = "#B0B0B0"; + indicator = "#5D5D5D"; + childBorder = "#000000"; }; - urgentWorkspace = { + unfocused = { + border = "#000000"; + background = "#000000"; + text = "#B0B0B0"; + indicator = "#5D5D5D"; + childBorder = "#000000"; + }; + urgent = { border = "#72B3CC"; background = "#72B3CC"; text = "#FFFFFF"; + indicator = "#72B3CC"; + childBorder = "#72B3CC"; }; - bindingMode = { - border = "#72B3CC"; - background = "#72B3CC"; - text = "#FFFFFF"; + placeholder = { + border = "#000000"; + background = "#000000"; + text = "#D3D7CF"; + indicator = "#000000"; + childBorder = "#000000"; }; }; - extraConfig = '' - separator_symbol " " - ''; - }]; + bars = [{ + mode = "hide"; + position = "top"; - window = { - titlebar = true; - border = 0; - hideEdgeBorders = "both"; + workspaceButtons = true; + workspaceNumbers = true; - commands = [ - { - command = ''title_format "%title"''; - criteria = { class = ".*"; }; - } - { - command = "sticky enable"; - criteria = { window_type = "dialog"; }; - } - { - command = "sticky enable"; - criteria = { class = "KeePassXC"; }; - } - { - command = "border none"; - criteria = { class = "^vlc$"; }; - } - { - command = "floating disable"; - criteria = { class = "^Pidgin$"; }; - } - ]; - }; + statusCommand = "i3blocks"; - floating = { - titlebar = true; - border = 0; + fonts = { + names = ["monospace"]; + style = "Bold"; + size = 12.0; + }; - criteria = [ - { "class" = "KeePassXC"; } - ]; - }; + colors = { + background = "#000000"; + statusline = "#72B3CC"; + separator = "#72B3CC"; + focusedWorkspace = { + border = "#72B3CC"; + background = "#000000"; + text = "#72B3CC"; + }; + activeWorkspace = { + border = "#000000"; + background = "#000000"; + text = "#72B3CC"; + }; + inactiveWorkspace = { + border = "#000000"; + background = "#000000"; + text = "#72B3CC"; + }; + urgentWorkspace = { + border = "#72B3CC"; + background = "#72B3CC"; + text = "#FFFFFF"; + }; + bindingMode = { + border = "#72B3CC"; + background = "#72B3CC"; + text = "#FFFFFF"; + }; + }; - # For debugging, include class (https://i3wm.org/docs/userguide.html#command_criteria) - # also use bash tool "xprop" or "xwininfo" - assigns = { - "2:💶" = [ - { class = "^time-tracking$"; } - { class = "^mailhog$"; } - { window_role = "^browser$"; } - ]; - "3:💬" = [ - { class = "^Pidgin$"; } - { class = "^chat$"; } - { class = "^phone$"; } - ]; - "4:📧" = [ - { class = "^thunderbird$"; } - { class = "^mail$"; } - ]; - "5:🎵" = [ - # TODO: Assign cmus, but it is opened within terminal - # i3-dmenu-desktop does not allow to pass the wm class for the terminal, should I wrap the .desktop call or cmus binary? - { class = "^Pavucontrol$"; } - { class = "^vlc$"; } - { class = "^Audacity$"; } - ]; - }; + extraConfig = '' + separator_symbol " " + ''; + }]; - startup = [ - # Start programs / applets - { - command = "nm-applet"; - notification = false; - } - { - command = "${pkgs.udiskie}/bin/udiskie --smart-tray"; - notification = false; - } - ]; + window = { + titlebar = true; + border = 0; + hideEdgeBorders = "both"; - keybindings = { - # kill focused window - "${modifier}+Shift+q" = "kill"; - - # start a terminal - "${modifier}+Return" = "exec st zsh"; - - "${modifier}+Shift+a" = "exec xrandr --auto"; - - # start dmenu (a program launcher) - # "${modifier}+d" = "exec dmenu_run"; - # There also is the (new) i3-dmenu-desktop which only displays applications - # shipping a .desktop file. It is a wrapper around dmenu, so you need that - # installed. - # For docs, see: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en - "${modifier}+a" = "exec --no-startup-id i3-dmenu-desktop --dmenu='dmenu -i -l 20'"; - - "${modifier}+space" = "exec --no-startup-id custom-dmenu-selection"; - - # change focus - "${modifier}+h" = "focus left"; - "${modifier}+j" = "focus down"; - "${modifier}+k" = "focus up"; - "${modifier}+l" = "focus right"; - - # move focused window - "${modifier}+Shift+h" = "move left"; - "${modifier}+Shift+j" = "move down"; - "${modifier}+Shift+k" = "move up"; - "${modifier}+Shift+l" = "move right"; - - # split in horizontal orientation - "${modifier}+Right" = "split h"; - - # split in vertical orientation - "${modifier}+Down" = "split v"; - - # enter fullscreen mode for the focused container - "${modifier}+f" = "fullscreen toggle"; - - # toggle tiling / floating - "${modifier}+Shift+f" = "floating toggle"; - - # toggle sticky - "${modifier}+Shift+s" = "sticky toggle"; - - # switch to workspace - "${modifier}+1" = "workspace 1"; - "${modifier}+2" = "workspace 2:💶"; - "${modifier}+3" = "workspace 3:💬"; - "${modifier}+4" = "workspace 4:📧"; - "${modifier}+5" = "workspace 5:🎵"; - "${modifier}+6" = "workspace 6:T3"; - "${modifier}+7" = "workspace 7"; - "${modifier}+8" = "workspace 8"; - "${modifier}+9" = "workspace 9:🖥️"; - "${modifier}+0" = "workspace 10:🌐"; - - # move focused container to workspace - "${modifier}+Shift+1" = "move container to workspace 1"; - "${modifier}+Shift+2" = "move container to workspace 2:💶"; - "${modifier}+Shift+3" = "move container to workspace 3:💬"; - "${modifier}+Shift+4" = "move container to workspace 4:📧"; - "${modifier}+Shift+5" = "move container to workspace 5:🎵"; - "${modifier}+Shift+6" = "move container to workspace 6:T3"; - "${modifier}+Shift+7" = "move container to workspace 7"; - "${modifier}+Shift+8" = "move container to workspace 8"; - "${modifier}+Shift+9" = "move container to workspace 9:🖥️"; - "${modifier}+Shift+0" = "move container to workspace 10:🌐"; - - # workspace 9:🖥️ output DP2 - - # Make the currently focused window a scratchpad - "${modifier}+Shift+minus" = "move scratchpad"; - # Show the first scratchpad window - "${modifier}+minus" = "scratchpad show"; - - # Show Terminal - "${modifier}+t" = "[class=\"st-256color\"] scratchpad show"; - # Show KeepassXC - "${modifier}+p" = "[class=\"KeePassXC\"] scratchpad show"; - - # reload the configuration file - "${modifier}+Shift+c" = "reload"; - # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) - "${modifier}+Shift+r" = "restart"; - # exit i3 (logs you out of your X session) - "${modifier}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\""; - - # Move workspace between displays - "${modifier}+Shift+Left" = "move workspace to output left"; - "${modifier}+Shift+Right" = "move workspace to output right"; - - # Function Key Bindings (🎵) - "XF86AudioPause" = "exec cmus-remote --pause"; - "XF86AudioPlay" = "exec cmus-remote --pause"; - "XF86AudioPrev" = "exec cmus-remote --prev"; - "XF86AudioNext" = "exec cmus-remote --next"; - "XF86AudioMute" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 0\""; - "XF86AudioRaiseVolume" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 5%+\""; - "XF86AudioLowerVolume" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 5%-\""; - - # Switch sound device: - # https://askubuntu.com/a/72076/491377 - # - # Detect current devices - # pulseaudio -k && pactl load-module module-detect - # - # Run Pulseaudio Volume Control and adjust - # Adjust also "default / fallback" device, in order to make volume control work. - # - # Alternativly via cli: - # ~ > pacmd list-sinks - # ~ > pacmd list-sink-inputs - # ~ > pacmd set-default-sink 8 - # ~ > pacmd move-sink-input 3 8 - - # Function Key Bindings (💡) - "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s +10"; - "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s 10-"; - "SHIFT+XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s +1"; - "SHIFT+XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s 1-"; - - "XF86KbdBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${keyboardBrightnessDevice} s +1"; - "XF86KbdBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${keyboardBrightnessDevice} s 1-"; - - # Dunst Key Bindings - # See: man dunstctl.1 - "Control+space" = "exec --no-startup-id dunstctl close-all"; - "Control+grave" = "exec --no-startup-id dunstctl history-pop"; - - "${modifier}+d" = "mode displays"; - "${modifier}+r" = "mode resize"; - }; - - modes = { - resize = { - "h" = "resize shrink width 10 px or 10 ppt"; - "j" = "resize grow height 10 px or 10 ppt"; - "k" = "resize shrink height 10 px or 10 ppt"; - "l" = "resize grow width 10 px or 10 ppt"; - "Shift+h" = "resize shrink width 50 px or 50 ppt"; - "Shift+j" = "resize grow height 50 px or 50 ppt"; - "Shift+k" = "resize shrink height 50 px or 50 ppt"; - "Shift+l" = "resize grow width 50 px or 50 ppt"; - - # same bindings, but for the arrow keys - "Left" = "resize shrink width 10 px or 10 ppt"; - "Down" = "resize grow height 10 px or 10 ppt"; - "Up" = "resize shrink height 10 px or 10 ppt"; - "Right" = "resize grow width 10 px or 10 ppt"; - - # back to normal: Enter or Escape - "Return" = "mode default"; - "Escape" = "mode default"; + commands = [ + { + command = ''title_format "%title"''; + criteria = { class = ".*"; }; + } + { + command = "sticky enable"; + criteria = { window_type = "dialog"; }; + } + { + command = "sticky enable"; + criteria = { class = "KeePassXC"; }; + } + { + command = "border none"; + criteria = { class = "^vlc$"; }; + } + { + command = "floating disable"; + criteria = { class = "^Pidgin$"; }; + } + ]; }; - # "display setup: [a]uto [e]extern only [h]ome [o]ffice" = { - displays = { - "a" = "exec xrandr --auto ${displayDefaults} && ${pkgs.brightnessctl}/bin/brightnessctl --device ${displayBrightnessDevice} s 10;"; - "e" = "exec xrandr --auto --output ${displayBuiltInOutput} --off"; - "h" = "exec xrandr --output ${displayBuiltInOutput} --off --output DP1 --scale 1x1 --mode 2560x1440"; - "o" = "exec xrandr --output DP2 --primary --mode 3840x2160 --scale 0.65x0.65 --output ${displayBuiltInOutput} --off"; - # Mirror - # xrandr --output ${displayBuiltInOutput} --rate 60 --mode 1920x1080 --fb 1920x1080 --output DP1 --mode 1920x1080 --same-as ${displayBuiltInOutput} - # To turn off, use position, e.g.: - # xrandr --output DP1 --right-of ${displayBuiltInOutput} + floating = { + titlebar = true; + border = 0; - # Hikari present - # xrandr --output eDP-1 --same-as HDMI-1 --scale 1.5x1.5 --output HDMI-1 --mode 1920x1080 - - # back to normal: Enter or Escape - "Return" = "mode default"; - "Escape" = "mode default"; + criteria = [ + { "class" = "KeePassXC"; } + ]; }; - }; + # For debugging, include class (https://i3wm.org/docs/userguide.html#command_criteria) + # also use bash tool "xprop" or "xwininfo" + assigns = { + "2:💶" = [ + { class = "^time-tracking$"; } + { class = "^mailhog$"; } + { window_role = "^browser$"; } + ]; + "3:💬" = [ + { class = "^Pidgin$"; } + { class = "^chat$"; } + { class = "^phone$"; } + ]; + "4:📧" = [ + { class = "^thunderbird$"; } + { class = "^mail$"; } + ]; + "5:🎵" = [ + # TODO: Assign cmus, but it is opened within terminal + # i3-dmenu-desktop does not allow to pass the wm class for the terminal, should I wrap the .desktop call or cmus binary? + { class = "^Pavucontrol$"; } + { class = "^vlc$"; } + { class = "^Audacity$"; } + ]; + }; + + startup = [ + # Start programs / applets + { + command = "nm-applet"; + notification = false; + } + { + command = "${pkgs.udiskie}/bin/udiskie --smart-tray"; + notification = false; + } + ]; + + keybindings = { + # kill focused window + "${modifier}+Shift+q" = "kill"; + + # start a terminal + "${modifier}+Return" = "exec st zsh"; + + "${modifier}+Shift+a" = "exec xrandr --auto"; + + # start dmenu (a program launcher) + # "${modifier}+d" = "exec dmenu_run"; + # There also is the (new) i3-dmenu-desktop which only displays applications + # shipping a .desktop file. It is a wrapper around dmenu, so you need that + # installed. + # For docs, see: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en + "${modifier}+a" = "exec --no-startup-id i3-dmenu-desktop --dmenu='dmenu -i -l 20'"; + + "${modifier}+space" = "exec --no-startup-id custom-dmenu-selection"; + + # change focus + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + + # move focused window + "${modifier}+Shift+h" = "move left"; + "${modifier}+Shift+j" = "move down"; + "${modifier}+Shift+k" = "move up"; + "${modifier}+Shift+l" = "move right"; + + # split in horizontal orientation + "${modifier}+Right" = "split h"; + + # split in vertical orientation + "${modifier}+Down" = "split v"; + + # enter fullscreen mode for the focused container + "${modifier}+f" = "fullscreen toggle"; + + # toggle tiling / floating + "${modifier}+Shift+f" = "floating toggle"; + + # toggle sticky + "${modifier}+Shift+s" = "sticky toggle"; + + # switch to workspace + "${modifier}+1" = "workspace 1"; + "${modifier}+2" = "workspace 2:💶"; + "${modifier}+3" = "workspace 3:💬"; + "${modifier}+4" = "workspace 4:📧"; + "${modifier}+5" = "workspace 5:🎵"; + "${modifier}+6" = "workspace 6:T3"; + "${modifier}+7" = "workspace 7"; + "${modifier}+8" = "workspace 8"; + "${modifier}+9" = "workspace 9:🖥️"; + "${modifier}+0" = "workspace 10:🌐"; + + # move focused container to workspace + "${modifier}+Shift+1" = "move container to workspace 1"; + "${modifier}+Shift+2" = "move container to workspace 2:💶"; + "${modifier}+Shift+3" = "move container to workspace 3:💬"; + "${modifier}+Shift+4" = "move container to workspace 4:📧"; + "${modifier}+Shift+5" = "move container to workspace 5:🎵"; + "${modifier}+Shift+6" = "move container to workspace 6:T3"; + "${modifier}+Shift+7" = "move container to workspace 7"; + "${modifier}+Shift+8" = "move container to workspace 8"; + "${modifier}+Shift+9" = "move container to workspace 9:🖥️"; + "${modifier}+Shift+0" = "move container to workspace 10:🌐"; + + # workspace 9:🖥️ output DP2 + + # Make the currently focused window a scratchpad + "${modifier}+Shift+minus" = "move scratchpad"; + # Show the first scratchpad window + "${modifier}+minus" = "scratchpad show"; + + # Show Terminal + "${modifier}+t" = "[class=\"st-256color\"] scratchpad show"; + # Show KeepassXC + "${modifier}+p" = "[class=\"KeePassXC\"] scratchpad show"; + + # reload the configuration file + "${modifier}+Shift+c" = "reload"; + # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) + "${modifier}+Shift+r" = "restart"; + # exit i3 (logs you out of your X session) + "${modifier}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\""; + + # Move workspace between displays + "${modifier}+Shift+Left" = "move workspace to output left"; + "${modifier}+Shift+Right" = "move workspace to output right"; + + # Function Key Bindings (🎵) + "XF86AudioPause" = "exec cmus-remote --pause"; + "XF86AudioPlay" = "exec cmus-remote --pause"; + "XF86AudioPrev" = "exec cmus-remote --prev"; + "XF86AudioNext" = "exec cmus-remote --next"; + "XF86AudioMute" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 0\""; + "XF86AudioRaiseVolume" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 5%+\""; + "XF86AudioLowerVolume" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 5%-\""; + + # Switch sound device: + # https://askubuntu.com/a/72076/491377 + # + # Detect current devices + # pulseaudio -k && pactl load-module module-detect + # + # Run Pulseaudio Volume Control and adjust + # Adjust also "default / fallback" device, in order to make volume control work. + # + # Alternativly via cli: + # ~ > pacmd list-sinks + # ~ > pacmd list-sink-inputs + # ~ > pacmd set-default-sink 8 + # ~ > pacmd move-sink-input 3 8 + + # Function Key Bindings (💡) + "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s +10"; + "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s 10-"; + "SHIFT+XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s +1"; + "SHIFT+XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s 1-"; + + "XF86KbdBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${keyboardBrightnessDevice} s +1"; + "XF86KbdBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${keyboardBrightnessDevice} s 1-"; + + # Dunst Key Bindings + # See: man dunstctl.1 + "Control+space" = "exec --no-startup-id dunstctl close-all"; + "Control+grave" = "exec --no-startup-id dunstctl history-pop"; + + "${modifier}+d" = "mode displays"; + "${modifier}+r" = "mode resize"; + }; + + modes = { + resize = { + "h" = "resize shrink width 10 px or 10 ppt"; + "j" = "resize grow height 10 px or 10 ppt"; + "k" = "resize shrink height 10 px or 10 ppt"; + "l" = "resize grow width 10 px or 10 ppt"; + "Shift+h" = "resize shrink width 50 px or 50 ppt"; + "Shift+j" = "resize grow height 50 px or 50 ppt"; + "Shift+k" = "resize shrink height 50 px or 50 ppt"; + "Shift+l" = "resize grow width 50 px or 50 ppt"; + + # same bindings, but for the arrow keys + "Left" = "resize shrink width 10 px or 10 ppt"; + "Down" = "resize grow height 10 px or 10 ppt"; + "Up" = "resize shrink height 10 px or 10 ppt"; + "Right" = "resize grow width 10 px or 10 ppt"; + + # back to normal: Enter or Escape + "Return" = "mode default"; + "Escape" = "mode default"; + }; + # "display setup: [a]uto [e]extern only [h]ome [o]ffice" = { + displays = { + "a" = "exec xrandr --auto ${displayDefaults} && ${pkgs.brightnessctl}/bin/brightnessctl --device ${displayBrightnessDevice} s 10;"; + "e" = "exec xrandr --auto --output ${displayBuiltInOutput} --off"; + "h" = "exec xrandr --output ${displayBuiltInOutput} --off --output DP1 --scale 1x1 --mode 2560x1440"; + "o" = "exec xrandr --output DP2 --primary --mode 3840x2160 --scale 0.65x0.65 --output ${displayBuiltInOutput} --off"; + + # Mirror + # xrandr --output ${displayBuiltInOutput} --rate 60 --mode 1920x1080 --fb 1920x1080 --output DP1 --mode 1920x1080 --same-as ${displayBuiltInOutput} + # To turn off, use position, e.g.: + # xrandr --output DP1 --right-of ${displayBuiltInOutput} + + # Hikari present + # xrandr --output eDP-1 --same-as HDMI-1 --scale 1.5x1.5 --output HDMI-1 --mode 1920x1080 + + # back to normal: Enter or Escape + "Return" = "mode default"; + "Escape" = "mode default"; + }; + }; + + }; }; } diff --git a/home/xdg.nix b/home/xdg.nix index 1502171..2a1d32e 100644 --- a/home/xdg.nix +++ b/home/xdg.nix @@ -1,140 +1,142 @@ { pkgs + ,... }: { - enable = true; + xdg = { + enable = true; - configFile = { + configFile = { - "i3blocks/config".source = ./files/i3-blocks; + "i3blocks/config".source = ./files/i3-blocks; - "borg/exclude".source = ./files/borg-exclude; - "ctags/config.ctags".source = ./files/ctags; - "sc-im/scimrc".source = ./files/scimrc; - "ncdu/config".source = ./files/ncdu; - "keepassxc/keepassxc.ini".text = pkgs.lib.generators.toINI { } (import ./files/keepassxc-ini.nix); - "litecli/config".source = ./files/litecli; - "phpactor".source = ./files/phpactor; - "tig/config".source = ./files/tig; - "yamllint/config".source = ./files/yamllint/config; + "borg/exclude".source = ./files/borg-exclude; + "ctags/config.ctags".source = ./files/ctags; + "sc-im/scimrc".source = ./files/scimrc; + "ncdu/config".source = ./files/ncdu; + "keepassxc/keepassxc.ini".text = pkgs.lib.generators.toINI { } (import ./files/keepassxc-ini.nix); + "litecli/config".source = ./files/litecli; + "phpactor".source = ./files/phpactor; + "tig/config".source = ./files/tig; + "yamllint/config".source = ./files/yamllint/config; - # Music player - "cmus/rc".source = ./files/cmus/rc; - "cmus/smyckblue.theme".source = ./files/cmus/smyckblue.theme; + # Music player + "cmus/rc".source = ./files/cmus/rc; + "cmus/smyckblue.theme".source = ./files/cmus/smyckblue.theme; - "networkmanager-dmenu/config.ini".text = pkgs.lib.generators.toINI { } { - dmenu = { - dmenu_command = "dmenu -i -l 25"; + "networkmanager-dmenu/config.ini".text = pkgs.lib.generators.toINI { } { + dmenu = { + dmenu_command = "dmenu -i -l 25"; + }; + }; + + "composer/update-channel".text = "stable"; + "composer/auth.json".source = ./files/composer/auth.json; + + "containers/registries.conf".source = ./files/containers/registries.conf; + + # Handbrake + "ghb/preferences.json".source = ./files/ghb/preferences.json; + "ghb/presets.json".source = ./files/ghb/presets.json; + + "rclone/rclone.conf".source = ./files/rclone.conf; + + "docker/config.json".source = ./files/docker/config.json; + + }; + + dataFile = { + "xsd/xliff-core-1.2-strict.xsd".source = pkgs.fetchurl { + url = "https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd"; + sha256 = "nzevVk7NJ9X2kVTXz+e6jesfYgyBuUzw6rH0IFx01fg="; + }; + "typo3-configuration".source = ./files/typo3-configuration; + }; + + desktopEntries = { + kimai = { + name = "Kimai Time Tracking"; + type = "Application"; + exec = "firefox --new-instance -P time-tracking --class=\"time-tracking\" https://track.codappix.com"; + }; + mailhog-ui = { + name = "Mailhog"; + type = "Application"; + exec = "firefox --new-instance -P mailhog --class=\"mailhog\" https://mailhog.localhost"; + }; + microsoft-teams = { + name = "Microsoft Teams"; + type = "Application"; + exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://teams.microsoft.com/ --user-agent=\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36\""; + }; + jitsi = { + name = "Jitsi"; + type = "Application"; + exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://meet.codappix.com/"; + }; + slack-codappix = { + name = "Slack: Codappix"; + type = "Application"; + exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://codappix.slack.com/"; + }; + slack-typo3 = { + name = "Slack: TYPO3"; + type = "Application"; + exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://typo3.slack.com/"; + }; + slack-sac = { + name = "Slack: SAC"; + type = "Application"; + exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://saccas.slack.com/"; }; }; - "composer/update-channel".text = "stable"; - "composer/auth.json".source = ./files/composer/auth.json; + mime.enable = true; + mimeApps = { + enable = true; + # Use file --mime-type to detect mime type + defaultApplications = { - "containers/registries.conf".source = ./files/containers/registries.conf; + "inode/directory" = [ "org.gnome.Nautilus.desktop" ]; - # Handbrake - "ghb/preferences.json".source = ./files/ghb/preferences.json; - "ghb/presets.json".source = ./files/ghb/presets.json; + "text/calendar" = [ "org.kde.korganizer.desktop" ]; - "rclone/rclone.conf".source = ./files/rclone.conf; + "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ]; - "docker/config.json".source = ./files/docker/config.json; + # Browser + "text/html" = [ "firefox.desktop" ]; + "x-scheme-handler/http" = [ "firefox.desktop" ]; + "x-scheme-handler/https" = [ "firefox.desktop" ]; - }; + # Images + "image/bmp" = [ "feh.desktop" ]; + "image/gif" = [ "feh.desktop" ]; + "image/jpeg" = [ "feh.desktop" ]; + "image/jpg" = [ "feh.desktop" ]; + "image/pjpeg" = [ "feh.desktop" ]; + "image/png" = [ "feh.desktop" ]; + "image/tiff" = [ "feh.desktop" ]; + "image/webp" = [ "feh.desktop" ]; + "image/x-bmp" = [ "feh.desktop" ]; + "image/x-pcx" = [ "feh.desktop" ]; + "image/x-png" = [ "feh.desktop" ]; + "image/x-portable-anymap" = [ "feh.desktop" ]; + "image/x-portable-bitmap" = [ "feh.desktop" ]; + "image/x-portable-graymap" = [ "feh.desktop" ]; + "image/x-portable-pixmap" = [ "feh.desktop" ]; + "image/x-tga" = [ "feh.desktop" ]; + "image/x-xbitmap" = [ "feh.desktop" ]; - dataFile = { - "xsd/xliff-core-1.2-strict.xsd".source = pkgs.fetchurl { - url = "https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd"; - sha256 = "nzevVk7NJ9X2kVTXz+e6jesfYgyBuUzw6rH0IFx01fg="; - }; - "typo3-configuration".source = ./files/typo3-configuration; - }; + # Audio + "audio/mpeg" = [ "vlc.desktop" ]; - desktopEntries = { - kimai = { - name = "Kimai Time Tracking"; - type = "Application"; - exec = "firefox --new-instance -P time-tracking --class=\"time-tracking\" https://track.codappix.com"; - }; - mailhog-ui = { - name = "Mailhog"; - type = "Application"; - exec = "firefox --new-instance -P mailhog --class=\"mailhog\" https://mailhog.localhost"; - }; - microsoft-teams = { - name = "Microsoft Teams"; - type = "Application"; - exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://teams.microsoft.com/ --user-agent=\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36\""; - }; - jitsi = { - name = "Jitsi"; - type = "Application"; - exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://meet.codappix.com/"; - }; - slack-codappix = { - name = "Slack: Codappix"; - type = "Application"; - exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://codappix.slack.com/"; - }; - slack-typo3 = { - name = "Slack: TYPO3"; - type = "Application"; - exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://typo3.slack.com/"; - }; - slack-sac = { - name = "Slack: SAC"; - type = "Application"; - exec = "${pkgs.chromium}/bin/chromium --class=\"chat\" --new-window --app=https://saccas.slack.com/"; + # Video + "video/mp4" = [ "vlc.desktop" ]; + "video/m4v" = [ "vlc.desktop" ]; + "video/x-matroska" = [ "vlc.desktop" ]; + "video/quicktime" = [ "vlc.desktop" ]; + }; }; }; - - mime.enable = true; - mimeApps = { - enable = true; - # Use file --mime-type to detect mime type - defaultApplications = { - - "inode/directory" = [ "org.gnome.Nautilus.desktop" ]; - - "text/calendar" = [ "org.kde.korganizer.desktop" ]; - - "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ]; - - # Browser - "text/html" = [ "firefox.desktop" ]; - "x-scheme-handler/http" = [ "firefox.desktop" ]; - "x-scheme-handler/https" = [ "firefox.desktop" ]; - - # Images - "image/bmp" = [ "feh.desktop" ]; - "image/gif" = [ "feh.desktop" ]; - "image/jpeg" = [ "feh.desktop" ]; - "image/jpg" = [ "feh.desktop" ]; - "image/pjpeg" = [ "feh.desktop" ]; - "image/png" = [ "feh.desktop" ]; - "image/tiff" = [ "feh.desktop" ]; - "image/webp" = [ "feh.desktop" ]; - "image/x-bmp" = [ "feh.desktop" ]; - "image/x-pcx" = [ "feh.desktop" ]; - "image/x-png" = [ "feh.desktop" ]; - "image/x-portable-anymap" = [ "feh.desktop" ]; - "image/x-portable-bitmap" = [ "feh.desktop" ]; - "image/x-portable-graymap" = [ "feh.desktop" ]; - "image/x-portable-pixmap" = [ "feh.desktop" ]; - "image/x-tga" = [ "feh.desktop" ]; - "image/x-xbitmap" = [ "feh.desktop" ]; - - # Audio - "audio/mpeg" = [ "vlc.desktop" ]; - - # Video - "video/mp4" = [ "vlc.desktop" ]; - "video/m4v" = [ "vlc.desktop" ]; - "video/x-matroska" = [ "vlc.desktop" ]; - "video/quicktime" = [ "vlc.desktop" ]; - }; - }; - } diff --git a/home/xsession.nix b/home/xsession.nix index 3d5de73..26cc658 100644 --- a/home/xsession.nix +++ b/home/xsession.nix @@ -2,6 +2,7 @@ config ,pkgs ,hostName + ,... }: let @@ -21,25 +22,23 @@ let xinput --set-prop 'DELL07E6:00 06CB:76AF Touchpad' 'libinput Natural Scrolling Enabled' 1 ''; in { - enable = true; + xsession = { + enable = true; - numlock.enable = true; + numlock.enable = true; - initExtra = (if hostName == "hikari" then initExtraHikari else initExtraHikari2) + '' - # Set backlight of output - xbacklight -set 25 + initExtra = (if hostName == "hikari" then initExtraHikari else initExtraHikari2) + '' + # Set backlight of output + xbacklight -set 25 - # Set background color - xsetroot -solid "#2E3436" + # Set background color + xsetroot -solid "#2E3436" - # Disable screen saver - xset s off + # Disable screen saver + xset s off - # Increase mouse speed - xinput --set-prop 13 'libinput Accel Speed' 1 - ''; - - windowManager.i3 = import ./windowManager/i3.nix { - inherit config pkgs hostName; + # Increase mouse speed + xinput --set-prop 13 'libinput Accel Speed' 1 + ''; }; }