From 7c93cd7b9a14a0f02bf482d8279f865380bedbfe Mon Sep 17 00:00:00 2001 From: Jakub Trzeciak Date: Mon, 23 Oct 2023 13:19:40 +0200 Subject: Sway --- home-manager/addons/firefox.nix | 109 ++++++++++++++++++++++++++++++++ home-manager/firefox.nix | 109 -------------------------------- home-manager/home.nix | 53 ++++++++-------- home-manager/sway-config.nix | 135 ++++++++++++++++++++++++++++++++++++++++ nixos/autologin.nix | 19 ------ nixos/configuration.nix | 122 +++++++++++++++++------------------- nixos/sway-config.nix | 12 ++++ overlays/default.nix | 34 +++++----- 8 files changed, 356 insertions(+), 237 deletions(-) create mode 100644 home-manager/addons/firefox.nix delete mode 100644 home-manager/firefox.nix create mode 100644 home-manager/sway-config.nix delete mode 100644 nixos/autologin.nix create mode 100644 nixos/sway-config.nix diff --git a/home-manager/addons/firefox.nix b/home-manager/addons/firefox.nix new file mode 100644 index 0000000..0a3b922 --- /dev/null +++ b/home-manager/addons/firefox.nix @@ -0,0 +1,109 @@ +{ config, pkgs, theme, ... }: + +let + firefox-i2p = pkgs.writeShellScriptBin "firefox-i2p" ''firefox -p i2p''; + firefox-work = pkgs.writeShellScriptBin "firefox-work" ''firefox -p work''; + + # Show all packages - `nix flake show "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"` + default-extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + decentraleyes + clearurls + darkreader + noscript + + # ImageBlock - Blure Images + # ClearlyRead + + # privacy-badger + ]; + + default-settings = { + "browser.search.region" = "US"; + + "app.normandy.first_run" = false; + "toolkit.telemetry.reportingpolicy.firstRun" = false; + "trailhead.firstrun.didSeeAboutWelcome" = true; + + "browser.startup.homepage" = "https://jptrzy.xyz"; + + "browser.compactmode.show" = true; + "browser.uidensity" = 1; + #"browser.uiCustomization.state" = ''{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["ublock0_raymondhill_net-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","customizableui-special-spring6","urlbar-container","customizableui-special-spring7","downloads-button","jid1-mnnxcxisbpnsxq_jetpack-browser-action","unified-extensions-button"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","jid1-mnnxcxisbpnsxq_jetpack-browser-action","ublock0_raymondhill_net-browser-action","developer-button"],"dirtyAreaCache":["unified-extensions-area","nav-bar","TabsToolbar","widget-overflow-fixed-list","PersonalToolbar"],"currentVersion":19,"newElementCount":7}''; + + "media.ffmpeg.vaapi.enabled" = true; + #"xpinstall.signatures.required" = false; # TODO - it is a security issue + }; +in { + programs.firefox = { + enable = true; + + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + # https://github.com/mozilla/policy-templates#enterprisepoliciesenabled + extraPolicies = { + CaptivePortal = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableFirefoxAccounts = true; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = false; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + }; + + profiles = { + i2p = { + isDefault = false; id = 2; + name = "i2p"; + + settings = { + "javascript.enabled" = false; + "keyword.enabled" = true; + + "network.proxy.type" = 1; + "network.proxy.share_proxy_settings" = true; + + "network.proxy.http" = "127.0.0.1"; + "network.proxy.http_port" = 4444; + + "network.proxy.ssl" = "127.0.0.1"; + "network.proxy.ssl_port" = 4444; + }; + }; + + work = { + isDefault = false; id = 1; + name = "work"; + + extensions = default-extensions; + settings = default-settings; + }; + + default = { + isDefault = true; id = 0; + name = "main"; + + extensions = default-extensions; + settings = default-settings; + }; + }; + }; + + home.packages = [ + firefox-i2p + firefox-work + ]; +} diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix deleted file mode 100644 index 0a3b922..0000000 --- a/home-manager/firefox.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ config, pkgs, theme, ... }: - -let - firefox-i2p = pkgs.writeShellScriptBin "firefox-i2p" ''firefox -p i2p''; - firefox-work = pkgs.writeShellScriptBin "firefox-work" ''firefox -p work''; - - # Show all packages - `nix flake show "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"` - default-extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - decentraleyes - clearurls - darkreader - noscript - - # ImageBlock - Blure Images - # ClearlyRead - - # privacy-badger - ]; - - default-settings = { - "browser.search.region" = "US"; - - "app.normandy.first_run" = false; - "toolkit.telemetry.reportingpolicy.firstRun" = false; - "trailhead.firstrun.didSeeAboutWelcome" = true; - - "browser.startup.homepage" = "https://jptrzy.xyz"; - - "browser.compactmode.show" = true; - "browser.uidensity" = 1; - #"browser.uiCustomization.state" = ''{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["ublock0_raymondhill_net-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","customizableui-special-spring6","urlbar-container","customizableui-special-spring7","downloads-button","jid1-mnnxcxisbpnsxq_jetpack-browser-action","unified-extensions-button"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","jid1-mnnxcxisbpnsxq_jetpack-browser-action","ublock0_raymondhill_net-browser-action","developer-button"],"dirtyAreaCache":["unified-extensions-area","nav-bar","TabsToolbar","widget-overflow-fixed-list","PersonalToolbar"],"currentVersion":19,"newElementCount":7}''; - - "media.ffmpeg.vaapi.enabled" = true; - #"xpinstall.signatures.required" = false; # TODO - it is a security issue - }; -in { - programs.firefox = { - enable = true; - - package = pkgs.wrapFirefox pkgs.firefox-unwrapped { - # https://github.com/mozilla/policy-templates#enterprisepoliciesenabled - extraPolicies = { - CaptivePortal = false; - DisableFirefoxStudies = true; - DisablePocket = true; - DisableTelemetry = true; - DisableFirefoxAccounts = true; - NoDefaultBookmarks = true; - OfferToSaveLogins = false; - OfferToSaveLoginsDefault = false; - PasswordManagerEnabled = false; - FirefoxHome = { - Search = true; - Pocket = false; - Snippets = false; - TopSites = false; - Highlights = false; - }; - UserMessaging = { - ExtensionRecommendations = false; - SkipOnboarding = true; - }; - }; - }; - - profiles = { - i2p = { - isDefault = false; id = 2; - name = "i2p"; - - settings = { - "javascript.enabled" = false; - "keyword.enabled" = true; - - "network.proxy.type" = 1; - "network.proxy.share_proxy_settings" = true; - - "network.proxy.http" = "127.0.0.1"; - "network.proxy.http_port" = 4444; - - "network.proxy.ssl" = "127.0.0.1"; - "network.proxy.ssl_port" = 4444; - }; - }; - - work = { - isDefault = false; id = 1; - name = "work"; - - extensions = default-extensions; - settings = default-settings; - }; - - default = { - isDefault = true; id = 0; - name = "main"; - - extensions = default-extensions; - settings = default-settings; - }; - }; - }; - - home.packages = [ - firefox-i2p - firefox-work - ]; -} diff --git a/home-manager/home.nix b/home-manager/home.nix index 7c0c4de..100e67d 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -15,9 +15,9 @@ let in { imports = [ nix-colors.homeManagerModules.default - ./firefox.nix - ./addons/alacritty.nix - ./addons/xresources.nix + #./addons/firefox.nix + #./addons/alacritty.nix + #./addons/xresources.nix ]; colorScheme = schemeFromYaml "lux-scheme" (builtins.readFile lux-scheme); @@ -37,7 +37,6 @@ in { home.packages = [ pkgs.picom pkgs.libnotify - pkgs.birdtray pkgs.dmenu-bluetooth #pkgs.pureref @@ -59,8 +58,6 @@ in { home.file = { ".config/nvim/spell/pl.utf-8.spl".source = nvim-spell-pl-utf8-dict; - ".config/sx/sxrc".source = ./sxrc; - ".local/share/gnupg/gpg-agent.conf".text = '' debug-pinentry debug ipc @@ -70,6 +67,8 @@ in { #pinentry-program /run/current-system/sw/bin/pinentry pinentry-program /run/current-system/sw/bin/pinentry-gtk-2 ''; + + ".config/sway/config" = (import ./sway-config.nix {inherit pkgs;}); }; dconf = { @@ -86,26 +85,30 @@ in { font.name = "Neo Comic Mono 12"; - theme = { - name = "lux-scheme"; - package = nix-colors-lib.gtkThemeFromScheme { - scheme = config.colorScheme; - }; - }; - - iconTheme = { - name = "Adwaita"; - package = pkgs.gnome.adwaita-icon-theme; - }; - - cursorTheme = { - name = "Adwaita"; - package = pkgs.gnome.adwaita-icon-theme; - }; + #theme = { + # name = "lux-scheme"; + # package = nix-colors-lib.gtkThemeFromScheme { + # scheme = config.colorScheme; + # }; + #}; + + #iconTheme = { + # name = "Adwaita"; + # package = pkgs.gnome.adwaita-icon-theme; + #}; + + #cursorTheme = { + # name = "Adwaita"; + # package = pkgs.gnome.adwaita-icon-theme; + #}; }; services = { dunst.enable = true; + + kanshi = { + enable = true; + }; }; programs = { @@ -139,12 +142,6 @@ in { #QT_STYLE_OVERRIDE=adwaita #QT_QPA_PLATFORMTHEME=gnome }; - - profileExtra = '' - if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then - exec sx - fi - ''; }; git = { diff --git a/home-manager/sway-config.nix b/home-manager/sway-config.nix new file mode 100644 index 0000000..c53fb56 --- /dev/null +++ b/home-manager/sway-config.nix @@ -0,0 +1,135 @@ +{ pkgs }: { text = '' + +exec ${pkgs.pulseaudio}/bin/pulseaudio --start +exec systemctl --user import-environment + +#exec ${pkgs.eww-wayland}/bin/eww daemon +#exec ${pkgs.eww-wayland}/bin/eww open bar0 +#exec ${pkgs.eww-wayland}/bin/eww open bar1 + +set $mod Mod1 +set $left h +set $down j +set $up k +set $right l + +floating_modifier $mod normal + +# Apps + bindsym $mod+d exec ${pkgs.dmenu}/bin/dmenu_path | ${pkgs.wmenu}/bin/wmenu | xargs ${pkgs.sway}/bin/swaymsg exec -- + bindsym $mod+Return exec ${pkgs.foot}/bin/foot + +# Basic + bindsym $mod+Shift+q kill + bindsym $mod+Shift+r reload; + bindsym $mod+f fullscreen + bindsym $mod+Shift+space floating toggle + + bindsym $mod+b splith + bindsym $mod+v splitv + +# Multimedia + # Sound + bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% + bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle + + # Screen Brightness + bindsym XF86MonBrightnessUp exec light -A 10 + bindsym XF86MonBrightnessDown exec light -U 10 + +# Movement + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + +# Workspace + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + + + +# Resize + mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" + } + + bindsym $mod+r mode "resize" + + + +# Status Bar + bar { + position top + font "Neo Comic Mono 12" + } + +# Window border + default_border none + default_floating_border none + font pango:monospace 0 + titlebar_padding 1 + titlebar_border_thickness 0 + + +# Input + input "type:keyboard" { + xkb_options caps:escape + } + + input "2:7:SynPS/2_Synaptics_TouchPad" { + natural_scroll enabled + } + + + + +include @sysconfdir@/sway/config.d/* +''; } diff --git a/nixos/autologin.nix b/nixos/autologin.nix deleted file mode 100644 index 42a3316..0000000 --- a/nixos/autologin.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, pkgs, getty, ... }: - -let - script = pkgs.writeText "login-program.sh" '' - if [[ "$(tty)" == '/dev/tty1' ]]; then - ${pkgs.shadow}/bin/login -f jp3; - else - ${pkgs.shadow}/bin/login; - fi - ''; -in - -{ - services.getty = { - loginProgram = "${pkgs.bash}/bin/sh"; - loginOptions = toString script; - extraArgs = [ "--skip-login" ]; - }; -} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 2f75bdb..f55d352 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,38 +1,50 @@ { inputs, outputs, hostname, username, config, pkgs, ... }: { system.stateVersion = "23.05"; # Did you read the comment? - nixpkgs.config.allowUnfree = true; + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + ]; + + config = { + allowUnfree = true; + pulseaduio = true; + packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - nix.gc.automatic = true; + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + angband = pkgs.angband.override { + enableSdl2 = true; + }; + }; + }; + }; + + nix = { + extraOptions = '' + experimental-features = nix-command flakes + ''; + gc.automatic = true; + }; imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix # Autologin on tty1 - ./autologin.nix ]; - nixpkgs.config.packageOverrides = pkgs: { - nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { - inherit pkgs; - }; - - vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; - angband = pkgs.angband.override { - enableSdl2 = true; - }; - }; - - security.pam.services."${username}".enableGnomeKeyring = true; - security.wrappers = { - slock = { - owner = "root"; group = "root"; - setuid = true; - source = "${pkgs.slock}/bin/slock"; + security = { + pam.services."${username}".enableGnomeKeyring = true; + wrappers = { + slock = { + owner = "root"; group = "root"; + setuid = true; + source = "${pkgs.slock}/bin/slock"; + }; }; }; @@ -59,7 +71,6 @@ }; # System - # Set your time zone. time.timeZone = "Europe/Warsaw"; @@ -116,6 +127,18 @@ }; services = { + greetd = { + enable = true; + + settings = rec { + initial_session = { + command = "${pkgs.sway}/bin/sway"; + user = "jp3"; + }; + default_session = initial_session; + }; + }; + i2pd = { enable = true; enableIPv6 = true; @@ -141,25 +164,6 @@ HandleLidSwitch=suspend ''; - xserver = { # Enable the X11 windowing system. - enable = true; - - layout = "pl"; - xkbOptions = "caps:escape"; - - displayManager.sx.enable = true; - windowManager.dwm.enable = true; - - libinput = { - enable = true; - touchpad = { - naturalScrolling = true; - clickMethod = "none"; - tapping = false; - }; - }; - }; - printing = { enable = true; drivers = [ @@ -222,15 +226,8 @@ dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server }; - # Suckless Overlays - nixpkgs.overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - #outputs.overlays.unstable-packages - ]; - # List packages installed in system profile. To search, run: - environment.binsh = "${pkgs.dash}/bin/dash"; + #environment.binsh = "${pkgs.dash}/bin/dash"; # $ nix search wget environment.systemPackages = with pkgs; [ @@ -248,17 +245,13 @@ # Window Manager cmus - dconf - dmenu dwm dwmblocks slock - xclip - nsxiv zathura pinentry-gnome gcr pinentry-gtk2 # Heavy lazygit - alacritty + foot firefox gnome.nautilus pika-backup @@ -271,24 +264,20 @@ thunderbird signal-desktop w3m - texlive.combined.scheme-full + texlive.combined.scheme-full # Latex yt-dlp curl - ueberzug libnotify - abaddon # Discord inkscape gimp krita cups - arandr monero-gui - sent - xautolock fragments # Torrent client libresprite ldtk - betterbird libreoffice-qt mercury-browser + dconf + wl-clipboard # Gnome Apps without Gnome gnome.adwaita-icon-theme libsecret gnome.seahorse @@ -307,8 +296,13 @@ gamemode heroic gogdl + wdisplays + + # TEMP + jq + sway ] ++ [ - (pkgs.nnn.override { withNerdIcons = true; }) + #(pkgs.nnn.override { withNerdIcons = true; }) #(pkgs.unstable.callPackage ../pkgs/heroic-launcher { # electron = pkgs.unstable.electron_24; #}) diff --git a/nixos/sway-config.nix b/nixos/sway-config.nix new file mode 100644 index 0000000..e372589 --- /dev/null +++ b/nixos/sway-config.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: pkgs.writeText "nixos-sway-config" '' + +set $mod Mod1 + +bindsym $mod+d exec ${pkgs.dmenu}/bin/dmenu_path | ${pkgs.wmenu}/bin/wmenu | xargs ${pkgs.sway}/bin/swaymsg exec -- +bindsym $mod+Return exec ${pkgs.foot}/bin/foot + +'' + +#bindsym $mod+Shift+q kill + +#bindsym $mod+Shift+r reload diff --git a/overlays/default.nix b/overlays/default.nix index 2bdd11f..d505988 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,11 +1,11 @@ # This file defines overlays { pkgs, username, inputs, ... }: let - dmenu-src = builtins.fetchTarball "https://git.jptrzy.xyz/dmenu/snapshot/master.tar.gz"; + #dmenu-src = builtins.fetchTarball "https://git.jptrzy.xyz/dmenu/snapshot/master.tar.gz"; #dwm-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwm/snapshot/master.tar.gz"; - dwmblocks-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwmblocks/snapshot/master.tar.gz"; - sent-src = builtins.fetchTarball "https://git.jptrzy.xyz/sent/snapshot/master.tar.gz"; - slock-src = builtins.fetchTarball "https://git.jptrzy.xyz/slock/snapshot/master.tar.gz"; - dwm-src = /home/${username}/.local/src/dwm; + #dwmblocks-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwmblocks/snapshot/master.tar.gz"; + #sent-src = builtins.fetchTarball "https://git.jptrzy.xyz/sent/snapshot/master.tar.gz"; + #slock-src = builtins.fetchTarball "https://git.jptrzy.xyz/slock/snapshot/master.tar.gz"; + #dwm-src = /home/${username}/.local/src/dwm; in { # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs {pkgs = final;}; @@ -26,17 +26,17 @@ in { # example = prev.example.overrideAttrs (oldAttrs: rec { # ... # }); - dmenu = prev.dmenu.overrideAttrs (old: { src = dmenu-src; }); - dwm = prev.dwm.overrideAttrs (old: { src = dwm-src; }); - dwmblocks = prev.dwmblocks.overrideAttrs (old: { src = dwmblocks-src; }); - sent = prev.dwm.overrideAttrs (old: { src = sent-src; }); - slock = prev.slock.overrideAttrs (old: { - src = slock-src; - buildInputs = with pkgs; [ - xorg.libXinerama - xorg.libXft - imlib2 - ] ++ old.buildInputs; - }); + #dmenu = prev.dmenu.overrideAttrs (old: { src = dmenu-src; }); + #dwm = prev.dwm.overrideAttrs (old: { src = dwm-src; }); + #dwmblocks = prev.dwmblocks.overrideAttrs (old: { src = dwmblocks-src; }); + #sent = prev.dwm.overrideAttrs (old: { src = sent-src; }); + #slock = prev.slock.overrideAttrs (old: { + # src = slock-src; + # buildInputs = with pkgs; [ + # xorg.libXinerama + # xorg.libXft + # imlib2 + # ] ++ old.buildInputs; + #}); }; } -- cgit v1.2.3