From 54b9013329daea0435ef1962c74b515987e4b5be Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 17 Feb 2023 00:59:29 +0100 Subject: [PATCH] next step of thinin out system/desktop --- nixos/components/gui/browser.nix | 59 +++ nixos/components/gui/default.nix | 7 +- .../desktop => components/gui}/pass.nix | 24 +- .../desktop => components/gui}/suspend.nix | 13 +- .../gui/xorg/{x11.nix => default.nix} | 8 +- .../desktop => components/gui/xorg}/xlock.nix | 7 +- nixos/system/desktop/browser.nix | 58 --- nixos/system/desktop/default.nix | 9 - nixos/system/desktop/hoard.nix | 21 -- nixos/system/desktop/mc.nix | 344 ------------------ nixos/system/desktop/x11.nix | 19 - 11 files changed, 91 insertions(+), 478 deletions(-) create mode 100644 nixos/components/gui/browser.nix rename nixos/{system/desktop => components/gui}/pass.nix (50%) rename nixos/{system/desktop => components/gui}/suspend.nix (79%) rename nixos/components/gui/xorg/{x11.nix => default.nix} (95%) rename nixos/{system/desktop => components/gui/xorg}/xlock.nix (85%) delete mode 100644 nixos/system/desktop/browser.nix delete mode 100644 nixos/system/desktop/hoard.nix delete mode 100644 nixos/system/desktop/mc.nix delete mode 100644 nixos/system/desktop/x11.nix diff --git a/nixos/components/gui/browser.nix b/nixos/components/gui/browser.nix new file mode 100644 index 0000000..23fd339 --- /dev/null +++ b/nixos/components/gui/browser.nix @@ -0,0 +1,59 @@ +{ config, lib, ... }: +let + backupFolder = "~/desktop/browser-images"; + homeFolder = "/browsers"; +in +{ + config = lib.mkIf config.components.gui.enable { + programs.custom.browser = { + enable = lib.mkDefault true; + configList = { + development = { + home = "${homeFolder}/development-browser"; + homeBackup = "${backupFolder}/development-browser"; + gpu = false; + }; + google = { + home = "${homeFolder}/google-browser"; + homeBackup = "${backupFolder}/google-browser"; + gpu = true; + }; + finance = { + home = "${homeFolder}/finance-browser"; + homeBackup = "${backupFolder}/finance-browser"; + gpu = false; + }; + facebook = { + home = "${homeFolder}/facebook-browser"; + homeBackup = "${backupFolder}/facebook-browser"; + gpu = false; + }; + shopping = { + home = "${homeFolder}/shopping-browser"; + homeBackup = "${backupFolder}/shopping-browser"; + gpu = false; + }; + + firefox-tmp = { + browserType = "firefox"; + home = "${homeFolder}/firefox-tmp"; + homeBackup = "${backupFolder}/firefox-tmp-browser"; + gpu = false; + }; + chromium-tmp = { + browserType = "chrome"; + home = "${homeFolder}/chromium-tmp"; + homeBackup = "${backupFolder}/chrome-tmp-browser"; + gpu = false; + }; + google-tmp = { + browserType = "google"; + home = "${homeFolder}/google-tmp"; + homeBackup = "${backupFolder}google-tmp-browser"; + gpu = false; + }; + + }; + }; + }; +} diff --git a/nixos/components/gui/default.nix b/nixos/components/gui/default.nix index 624e632..8e45c4d 100644 --- a/nixos/components/gui/default.nix +++ b/nixos/components/gui/default.nix @@ -6,9 +6,12 @@ with lib; }; imports = [ - ./xorg/x11.nix + ./xorg ./home-manager + ./browser.nix ]; - config = mkIf config.components.gui.enable { }; + config = mkIf config.components.gui.enable { + # todo extract xorg stuff to prepare wayland + }; } diff --git a/nixos/system/desktop/pass.nix b/nixos/components/gui/pass.nix similarity index 50% rename from nixos/system/desktop/pass.nix rename to nixos/components/gui/pass.nix index 21859c4..ac1a4e7 100644 --- a/nixos/system/desktop/pass.nix +++ b/nixos/components/gui/pass.nix @@ -1,7 +1,5 @@ -{ lib, pkgs, ... }: - +{ lib, pkgs, config, ... }: with lib; - let # desktop file @@ -26,16 +24,18 @@ let in { + config = mkIf config.components.gui.enable { - environment.systemPackages = [ - (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) - (desktopFile "passmenu" "${pkgs.pass.withExtensions (ext: [ext.pass-otp])}/bin/passmenu --type -l 10") + environment.systemPackages = [ + (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) + # todo : use upstream desktop file creator + (desktopFile "passmenu" "${pkgs.pass.withExtensions (ext: [ext.pass-otp])}/bin/passmenu --type -l 10") - # todo ein script machen was hier tut - # zbarimg -q --raw 2018-12-18-114509.png | pass otp insert mindcurv/cloudamqp/otp - pkgs.zbar + pkgs.otpmenu - pkgs.otpmenu - - ]; + # todo ein script machen was hier tut + # zbarimg -q --raw 2018-12-18-114509.png | pass otp insert mindcurv/cloudamqp/otp + pkgs.zbar + ]; + }; } diff --git a/nixos/system/desktop/suspend.nix b/nixos/components/gui/suspend.nix similarity index 79% rename from nixos/system/desktop/suspend.nix rename to nixos/components/gui/suspend.nix index 295d029..bdc12ad 100644 --- a/nixos/system/desktop/suspend.nix +++ b/nixos/components/gui/suspend.nix @@ -1,15 +1,12 @@ { pkgs, config, lib, ... }: with lib; - -let - - cfg = config.system.custom.suspend; -in { + options.components.gui.suspend.enable = mkOption { + type = lib.types.bool; + default = true; + }; - options.system.custom.suspend.enable = mkEnableOption "use xlock in suspend"; - - config = mkIf cfg.enable { + config = mkIf (config.components.gui.enable && config.components.gui.suspend.enable) { systemd.services.screenlock = { before = [ "sleep.target" ]; diff --git a/nixos/components/gui/xorg/x11.nix b/nixos/components/gui/xorg/default.nix similarity index 95% rename from nixos/components/gui/xorg/x11.nix rename to nixos/components/gui/xorg/default.nix index babd86f..844a59e 100644 --- a/nixos/components/gui/xorg/x11.nix +++ b/nixos/components/gui/xorg/default.nix @@ -4,6 +4,8 @@ with lib; config = mkIf config.components.gui.enable { + system.custom.fonts.enable = true; + services.xserver = { enable = true; @@ -48,11 +50,15 @@ with lib; # -------- environment.systemPackages = with pkgs; [ + xclip + xtrlock-pam + xorg.xev + xorg.xmodmap + dmenu arandr xcalib flameshot - xorg.xmodmap feh ]; diff --git a/nixos/system/desktop/xlock.nix b/nixos/components/gui/xorg/xlock.nix similarity index 85% rename from nixos/system/desktop/xlock.nix rename to nixos/components/gui/xorg/xlock.nix index 97d0e17..113f790 100644 --- a/nixos/system/desktop/xlock.nix +++ b/nixos/components/gui/xorg/xlock.nix @@ -1,7 +1,5 @@ { lib, pkgs, ... }: - with lib; - let name = "lock"; @@ -32,6 +30,7 @@ let in { - - environment.systemPackages = [ lockProgram desktopFile ]; + config = mkIf config.components.gui.enable { + environment.systemPackages = [ lockProgram desktopFile ]; + }; } diff --git a/nixos/system/desktop/browser.nix b/nixos/system/desktop/browser.nix deleted file mode 100644 index d244288..0000000 --- a/nixos/system/desktop/browser.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config, lib, ... }: -let - backupFolder = "~/desktop/browser-images"; - homeFolder = "/browsers"; -in -{ - programs.custom.browser = { - enable = lib.mkDefault true; - configList = { - development = { - home = "${homeFolder}/development-browser"; - homeBackup = "${backupFolder}/development-browser"; - gpu = false; - }; - google = { - home = "${homeFolder}/google-browser"; - homeBackup = "${backupFolder}/google-browser"; - gpu = true; - }; - finance = { - home = "${homeFolder}/finance-browser"; - homeBackup = "${backupFolder}/finance-browser"; - gpu = false; - }; - facebook = { - home = "${homeFolder}/facebook-browser"; - homeBackup = "${backupFolder}/facebook-browser"; - gpu = false; - }; - shopping = { - home = "${homeFolder}/shopping-browser"; - homeBackup = "${backupFolder}/shopping-browser"; - gpu = false; - }; - - firefox-tmp = { - browserType = "firefox"; - home = "${homeFolder}/firefox-tmp"; - homeBackup = "${backupFolder}/firefox-tmp-browser"; - gpu = false; - }; - chromium-tmp = { - browserType = "chrome"; - home = "${homeFolder}/chromium-tmp"; - homeBackup = "${backupFolder}/chrome-tmp-browser"; - gpu = false; - }; - google-tmp = { - browserType = "google"; - home = "${homeFolder}/google-tmp"; - homeBackup = "${backupFolder}google-tmp-browser"; - gpu = false; - }; - - }; - }; - -} diff --git a/nixos/system/desktop/default.nix b/nixos/system/desktop/default.nix index 0110cb9..0674060 100644 --- a/nixos/system/desktop/default.nix +++ b/nixos/system/desktop/default.nix @@ -6,29 +6,20 @@ #./icecast.nix ./audio.nix - ./browser.nix ./cachix.nix ./direnv.nix - ./hoard.nix ./mail-stuff.nix - #./mc.nix ./network.nix ./packages.nix - ./pass.nix ./remote-install.nix ./size.nix - ./suspend.nix ./user.nix - ./x11.nix - ./xlock.nix ./yubikey.nix ./wtf.nix ]; components.network.sshd.onlyTincAccess = lib.mkDefault true; - system.custom.suspend.enable = lib.mkDefault true; - backup.dirs = [ "${config.users.users.mainUser.home}/.config/noti" "${config.users.users.mainUser.home}/.password-store" diff --git a/nixos/system/desktop/hoard.nix b/nixos/system/desktop/hoard.nix deleted file mode 100644 index 9600a9b..0000000 --- a/nixos/system/desktop/hoard.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, lib, pkgs, ... }: -let - package = pkgs.unstable.hoard; -in -{ - environment.systemPackages = [ package ]; - - #home-manager.users.mainUser.programs.direnv.enable = true; - - #programs.zsh.interactiveShellInit = '' - # source ${package}/src/shell/hoard.zsh - #''; - #programs.bash.interactiveShellInit = '' - # source ${package}/src/shell/hoard.bash - #''; - - backup.dirs = [ - "${config.users.users.mainUser.home}/.config/hoard" - ]; - -} diff --git a/nixos/system/desktop/mc.nix b/nixos/system/desktop/mc.nix deleted file mode 100644 index a04ba70..0000000 --- a/nixos/system/desktop/mc.nix +++ /dev/null @@ -1,344 +0,0 @@ -{ config, pkgs, ... }: - -let - mcExt = pkgs.writeText "mc.ext" '' - # gitfs changeset - regex/^\[git\] - Open=%cd %p/changesetfs:// - View=%cd %p/patchsetfs:// - - ### Archives ### - - # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk, .gem - regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$|\.gem$ - Open=%cd %p/utar:// - - shell/.tar.bz - # Open=%cd %p/utar:// - - regex/\.t(ar\.bz2|bz2?|b2)$ - Open=%cd %p/utar:// - - # .tar.lzma, .tlz - regex/\.t(ar\.lzma|lz)$ - Open=%cd %p/utar:// - - # .tar.xz, .txz - regex/\.t(ar\.xz|xz)$ - Open=%cd %p/utar:// - - # .tar.F - used in QNX - shell/.tar.F - # Open=%cd %p/utar:// - - # .qpr/.qpk - QNX Neutrino package installer files - regex/\.qp[rk]$ - Open=%cd %p/utar:// - - # tar - shell/i/.tar - Open=%cd %p/utar:// - - # lha - type/^LHa\ .*archive - Open=%cd %p/ulha:// - - # arj - regex/i/\.a(rj|[0-9][0-9])$ - Open=%cd %p/uarj:// - - # cab - shell/i/.cab - Open=%cd %p/ucab:// - - # ha - shell/i/.ha - Open=%cd %p/uha:// - - # rar - regex/i/\.r(ar|[0-9][0-9])$ - Open=%cd %p/urar:// - - # ALZip - shell/i/.alz - Open=%cd %p/ualz:// - - # cpio - shell/.cpio.Z - Open=%cd %p/ucpio:// - - shell/.cpio.xz - Open=%cd %p/ucpio:// - - shell/.cpio.gz - Open=%cd %p/ucpio:// - - shell/i/.cpio - Open=%cd %p/ucpio:// - - # 7zip archives (they are not man pages) - shell/i/.7z - Open=%cd %p/u7z:// - - # patch - regex/\.(diff|patch)(\.bz2)$ - Open=%cd %p/patchfs:// - - regex/\.(diff|patch)(\.(gz|Z))$ - Open=%cd %p/patchfs:// - - # ls-lR - regex/(^|\.)ls-?lR(\.gz|Z|bz2)$ - Open=%cd %p/lslR:// - - # trpm - shell/.trpm - Open=%cd %p/trpm:// - - # RPM packages (SuSE uses *.spm for source packages) - regex/\.(src\.rpm|spm)$ - Open=%cd %p/rpm:// - - shell/.rpm - Open=%cd %p/rpm:// - - # deb - regex/\.u?deb$ - Open=%cd %p/deb:// - - # dpkg - shell/.debd - Open=%cd %p/debd:// - - # apt - shell/.deba - Open=%cd %p/deba:// - - # ISO9660 - shell/i/.iso - Open=%cd %p/iso9660:// - - - regex/\.(diff|patch)$ - Open=%cd %p/patchfs:// - - # ar library - regex/\.s?a$ - Open=%cd %p/uar:// - - # gplib - shell/i/.lib - Open=%cd %p/ulib:// - - - # Mailboxes - type/^ASCII\ mail\ text - Open=%cd %p/mailfs:// - - - ### Sources ### - - # C/C++ - regex/i/\.(c|cc|cpp)$ - Include=editor - - # C/C++ header - regex/i/\.(h|hh|hpp)$ - Include=editor - - # Fortran - shell/i/.f - Include=editor - - # Assembler - regex/i/\.(s|asm)$ - Include=editor - - include/editor - Open=%var{EDITOR:${pkgs.vim}/bin/vim} %f - - ### Images ### - - shell/i/.gif - Include=image - - regex/i/\.jpe?g$ - Include=image - - shell/i/.bmp - Include=image - - shell/i/.png - Include=image - - shell/i/.jng - Include=image - - shell/i/.mng - Include=image - - shell/i/.tiff - Include=image - - shell/.ico - Include=image - - include/image - Open=${pkgs.sxiv}/bin/sxiv %f - View=${pkgs.sxiv}/bin/sxiv %f - - ### Sound files ### - - regex/i/\.(wav|snd|voc|au|smp|aiff|snd|m4a|ape|aac|wv)$ - Include=audio - - regex/i/\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$ - Include=audio - - shell/i/.waw22 - Include=audio - - shell/i/.mp3 - Include=audio - - regex/i/\.og[gax]$ - Include=audio - - regex/i/\.(spx|flac)$ - Include=audio - - regex/i/\.(midi?|rmid?)$ - Include=audio - - shell/i/.wma - Include=audio - - include/audio - Open=${pkgs.mpv}/bin/mpv %f - View=${pkgs.mpv}/bin/mpv %f - - ### Video ### - - shell/i/.avi - Include=video - - regex/i/\.as[fx]$ - Include=video - - shell/i/.divx - Include=video - - shell/i/.mkv - Include=video - - regex/i/\.(mov|qt)$ - Include=video - - regex/i/\.(mp4|m4v|mpe?g)$ - Include=video - - # MPEG-2 TS container + H.264 codec - shell/i/.mts - Include=video - - shell/i/.ts - Include=video - - shell/i/.vob - Include=video - - shell/i/.wmv - Include=video - - regex/i/\.fl[icv]$ - Include=video - - shell/i/.ogv - Include=video - - # WebM - shell/i/.webm - Include=video - - type/WebM - Include=video - - include/video - Open=${pkgs.mpv}/bin/mpv %f - View=${pkgs.mpv}/bin/mpv %f - - - ### Documents ### - - # PDF - shell/i/.pdf - Open=zathura %f - View=zathura %f - - ### Miscellaneous ### - - # Makefile - regex/[Mm]akefile$ - Open=make -f %f %{Enter parameters} - - - ### Plain compressed files ### - - # ace - shell/i/.ace - Open=%cd %p/uace:// - Extract=unace x %f - - # arc - shell/i/.arc - Open=%cd %p/uarc:// - Extract=arc x %f '*' - Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi - - # zip - shell/i/.zip - Open=%cd %p/uzip:// - - # zip - type/i/^zip\ archive - Open=%cd %p/uzip:// - - # jar(zip) - type/i/^Java\ Jar\ file\ data\ \(zip\) - Open=%cd %p/uzip:// - - # zoo - shell/i/.zoo - Open=%cd %p/uzoo:// - - ### Default ### - - # Default target for anything not described above - default/* - Open=vim %f - View=vim %f - - ''; - -in -{ - environment.systemPackages = [ - (pkgs.symlinkJoin { - name = "mc"; - paths = [ - (pkgs.writers.writeDashBin "mc" '' - export MC_DATADIR=${ - pkgs.writers.write "mc-ext" { - "/mc.ext".link = mcExt; - "/sfs.ini".text = ""; - } - }; - export TERM=xterm-256color - exec ${pkgs.mc}/bin/mc -S xoria256 "$@" - '') - pkgs.mc - ]; - }) - ]; -} - diff --git a/nixos/system/desktop/x11.nix b/nixos/system/desktop/x11.nix deleted file mode 100644 index 80ff822..0000000 --- a/nixos/system/desktop/x11.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, pkgs, lib, ... }: { - - environment.systemPackages = with pkgs; [ xclip xtrlock-pam xorg.xev ]; - - system.custom.fonts.enable = true; - - # xinput list < to show devices - # https://unix.stackexchange.com/questions/90572/how-can-i-set-mouse-sensitivity-not-just-mouse-acceleration - #services.xserver.displayManager.sessionCommands = let - # mouseSpeed = name: speed: '' - # ${pkgs.xlibs.xinput}/bin/xinput set-prop "${name}" "Coordinate Transformation Matrix" ${ - # toString speed - # } 0 0 0 ${toString speed} 0 0 0 1 || true - # ''; - #in lib.concatStringsSep "\n" - #[ (mouseSpeed "Logitech Gaming Mouse G400" 3.1) ]; - -} -