diff --git a/.gitignore b/.gitignore index 9095875..c4a847d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/configuration.nix /result diff --git a/defaults/database/default.nix b/defaults/database/default.nix deleted file mode 100644 index 0aab494..0000000 --- a/defaults/database/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, ... }: - -{ - - services.postgresql = { - enable = true; - package = pkgs.postgresql_12; - }; - - services.postgresqlBackup.enable = true; -} diff --git a/defaults/desktop/default.nix b/defaults/desktop/default.nix index cc28483..74e5b59 100644 --- a/defaults/desktop/default.nix +++ b/defaults/desktop/default.nix @@ -5,6 +5,7 @@ ./greeter.nix ./hardware.nix ./office-suite.nix + ./security.nix ]; } diff --git a/defaults/desktop/desktop-environment.nix b/defaults/desktop/desktop-environment.nix index f3d34cc..5bf16fd 100644 --- a/defaults/desktop/desktop-environment.nix +++ b/defaults/desktop/desktop-environment.nix @@ -26,6 +26,8 @@ light.enable = true; dconf.enable = true; + + sway.enable = true; }; services.gnome = { @@ -36,6 +38,7 @@ gnome-keyring.enable = true; evolution-data-server.enable = true; gnome-online-accounts.enable = true; + gnome-remote-desktop.enable = true; sushi.enable = false; }; @@ -45,6 +48,7 @@ services.flatpak.enable = true; xdg.portal = { enable = true; + wlr.enable = true; gtkUsePortal = false; #extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; diff --git a/defaults/desktop/hardware.nix b/defaults/desktop/hardware.nix index a20e23f..d9c78eb 100644 --- a/defaults/desktop/hardware.nix +++ b/defaults/desktop/hardware.nix @@ -59,5 +59,6 @@ }; programs.light.enable = true; + programs.adb.enable = true; } diff --git a/defaults/user-configuration/fhauser/security.nix b/defaults/desktop/security.nix similarity index 100% rename from defaults/user-configuration/fhauser/security.nix rename to defaults/desktop/security.nix diff --git a/defaults/user-configuration/default.nix b/defaults/user-configuration/default.nix deleted file mode 100644 index 18bb59f..0000000 --- a/defaults/user-configuration/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, lib, ... }: { - - imports = [ ]; - - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - }; -} diff --git a/defaults/user-configuration/fhauser/applications/android-studio.nix b/defaults/user-configuration/fhauser/applications/android-studio.nix deleted file mode 100644 index 472af5f..0000000 --- a/defaults/user-configuration/fhauser/applications/android-studio.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, ... }: { - programs.adb.enable = true; - users.users.fhauser.extraGroups = [ "adbusers" ]; -} diff --git a/defaults/user-configuration/fhauser/applications/default.nix b/defaults/user-configuration/fhauser/applications/default.nix deleted file mode 100644 index 2bc56d8..0000000 --- a/defaults/user-configuration/fhauser/applications/default.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - - imports = [ - ./evolution.nix - ./firefox.nix - ./gpg.nix - ./ssh.nix - ./scripts.nix - ./webapps.nix - ./vim.nix - ./git.nix - ./waybar.nix - ./psql.nix - ./android-studio.nix - ./mako.nix - ./redshift.nix - ./alacritty.nix - ./shell.nix - ./swaylock.nix - ./kanshi.nix - ./sway.nix - ./android-studio.nix - ]; - home-manager.users.fhauser = { config, pkgs, ... }: { - services = { - network-manager-applet.enable = true; - nextcloud-client = { - enable = true; - startInBackground = true; - }; - owncloud-client.enable = true; - pasystray.enable = true; - blueman-applet.enable = true; - }; - - home = { - packages = with pkgs; - [ # Networking - unison - transmission # GUI Tools, maybe extract... - ] ++ [ # Desktop Environment Applications - google-chrome - chromium - #midori # TODO: Currently unused - #qutebrowser # TODO: Currently unused - synergy - #quicksynergy # Currently unused - nextcloud-client - owncloud-client - ] ++ [ # office # TODO: Migrate to office.nix - # TODO: Build fails! - libreoffice-fresh # TODO: Dictionaries, nixos/nixpkgs#14430 - # pdfgrep - # pdftk - # calibre - tectonic - # texstudio - # pandoc - # system-config-printer - # cups-pk-helper - # cups-bjnp - # gutenprint - # gutenprintBin - # hplipWithPlugin - simple-scan - gnome.gnome-online-accounts - gnome.gnome-control-center - ] ++ [ # Communication - signal-desktop - tdesktop - discord - mattermost-desktop - # pidgin pidgin-otr pidgin-with-plugins #TODO: Pidgin needed? - #TODO: ekiga? - skype - slack - teams - jitsi-meet-electron - teamviewer - rdesktop - ] ++ [ # Development - vscodium - gitlab-runner - docker-compose - vagrant - virt-manager - modemmanager # TODO: makes sense here? - modem-manager-gui - ]; - - #TODO: Write module - activation.statefulConfigSymlinks = - config.lib.dag.entryAfter [ "writeBoundary" ] '' - set -eo pipefail - - STATEFUL_CONFS=( - ".config/spotify" - ".mozilla" - ".password-store" - ) - for STATEFUL_CONF in ''${STATEFUL_CONFS[@]}; do - if [ -e "$STATEFUL_CONF" ] && [ ! -h "$STATEFUL_CONF" ]; then - echo "File $STATEFUL_CONF already exists, exiting!" >&2 - exit 1 - fi - - if [ -h "$STATEFUL_CONF" ]; then - rm "$STATEFUL_CONF" - fi - - $DRY_RUN_CMD ln -s $VERBOSE_ARG "$HOME/.stateful/$STATEFUL_CONF" "$HOME/$STATEFUL_CONF" - done - ''; - }; - }; -} diff --git a/defaults/user-configuration/fhauser/applications/evolution.nix b/defaults/user-configuration/fhauser/applications/evolution.nix deleted file mode 100644 index a981f9a..0000000 --- a/defaults/user-configuration/fhauser/applications/evolution.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: { - home-manager.users.fhauser = { - dconf.settings."org/gnome/evolution-data-server/calendar".notify-enable-audio = - false; - }; -} diff --git a/defaults/user-configuration/fhauser/applications/firefox.nix b/defaults/user-configuration/fhauser/applications/firefox.nix deleted file mode 100644 index 8fdff09..0000000 --- a/defaults/user-configuration/fhauser/applications/firefox.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: { - home-manager.users.fhauser = { - programs.firefox = { - enable = true; - package = pkgs.firefox-wayland; - }; - home.sessionVariables = { - MOZ_ENABLE_WAYLAND = "true"; - MOZ_DBUS_REMOTE = "1"; - }; - }; -} diff --git a/defaults/user-configuration/fhauser/applications/sway.nix b/defaults/user-configuration/fhauser/applications/sway.nix deleted file mode 100644 index 9f48933..0000000 --- a/defaults/user-configuration/fhauser/applications/sway.nix +++ /dev/null @@ -1,171 +0,0 @@ -{ pkgs, lib, config, ... }: { - - # environment.systemPackages = with pkgs; [ polkit_gnome ]; #TODO: Needed? - programs.sway.enable = true; - xdg.portal.wlr.enable = true; - - services.gnome.gnome-remote-desktop.enable = true; - #environment.systemPackages = with pkgs; [ pipewire ]; - #systemd.user.services.pipewire.environment.XDG_CURRENT_DESKTOP = "sway"; - #systemd.user.services.xdg-desktop-portal-wlr.environment.XDG_CURRENT_DESKTOP = - # "sway"; - # systemd.user.services.xdg-desktop-portal-wlr.script = "${pkgs.xdg-desktop-portal-wlr}/libexec/xdg-desktop-portal-wlr"; - # systemd.user.services.xdg-desktop-portal-wlr.scriptArgs = "--output=DP-1"; # TODO: Extract this ***** - home-manager.users.fhauser = let - adhereTheSwayTarget = { - Install.WantedBy = lib.mkForce [ "sway-session.target" ]; - Unit.PartOf = lib.mkForce [ "sway-session.target" ]; - }; - # TODO: active screen with -m $active_screen - bemenuLauncher = pkgs.writeScriptBin "bemenuLauncher" '' - #!${pkgs.stdenv.shell} - #active_screen=$(swaymsg -r -t get_outputs | \ - # ${pkgs.jq}/bin/jq '. [] | select (.focused == true) | .name | split ("-") | last') - ${pkgs.dmenu}/bin/dmenu_path | \ - ${pkgs.bemenu}/bin/bemenu --list 20 --ignorecase --prompt 'Start: ' | \ - xargs swaymsg exec -- - ''; - homeManagerConfig = config.home-manager.users.fhauser; - in rec { - home.packages = with pkgs; [ - sway-contrib.grimshot - wl-clipboard - libappindicator - gnome.defaultIconTheme - gnome2.gnome-icon-theme - hicolor-icon-theme # TODO: Move these requirements? - ]; - - xsession.preferStatusNotifierItems = true; - - wayland.windowManager.sway = { - enable = true; - systemdIntegration = true; - xwayland = true; - wrapperFeatures = { gtk = true; }; - extraSessionCommands = '' - #export XDG_CURRENT_DESKTOP=Unity - export XDG_CURRENT_DESKTOP=sway - export XDG_SESSION_TYPE="wayland" - export _JAVA_AWT_WM_NONREPARENTING=1 - export SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh # TODO: Migrate - export QT_QPA_PLATFORM=wayland - export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # TODO: QTpie - export WLR_DRM_NO_MODIFIERS=1 - export WLR_NO_HARDWARE_CURSORS=1 - ''; - config = { - input = { - "type:keyboard" = { - xkb_layout = "ch,de"; - xkb_options = "eurosign:e"; - }; - "*" = { xkb_numlock = "enable"; }; - }; - terminal = "${pkgs.alacritty}/bin/alacritty"; - menu = "${bemenuLauncher}/bin/bemenuLauncher"; - gaps.inner = 8; - modifier = "Mod4"; - window.border = 0; - #colors.focused.border = "#323232"; - - #TODO: Workspace Programm assignment: Not working properly - assigns = { - "10" = [{ app_id = "^firefox$"; }]; - "11" = [{ app_id = "^(claws-mail|thunderbird|evolution)$"; }]; - "12" = [{ - class = "^Chromium-browser$"; - instance = "^web.threema.ch"; - }]; - "13" = [{ class = "^Spotify$"; }]; - }; - - keybindings = let - mod = wayland.windowManager.sway.config.modifier; - playerctl = "${pkgs.playerctl}/bin/playerctl"; - pamixer = "${pkgs.pamixer}/bin/pamixer"; - light = "${pkgs.light}/bin/light"; - in lib.mkOptionDefault { - "${mod}+p" = "exec passbemenu"; - "${mod}+x" = "move workspace to output right"; - "${mod}+y" = "move workspace to output left"; - - "${mod}+section" = "workspace 0"; - "${mod}+0" = "workspace 10"; - "${mod}+apostrophe" = "workspace 11"; - "${mod}+dead_circumflex" = "workspace 12"; - "${mod}+dead_diaeresis" = "workspace 13"; - "${mod}+dollar" = "workspace 14"; - - "${mod}+Shift+section" = "move container to workspace 0"; - "${mod}+Shift+0" = "move container to workspace 10"; - "${mod}+Shift+apostrophe" = "move container to workspace 11"; - "${mod}+Shift+dead_circumflex" = "move container to workspace 12"; - "${mod}+Shift+dead_diaeresis" = "move container to workspace 13"; - "${mod}+Shift+dollar" = "move container to workspace 14"; - - "Ctrl+mod1+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session"; - "Ctrl+mod1+Shift+L" = "exec ${pkgs.systemd}/bin/systemctl suspend"; - - # pulse audio volume control - XF86AudioLowerVolume = "exec ${pamixer} --decrease 3"; - XF86AudioRaiseVolume = "exec ${pamixer} --increase 3"; - XF86AudioMute = "exec ${pamixer} --toggle-mute"; - XF86AudioMicMute = "exec ${pamixer} --default-source --toggle-mute"; - - # Spotify control - XF86AudioPause = "exec ${playerctl} play-pause"; - XF86AudioPlay = "exec ${playerctl} play-pause"; - XF86AudioNext = "exec ${playerctl} next"; - XF86AudioPrev = "exec ${playerctl} previous"; - - # screen brightness - XF86MonBrightnessUp = "exec ${light} -A 10"; - XF86MonBrightnessDown = "exec ${light} -U 5"; - - # screenshot - Print = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"; - }; - }; - extraConfig = '' - # Disable the laptop screen when the lid is closed. - bindswitch --reload lid:on output eDP-1 disable - bindswitch --reload lid:off output eDP-1 enable - ''; - }; - - systemd.user.services.network-manager-applet = adhereTheSwayTarget; - systemd.user.services.nextcloud-client = adhereTheSwayTarget // { - # For trayicon to work: - Unit.After = [ "waybar.service" ]; - Service = { - ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; - Environment = lib.mkForce - "PATH=${homeManagerConfig.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity"; - }; - }; - systemd.user.services.owncloud-client = adhereTheSwayTarget // { - # For trayicon to work: - Unit.After = [ "waybar.service" ]; - Service = { - ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; - Environment = lib.mkForce - "PATH=${homeManagerConfig.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity"; - }; - }; - systemd.user.services.pasystray = adhereTheSwayTarget; - - gtk = { - iconTheme = { - # package = pkgs.gnome-icon-theme; - # name = "gnome"; - package = pkgs.hicolor_icon_theme; - name = "hicolor"; - }; - gtk3.extraConfig.gtk-menu-images = true; - }; - - dconf.settings = { "org/gnome/desktop/interface".menus-have-icons = true; }; - }; -} diff --git a/defaults/user-configuration/fhauser/applications/waybar.nix b/defaults/user-configuration/fhauser/applications/waybar.nix deleted file mode 100644 index 9c72ad5..0000000 --- a/defaults/user-configuration/fhauser/applications/waybar.nix +++ /dev/null @@ -1,386 +0,0 @@ -{ pkgs, lib, config, ... }: { - home-manager.users.fhauser = { - xsession.preferStatusNotifierItems = true; - wayland.windowManager.sway.config.bars = [ ]; - - programs.waybar = { - enable = true; - settings = [{ - position = "top"; - #height = - modules-left = [ "sway/mode" "sway/workspaces" ]; - modules-center = [ "sway/window" ]; - modules-right = [ - "backlight" - "idle_inhibitor" - "bluetooth" - "cpu" - "temperature" - "memory" - "disk" - "network" - "pulseaudio" - #"custom/keyboard-layout" - "battery" - "tray" - "clock" - ]; - modules = { - backlight.format = " {percent}%"; - disk.format = " {percentage_used}%"; - clock.format = "{:%Y-%2m-%2d %H:%M}"; - "sway/workspaces" = { - disable-scroll-wraparound = true; - enable-bar-scroll = true; - numeric-first = true; - }; - - battery = { - interval = 10; - states = { - warning = 15; - critical = 10; - }; - format = " {capacity}% {time}"; # Icon: bolt - format-discharging = "{icon} {capacity}% {time}"; - format-time = "{H}:{M}"; - format-icons = [ - "" # Icon: battery-full - "" # Icon: battery-three-quarters - "" # Icon: battery-half - "" # Icon: battery-quarter - "" # Icon: battery-empty - ]; - tooltip = "true"; - }; - - cpu = { - interval = "5"; - format = " {usage}% ({load})"; # Icon: microchip - states = { - warning = "70"; - critical = "90"; - }; - }; - - #"custom/keyboard-layout" = { - # exec = pkgs.writeShellScript "keyboard-layout" "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4"; - # # Interval set only as a fallback, as the value is updated by signal - # interval = "30"; - # format = " {}"; # Icon: keyboard - # # Signal sent by Sway key binding (~/.config/sway/key-bindings) - # signal = "1"; # SIGHUP - # tooltip = "false"; - #}; - - memory = { - interval = "5"; - format = " {}%"; # Icon: microchip - states = { - warning = "70"; - critical = "90"; - }; - }; - - network = { - interval = "5"; - format-wifi = " {essid} ({signalStrength}%)"; # Icon: wifi - format-ethernet = "🔗 {ifname}: {ipaddr}/{cidr}"; # Icon: ethernet - format-disconnected = "🔗"; - tooltip-format = "{ifname}: {ipaddr}"; - }; - - "sway/mode" = { - format = - '' {}''; # Icon: expand-arrows-alt - tooltip = "false"; - }; - - "sway/window" = { - format = "{}"; - max-length = "120"; - }; - - "sway/workspaces" = { - all-outputs = false; - disable-scroll = true; - format = "{icon}"; - format-icons = { - "10" = " 10"; - "11" = " 11"; - "12" = " 12"; - "13" = " 13"; - }; - }; - - pulseaudio = { - scroll-step = 3; - format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}%"; - format-muted = "🔇"; - format-icons = { - headphones = ""; - handsfree = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ "" "" "" ]; - }; - on-click = "pavucontrol"; - }; - - temperature = { - critical-threshold = 80; - interval = 5; - format = "{icon} {temperatureC}°C"; - format-icons = [ - "" # Icon: temperature-empty - "" # Icon: temperature-quarter - "" # Icon: temperature-half - "" # Icon: temperature-three-quarters - "" # Icon: temperature-full - ]; - tooltip = "true"; - hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; - }; - - idle_inhibitor = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; - }; - }; - - tray = { - icon-size = "21"; - spacing = "10"; - }; - }; - }]; - - systemd.enable = true; - - style = '' - /* ============================================================================= - * - * Waybar configuration - * - * Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration - * - * =========================================================================== */ - - /* ----------------------------------------------------------------------------- - * Keyframes - * -------------------------------------------------------------------------- */ - - @keyframes blink-warning { - 70% { - color: white; - } - - to { - color: white; - background-color: orange; - } - } - - @keyframes blink-critical { - 70% { - color: white; - } - - to { - color: white; - background-color: red; - } - } - - - /* ----------------------------------------------------------------------------- - * Base styles - * -------------------------------------------------------------------------- */ - - /* Reset all styles */ - * { - border: none; - border-radius: 0; - min-height: 0; - margin: 0; - padding: 0; - } - - /* The whole bar */ - #waybar { - background: #323232; - color: white; - /*font-family: Cantarell, Noto Sans, sans-serif;*/ - font-size: 13px; - } - - /* Each module */ - #battery, - #clock, - #cpu, - #custom-keyboard-layout, - #memory, - #mode, - #network, - #pulseaudio, - #temperature, - #backlight, - #idle_inhibitor, - #tray { - margin-left: 5px; - margin-right: 5px; - padding-left: 5px; - padding-right: 5px; - /*border-right: solid 1px black;*/ - } - - #backlight { - margin-right: 0; - padding-right: 0; - } - - #idle_inhibiter { - margin-left: 0; - padding-left: 0; - } - - - /* ----------------------------------------------------------------------------- - * Module styles - * -------------------------------------------------------------------------- */ - - #battery { - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - #battery.warning { - color: orange; - } - - #battery.critical { - color: red; - } - - #battery.warning.discharging { - animation-name: blink-warning; - animation-duration: 4s; - } - - #battery.critical.discharging { - animation-name: blink-critical; - animation-duration: 3s; - } - - #clock { - font-weight: bold; - } - - #cpu { - /* No styles */ - } - - #cpu.warning { - color: orange; - } - - #cpu.critical { - color: red; - } - - #memory { - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - #memory.warning { - color: orange; - } - - #memory.critical { - color: red; - animation-name: blink-critical; - animation-duration: 2s; - } - - #mode { - background: #64727D; - border-top: 2px solid white; - /* To compensate for the top border and still have vertical centering */ - padding-bottom: 2px; - } - - #network { - /* No styles */ - } - - #network.disconnected { - color: orange; - } - - #pulseaudio { - /* No styles */ - } - - #pulseaudio.muted { - /* No styles */ - } - - #custom-spotify { - color: rgb(102, 220, 105); - } - - #temperature { - /* No styles */ - } - - #temperature.critical { - color: red; - } - - #tray { - /* No styles */ - } - - #window { - font-weight: bold; - } - - #workspaces button { - border-top: 2px solid transparent; - /* To compensate for the top border and still have vertical centering */ - padding-bottom: 2px; - padding-left: 10px; - padding-right: 10px; - color: #888888; - } - - #workspaces button.focused { - border-color: #4c7899; - color: white; - background-color: #285577; - } - - #workspaces button.urgent { - border-color: #c9545d; - color: #c9545d; - } - ''; - }; - systemd.user.services.waybar = with lib; { - # Install.WantedBy = mkForce [ "sway-session.target" ]; # TODO: Set as systemd.target with 22.05 - Unit = { - Requisite = mkForce [ ]; - After = mkForce [ ]; - PartOf = [ "tray.target" ]; - }; - }; - }; -} diff --git a/defaults/user-configuration/fhauser/default.nix b/defaults/user-configuration/fhauser/default.nix deleted file mode 100644 index 848f552..0000000 --- a/defaults/user-configuration/fhauser/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, lib, ... }: { - imports = - [ ./multimedia.nix ./security.nix ./applications ./work ./mimetypes.nix ]; - home-manager.users.fhauser.home.stateVersion = config.system.stateVersion; - home-manager.users.fhauser.systemd.user.targets.tray = { - Unit = { - Description = "Home Manager System Tray"; - Requires = [ "graphical-session-pre.target" ]; - }; - }; -} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..058605b --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1648834319, + "narHash": "sha256-i5Aj4Aw64D/A0X6XW5LxSS4XBnYj7gMz+kN4dpsbdk8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0bdbdea2e26c984b096f4f7d10e3c88536a980b0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-21.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1649490789, + "narHash": "sha256-YrhVxwoofZSx/wLZ4GYET//8vS+uqWX572zvdmP/Etg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c86185d20d708013caf97a6adaa8dc6d72313c75", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1649408932, + "narHash": "sha256-JhTW1OtS5fACcRXLqcTTQyYO5vLkO+bceCqeRms13SY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "42948b300670223ca8286aaf916bc381f66a5313", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e9b537f --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + inputs = { + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-21.11"; + home-manager.url = "github:nix-community/home-manager/release-21.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs-stable"; + #fabianhauser-etaxes.url = "github:fabianhauser/etaxes-sg-nix"; + }; + + outputs = { self, nixpkgs-unstable, nixpkgs-stable, home-manager, ... }@inputs: + let system = "x86_64-linux"; + pkgsUnstable = import nixpkgs-unstable { + inherit system; + config.allowUnfree = true; # For vscode + }; + in { + checks.${system}.formatCheck = let pkgs = pkgsUnstable; in pkgs.runCommand "nixfmt-check" { } '' + set -euo pipefail + cd ${self} + ${pkgs.findutils}/bin/find . -type f -name '*.nix' -exec ${pkgs.nixfmt}/bin/nixfmt --check {} + + mkdir $out + ''; + + # Build with `nixos-rebuild --flake .#` or + # `nix build .#nixosConfigurations..config.system.build.toplevel + nixosConfigurations = let + hosts = [ "speer" "hummelberg" ]; + home-manager-modules = [ home-manager.nixosModules.home-manager { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit pkgsUnstable; }; + users.fhauser = import ./home/fhauser/default.nix; + }; + }]; + mapHostnameToAttr = host: + nixpkgs-stable.lib.nixosSystem { + inherit system; + modules = [ ./host/${host}/default.nix ] ++ home-manager-modules; + }; + in pkgsUnstable.lib.genAttrs hosts mapHostnameToAttr; + + + homeConfigurations = { + fhauser = home-manager.lib.homeManagerConfiguration rec { + inherit system; + username = "fhauser"; + configuration = import ./home/${username}/default.nix; + extraSpecialArgs = { inherit pkgsUnstable; }; + + # Update the state version as needed. + # See the changelog here: + # https://nix-community.github.io/home-manager/release-notes.html#sec-release-21.05 + stateVersion = "21.11"; + }; + }; + }; +} diff --git a/defaults/user-configuration/fhauser/applications/alacritty.nix b/home/fhauser/applications/alacritty.nix similarity index 62% rename from defaults/user-configuration/fhauser/applications/alacritty.nix rename to home/fhauser/applications/alacritty.nix index 76b0257..6c5badd 100644 --- a/defaults/user-configuration/fhauser/applications/alacritty.nix +++ b/home/fhauser/applications/alacritty.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.programs.alacritty = { + programs.alacritty = { enable = true; settings."background_opacity" = 0.95; }; diff --git a/home/fhauser/applications/default.nix b/home/fhauser/applications/default.nix new file mode 100644 index 0000000..ba3753a --- /dev/null +++ b/home/fhauser/applications/default.nix @@ -0,0 +1,115 @@ +{ config, pkgs, lib, ... }: + +{ + + imports = [ + ./evolution.nix + ./firefox.nix + ./gpg.nix + ./ssh.nix + ./scripts.nix + ./webapps.nix + ./vim.nix + ./git.nix + ./waybar.nix + ./psql.nix + ./mako.nix + ./redshift.nix + ./alacritty.nix + ./shell.nix + ./swaylock.nix + ./kanshi.nix + ./sway.nix + ]; + + services = { + network-manager-applet.enable = true; + nextcloud-client = { + enable = true; + startInBackground = true; + }; + owncloud-client.enable = true; + pasystray.enable = true; + blueman-applet.enable = true; + }; + + home = { + packages = with pkgs; + [ # Networking + unison + transmission # GUI Tools, maybe extract... + ] ++ [ # Desktop Environment Applications + google-chrome + chromium + #midori # TODO: Currently unused + #qutebrowser # TODO: Currently unused + synergy + #quicksynergy # Currently unused + nextcloud-client + owncloud-client + ] ++ [ # office # TODO: Migrate to office.nix + # TODO: Build fails! + libreoffice-fresh # TODO: Dictionaries, nixos/nixpkgs#14430 + # pdfgrep + # pdftk + # calibre + tectonic + # texstudio + # pandoc + # system-config-printer + # cups-pk-helper + # cups-bjnp + # gutenprint + # gutenprintBin + # hplipWithPlugin + simple-scan + gnome.gnome-online-accounts + gnome.gnome-control-center + ] ++ [ # Communication + signal-desktop + tdesktop + discord + mattermost-desktop + # pidgin pidgin-otr pidgin-with-plugins #TODO: Pidgin needed? + #TODO: ekiga? + skype + slack + teams + jitsi-meet-electron + teamviewer + rdesktop + ] ++ [ # Development + vscodium + gitlab-runner + docker-compose + vagrant + virt-manager + modemmanager # TODO: makes sense here? + modem-manager-gui + ]; + + #TODO: Write module + activation.statefulConfigSymlinks = + config.lib.dag.entryAfter [ "writeBoundary" ] '' + set -eo pipefail + + STATEFUL_CONFS=( + ".config/spotify" + ".mozilla" + ".password-store" + ) + for STATEFUL_CONF in ''${STATEFUL_CONFS[@]}; do + if [ -e "$STATEFUL_CONF" ] && [ ! -h "$STATEFUL_CONF" ]; then + echo "File $STATEFUL_CONF already exists, exiting!" >&2 + exit 1 + fi + + if [ -h "$STATEFUL_CONF" ]; then + rm "$STATEFUL_CONF" + fi + + $DRY_RUN_CMD ln -s $VERBOSE_ARG "$HOME/.stateful/$STATEFUL_CONF" "$HOME/$STATEFUL_CONF" + done + ''; + }; +} diff --git a/home/fhauser/applications/evolution.nix b/home/fhauser/applications/evolution.nix new file mode 100644 index 0000000..6de3ca5 --- /dev/null +++ b/home/fhauser/applications/evolution.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: { + dconf.settings."org/gnome/evolution-data-server/calendar".notify-enable-audio = + false; +} diff --git a/home/fhauser/applications/firefox.nix b/home/fhauser/applications/firefox.nix new file mode 100644 index 0000000..72543dd --- /dev/null +++ b/home/fhauser/applications/firefox.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + programs.firefox = { + enable = true; + package = pkgs.firefox-wayland; + }; + home.sessionVariables = { + MOZ_ENABLE_WAYLAND = "true"; + MOZ_DBUS_REMOTE = "1"; + }; +} diff --git a/defaults/user-configuration/fhauser/applications/git.nix b/home/fhauser/applications/git.nix similarity index 98% rename from defaults/user-configuration/fhauser/applications/git.nix rename to home/fhauser/applications/git.nix index 25a0dea..f67c853 100644 --- a/defaults/user-configuration/fhauser/applications/git.nix +++ b/home/fhauser/applications/git.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.programs.git = { + programs.git = { enable = true; package = pkgs.gitAndTools.gitFull; aliases = { diff --git a/defaults/user-configuration/fhauser/applications/gpg.nix b/home/fhauser/applications/gpg.nix similarity index 85% rename from defaults/user-configuration/fhauser/applications/gpg.nix rename to home/fhauser/applications/gpg.nix index 77094ea..d4d5c06 100644 --- a/defaults/user-configuration/fhauser/applications/gpg.nix +++ b/home/fhauser/applications/gpg.nix @@ -1,12 +1,10 @@ -{ pkgs, ... }: -let unstable = import { }; -in { +{ pkgs, pkgsUnstable, ... }: { #TODO: ENV variabls for agent - home-manager.users.fhauser.home.sessionVariables.SSH_AUTH_SOCK = + home.sessionVariables.SSH_AUTH_SOCK = "/run/user/1000/gnupg/S.gpg-agent.ssh"; - home-manager.users.fhauser.programs.gpg = { + programs.gpg = { enable = true; - package = unstable.gnupg; + package = pkgsUnstable.gnupg; settings = { "use-agent" = true; "trust-model" = "tofu"; @@ -34,7 +32,7 @@ in { # { source = "./fabian.hauser@threema.ch.pub"; trust = 5; } #]; }; - home-manager.users.fhauser.services.gpg-agent = { + services.gpg-agent = { enable = true; enableScDaemon = true; enableSshSupport = true; diff --git a/defaults/user-configuration/fhauser/applications/kanshi.nix b/home/fhauser/applications/kanshi.nix similarity index 90% rename from defaults/user-configuration/fhauser/applications/kanshi.nix rename to home/fhauser/applications/kanshi.nix index bfc9ccd..4534b66 100644 --- a/defaults/user-configuration/fhauser/applications/kanshi.nix +++ b/home/fhauser/applications/kanshi.nix @@ -1,6 +1,6 @@ { pkgs, lib, config, ... }: { - # home-manager.users.fhauser.systemd.user.services.kanshi.Install.WantedBy = "home-manager-fhauser.service"; # TODO: Upstream array type of systemdTarget - home-manager.users.fhauser.services.kanshi = { + # systemd.user.services.kanshi.Install.WantedBy = "home-manager-fhauser.service"; # TODO: Upstream array type of systemdTarget + services.kanshi = { enable = true; profiles = let backgroundPicturePath = "~/pictures/backgrounds"; diff --git a/defaults/user-configuration/fhauser/applications/mako.nix b/home/fhauser/applications/mako.nix similarity index 87% rename from defaults/user-configuration/fhauser/applications/mako.nix rename to home/fhauser/applications/mako.nix index 9b10df3..0b3e412 100644 --- a/defaults/user-configuration/fhauser/applications/mako.nix +++ b/home/fhauser/applications/mako.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.programs.mako = { + programs.mako = { enable = true; backgroundColor = "#CCCCCCCC"; # TODO: Make layout colors in a central place borderSize = 0; diff --git a/defaults/user-configuration/fhauser/applications/psql.nix b/home/fhauser/applications/psql.nix similarity index 85% rename from defaults/user-configuration/fhauser/applications/psql.nix rename to home/fhauser/applications/psql.nix index 866c32f..b602044 100644 --- a/defaults/user-configuration/fhauser/applications/psql.nix +++ b/home/fhauser/applications/psql.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.home.file.".psqlrc".text = '' + home.file.".psqlrc".text = '' \set QUIET 1 \pset linestyle unicode diff --git a/defaults/user-configuration/fhauser/applications/redshift.nix b/home/fhauser/applications/redshift.nix similarity index 82% rename from defaults/user-configuration/fhauser/applications/redshift.nix rename to home/fhauser/applications/redshift.nix index cd4d94c..7439e07 100644 --- a/defaults/user-configuration/fhauser/applications/redshift.nix +++ b/home/fhauser/applications/redshift.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.services.redshift = { + services.redshift = { enable = true; package = pkgs.redshift-wlr; settings.redshift.brightness-night = "0.9"; diff --git a/defaults/user-configuration/fhauser/applications/scripts.nix b/home/fhauser/applications/scripts.nix similarity index 84% rename from defaults/user-configuration/fhauser/applications/scripts.nix rename to home/fhauser/applications/scripts.nix index 2ebe330..6b14a27 100644 --- a/defaults/user-configuration/fhauser/applications/scripts.nix +++ b/home/fhauser/applications/scripts.nix @@ -25,16 +25,16 @@ let ${pkgs.pass-wayland}/bin/pass show -c "$password" 2>/dev/null ''; - threema-vpn = pkgs.writeScriptBin "threema-vpn" '' - #!${pkgs.stdenv.shell} - set -eo pipefail + threema-vpn = pkgs.writeScriptBin "threema-vpn" ""; #'' + # #!${pkgs.stdenv.shell} + # set -eo pipefail - SERVICE=openvpn-threema - SERVICE_EXEC="${config.systemd.services.openvpn-threema.serviceConfig.ExecStart}" + # SERVICE=openvpn-threema + # SERVICE_EXEC="${config.systemd.services.openvpn-threema.serviceConfig.ExecStart}" - exec sudo ${pkgs.openvpn}/sbin/openvpn''${SERVICE_EXEC#@* openvpn} + # exec sudo ${pkgs.openvpn}/sbin/openvpn''${SERVICE_EXEC#@* openvpn} - ''; + #''; threema-env = pkgs.writeScriptBin "threema-env" '' #!/usr/bin/env bash set -eo pipefail @@ -74,6 +74,6 @@ let ${xhost}/bin/xhost ''; in { - home-manager.users.fhauser.home.packages = + home.packages = [ passbemenu threema-vpn threema-env wsudo ]; } diff --git a/defaults/user-configuration/fhauser/applications/shell.nix b/home/fhauser/applications/shell.nix similarity index 97% rename from defaults/user-configuration/fhauser/applications/shell.nix rename to home/fhauser/applications/shell.nix index 68dc5f1..546fdca 100644 --- a/defaults/user-configuration/fhauser/applications/shell.nix +++ b/home/fhauser/applications/shell.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.programs = { + programs = { bash = { enable = true; historyIgnore = [ "ls" "cd" "exit" "j" ]; diff --git a/defaults/user-configuration/fhauser/applications/ssh.nix b/home/fhauser/applications/ssh.nix similarity index 96% rename from defaults/user-configuration/fhauser/applications/ssh.nix rename to home/fhauser/applications/ssh.nix index 59b1000..00b4f29 100644 --- a/defaults/user-configuration/fhauser/applications/ssh.nix +++ b/home/fhauser/applications/ssh.nix @@ -1,5 +1,5 @@ { pkgs, lib, ... }: { - home-manager.users.fhauser.programs.ssh = let + programs.ssh = let forceIdentityThreema = { identityFile = toString (pkgs.writeText "fabian.hauser@threema.ch.pub" '' ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7h492sXT7zdamf+nbOt+y6jiqxicOnm6+wiuEG1EvZ openpgp:0x18B553DD diff --git a/home/fhauser/applications/sway.nix b/home/fhauser/applications/sway.nix new file mode 100644 index 0000000..09ee49c --- /dev/null +++ b/home/fhauser/applications/sway.nix @@ -0,0 +1,156 @@ +{ pkgs, lib, config, ... }: let + adhereTheSwayTarget = { + Install.WantedBy = lib.mkForce [ "sway-session.target" ]; + Unit.PartOf = lib.mkForce [ "sway-session.target" ]; + }; + # TODO: active screen with -m $active_screen + bemenuLauncher = pkgs.writeScriptBin "bemenuLauncher" '' + #!${pkgs.stdenv.shell} + #active_screen=$(swaymsg -r -t get_outputs | \ + # ${pkgs.jq}/bin/jq '. [] | select (.focused == true) | .name | split ("-") | last') + ${pkgs.dmenu}/bin/dmenu_path | \ + ${pkgs.bemenu}/bin/bemenu --list 20 --ignorecase --prompt 'Start: ' | \ + xargs swaymsg exec -- + ''; +in rec { + home.packages = with pkgs; [ + sway-contrib.grimshot + wl-clipboard + libappindicator + gnome.defaultIconTheme + gnome2.gnome-icon-theme + hicolor-icon-theme # TODO: Move these requirements? + ]; + + xsession.preferStatusNotifierItems = true; + + wayland.windowManager.sway = { + enable = true; + systemdIntegration = true; + xwayland = true; + wrapperFeatures = { gtk = true; }; + extraSessionCommands = '' + #export XDG_CURRENT_DESKTOP=Unity + export XDG_CURRENT_DESKTOP=sway + export XDG_SESSION_TYPE="wayland" + export _JAVA_AWT_WM_NONREPARENTING=1 + export SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh # TODO: Migrate + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # TODO: QTpie + export WLR_DRM_NO_MODIFIERS=1 + export WLR_NO_HARDWARE_CURSORS=1 + ''; + config = { + input = { + "type:keyboard" = { + xkb_layout = "ch,de"; + xkb_options = "eurosign:e"; + }; + "*" = { xkb_numlock = "enable"; }; + }; + terminal = "${pkgs.alacritty}/bin/alacritty"; + menu = "${bemenuLauncher}/bin/bemenuLauncher"; + gaps.inner = 8; + modifier = "Mod4"; + window.border = 0; + #colors.focused.border = "#323232"; + + #TODO: Workspace Programm assignment: Not working properly + assigns = { + "10" = [{ app_id = "^firefox$"; }]; + "11" = [{ app_id = "^(claws-mail|thunderbird|evolution)$"; }]; + "12" = [{ + class = "^Chromium-browser$"; + instance = "^web.threema.ch"; + }]; + "13" = [{ class = "^Spotify$"; }]; + }; + + keybindings = let + mod = wayland.windowManager.sway.config.modifier; + playerctl = "${pkgs.playerctl}/bin/playerctl"; + pamixer = "${pkgs.pamixer}/bin/pamixer"; + light = "${pkgs.light}/bin/light"; + in lib.mkOptionDefault { + "${mod}+p" = "exec passbemenu"; + "${mod}+x" = "move workspace to output right"; + "${mod}+y" = "move workspace to output left"; + + "${mod}+section" = "workspace 0"; + "${mod}+0" = "workspace 10"; + "${mod}+apostrophe" = "workspace 11"; + "${mod}+dead_circumflex" = "workspace 12"; + "${mod}+dead_diaeresis" = "workspace 13"; + "${mod}+dollar" = "workspace 14"; + + "${mod}+Shift+section" = "move container to workspace 0"; + "${mod}+Shift+0" = "move container to workspace 10"; + "${mod}+Shift+apostrophe" = "move container to workspace 11"; + "${mod}+Shift+dead_circumflex" = "move container to workspace 12"; + "${mod}+Shift+dead_diaeresis" = "move container to workspace 13"; + "${mod}+Shift+dollar" = "move container to workspace 14"; + + "Ctrl+mod1+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session"; + "Ctrl+mod1+Shift+L" = "exec ${pkgs.systemd}/bin/systemctl suspend"; + + # pulse audio volume control + XF86AudioLowerVolume = "exec ${pamixer} --decrease 3"; + XF86AudioRaiseVolume = "exec ${pamixer} --increase 3"; + XF86AudioMute = "exec ${pamixer} --toggle-mute"; + XF86AudioMicMute = "exec ${pamixer} --default-source --toggle-mute"; + + # Spotify control + XF86AudioPause = "exec ${playerctl} play-pause"; + XF86AudioPlay = "exec ${playerctl} play-pause"; + XF86AudioNext = "exec ${playerctl} next"; + XF86AudioPrev = "exec ${playerctl} previous"; + + # screen brightness + XF86MonBrightnessUp = "exec ${light} -A 10"; + XF86MonBrightnessDown = "exec ${light} -U 5"; + + # screenshot + Print = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"; + }; + }; + extraConfig = '' + # Disable the laptop screen when the lid is closed. + bindswitch --reload lid:on output eDP-1 disable + bindswitch --reload lid:off output eDP-1 enable + ''; + }; + + systemd.user.services.network-manager-applet = adhereTheSwayTarget; + systemd.user.services.nextcloud-client = adhereTheSwayTarget // { + # For trayicon to work: + Unit.After = [ "waybar.service" ]; + Service = { + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; + Environment = lib.mkForce + "PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity"; + }; + }; + systemd.user.services.owncloud-client = adhereTheSwayTarget // { + # For trayicon to work: + Unit.After = [ "waybar.service" ]; + Service = { + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; + Environment = lib.mkForce + "PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity"; + }; + }; + systemd.user.services.pasystray = adhereTheSwayTarget; + + gtk = { + iconTheme = { + # package = pkgs.gnome-icon-theme; + # name = "gnome"; + package = pkgs.hicolor_icon_theme; + name = "hicolor"; + }; + gtk3.extraConfig.gtk-menu-images = true; + }; + + dconf.settings = { "org/gnome/desktop/interface".menus-have-icons = true; }; +} diff --git a/defaults/user-configuration/fhauser/applications/swaylock.nix b/home/fhauser/applications/swaylock.nix similarity index 95% rename from defaults/user-configuration/fhauser/applications/swaylock.nix rename to home/fhauser/applications/swaylock.nix index ede56d6..da97606 100644 --- a/defaults/user-configuration/fhauser/applications/swaylock.nix +++ b/home/fhauser/applications/swaylock.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.systemd.user.services.swayidle = let + systemd.user.services.swayidle = let lock = "${pkgs.swaylock}/bin/swaylock --hide-keyboard-layout --ignore-empty-password --daemonize --show-failed-attempts --color=000000"; logTimeCmd = "${pkgs.coreutils}/bin/date --rfc-3339=seconds >> ~/locklog"; diff --git a/defaults/user-configuration/fhauser/applications/vim.nix b/home/fhauser/applications/vim.nix similarity index 96% rename from defaults/user-configuration/fhauser/applications/vim.nix rename to home/fhauser/applications/vim.nix index 7c135e8..bc7426d 100644 --- a/defaults/user-configuration/fhauser/applications/vim.nix +++ b/home/fhauser/applications/vim.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home-manager.users.fhauser.programs.vim = { + programs.vim = { enable = true; extraConfig = '' colorscheme elflord diff --git a/home/fhauser/applications/waybar.nix b/home/fhauser/applications/waybar.nix new file mode 100644 index 0000000..b357b06 --- /dev/null +++ b/home/fhauser/applications/waybar.nix @@ -0,0 +1,384 @@ +{ pkgs, lib, config, ... }: { + xsession.preferStatusNotifierItems = true; + wayland.windowManager.sway.config.bars = [ ]; + + programs.waybar = { + enable = true; + settings = [{ + position = "top"; + #height = + modules-left = [ "sway/mode" "sway/workspaces" ]; + modules-center = [ "sway/window" ]; + modules-right = [ + "backlight" + "idle_inhibitor" + "bluetooth" + "cpu" + "temperature" + "memory" + "disk" + "network" + "pulseaudio" + #"custom/keyboard-layout" + "battery" + "tray" + "clock" + ]; + modules = { + backlight.format = " {percent}%"; + disk.format = " {percentage_used}%"; + clock.format = "{:%Y-%2m-%2d %H:%M}"; + "sway/workspaces" = { + disable-scroll-wraparound = true; + enable-bar-scroll = true; + numeric-first = true; + }; + + battery = { + interval = 10; + states = { + warning = 15; + critical = 10; + }; + format = " {capacity}% {time}"; # Icon: bolt + format-discharging = "{icon} {capacity}% {time}"; + format-time = "{H}:{M}"; + format-icons = [ + "" # Icon: battery-full + "" # Icon: battery-three-quarters + "" # Icon: battery-half + "" # Icon: battery-quarter + "" # Icon: battery-empty + ]; + tooltip = "true"; + }; + + cpu = { + interval = "5"; + format = " {usage}% ({load})"; # Icon: microchip + states = { + warning = "70"; + critical = "90"; + }; + }; + + #"custom/keyboard-layout" = { + # exec = pkgs.writeShellScript "keyboard-layout" "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4"; + # # Interval set only as a fallback, as the value is updated by signal + # interval = "30"; + # format = " {}"; # Icon: keyboard + # # Signal sent by Sway key binding (~/.config/sway/key-bindings) + # signal = "1"; # SIGHUP + # tooltip = "false"; + #}; + + memory = { + interval = "5"; + format = " {}%"; # Icon: microchip + states = { + warning = "70"; + critical = "90"; + }; + }; + + network = { + interval = "5"; + format-wifi = " {essid} ({signalStrength}%)"; # Icon: wifi + format-ethernet = "🔗 {ifname}: {ipaddr}/{cidr}"; # Icon: ethernet + format-disconnected = "🔗"; + tooltip-format = "{ifname}: {ipaddr}"; + }; + + "sway/mode" = { + format = + '' {}''; # Icon: expand-arrows-alt + tooltip = "false"; + }; + + "sway/window" = { + format = "{}"; + max-length = "120"; + }; + + "sway/workspaces" = { + all-outputs = false; + disable-scroll = true; + format = "{icon}"; + format-icons = { + "10" = " 10"; + "11" = " 11"; + "12" = " 12"; + "13" = " 13"; + }; + }; + + pulseaudio = { + scroll-step = 3; + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = "🔇"; + format-icons = { + headphones = ""; + handsfree = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ "" "" "" ]; + }; + on-click = "pavucontrol"; + }; + + temperature = { + critical-threshold = 80; + interval = 5; + format = "{icon} {temperatureC}°C"; + format-icons = [ + "" # Icon: temperature-empty + "" # Icon: temperature-quarter + "" # Icon: temperature-half + "" # Icon: temperature-three-quarters + "" # Icon: temperature-full + ]; + tooltip = "true"; + hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + }; + + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + + tray = { + icon-size = "21"; + spacing = "10"; + }; + }; + }]; + + systemd.enable = true; + + style = '' + /* ============================================================================= + * + * Waybar configuration + * + * Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration + * + * =========================================================================== */ + + /* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + + @keyframes blink-warning { + 70% { + color: white; + } + + to { + color: white; + background-color: orange; + } + } + + @keyframes blink-critical { + 70% { + color: white; + } + + to { + color: white; + background-color: red; + } + } + + + /* ----------------------------------------------------------------------------- + * Base styles + * -------------------------------------------------------------------------- */ + + /* Reset all styles */ + * { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; + } + + /* The whole bar */ + #waybar { + background: #323232; + color: white; + /*font-family: Cantarell, Noto Sans, sans-serif;*/ + font-size: 13px; + } + + /* Each module */ + #battery, + #clock, + #cpu, + #custom-keyboard-layout, + #memory, + #mode, + #network, + #pulseaudio, + #temperature, + #backlight, + #idle_inhibitor, + #tray { + margin-left: 5px; + margin-right: 5px; + padding-left: 5px; + padding-right: 5px; + /*border-right: solid 1px black;*/ + } + + #backlight { + margin-right: 0; + padding-right: 0; + } + + #idle_inhibiter { + margin-left: 0; + padding-left: 0; + } + + + /* ----------------------------------------------------------------------------- + * Module styles + * -------------------------------------------------------------------------- */ + + #battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #battery.warning { + color: orange; + } + + #battery.critical { + color: red; + } + + #battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 4s; + } + + #battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 3s; + } + + #clock { + font-weight: bold; + } + + #cpu { + /* No styles */ + } + + #cpu.warning { + color: orange; + } + + #cpu.critical { + color: red; + } + + #memory { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #memory.warning { + color: orange; + } + + #memory.critical { + color: red; + animation-name: blink-critical; + animation-duration: 2s; + } + + #mode { + background: #64727D; + border-top: 2px solid white; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; + } + + #network { + /* No styles */ + } + + #network.disconnected { + color: orange; + } + + #pulseaudio { + /* No styles */ + } + + #pulseaudio.muted { + /* No styles */ + } + + #custom-spotify { + color: rgb(102, 220, 105); + } + + #temperature { + /* No styles */ + } + + #temperature.critical { + color: red; + } + + #tray { + /* No styles */ + } + + #window { + font-weight: bold; + } + + #workspaces button { + border-top: 2px solid transparent; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; + padding-left: 10px; + padding-right: 10px; + color: #888888; + } + + #workspaces button.focused { + border-color: #4c7899; + color: white; + background-color: #285577; + } + + #workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; + } + ''; + }; + systemd.user.services.waybar = with lib; { + # Install.WantedBy = mkForce [ "sway-session.target" ]; # TODO: Set as systemd.target with 22.05 + Unit = { + Requisite = mkForce [ ]; + After = mkForce [ ]; + PartOf = [ "tray.target" ]; + }; + }; +} diff --git a/defaults/user-configuration/fhauser/applications/webapps.nix b/home/fhauser/applications/webapps.nix similarity index 94% rename from defaults/user-configuration/fhauser/applications/webapps.nix rename to home/fhauser/applications/webapps.nix index be5a2cf..47c4475 100644 --- a/defaults/user-configuration/fhauser/applications/webapps.nix +++ b/home/fhauser/applications/webapps.nix @@ -14,7 +14,7 @@ let netflix = web-app "netflix" "https://netflix.com/"; disneyplus = web-app "disneyplus" "https://disneyplus.com/"; in { - home-manager.users.fhauser.home.packages = [ + home.packages = [ whatsapp netflix disneyplus diff --git a/home/fhauser/default.nix b/home/fhauser/default.nix new file mode 100644 index 0000000..b680a07 --- /dev/null +++ b/home/fhauser/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, lib, nixosConfig, ... }: { + imports = + [ ./multimedia.nix ./applications ./work ./mimetypes.nix ./games.nix ]; + home.stateVersion = nixosConfig.system.stateVersion; + systemd.user.targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = [ "graphical-session-pre.target" ]; + }; + }; +} diff --git a/defaults/games/default.nix b/home/fhauser/games.nix similarity index 85% rename from defaults/games/default.nix rename to home/fhauser/games.nix index 8081af0..ec66492 100644 --- a/defaults/games/default.nix +++ b/home/fhauser/games.nix @@ -1,7 +1,7 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, lib, ... }: { - environment.systemPackages = with pkgs; + home.packages = with pkgs; [ neverball wesnoth @@ -10,7 +10,6 @@ superTuxKart extremetuxracer zeroad - ] ++ (with pkgs.gnome; [ # Selection of gnome games five-or-more four-in-a-row diff --git a/defaults/user-configuration/fhauser/mimetypes.nix b/home/fhauser/mimetypes.nix similarity index 97% rename from defaults/user-configuration/fhauser/mimetypes.nix rename to home/fhauser/mimetypes.nix index f31df1c..a6fc2c0 100644 --- a/defaults/user-configuration/fhauser/mimetypes.nix +++ b/home/fhauser/mimetypes.nix @@ -1,6 +1,6 @@ { pkgs, lib, config, ... }: { - home-manager.users.fhauser.xdg.mimeApps = rec { + xdg.mimeApps = rec { enable = true; associations.added = defaultApplications; defaultApplications = let diff --git a/defaults/user-configuration/fhauser/multimedia.nix b/home/fhauser/multimedia.nix similarity index 94% rename from defaults/user-configuration/fhauser/multimedia.nix rename to home/fhauser/multimedia.nix index c42c052..143a6a9 100644 --- a/defaults/user-configuration/fhauser/multimedia.nix +++ b/home/fhauser/multimedia.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: { - home-manager.users.fhauser.home.packages = with pkgs; + home.packages = with pkgs; [ vlc v4l-utils calibre blender openshot-qt playerctl youtube-dl ] ++ [ # Audio audacity diff --git a/defaults/user-configuration/fhauser/work/.gitignore b/home/fhauser/work/.gitignore similarity index 100% rename from defaults/user-configuration/fhauser/work/.gitignore rename to home/fhauser/work/.gitignore diff --git a/defaults/user-configuration/fhauser/work/default.nix b/home/fhauser/work/default.nix similarity index 71% rename from defaults/user-configuration/fhauser/work/default.nix rename to home/fhauser/work/default.nix index 327d020..610341a 100644 --- a/defaults/user-configuration/fhauser/work/default.nix +++ b/home/fhauser/work/default.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: - { # Note: Some of these files might not be provided by this repository. - imports = [ ./openvpn.nix ]; + # TODO + #imports = [ ./openvpn.nix ]; } diff --git a/host/speer/default.nix b/host/speer/default.nix index 29c5495..341866b 100644 --- a/host/speer/default.nix +++ b/host/speer/default.nix @@ -12,15 +12,9 @@ ../../defaults/base ../../defaults/cifs-auth-fix ../../defaults/desktop - ../../defaults/games - ../../defaults/user-configuration - ../../defaults/user-configuration/fhauser #../../defaults/printing ]; - #TODO: Clean up next section - #services.xserver.dpi = 180; - virtualisation = { # TODO: This should probably be somewhere else. docker = { enable = true; diff --git a/meta/users.nix b/meta/users.nix index 1b0b06a..83ca4c5 100644 --- a/meta/users.nix +++ b/meta/users.nix @@ -10,7 +10,7 @@ isNormalUser = true; description = "Fabian Hauser"; group = "fhauser"; - extraGroups = [ "wheel" "video" "docker" "networkmanager" "libvirtd" ]; + extraGroups = [ "wheel" "video" "docker" "networkmanager" "libvirtd" "adbusers" ]; hashedPassword = "$6$rounds=20000$TYZ8CojfBLwejcwn$smEJe6/anL9NGf.Ytfny14nBfhr4TRPv2XK1lgHz7yg.zQow1HACePirEjsjxzFC6vTHGaT8t2NxobUsHbWLg1"; openssh.authorizedKeys.keys = [