From 629ef01306788a3fbed1a733d3d5638ea7543db9 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Fri, 1 Jul 2022 04:45:26 +0300 Subject: [PATCH] guh --- flake.lock | 139 ++++++------ flake.nix | 17 +- hosts/lungmen/default.nix | 14 +- modules/base/default.nix | 1 - modules/network/default.nix | 4 +- modules/persist/default.nix | 5 + pkgs-set/default.nix | 4 +- pkgs-set/overlays/chromium.nix | 5 - pkgs-set/overlays/helix.nix | 2 +- pkgs-set/overlays/hyprland.nix | 3 + pkgs-set/overlays/nur.nix | 1 + pkgs-set/pkgs-to-export.nix | 16 +- pkgs-set/pkgs/generate-firefox-addons.nix | 12 + users/modules/firefox/default.nix | 71 ++++++ users/modules/firefox/extensions.json | 3 + users/modules/firefox/extensions.nix | 18 ++ users/modules/font/default.nix | 28 +++ users/modules/hyprland/default.nix | 149 ++++++++++++ users/modules/mako/default.nix | 18 ++ users/modules/rofi/default.nix | 119 ++++++++++ users/modules/wezterm/default.nix | 32 +++ users/modules/zoxide/default.nix | 14 ++ users/patriot/config/wezterm/cfg.nix | 24 -- users/patriot/default.nix | 264 ++++++++-------------- 24 files changed, 671 insertions(+), 292 deletions(-) create mode 100644 modules/persist/default.nix create mode 100644 pkgs-set/overlays/hyprland.nix create mode 100644 pkgs-set/overlays/nur.nix create mode 100644 pkgs-set/pkgs/generate-firefox-addons.nix create mode 100644 users/modules/firefox/default.nix create mode 100644 users/modules/firefox/extensions.json create mode 100644 users/modules/firefox/extensions.nix create mode 100644 users/modules/font/default.nix create mode 100644 users/modules/hyprland/default.nix create mode 100644 users/modules/mako/default.nix create mode 100644 users/modules/rofi/default.nix create mode 100644 users/modules/wezterm/default.nix create mode 100644 users/modules/zoxide/default.nix delete mode 100644 users/patriot/config/wezterm/cfg.nix diff --git a/flake.lock b/flake.lock index ec33923..bebbfbd 100644 --- a/flake.lock +++ b/flake.lock @@ -19,11 +19,11 @@ "devshell": { "flake": false, "locked": { - "lastModified": 1654858401, - "narHash": "sha256-53bw34DtVJ2bnF6WEwy6Tym+qY0pNEiEwARUlvmTZjs=", + "lastModified": 1655976588, + "narHash": "sha256-VreHyH6ITkf/1EX/8h15UqhddJnUleb0HgbC3gMkAEQ=", "owner": "numtide", "repo": "devshell", - "rev": "f55e05c6d3bbe9acc7363bc8fc739518b2f02976", + "rev": "899ca4629020592a13a46783587f6e674179d1db", "type": "github" }, "original": { @@ -82,11 +82,11 @@ ] }, "locked": { - "lastModified": 1655826285, - "narHash": "sha256-dyrNTVBefSZWKdFNnAW+zUkO5bVo1colvLje4l1XXwA=", + "lastModified": 1655975833, + "narHash": "sha256-g8sdfuglIZ24oWVbntVzniNTJW+Z3n9DNL9w9Tt+UCE=", "owner": "nix-community", "repo": "dream2nix", - "rev": "f23add2b9c313c63dea5cff71523a850d29ffddb", + "rev": "4e75e665ec3a1cddae5266bed0dd72fce0b74a23", "type": "github" }, "original": { @@ -95,22 +95,6 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "locked": { "lastModified": 1637014545, @@ -135,11 +119,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1656263093, - "narHash": "sha256-gYWCKE0XrXB+Sc/MB90XuSTin+R+mlEqG9TIThJ6R18=", + "lastModified": 1656581160, + "narHash": "sha256-a6jMpUifIin5mK4TvU8iLKm5w5wR34ttbe1l2CdedpY=", "owner": "helix-editor", "repo": "helix", - "rev": "24351c20d41c26df0c695940e6790525858ab1c1", + "rev": "d06800f1dd47315f5738c529d40d1e0952ee2115", "type": "github" }, "original": { @@ -150,20 +134,17 @@ }, "home": { "inputs": { - "flake-compat": "flake-compat", "nixpkgs": [ "nixpkgs" ], - "nmd": "nmd", - "nmt": "nmt", "utils": "utils" }, "locked": { - "lastModified": 1656272360, - "narHash": "sha256-ceFmGObEq5GjObuZ3rI5PUad/OI6yulvsa6mMPciaic=", + "lastModified": 1656367977, + "narHash": "sha256-0hV17V9Up9pnAtPJ+787FhrsPnawxoTPA/VxgjRMrjc=", "owner": "nix-community", "repo": "home-manager", - "rev": "0434f8e4cab4f200c9b4d3741a9e5d89705e6754", + "rev": "3bf16c0fd141c28312be52945d1543f9ce557bb1", "type": "github" }, "original": { @@ -173,6 +154,27 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "wlroots": "wlroots" + }, + "locked": { + "lastModified": 1656612124, + "narHash": "sha256-NPiLaoApGbGw3I6Pp4oJnKh/Q64yCSeokLWRWjAmsu4=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "4510764f348d1a7c4cca613925ee22acfa38b388", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, "nixCargoIntegration": { "inputs": { "devshell": "devshell", @@ -187,11 +189,11 @@ ] }, "locked": { - "lastModified": 1655826649, - "narHash": "sha256-C4/7CdB/mzuD9ayWvEA3Jcog6INCq+oUJZxUsIP/GvE=", + "lastModified": 1656453541, + "narHash": "sha256-ZCPVnS6zJOZJvIlwU3rKR8MBVm6A3F4/0mA7G1lQ3D0=", "owner": "yusdacra", "repo": "nix-cargo-integration", - "rev": "5cf1685c021c47631a2fb16533c00c8d68afd09e", + "rev": "9eb74345b30cd2e536d9dac9d4435d3c475605c7", "type": "github" }, "original": { @@ -202,11 +204,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1656241064, - "narHash": "sha256-+jWwBt515aFGukeX8WSafg9CM3Ju3FD0XrF+X4ph0mU=", + "lastModified": 1656353817, + "narHash": "sha256-UJEzMQcft/0Ilu4LWV7UH51mr5UCo28GL06BGO+djv4=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "99e33a57149916ebede78ec13edd9ba310c10f2f", + "rev": "78e7c2c397b0376526e83162b58de921362e3399", "type": "github" }, "original": { @@ -232,11 +234,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1656239181, - "narHash": "sha256-wW1xRFBn376yGloXZ4QzBE4hjipMawpV18Lshd9QSPw=", + "lastModified": 1656461576, + "narHash": "sha256-rlmmw6lIlkMQIiB+NsnO8wQYWTfle8TA41UREPLP5VY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5", + "rev": "cf3ab54b4afe2b7477faa1dd0b65bf74c055d70c", "type": "github" }, "original": { @@ -246,45 +248,30 @@ "type": "github" } }, - "nmd": { - "flake": false, + "nur": { "locked": { - "lastModified": 1653339422, - "narHash": "sha256-RNLq09vfj21TyYuUCeD6BNTNC6Ew8bLhQULZytN4Xx8=", - "owner": "rycee", - "repo": "nmd", - "rev": "91dee681dd1c478d6040a00835d73c0f4a4c5c29", - "type": "gitlab" + "lastModified": 1656611551, + "narHash": "sha256-S1GkwCgMimVVU1nrwezTkoOqsoiXvvK1+pu4zplsqwo=", + "owner": "nix-community", + "repo": "NUR", + "rev": "b58e819d423cc525475b43bd06cf5f999feb5325", + "type": "github" }, "original": { - "owner": "rycee", - "repo": "nmd", - "type": "gitlab" - } - }, - "nmt": { - "flake": false, - "locked": { - "lastModified": 1648075362, - "narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=", - "owner": "rycee", - "repo": "nmt", - "rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae", - "type": "gitlab" - }, - "original": { - "owner": "rycee", - "repo": "nmt", - "type": "gitlab" + "owner": "nix-community", + "repo": "NUR", + "type": "github" } }, "root": { "inputs": { "helix": "helix", "home": "home", + "hyprland": "hyprland", "nixos-hardware": "nixos-hardware", "nixos-persistence": "nixos-persistence", "nixpkgs": "nixpkgs", + "nur": "nur", "smos": "smos" } }, @@ -341,6 +328,24 @@ "repo": "flake-utils", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1655824477, + "narHash": "sha256-1kskHOLsnisR3kqIL5IHrQbQG/4xoXxeEf1ExMV6/RU=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5c4384a1330faedf975c8b8644881d50390f3613", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "type": "gitlab" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 476d58c..c7b06b4 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nur.url = "github:nix-community/NUR"; home.url = "github:nix-community/home-manager/master"; home.inputs.nixpkgs.follows = "nixpkgs"; @@ -15,6 +16,8 @@ helix.url = "github:helix-editor/helix"; helix.inputs.nixpkgs.follows = "nixpkgs"; + hyprland.url = "github:hyprwm/Hyprland"; + hyprland.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs: let @@ -27,10 +30,22 @@ }; genPkgs = f: prev.genSystems (system: f (makePkgs system)); }); + allPkgs = tlib.genPkgs (x: x); in rec { nixosConfigurations = import ./hosts {inherit lib tlib inputs;}; - packages = tlib.genPkgs (pkgs: pkgs._exported); + packages = lib.mapAttrs (_: pkgs: pkgs._exported) allPkgs; + apps = + lib.mapAttrs + ( + _: pkgs: { + generate-firefox-addons = { + type = "app"; + program = toString "${pkgs.generate-firefox-addons}/bin/generate-firefox-addons"; + }; + } + ) + allPkgs; devShells = import ./shells {inherit lib tlib inputs;}; }; diff --git a/hosts/lungmen/default.nix b/hosts/lungmen/default.nix index d26683b..310c6ad 100644 --- a/hosts/lungmen/default.nix +++ b/hosts/lungmen/default.nix @@ -16,12 +16,15 @@ in { common-pc common-gpu-amd common-cpu-amd + ../../modules/persist ../../modules/network #../../modules/develop/nixbuild ../../users/root ../../users/patriot ]; + system.persistDir = "/persist"; + boot = { tmpOnTmpfs = true; loader = { @@ -50,7 +53,7 @@ in { fsType = "btrfs"; options = ["subvol=nix"] ++ btrfsOptions; }; - fileSystems."/persist" = { + fileSystems."${config.system.persistDir}" = { device = btrfsPartPath; fsType = "btrfs"; options = ["subvol=persist"] ++ btrfsOptions; @@ -60,13 +63,6 @@ in { device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; }; - /* - fileSystems."/media/archive" = { - device = "/dev/disk/by-uuid/f9b5f7f3-51e8-4357-8518-986b16311c71"; - fsType = "btrfs"; - options = btrfsOptions; - }; - */ swapDevices = []; zramSwap = { @@ -143,7 +139,7 @@ in { environment = { systemPackages = [pkgs.ntfs3g]; pathsToLink = ["/share/zsh"]; - persistence."/persist" = { + persistence."${config.system.persistDir}" = { directories = ["/etc/nixos"]; files = ["/etc/machine-id"]; }; diff --git a/modules/base/default.nix b/modules/base/default.nix index 2c025b9..238d333 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -46,7 +46,6 @@ in { exa lm_sensors mkpasswd - zoxide bottom amber unzip diff --git a/modules/network/default.nix b/modules/network/default.nix index de56fc4..3ffa333 100644 --- a/modules/network/default.nix +++ b/modules/network/default.nix @@ -1,11 +1,9 @@ { imports = [./dns]; - networking.dhcpcd.enable = false; + networking.dhcpcd.enable = true; networking.useDHCP = false; networking.dhcpcd.extraConfig = '' noarp nodelay ''; - # https://github.com/NixOS/nixpkgs/issues/60900 - # systemd.services.systemd-user-sessions.enable = false; } diff --git a/modules/persist/default.nix b/modules/persist/default.nix new file mode 100644 index 0000000..602ed64 --- /dev/null +++ b/modules/persist/default.nix @@ -0,0 +1,5 @@ +{lib, ...}: { + options.system.persistDir = lib.mkOption { + type = lib.types.str; + }; +} diff --git a/pkgs-set/default.nix b/pkgs-set/default.nix index 84e5268..10b5f30 100644 --- a/pkgs-set/default.nix +++ b/pkgs-set/default.nix @@ -32,9 +32,9 @@ config.allowUnfree = true; overlays = overlays ++ newPkgs; }; - pkgsToExport = import ./pkgs-to-export.nix; + pkgsToExport = import ./pkgs-to-export.nix pkgs; in pkgs // { - _exported = l.getAttrs pkgsToExport pkgs; + _exported = pkgsToExport; } diff --git a/pkgs-set/overlays/chromium.nix b/pkgs-set/overlays/chromium.nix index f99afcc..bbe4f37 100644 --- a/pkgs-set/overlays/chromium.nix +++ b/pkgs-set/overlays/chromium.nix @@ -6,13 +6,8 @@ _: prev: let "--enable-gpu-rasterization" "--enable-zero-copy" "--force-dark-mode" - "--enable-features=VaapiVideoDecoder" - "--use-gl=egl" - "--disable-features=UseChromeOSDirectVideoDecoder" - "--disable-features=UseSkiaRenderer" "--enable-webrtc-pipewire-capturer" "--ozone-platform-hint=auto" - "--enable-raw-draw" ]; mkCliArgs = flags: prev.lib.concatStringsSep " " flags; in { diff --git a/pkgs-set/overlays/helix.nix b/pkgs-set/overlays/helix.nix index 65a76a7..494ac99 100644 --- a/pkgs-set/overlays/helix.nix +++ b/pkgs-set/overlays/helix.nix @@ -1,3 +1,3 @@ {inputs}: final: prev: { - helix = inputs.helix.defaultPackage.${prev.system}; + helix = inputs.helix.packages.${prev.system}.default; } diff --git a/pkgs-set/overlays/hyprland.nix b/pkgs-set/overlays/hyprland.nix new file mode 100644 index 0000000..867165a --- /dev/null +++ b/pkgs-set/overlays/hyprland.nix @@ -0,0 +1,3 @@ +{inputs}: final: prev: { + hyprland = inputs.hyprland.packages.${prev.system}.default; +} diff --git a/pkgs-set/overlays/nur.nix b/pkgs-set/overlays/nur.nix new file mode 100644 index 0000000..74719e8 --- /dev/null +++ b/pkgs-set/overlays/nur.nix @@ -0,0 +1 @@ +{inputs}: inputs.nur.overlay diff --git a/pkgs-set/pkgs-to-export.nix b/pkgs-set/pkgs-to-export.nix index f7d2d10..bdb6fab 100644 --- a/pkgs-set/pkgs-to-export.nix +++ b/pkgs-set/pkgs-to-export.nix @@ -1,6 +1,10 @@ -[ - "discord-system-electron" - "fractal-next" - "gamescope" - "gaudible" -] +pkgs: ( + pkgs.lib.getAttrs + [ + "discord-system-electron" + "fractal-next" + "gamescope" + "gaudible" + ] + pkgs +) diff --git a/pkgs-set/pkgs/generate-firefox-addons.nix b/pkgs-set/pkgs/generate-firefox-addons.nix new file mode 100644 index 0000000..bfb2b90 --- /dev/null +++ b/pkgs-set/pkgs/generate-firefox-addons.nix @@ -0,0 +1,12 @@ +{ + nur, + treefmt, + writers, + ... +}: +writers.writeBashBin "generate-firefox-addons" '' + ${nur.repos.rycee.firefox-addons-generator}/bin/nixpkgs-firefox-addons \ + users/modules/firefox/extensions.json \ + users/modules/firefox/extensions.nix + ${treefmt}/bin/treefmt +'' diff --git a/users/modules/firefox/default.nix b/users/modules/firefox/default.nix new file mode 100644 index 0000000..ba8ff9d --- /dev/null +++ b/users/modules/firefox/default.nix @@ -0,0 +1,71 @@ +{ + pkgs, + config, + ... +}: { + home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = [".mozilla"]; + programs.firefox = { + enable = true; + package = pkgs.firefox-wayland.override { + extraPrefs = '' + lockPref("privacy.resistFingerprinting.letterboxing", false); + lockPref("browser.startup.homepage", "about:home"); + lockPref("browser.newtabpage.enabled", true); + lockPref("browser.startup.page", 1); + lockPref("privacy.clearOnShutdown.downloads", false); + lockPref("privacy.clearOnShutdown.formdata", false); + lockPref("privacy.clearOnShutdown.history", false); + lockPref("privacy.clearOnShutdown.offlineApps", false); + lockPref("privacy.clearOnShutdown.sessions", false); + lockPref("services.sync.engine.passwords", false); + ''; + extraPolicies = { + CaptivePortal = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableFirefoxAccounts = true; + FirefoxHome = { + Pocket = false; + Snippets = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; let + myExtensions = + pkgs.callPackage ./extensions.nix {inherit buildFirefoxXpiAddon;}; + in + [ + ublock-origin + darkreader + bitwarden + refined-github + stylus + ] + ++ (with myExtensions; [ + catppuccin-mocha-sky + ]); + profiles = { + default = { + id = 0; + isDefault = false; + name = "defaulta"; + }; + personal = { + id = 1; + isDefault = true; + name = "personal"; + extraConfig = builtins.readFile ( + builtins.fetchurl { + url = "https://raw.githubusercontent.com/arkenfox/user.js/101.0/user.js"; + sha256 = "sha256:1mb1l9dgb8mfl70lhwykgfphqnxxi1xw0h3hlgj8jyj6n1mn5v8f"; + } + ); + }; + }; + }; +} diff --git a/users/modules/firefox/extensions.json b/users/modules/firefox/extensions.json new file mode 100644 index 0000000..5b72718 --- /dev/null +++ b/users/modules/firefox/extensions.json @@ -0,0 +1,3 @@ +[ + {"slug":"catppuccin-mocha-sky"} +] diff --git a/users/modules/firefox/extensions.nix b/users/modules/firefox/extensions.nix new file mode 100644 index 0000000..35a4381 --- /dev/null +++ b/users/modules/firefox/extensions.nix @@ -0,0 +1,18 @@ +{ + buildFirefoxXpiAddon, + fetchurl, + lib, + stdenv, +}: { + "catppuccin-mocha-sky" = buildFirefoxXpiAddon { + pname = "catppuccin-mocha-sky"; + version = "2.0"; + addonId = "{12eeb304-58cd-4bcb-9676-99562b04f066}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3954372/catppuccin_dark_sky-2.0.xpi"; + sha256 = "d9453ae265608d3a1b17c812d77422ab2aaf357365e527812268a407643efa25"; + meta = with lib; { + description = "Firefox theme based on https://github.com/catppuccin/catppuccin"; + platforms = platforms.all; + }; + }; +} diff --git a/users/modules/font/default.nix b/users/modules/font/default.nix new file mode 100644 index 0000000..c427704 --- /dev/null +++ b/users/modules/font/default.nix @@ -0,0 +1,28 @@ +{ + lib, + config, + ... +}: let + cfg = config.fonts.settings; +in + with lib; { + options.fonts.settings = { + enable = mkOption { + type = types.bool; + default = false; + }; + name = mkOption { + type = types.str; + }; + package = mkOption { + type = types.package; + }; + size = mkOption { + type = types.ints.unsigned; + }; + }; + + config = mkIf cfg.enable { + home.packages = [cfg.package]; + }; + } diff --git a/users/modules/hyprland/default.nix b/users/modules/hyprland/default.nix new file mode 100644 index 0000000..22d9586 --- /dev/null +++ b/users/modules/hyprland/default.nix @@ -0,0 +1,149 @@ +{pkgs, ...}: { + systemd.user.targets.hyprland-session = { + Unit = { + Description = "hyprland compositor session"; + Documentation = ["man:systemd.special(7)"]; + BindsTo = ["graphical-session.target"]; + Wants = ["graphical-session-pre.target"]; + After = ["graphical-session-pre.target"]; + }; + }; + + xdg.enable = true; + xdg.configFile."hypr/hyprland.conf".text = let + rofi = "${pkgs.rofi-wayland}/bin/rofi"; + launcher = "${rofi} -show drun"; + term = "${pkgs.wezterm}/bin/wezterm"; + + swaybg = "${pkgs.swaybg}/bin/swaybg"; + grim = "${pkgs.grim}/bin/grim"; + light = "${pkgs.light}/bin/light"; + playerctl = "${pkgs.playerctl}/bin/playerctl"; + pulsemixer = "${pkgs.pulsemixer}/bin/pulsemixer"; + slurp = "${pkgs.slurp}/bin/slurp"; + wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy"; + notify-date = with pkgs; + writers.writeBash "notify-date" '' + ${libnotify}/bin/notify-send " $(${coreutils}/bin/date +'%H:%M %d/%m/%Y')" + ''; + in '' + # should be configured per-profile + monitor=HDMI-A-1,1920x1080@60,0x0,1 + workspace=HDMI-A-1,1 + exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY HYPRLAND_INSTANCE_SIGNATURE + exec-once=systemctl --user start graphical-session-pre.target + exec-once=systemctl --user start graphical-session.target + exec-once=${swaybg} -i ~/.config/wallpaper + input { + kb_layout=tr + kb_variant= + kb_model= + kb_options= + kb_rules= + follow_mouse=1 + force_no_accel=1 + touchpad { + natural_scroll=1 + } + } + general { + sensitivity=1 + main_mod=SUPER + gaps_in=5 + gaps_out=5 + border_size=0 + damage_tracking=full + } + decoration { + rounding=16 + blur=1 + blur_size=3 # minimum 1 + blur_passes=3 # minimum 1, more passes = more resource intensive. + # Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts. + # if you want heavy blur, you need to up the blur_passes. + # the more passes, the more you can up the blur_size without noticing artifacts. + } + animations { + enabled=1 + animation=windows,1,2,default + animation=borders,1,2,default + animation=fadein,1,2,default + animation=workspaces,1,2,slide + } + dwindle { + pseudotile=0 # enable pseudotiling on dwindle + } + # example window rules + # for windows named/classed as abc and xyz + #windowrule=move 69 420,abc + #windowrule=size 420 69,abc + #windowrule=tile,xyz + #windowrule=float,abc + #windowrule=pseudo,abc + #windowrule=monitor 0,xyz + bind=SUPER,RETURN,exec,${term} + bind=SUPER,D,exec,${launcher} + bind=SUPER,Q,killactive, + bind=SUPERSHIFT,E,exec,pkill Hyprland + bind=SUPER,F,fullscreen, + bind=SUPER,P,pseudo, + bind=SUPER,T,exec,${notify-date} + bind=SUPERSHIFT,T,togglefloating, + bind=,XF86AudioPlay,exec,${playerctl} play-pause + bind=,XF86AudioPrev,exec,${playerctl} previous + bind=,XF86AudioNext,exec,${playerctl} next + bind=,XF86AudioRaiseVolume,exec,${pulsemixer} --change-volume +6 + bind=,XF86AudioLowerVolume,exec,${pulsemixer} --change-volume -6 + bind=,XF86AudioMute,exec,${pulsemixer} --toggle-mute + bind=,XF86MonBrightnessUp,exec,${light} -A 5 + bind=,XF86MonBrightnessDown,exec,${light} -U 5 + # screenshot + # selection + $ssselection=${grim} -g "$(${slurp})" - | ${wl-copy} -t image/png + bind=,Print,exec,$ssselection + bind=SUPERSHIFT,R,exec,$ssselection + # monitor + $ssmonitor=${grim} -o "$(${slurp} -f %o -or)" - | ${wl-copy} -t image/png + bind=CTRL,Print,exec,$ssmonitor + bind=SUPERSHIFTCTRL,R,exec,$ssmonitor + # all-monitors + $ssall=${grim} - | ${wl-copy} -t image/png + bind=ALT,Print,exec,$ssall + bind=SUPERSHIFTALT,R,exec,$ssall + # move focus + bind=SUPER,left,movefocus,l + bind=SUPER,right,movefocus,r + bind=SUPER,up,movefocus,u + bind=SUPER,down,movefocus,d + # go to workspace + bind=SUPER,grave,togglespecialworkspace,eDP-1 + bind=SUPER,1,workspace,1 + bind=SUPER,2,workspace,2 + bind=SUPER,3,workspace,3 + bind=SUPER,4,workspace,4 + bind=SUPER,5,workspace,5 + bind=SUPER,6,workspace,6 + bind=SUPER,7,workspace,7 + bind=SUPER,8,workspace,8 + bind=SUPER,9,workspace,9 + bind=SUPER,0,workspace,10 + # cycle workspaces + bind=SUPER,bracketleft,workspace,m-1 + bind=SUPER,bracketright,workspace,m+1 + # cycle monitors + bind=SUPERSHIFT,braceleft,focusmonitor,l + bind=SUPERSHIFT,braceright,focusmonitor,r + # move to workspace + bind=SUPERSHIFT,asciitilde,movetoworkspace,special + bind=SUPERSHIFT,exclam,movetoworkspace,1 + bind=SUPERSHIFT,at,movetoworkspace,2 + bind=SUPERSHIFT,numbersign,movetoworkspace,3 + bind=SUPERSHIFT,dollar,movetoworkspace,4 + bind=SUPERSHIFT,percent,movetoworkspace,5 + bind=SUPERSHIFT,asciicircum,movetoworkspace,6 + bind=SUPERSHIFT,ampersand,movetoworkspace,7 + bind=SUPERSHIFT,asterisk,movetoworkspace,8 + bind=SUPERSHIFT,parenleft,movetoworkspace,9 + bind=SUPERSHIFT,parenright,movetoworkspace,10 + ''; +} diff --git a/users/modules/mako/default.nix b/users/modules/mako/default.nix new file mode 100644 index 0000000..8759730 --- /dev/null +++ b/users/modules/mako/default.nix @@ -0,0 +1,18 @@ +{ + pkgs, + config, + ... +}: { + programs.mako = { + enable = true; + anchor = "top-center"; + font = "${config.fonts.settings.name} ${toString config.fonts.settings.size}"; + borderRadius = 16; + extraConfig = builtins.readFile ( + builtins.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/mako/d077d9832e8f22777a4812eadbfb658e793cbdfc/config"; + sha256 = "sha256:1c8j16ljbnynb5kplxvhg99rw536hbxxz1rl8qgaixdf2bg2awp0"; + } + ); + }; +} diff --git a/users/modules/rofi/default.nix b/users/modules/rofi/default.nix new file mode 100644 index 0000000..170b689 --- /dev/null +++ b/users/modules/rofi/default.nix @@ -0,0 +1,119 @@ +{ + pkgs, + config, + ... +}: { + home.packages = [pkgs.rofi-wayland]; + xdg.enable = true; + xdg.dataFile = { + "rofi/themes/catppuccin.rasi".source = builtins.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/rofi/c7c242d6bfd4cabdc9a220cff71e3b0766811fbe/.local/share/rofi/themes/catppuccin.rasi"; + sha256 = "sha256:17jssby0llsnabzfz3lp4wcc9vdzfz77i5wjcclfcyyvpswc53nx"; + }; + }; + xdg.configFile = { + "rofi/config.rasi".text = '' + configuration{ + modi: "drun"; + lines: 5; + font: "${config.fonts.settings.name} ${toString config.fonts.settings.size}"; + show-icons: true; + terminal: "st"; + drun-display-format: "{icon} {name}"; + location: 0; + disable-history: false; + hide-scrollbar: true; + display-drun: "  Apps "; + display-run: "  Run "; + display-window: " 﩯 Window"; + display-Network: " 󰤨 Network"; + sidebar-mode: true; + } + + @theme "catppuccin" + + element-text, element-icon , mode-switcher { + background-color: inherit; + text-color: inherit; + } + + window { + height: 360px; + border: 3px; + border-color: @border-col; + background-color: @bg-col; + } + + mainbox { + background-color: @bg-col; + } + + inputbar { + children: [prompt,entry]; + background-color: @bg-col; + border-radius: 5px; + padding: 2px; + } + + prompt { + background-color: @blue; + padding: 6px; + text-color: @bg-col; + border-radius: 3px; + margin: 20px 0px 0px 20px; + } + + textbox-prompt-colon { + expand: false; + str: ":"; + } + + entry { + padding: 6px; + margin: 20px 0px 0px 10px; + text-color: @fg-col; + background-color: @bg-col; + } + + listview { + border: 0px 0px 0px; + padding: 6px 0px 0px; + margin: 10px 0px 0px 20px; + columns: 2; + background-color: @bg-col; + } + + element { + padding: 5px; + background-color: @bg-col; + text-color: @fg-col ; + } + + element-icon { + size: 25px; + } + + element selected { + background-color: @selected-col ; + text-color: @fg-col2 ; + } + + mode-switcher { + spacing: 0; + } + + button { + padding: 10px; + background-color: @bg-col-light; + text-color: @grey; + vertical-align: 0.5; + horizontal-align: 0.5; + } + + button selected { + background-color: @bg-col; + text-color: @blue; + } + ''; + }; +} diff --git a/users/modules/wezterm/default.nix b/users/modules/wezterm/default.nix new file mode 100644 index 0000000..21723dd --- /dev/null +++ b/users/modules/wezterm/default.nix @@ -0,0 +1,32 @@ +{ + pkgs, + config, + ... +}: { + home.packages = [pkgs.wezterm]; + xdg.enable = true; + xdg.configFile = { + "wezterm/wezterm.lua".text = '' + local wezterm = require 'wezterm'; + local catppuccin = require("colors/catppuccin").setup { + -- whether or not to sync with the system's theme + sync = false, + -- the default/fallback flavour, when syncing is disabled + flavour = "mocha" + } + + return { + font = wezterm.font("${config.fonts.settings.name}"), + font_size = ${builtins.toJSON config.fonts.settings.size}, + default_cursor_style = "BlinkingBar", + enable_wayland = true, + enable_tab_bar = false, + colors = catppuccin + } + ''; + "wezterm/colors/catppuccin.lua".source = builtins.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/wezterm/65078e846c8751e9b4837a575deb0745f0c0512f/catppuccin.lua"; + sha256 = "sha256:0cm8kjjga9k1fzgb7nqjwd1jdjqjrkkqaxcavfxdkl3mw7qiy1ib"; + }; + }; +} diff --git a/users/modules/zoxide/default.nix b/users/modules/zoxide/default.nix new file mode 100644 index 0000000..721bbba --- /dev/null +++ b/users/modules/zoxide/default.nix @@ -0,0 +1,14 @@ +{ + pkgs, + config, + lib, + ... +}: { + home.packages = [pkgs.zoxide]; + home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = + lib.singleton + ".local/share/zoxide"; + programs.zsh.initExtra = '' + eval "$(zoxide init zsh)" + ''; +} diff --git a/users/patriot/config/wezterm/cfg.nix b/users/patriot/config/wezterm/cfg.nix deleted file mode 100644 index 45000b9..0000000 --- a/users/patriot/config/wezterm/cfg.nix +++ /dev/null @@ -1,24 +0,0 @@ -{font, ...}: '' - local wezterm = require 'wezterm'; - local catppuccin = require("colors/catppuccin").setup { - -- whether or not to sync with the system's theme - sync = true, - -- the flavours to switch between when syncing - -- available flavours: "latte" | "frappe" | "macchiato" | "mocha" - sync_flavours = { - light = "latte", - dark = "mocha" - }, - -- the default/fallback flavour, when syncing is disabled - flavour = "mocha" - } - - return { - font = wezterm.font("${font.name}"), - font_size = ${builtins.toJSON font.size}, - default_cursor_style = "BlinkingBar", - enable_wayland = true, - enable_tab_bar = false, - colors = catppuccin - } -'' diff --git a/users/patriot/default.nix b/users/patriot/default.nix index ad99010..bda9536 100644 --- a/users/patriot/default.nix +++ b/users/patriot/default.nix @@ -2,15 +2,19 @@ pkgs, lib, tlib, + config, + inputs, ... } @ globalAttrs: let inherit (lib) mapAttrs' nameValuePair; inherit (builtins) readDir fetchGit; + l = lib // builtins; pkgBin = tlib.pkgBin pkgs; nixosConfig = globalAttrs.config; - useWayland = false; in { + imports = [inputs.hyprland.nixosModules.default]; + users.users.patriot = { isNormalUser = true; createHome = true; @@ -24,73 +28,33 @@ in { hashedPassword = "$6$spzqhAyJfhHy$iHgLBlhjGn1l8PnbjJdWTn1GPvcjMqYNKUzdCe/7IrX6sHNgETSr/Nfpdmq9FCXLhrAfwHOd/q/8SvfeIeNX4/"; }; environment = { - systemPackages = lib.optional useWayland pkgs.qt5.qtwayland; + systemPackages = [pkgs.qt5.qtwayland]; shells = with pkgs; [bashInteractive zsh]; }; xdg.portal = { enable = true; - wlr.enable = useWayland; - gtkUsePortal = false; - extraPortals = lib.optional useWayland pkgs.xdg-desktop-portal-wlr; + wlr.enable = true; + gtkUsePortal = true; + extraPortals = with pkgs; [xdg-desktop-portal-gtk xdg-desktop-portal-wlr]; }; programs = { + # this is needed for impermanence fuse.userAllowOther = true; adb.enable = true; steam.enable = true; - kdeconnect = { - enable = true; - package = pkgs.gnomeExtensions.gsconnect; - }; - gnome-disks.enable = false; - file-roller.enable = false; + # gnome stuffs seahorse.enable = true; + hyprland.enable = true; + hyprland.extraPackages = []; }; - security = { - pam.services.patriot = { - enableGnomeKeyring = true; - enableKwallet = false; - }; - }; - services = { - gnome = { - gnome-keyring.enable = true; - core-shell.enable = true; - core-os-services.enable = true; - chrome-gnome-shell.enable = true; - at-spi2-core.enable = true; - gnome-online-accounts.enable = false; - gnome-online-miners.enable = lib.mkForce false; - gnome-remote-desktop.enable = false; - core-utilities.enable = false; - tracker-miners.enable = false; - tracker.enable = false; - gnome-settings-daemon.enable = lib.mkForce false; - sushi.enable = false; - }; - xserver = { - enable = true; - desktopManager = { - gnome.enable = true; - xterm.enable = false; - }; - displayManager = { - autoLogin = { - enable = true; - user = "patriot"; - }; - gdm = { - enable = true; - wayland = useWayland; - }; - startx.enable = false; - }; - }; + # gnome keyring better fr fr + security.pam.services.patriot = { + enableGnomeKeyring = true; + enableKwallet = false; }; systemd = { targets.network-online.enable = false; services = { - "getty@tty1".enable = false; - "autovt@tty1".enable = false; systemd-networkd-wait-online.enable = false; NetworkManager-wait-online.enable = false; }; @@ -104,41 +68,29 @@ in { personal = import ../../personal.nix; name = personal.name; email = personal.emails.primary; - font = { - name = "Comic Mono"; - size = 13; - package = let - ttf = pkgs.fetchurl { - url = "https://dtinth.github.io/comic-mono-font/ComicMono.ttf"; - sha256 = "sha256-O8FCXpIqFqvw7HZ+/+TQJoQ5tMDc6YQy4H0V9drVcZY="; - }; - in - pkgs.runCommand "comic-mono" {} '' - mkdir -p $out/share/fonts/truetype - ln -s ${ttf} $out/share/fonts/truetype - ''; - }; in { imports = [ ../modules/direnv ../modules/git ../modules/starship ../modules/helix + ../modules/zoxide + ../modules/wezterm + ../modules/hyprland + ../modules/rofi + ../modules/mako + ../modules/font + ../modules/firefox + ../../modules/persist # ../modules/smos inputs.nixos-persistence.nixosModules.home-manager.impermanence ]; - gtk = { - enable = true; - theme = { - name = "Catppuccin"; - package = pkgs.catppuccin-gtk; - }; - }; + system.persistDir = nixosConfig.system.persistDir; - home.persistence."/persist/home/patriot" = let + home.persistence."${config.system.persistDir}${config.home.homeDirectory}" = let mkPaths = prefix: paths: - builtins.map (n: "${prefix}/${n}") paths; + builtins.map (n: "${prefix}/${n}") (l.flatten paths); in { directories = [ @@ -157,62 +109,69 @@ in { ".cache" ] ++ mkPaths ".local/share" [ - "zoxide" "direnv" "zsh" "Steam" - "backgrounds" "keyrings" "lutris" "PolyMC" ] ++ mkPaths ".config" [ - "dconf" - "chromium" - "gsconnect" "lutris" ]; - files = [ - ".config/gnome-initial-setup-done" + files = l.flatten [ + ".config/wallpaper" (lib.removePrefix "~/" config.programs.ssh.userKnownHostsFile) ]; allowOther = true; }; fonts.fontconfig.enable = lib.mkForce true; + fonts.settings = { + enable = true; + name = "Comic Mono"; + size = 13; + package = let + ttf = pkgs.fetchurl { + url = "https://dtinth.github.io/comic-mono-font/ComicMono.ttf"; + sha256 = "sha256-O8FCXpIqFqvw7HZ+/+TQJoQ5tMDc6YQy4H0V9drVcZY="; + }; + in + pkgs.runCommandNoCC "comic-mono" {} '' + mkdir -p $out/share/fonts/truetype + ln -s ${ttf} $out/share/fonts/truetype + ''; + }; home = { stateVersion = nixosConfig.system.stateVersion; homeDirectory = nixosConfig.users.users.patriot.home; - packages = with pkgs; [ - # Font stuff - font.package - noto-fonts-cjk - font-awesome - dejavu_fonts - # Programs - bitwarden - wezterm - cargo-outdated - cargo-release - cargo-udeps - vulkan-tools - krita - cachix - gnupg - imv - mpv - ffmpeg - mupdf - xdg_utils - wl-clipboard - xclip - rust-analyzer - # polymc - cloudflared - lutris - gnome.gnome-themes-extra - gnome.gnome-tweaks - ]; + packages = with pkgs; + l.flatten [ + # Font stuff + noto-fonts-cjk + font-awesome + dejavu_fonts + # Programs + bitwarden + cargo-outdated + cargo-release + cargo-udeps + vulkan-tools + krita + cachix + gnupg + imv + mpv + ffmpeg + mupdf + xdg_utils + wl-clipboard + xclip + rust-analyzer + # polymc + cloudflared + lutris + ]; shellAliases = nixosConfig.environment.shellAliases // { @@ -222,40 +181,13 @@ in { }; sessionVariables = nixosConfig.environment.sessionVariables - // { + // l.optionalAttrs config.programs.fzf.enable { FZF_DEFAULT_OPTS = "--color=bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD --color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96 --color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD"; }; }; programs = { command-not-found.enable = nixosConfig.programs.command-not-found.enable; - chromium = { - enable = true; - package = - if useWayland - then pkgs.chromium-wayland - else pkgs.chromium; - extensions = [ - # https everywhere - "gcbommkclmclpchllfjekcdonpmejbdp" - # ublock - "cjpalhdlnbpafiamejdnhcphjbkeiagm" - # bitwarden - "nngceckbapebfimnlniiiahkandclblb" - # decentraleyes - "ldpochfccmkkmhdbclfhpagapcfdljkj" - # dark theme - "annfbnbieaamhaimclajlajpijgkdblo" - # dark reader - "eimadpbcbfnmbkopoojfekhnkhdbieeh" - # github refined - "hlepfoohegkhhmjieoechaddaejaokhf" - # privacy redirect - "pmcmeagblkinmogikoikkdjiligflglb" - # pronoundb - "nblkbiljcjfemkfjnhoobnojjgjdmknf" - ]; - }; git = { signing = { key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6"; @@ -285,30 +217,21 @@ in { enableVteIntegration = true; enableAutosuggestions = true; enableCompletion = true; - plugins = let - fast-syntax-highlighting = let - name = "fast-syntax-highlighting"; - in { - inherit name; - src = pkgs."zsh-${name}".out; - }; - per-directory-history = { + plugins = [ + { name = "per-directory-history"; - src = - pkgs.fetchFromGitHub - { - owner = "jimhester"; - repo = "per-directory-history"; - rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; - hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; - }; - }; - in [fast-syntax-highlighting per-directory-history]; + src = pkgs.fetchFromGitHub { + owner = "jimhester"; + repo = "per-directory-history"; + rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; + hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; + }; + } + ]; # xdg compliant dotDir = ".config/zsh"; history.path = "${config.home.homeDirectory}/.local/share/zsh/history"; initExtra = '' - export TERM=alacritty export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) function tomp4 () { @@ -319,11 +242,16 @@ in { ${pkgBin "ffmpeg"} -i $1 "$1.png" } + # fix some key stuff bindkey "$terminfo[kRIT5]" forward-word bindkey "$terminfo[kLFT5]" backward-word + # makes completions pog zstyle ':completion:*' menu select - - eval "$(zoxide init zsh)" + ''; + loginExtra = '' + if [[ "$(tty)" == "/dev/tty1" ]]; then + exec Hyprland + fi ''; }; fzf.enable = true; @@ -340,17 +268,7 @@ in { defaultCacheTtlSsh = defaultCacheTtl; maxCacheTtlSsh = maxCacheTtl; grabKeyboardAndMouse = false; - pinentryFlavor = "gnome3"; - }; - }; - xdg = { - enable = true; - configFile = { - "wezterm/wezterm.lua".text = import ./config/wezterm/cfg.nix {inherit font;}; - "wezterm/colors/catppuccin.lua".source = builtins.fetchurl { - url = "https://raw.githubusercontent.com/catppuccin/wezterm/65078e846c8751e9b4837a575deb0745f0c0512f/catppuccin.lua"; - sha256 = "sha256:0cm8kjjga9k1fzgb7nqjwd1jdjqjrkkqaxcavfxdkl3mw7qiy1ib"; - }; + pinentryFlavor = "gtk2"; }; }; };