From 0014961d3a9bc0e537c048ca3fdce5fccb16032e Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 23 Nov 2021 12:09:24 +0100 Subject: [PATCH] Revert firefox package to firefox-wayland, add electron config and tweak sway config to be more reusable --- .envrc | 3 ++ flake.lock | 12 ++++---- home-manager/modules/electron/default.nix | 21 +++++++++++++ home-manager/modules/firefox/default.nix | 2 +- home-manager/modules/fish/default.nix | 8 ++++- home-manager/modules/sway/default.nix | 6 ++-- krops.nix | 36 ++++++++++++++++++++++- modules/desktop/default.nix | 10 +++++-- modules/greetd/default.nix | 7 +++++ 9 files changed, 92 insertions(+), 13 deletions(-) create mode 100644 .envrc create mode 100644 home-manager/modules/electron/default.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1867f14 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +PASSWORD_STORE_DIR=${PWD}/secrets + +export PASSWORD_STORE_DIR diff --git a/flake.lock b/flake.lock index 9cfa4d0..ebda8e6 100644 --- a/flake.lock +++ b/flake.lock @@ -47,11 +47,11 @@ ] }, "locked": { - "lastModified": 1637516270, - "narHash": "sha256-qTffAQ0kWA2qXMJUVMDsgXVbzMNI0BfR78vB/4QFA+o=", + "lastModified": 1637649415, + "narHash": "sha256-I82k+kFZuezkWPJypuqhqhChFbzDR4jpn89e2Fm2zRo=", "owner": "nix-community", "repo": "home-manager", - "rev": "15ae861e1bfad90e0d14106551544e9e07cbcb10", + "rev": "c4c761ba554bc674b0d5a89eb7e9f7a488a8859d", "type": "github" }, "original": { @@ -84,11 +84,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1637155076, - "narHash": "sha256-26ZPNiuzlsnXpt55Q44+yzXvp385aNAfevzVEKbrU5Q=", + "lastModified": 1637595801, + "narHash": "sha256-LkIMwVFKCuEqidaUdg8uxwpESAXjsPo4oCz3eJ7RaRw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "715f63411952c86c8f57ab9e3e3cb866a015b5f2", + "rev": "263ef4cc4146c9fab808085487438c625d4426a9", "type": "github" }, "original": { diff --git a/home-manager/modules/electron/default.nix b/home-manager/modules/electron/default.nix new file mode 100644 index 0000000..5b5a0af --- /dev/null +++ b/home-manager/modules/electron/default.nix @@ -0,0 +1,21 @@ +{ pkgs, config, lib, ... }: +with lib; +let + cfg = config.eboskma.programs.electron; +in +{ + options.eboskma.programs.electron = { + enable = mkEnableOption "activate electron settings"; + wayland = mkEnableOption "set Wayland compatibility settings"; + }; + + config = mkIf (cfg.enable) { + home.file.electron_conf = mkIf (cfg.wayland) { + target = ".config/electron-flags.conf"; + text = '' + --enable-features=UseOzonePlatform + --ozone-platform=wayland + ''; + }; + }; +} diff --git a/home-manager/modules/firefox/default.nix b/home-manager/modules/firefox/default.nix index a390b46..eaa1de8 100644 --- a/home-manager/modules/firefox/default.nix +++ b/home-manager/modules/firefox/default.nix @@ -41,7 +41,7 @@ in config = mkIf (cfg.enable) { programs.firefox = { enable = true; - package = pkgs.firefox-bin; + package = pkgs.firefox-wayland; profiles = { private = { diff --git a/home-manager/modules/fish/default.nix b/home-manager/modules/fish/default.nix index 383ce73..c61d653 100644 --- a/home-manager/modules/fish/default.nix +++ b/home-manager/modules/fish/default.nix @@ -23,10 +23,16 @@ in ''; description = "Reload Fish while keeping some context"; }; + update-env = { + body = '' + set -gx SWAYSOCK /run/user/(id -u)/sway-ipc.(id -u).(pgrep -x sway).sock + ''; + description = "Update environment variables"; + }; }; shellAliases = { - code = "${pkgs.vscode}/bin/code --enable-features=UseOzonePlatform --ozone-platform=wayland"; + # code = "${pkgs.vscode}/bin/code --enable-features=UseOzonePlatform --ozone-platform=wayland"; ls = "${pkgs.exa}/bin/exa -Fb"; }; # interactiveShellInit = '' diff --git a/home-manager/modules/sway/default.nix b/home-manager/modules/sway/default.nix index ce54fad..2f932a1 100644 --- a/home-manager/modules/sway/default.nix +++ b/home-manager/modules/sway/default.nix @@ -180,11 +180,13 @@ in for_window [class="^.*"] inhibit_idle fullscreen for_window [app_id="gnome-calculator"] floating enable - exec_always --no-startup-id systemctl --user import-environment _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK - exec_always --no-startup-id dbus-update-activation-environment --systemd _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK + # exec_always --no-startup-id systemctl --user import-environment _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK + # exec_always --no-startup-id dbus-update-activation-environment --systemd _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK exec --no-startup-id ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator exec --no-startup-id ${pkgs.swayidle}/bin/swayidle -w timeout 900 ${swaylockcmd}; exec --no-startup-id ${pkgs.swayidle}/bin/swayidle -w 1200 ${pkgs.sway}/bin/swaymsg 'output * dpms off' resume ${pkgs.sway}/bin/swaymsg 'output * dpms off'; + + include /etc/sway/config.d/* ''; extraSessionCommands = diff --git a/krops.nix b/krops.nix index ffcd441..474d18c 100644 --- a/krops.nix +++ b/krops.nix @@ -1 +1,35 @@ -{ } +let + krops = builtins.fetchGit { + url = https://cgit.krebsco.de/krops/; + }; + + lib = import "${krops}/lib"; + pkgs = import "${krops}/pkgs" { }; + source = name: + lib.evalSource [{ + machine-config.file = toString ./.; + }]; + + command = targetPath: '' + nix-shell -p git --run ' + nix build -v '${targetPath}/machine-config#nixosConfigurations.$(hostname).config.system.build.toplevel' && \ + nixos-rebuild switch -v --show-trace --flake ${targetPath}/machine-config + ' + ''; + + createHost = name: target: + pkgs.krops.writeCommand "deploy-${name}" { + inherit command; + source = source name; + target = target; + }; + +in +rec { + # Deployments + + # Run with: + # nix-build ./krops.nix -A loki && ./result + + loki = createHost "loki" "root@loki"; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 17bea83..d140e64 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -41,6 +41,10 @@ in programs = { alacritty.enable = true; bat.enable = true; + electron = { + enable = true; + wayland = true; + }; firefox = { enable = true; work = config.eboskma.base.work; @@ -69,6 +73,7 @@ in jetbrains.clion neovim nomachine-client + pass ripgrep signal-desktop steam @@ -89,8 +94,8 @@ in }; iconTheme = { - name = "Paper"; - package = pkgs.paper-icon-theme; + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; }; gtk3.extraConfig = { @@ -108,6 +113,7 @@ in } ../../home-manager/modules/alacritty ../../home-manager/modules/bat + ../../home-manager/modules/electron ../../home-manager/modules/firefox ../../home-manager/modules/fish ../../home-manager/modules/git diff --git a/modules/greetd/default.nix b/modules/greetd/default.nix index 554f99f..afbfb1a 100644 --- a/modules/greetd/default.nix +++ b/modules/greetd/default.nix @@ -31,6 +31,7 @@ in -m 'What do you want to do?' \ -b 'Poweroff' 'systemctl poweroff' \ -b 'Reboot' 'systemctl reboot' + include /etc/sway/config.d/* ''; user = "greeter"; group = "greeter"; @@ -43,6 +44,12 @@ in user = "greeter"; group = "greeter"; }; + "sway/config.d/systemd-env.conf" = { + text = '' + exec_always --no-startup-id systemctl --user import-environment _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK + exec_always --no-startup-id dbus-update-activation-environment --systemd _JAVA_AWT_WM_NONREPARENTING MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_WAYLAND_DISABLE_WINDOWDECORATION QT_QPA_PLATFORMTHEME SDL_VIDEODRIVER SSH_AUTH_SOCK + ''; + }; }; }; }