From fe6455b4f246bbcaa86be8c314fbb030d2ac8da4 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 30 Nov 2025 13:14:41 +0700 Subject: [PATCH] change hyprland to niri --- flake.lock | 129 ++++++++++ flake.nix | 15 +- home/programs/firefox/default.nix | 79 ++++--- home/programs/helix/default.nix | 18 ++ home/programs/nvf/default.nix | 19 +- home/programs/nvf/languages.nix | 2 +- home/programs/spicetify/default.nix | 21 +- home/system/hyprland/polkitagent.nix | 13 +- home/system/niri/default.nix | 244 +++++++++++++++++++ home/system/waybar/default.nix | 342 ++++++++++++++------------- hosts/laptop/configuration.nix | 16 +- hosts/laptop/home.nix | 32 ++- hosts/laptop/variables.nix | 14 +- nixos/nix.nix | 7 + nixos/tuigreet.nix | 8 +- nixos/upower.nix | 5 + nixos/users.nix | 20 +- nixos/xdg-portal.nix | 28 ++- 18 files changed, 741 insertions(+), 271 deletions(-) create mode 100644 home/programs/helix/default.nix create mode 100644 home/system/niri/default.nix create mode 100644 nixos/upower.nix diff --git a/flake.lock b/flake.lock index 9e1f2f8..593e38f 100644 --- a/flake.lock +++ b/flake.lock @@ -758,6 +758,64 @@ "type": "github" } }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1763891121, + "narHash": "sha256-Arwlg5N1ssnSxPiTMYFNgZL/oGZvVJRtFHMEWOvVkk4=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "d2c10541bad1e7c9341fd269ec35da54a2c48219", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1756556321, + "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.08", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1763887185, + "narHash": "sha256-uuwCdsGQUXoTSS02ShZAq+PeWudn0xu4vKpH43OubX8=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "efbe29f3faa69282aad110b7da74f3c41f8971cf", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1762267440, @@ -790,6 +848,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1763622513, + "narHash": "sha256-1jQnuyu82FpiSxowrF/iFK6Toh9BYprfDqfs4BB+19M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c58bc7f5459328e4afac201c5c4feb7c818d604b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1748929857, @@ -877,6 +951,26 @@ "type": "github" } }, + "noctalia": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763899714, + "narHash": "sha256-qsp91fwNj5SoqrZKGFqBMRZcEbrP6v7UoWaCxTQoJes=", + "owner": "noctalia-dev", + "repo": "noctalia-shell", + "rev": "faa074c330581cc4a065e592717045ba4fe1fc5d", + "type": "github" + }, + "original": { + "owner": "noctalia-dev", + "repo": "noctalia-shell", + "type": "github" + } + }, "nur": { "inputs": { "flake-parts": [ @@ -976,9 +1070,11 @@ "home-manager": "home-manager", "hyprland": "hyprland", "hyprpolkitagent": "hyprpolkitagent", + "niri": "niri", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_3", "nixvim": "nixvim", + "noctalia": "noctalia", "nvf": "nvf", "spicetify-nix": "spicetify-nix", "stylix": "stylix" @@ -1263,6 +1359,39 @@ "repo": "xdg-desktop-portal-hyprland", "type": "github" } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1755491097, + "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "388d291e82ffbc73be18169d39470f340707edaa", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.7", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1763704521, + "narHash": "sha256-ceYEV6PnvUN8Zixao4gpPuN+VT3B0SlAXKuPNHZhqUY=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "f379ff5722a821212eb59ada9cf8e51cb3654aad", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 36698f0..6a7468e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,6 @@ { description = '' - Nixy is a NixOS configuration with home-manager, secrets and custom theming all in one place. - It's a simple way to manage your system configuration and dotfiles. + Dhimas config based on nixy ''; inputs = { @@ -27,16 +26,24 @@ inputs.nixpkgs.follows = "nixpkgs"; }; nvf.url = "github:notashelf/nvf"; + niri = { + url = "github:sodiboo/niri-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + noctalia = { + url = "github:noctalia-dev/noctalia-shell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs@{ nixpkgs, ... }: { + outputs = inputs @ {nixpkgs, ...}: { nixosConfigurations = { dark = # CHANGEME: This should match the 'hostname' in your variables.nix file nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - { _module.args = { inherit inputs; }; } + {_module.args = {inherit inputs;};} inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x270 # CHANGEME: check https://github.com/NixOS/nixos-hardware inputs.home-manager.nixosModules.home-manager inputs.stylix.nixosModules.stylix diff --git a/home/programs/firefox/default.nix b/home/programs/firefox/default.nix index 7f3624f..f468a72 100644 --- a/home/programs/firefox/default.nix +++ b/home/programs/firefox/default.nix @@ -1,4 +1,8 @@ -{ pkgs, inputs, ... }: { +{ + pkgs, + inputs, + ... +}: { programs.firefox = { enable = true; profiles.dark = { @@ -49,56 +53,59 @@ search = { force = true; default = "Searx"; - order = [ "Searx" "google" ]; + order = ["Searx" "google"]; engines = { "Nix Packages" = { - urls = [{ - template = "https://search.nixos.org/packages"; - params = [ - { - name = "type"; - value = "packages"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - }]; - icon = - "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@np" ]; + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; }; "NixOS Wiki" = { - urls = [{ - template = "https://nixos.wiki/index.php?search={searchTerms}"; - }]; + urls = [ + { + template = "https://nixos.wiki/index.php?search={searchTerms}"; + } + ]; icon = "https://nixos.wiki/favicon.png"; updateInterval = 24 * 60 * 60 * 1000; # every day - definedAliases = [ "@nw" ]; + definedAliases = ["@nw"]; }; "Searx" = { - urls = [{ - template = "https://searx.aicampground.com/?q={searchTerms}"; - }]; + urls = [ + { + template = "https://searx.aicampground.com/?q={searchTerms}"; + } + ]; icon = "https://nixos.wiki/favicon.png"; updateInterval = 24 * 60 * 60 * 1000; # every day - definedAliases = [ "@searx" ]; + definedAliases = ["@searx"]; }; bing.metaData.hidden = true; - google.metaData.alias = - "@g"; # builtin engines only support specifying one additional alias + google.metaData.alias = "@g"; # builtin engines only support specifying one additional alias }; }; - extensions.packages = - with inputs.firefox-addons.packages.${pkgs.system}; [ - bitwarden - multi-account-containers - zotero-connector - unpaywall - ]; + extensions.packages = with inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}; [ + bitwarden + multi-account-containers + zotero-connector + unpaywall + ]; }; }; - stylix.targets.firefox.profileNames = [ "dark" ]; + stylix.targets.firefox.profileNames = ["dark"]; } diff --git a/home/programs/helix/default.nix b/home/programs/helix/default.nix new file mode 100644 index 0000000..374d936 --- /dev/null +++ b/home/programs/helix/default.nix @@ -0,0 +1,18 @@ +{ + inputs, + pkgs, + ... +}: { + programs.helix = { + enable = true; + languages = { + language = [ + { + name = "nix"; + auto-format = true; + formatter.command = "${pkgs.nixfmt}/bin/nixfmt"; + } + ]; + }; + }; +} diff --git a/home/programs/nvf/default.nix b/home/programs/nvf/default.nix index 5babac5..2ceb4d5 100644 --- a/home/programs/nvf/default.nix +++ b/home/programs/nvf/default.nix @@ -1,6 +1,10 @@ -{ inputs, pkgs, ... }: { - inputs = [ - inputs.nfv.homeManagerModules.default +{ + inputs, + pkgs, + ... +}: { + imports = [ + inputs.nvf.homeManagerModules.default ./options.nix ./languages.nix ./picker.nix @@ -9,5 +13,12 @@ ./utils.nix ./mini.nix ]; - programs.nvf = { enable = true; }; + programs.nvf = { + enable = true; + settings.vim = { + startPlugins = [ + pkgs.vimPlugins.vim-kitty-navigator + ]; + }; + }; } diff --git a/home/programs/nvf/languages.nix b/home/programs/nvf/languages.nix index e347b83..9c5c80c 100644 --- a/home/programs/nvf/languages.nix +++ b/home/programs/nvf/languages.nix @@ -74,7 +74,7 @@ php = { enable = true; - server = "intelephense"; + lsp.server = "intelephense"; }; go.enable = true; markdown = { diff --git a/home/programs/spicetify/default.nix b/home/programs/spicetify/default.nix index b22bf3e..0e5cee8 100644 --- a/home/programs/spicetify/default.nix +++ b/home/programs/spicetify/default.nix @@ -1,13 +1,16 @@ # Spicetify is a spotify client customizer -{ pkgs, config, lib, inputs, ... }: -let - spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; +{ + pkgs, + config, + lib, + inputs, + ... +}: let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.hostPlatform.system}; accent = "${config.lib.stylix.colors.base0D}"; + background = "${config.lib.stylix.colors.base00}"; in { - imports = [ inputs.spicetify-nix.homeManagerModules.default ]; - - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ "spotify" ]; + imports = [inputs.spicetify-nix.homeManagerModules.default]; stylix.targets.spicetify.enable = false; @@ -21,6 +24,9 @@ in { button = accent; button-active = accent; tab-active = accent; + player = background; + main = background; + sidebar = background; }; enabledExtensions = with spicePkgs.extensions; [ @@ -31,6 +37,7 @@ in { adblock fullAppDisplay shuffle + keyboardShortcut ]; }; } diff --git a/home/system/hyprland/polkitagent.nix b/home/system/hyprland/polkitagent.nix index 729eb4e..5166560 100644 --- a/home/system/hyprland/polkitagent.nix +++ b/home/system/hyprland/polkitagent.nix @@ -1,7 +1,8 @@ -{ inputs, pkgs, ... }: { - home.packages = - [ inputs.hyprpolkitagent.packages."${pkgs.system}".hyprpolkitagent ]; - - wayland.windowManager.hyprland.settings.exec-once = - [ "systemctl --user start hyprpolkitagent" ]; +{ + inputs, + pkgs, + ... +}: { + home.packages = [inputs.hyprpolkitagent.packages."${pkgs.stdenv.hostyPlatform.system}".hyprpolkitagent]; + wayland.windowManager.hyprland.settings.exec-once = ["systemctl --user start hyprpolkitagent"]; } diff --git a/home/system/niri/default.nix b/home/system/niri/default.nix new file mode 100644 index 0000000..1f60b6c --- /dev/null +++ b/home/system/niri/default.nix @@ -0,0 +1,244 @@ +{ + pkgs, + config, + inputs, + ... +}: let + noctalia = cmd: + ["noctalia-shell" "ipc" "call"] + ++ (pkgs.lib.splitString " " cmd); +in { + imports = [inputs.niri.homeModules.niri inputs.noctalia.homeModules.default]; + home.packages = with pkgs; [ + wayland-utils + libsecret + cage + xwayland-satellite + libnotify + cliphist + cava + kdePackages.polkit-kde-agent-1 + nautilus + direnv + imv + ]; + + programs.niri = { + enable = true; + settings = { + prefer-no-csd = true; + hotkey-overlay.skip-at-startup = true; + environment = { + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORM = "wayland"; + ELECTRON_OZON_PLATFORM_HINT = "wayland"; + DISPLAY = ":0"; # Or null + _JAVA_AWT_WM_NONREPARENTING = "1"; + }; + cursor = { + hide-when-typing = true; + hide-after-inactive-ms = 1000; + }; + + binds = with config.lib.niri.actions; { + "Mod+Space".action.spawn = noctalia "launcher toggle"; + "Mod+P".action.spawn = noctalia "sessionMenu toggle"; + "Mod+V".action.spawn = noctalia "launcher clipboard"; + "Mod+Shift+C".action.spawn = noctalia "launcher calculator"; + "Mod+C".action.spawn = noctalia "calendar toggle"; + "Mod+S".action.spawn = noctalia "controlCenter toggle"; + "Mod+F12".action.spawn = noctalia "powerProfile cycle"; + "XF86AudioLowerVolume".action.spawn = noctalia "volume decrease"; + "XF86AudioRaiseVolume".action.spawn = noctalia "volume increase"; + "XF86AudioMute".action.spawn = noctalia "volume muteOutput"; + "XF86MonBrightnessUp".action.spawn = noctalia "brightness increase"; + "XF86MonBrightnessDown".action.spawn = noctalia "brightness decrease"; + "XF86AudioPlay".action.spawn = noctalia "media playPause"; + "XF86AudioNext".action.spawn = noctalia "media next"; + "XF86AudioPrev".action.spawn = noctalia "media previous"; + "Mod+Shift+Q".action.spawn = noctalia "lockScreen lock"; + "Mod+Return".action.spawn = ["alacritty"]; + "Mod+E".action.spawn = ["nautilus"]; + "Mod+B".action.spawn = ["firefox"]; + "Mod+U".action = move-workspace-up; + "Mod+I".action = move-workspace-down; + "Mod+Shift+Slash".action = show-hotkey-overlay; + "Mod+Q".action = close-window; + "Mod+H".action = focus-column-or-monitor-left; + "Mod+L".action = focus-column-or-monitor-right; + "Mod+J".action = focus-window-or-monitor-down; + "Mod+K".action = focus-window-or-monitor-up; + "Mod+Shift+H".action = move-column-left-or-to-monitor-left; + "Mod+Shift+L".action = move-column-right-or-to-monitor-right; + "Mod+Shift+J".action = move-window-down-or-to-workspace-down; + "Mod+Shift+K".action = move-window-up-or-to-workspace-up; + "Mod+Ctrl+K".action = move-window-to-workspace-up; + "Mod+Ctrl+J".action = move-window-to-workspace-down; + "Mod+0".action = focus-workspace 0; + "Mod+1".action = focus-workspace 1; + "Mod+2".action = focus-workspace 2; + "Mod+3".action = focus-workspace 3; + "Mod+4".action = focus-workspace 4; + "Mod+5".action = focus-workspace 5; + "Mod+6".action = focus-workspace 6; + "Mod+7".action = focus-workspace 7; + "Mod+8".action = focus-workspace 8; + "Mod+9".action = focus-workspace 9; + "Mod+Shift+Period".action = move-workspace-to-monitor-next; + "Mod+Shift+Comma".action = move-workspace-to-monitor-previous; + "Mod+Comma".action = consume-or-expel-window-left; + "Mod+Period".action = consume-or-expel-window-right; + "Mod+Grave".action = toggle-overview; + "Mod+Tab".action = focus-workspace-previous; + "Mod+Equal".action = set-column-width "+5%"; + "Mod+Minus".action = set-column-width "-5%"; + "Mod+Shift+Equal".action = set-window-height "+5%"; + "Mod+Shift+Minus".action = set-window-height "-5%"; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+Ctrl+Shift+F".action = toggle-windowed-fullscreen; + "Mod+Y".action = toggle-window-floating; + "Mod+Shift+Y".action = switch-focus-between-floating-and-tiling; + "Mod+W".action = toggle-column-tabbed-display; + "Mod+Parenright".action = switch-layout "next"; + "Mod+Parenleft".action = switch-layout "prev"; + "Mod+Shift+E".action = quit; + }; + + input = { + warp-mouse-to-focus.enable = true; + focus-follows-mouse.enable = false; + trackpoint = { + accel-profile = "adaptive"; + accel-speed = 0.6; + }; + }; + layout = { + focus-ring = { + width = 2; + }; + }; + window-rules = [ + { + geometry-corner-radius = let + r = 4.0; + in { + top-left = r; + top-right = r; + bottom-left = r; + bottom-right = r; + }; + clip-to-geometry = true; + } + { + matches = [{app-id = "firefox";}]; + open-maximized = true; + } + { + matches = [{app-id = "chromium-browser";}]; + open-maximized = true; + } + ]; + # debug = { + # honor-xdg-activation-with-invalid-serial = 1; + # }; + }; + }; + + programs.noctalia-shell = { + enable = true; + systemd.enable = true; + settings = { + general = { + animationSpeed = 2; + compactLockScreen = true; + }; + wallpaper = { + enabled = false; + directory = "~/Pictures/wallpapers"; + }; + dock.enabled = false; + bar = { + density = "compact"; + position = "right"; + showCapsule = false; + widgets = { + left = [ + { + id = "SidePanelToggle"; + useDistroLogo = true; + } + { + id = "WiFi"; + } + { + id = "Bluetooth"; + } + ]; + center = [ + { + hideUnoccupied = false; + id = "Workspace"; + labelMode = "none"; + } + ]; + right = [ + { + colorizeIcons = true; + drawerEnabled = true; + id = "Tray"; + } + { + alwaysShowPercentage = false; + id = "Battery"; + warningThreshold = 30; + } + { + formatHorizontal = "HH:mm"; + formatVertical = "HH mm"; + id = "Clock"; + useMonospacedFont = true; + usePrimaryColor = true; + } + ]; + }; + }; + colorSchemes.predefinedScheme = "Monochrome"; + general = { + avatarImage = "/home/dim/.face"; + radiusRatio = 0.2; + }; + location = { + monthBeforeDay = false; + name = "Tangerang"; + }; + }; + # this may also be a string or a path to a JSON file, + # but in this case must include *all* settings. + }; + + programs.alacritty = { + enable = true; + settings = { + window.decorations = "None"; + }; + }; + + services.kanshi = { + enable = true; + profiles = { + rumah = { + outputs = [ + { + criteria = "LG Electronics 16EN33 305INKH5P181"; + position = "0,0"; + } + { + criteria = "eDP-1"; + position = "0,768"; + } + ]; + }; + }; + }; +} diff --git a/home/system/waybar/default.nix b/home/system/waybar/default.nix index 29463a7..ab147c7 100644 --- a/home/system/waybar/default.nix +++ b/home/system/waybar/default.nix @@ -1,191 +1,195 @@ -{ config, pkgs, ... }: -let +{ + config, + pkgs, + ... +}: let inherit (config.var.theme.bar) position; inherit (config.var.theme) rounding border-size gaps-in gaps-out; in { - home.packages = with pkgs; [ playerctl ]; + home.packages = with pkgs; [playerctl]; programs.waybar = { enable = true; systemd = { enable = true; target = "hyprland-session"; }; - settings = [{ - layer = "top"; - position = position; - modules-left = [ "hyprland/workspaces" "hyprland/window" ]; - modules-center = [ "mpris" ]; - modules-right = [ - "idle_inhibitor" - "backlight" - "battery#1" - "battery#2" - "cpu" - "memory" - "temperature" - "clock" - "privacy" - "custom/cuaca" - "wireplumber" - "tray" - ]; - clock = { - "format" = "{:%d %b %H:%M}  "; - "format-alt" = "{:%A, %d %B %Y (%R)} "; - "tooltip-format" = '' - {:%Y %B} - {calendar}''; - "calendar" = { - "mode" = "year"; - "mode-mon-col" = 3; - "weeks-pos" = "right"; - "on-scroll" = 1; - "format" = { - "months" = "{}"; - "days" = "{}"; - "weeks" = "W{}"; - "weekdays" = "{}"; - "today" = "{}"; + settings = [ + { + layer = "top"; + position = position; + modules-left = ["hyprland/workspaces" "mpris"]; + modules-center = []; + modules-right = [ + "idle_inhibitor" + "backlight" + "battery#1" + "battery#2" + "cpu" + "memory" + "temperature" + "clock" + "privacy" + "wireplumber" + "tray" + ]; + clock = { + "format" = "{:%d %b %H:%M}  "; + "format-alt" = "{:%A, %d %B %Y (%R)} "; + "tooltip-format" = '' + {:%Y %B} + {calendar}''; + "calendar" = { + "mode" = "year"; + "mode-mon-col" = 3; + "weeks-pos" = "right"; + "on-scroll" = 1; + "format" = { + "months" = "{}"; + "days" = "{}"; + "weeks" = "W{}"; + "weekdays" = "{}"; + "today" = "{}"; + }; + }; + actions = { + "on-click-right" = "mode"; + "on-scroll-up" = "shift_up"; + "on-scroll-down" = "shift_down"; }; }; - actions = { - "on-click-right" = "mode"; - "on-scroll-up" = "shift_up"; - "on-scroll-down" = "shift_down"; + tray = {spacing = gaps-in;}; + cpu = {format = " {usage}";}; + memory = {format = " {}";}; + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; }; - }; - tray = { spacing = gaps-in; }; - cpu = { format = " {usage}"; }; - memory = { format = " {}"; }; - idle_inhibitor = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; + network = { + format = "{ifname}"; + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} 󰈀"; + format-disconnected = ""; + tooltip-format = "{ifname} via {gwaddr} 󰈀"; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; }; - }; - network = { - format = "{ifname}"; - format-wifi = "{essid} ({signalStrength}%) "; - format-ethernet = "{ipaddr}/{cidr} 󰈀"; - format-disconnected = ""; - tooltip-format = "{ifname} via {gwaddr} 󰈀"; - tooltip-format-wifi = "{essid} ({signalStrength}%) "; - tooltip-format-ethernet = "{ifname} "; - tooltip-format-disconnected = "Disconnected"; - max-length = 50; - }; - temperature = { format = "{temperatureC}󰔄 "; }; - backlight = { - device = "intel_backlight"; - format = "{icon}"; - format-icons = [ "󱃓" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ]; - }; - "battery#1" = { - bat = "BAT0"; - interval = 90; - states = { - warning = 30; - critical = 15; + temperature = {format = "{temperatureC}󰔄 ";}; + backlight = { + device = "intel_backlight"; + format = "{icon}"; + format-icons = ["󱃓" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥"]; }; - format = "{capacity}"; - max-length = 2; - }; - "battery#2" = { - bat = "BAT1"; - interval = 90; - states = { - warning = 30; - critical = 15; + "battery#1" = { + bat = "BAT0"; + interval = 90; + states = { + warning = 30; + critical = 15; + }; + format = "{capacity}"; + max-length = 2; }; - format = "{capacity} {icon}"; - format-icons = [ "" "" "" "" "" ]; - max-length = 25; - }; - "hyprland/window" = { - format = "{}"; - max-length = 32; - rewrite = { - "(.*) — Mozilla Firefox" = "󰈹 $1"; - "(.*) - kitty" = " [$1]"; + "battery#2" = { + bat = "BAT1"; + interval = 90; + states = { + warning = 30; + critical = 15; + }; + format = "{capacity} {icon}"; + format-icons = ["" "" "" "" ""]; + max-length = 25; }; - separate-outputs = true; - }; - "hyprland/workspaces" = { format = "{name}"; }; - mpris = { - "format" = "{player_icon} {dynamic}"; - "format-paused" = "{status_icon} {dynamic}"; - "player-icons" = { - "default" = "󰐊"; - "mpv" = "󰎇"; + "hyprland/window" = { + format = "{}"; + max-length = 32; + rewrite = { + "(.*) — Mozilla Firefox" = "󰈹 $1"; + "(.*) - kitty" = " [$1]"; + }; + separate-outputs = true; }; - "dynamic-len" = 30; - "status-icons" = { "paused" = "󰏤"; }; - "ignored-players" = [ "firefox" ]; - }; - privacy = { - "icon-spacing" = 4; - "icon-size" = 18; - "transition-duration" = 250; - "modules" = [ - { - "type" = "screenshare"; - "tooltip" = true; - "tooltip-icon-size" = 24; - } - { - "type" = "audio-out"; - "tooltip" = true; - "tooltip-icon-size" = 24; - } - { - "type" = "audio-in"; - "tooltip" = true; - "tooltip-icon-size" = 24; - } - ]; - }; - pulseaudio = { - "format" = "{volume}%{icon}"; - "format-bluetooth" = "{volume}%{icon}"; - "format-muted" = ""; - "format-icons" = { - "headphone" = ""; - "phone" = ""; - "portable" = ""; - "car" = ""; - "default" = [ "" "" ]; + "hyprland/workspaces" = {format = "{name}";}; + mpris = { + "format" = "{player_icon} {dynamic}"; + "format-paused" = "{status_icon} {dynamic}"; + "player-icons" = { + "default" = "󰐊"; + "mpv" = "󰎇"; + }; + "dynamic-len" = 30; + "status-icons" = {"paused" = "󰏤";}; + "ignored-players" = ["firefox"]; }; - "scroll-step" = 1; - "on-click" = "pavucontrol"; - "ignored-sinks" = [ "Easy Effects Sink" ]; - }; - "wireplumber" = { - "on-click" = "pavucontrol"; - "on-click-right" = "amixer sset Master toggle 1>/dev/null"; - "format" = "{icon}{volume}%"; - "format-muted" = " "; - "format-source" = ""; - "format-source-muted" = ""; - "format-icons" = { - "headphone" = " "; - "hands-free" = " "; - "headset" = " "; - "phone" = " "; - "portable" = " "; - "car" = " "; - "default" = [ " " " " " " ]; + privacy = { + "icon-spacing" = 4; + "icon-size" = 18; + "transition-duration" = 250; + "modules" = [ + { + "type" = "screenshare"; + "tooltip" = true; + "tooltip-icon-size" = 24; + } + { + "type" = "audio-out"; + "tooltip" = true; + "tooltip-icon-size" = 24; + } + { + "type" = "audio-in"; + "tooltip" = true; + "tooltip-icon-size" = 24; + } + ]; }; - }; - "custom/cuaca" = { - "format" = "{}"; - "format-alt" = "{alt}: {}"; - "format-alt-click" = "click-right"; - "interval" = 3600; - "exec" = "curl -s 'https://wttr.in/Tangerang?format=1'"; - "exec-if" = "ping wttr.in -c1"; - }; - }]; + pulseaudio = { + "format" = "{volume}%{icon}"; + "format-bluetooth" = "{volume}%{icon}"; + "format-muted" = ""; + "format-icons" = { + "headphone" = ""; + "phone" = ""; + "portable" = ""; + "car" = ""; + "default" = ["" ""]; + }; + "scroll-step" = 1; + "on-click" = "pavucontrol"; + "ignored-sinks" = ["Easy Effects Sink"]; + }; + "wireplumber" = { + "on-click" = "pavucontrol"; + "on-click-right" = "amixer sset Master toggle 1>/dev/null"; + "format" = "{icon}{volume}%"; + "format-muted" = " "; + "format-source" = ""; + "format-source-muted" = ""; + "format-icons" = { + "headphone" = " "; + "hands-free" = " "; + "headset" = " "; + "phone" = " "; + "portable" = " "; + "car" = " "; + "default" = [" " " " " "]; + }; + }; + "custom/cuaca" = { + "format" = "{}"; + "format-alt" = "{alt}: {}"; + "format-alt-click" = "click-right"; + "interval" = 3600; + "exec" = "curl -s 'https://wttr.in/Tangerang?format=1'"; + "exec-if" = "ping wttr.in -c1"; + }; + } + ]; style = '' * { border: none; border-radius: 0; } diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 1e874d1..808be17 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -1,8 +1,9 @@ -{ config, pkgs, ... }: { +{ + config, + pkgs, + ... +}: { imports = [ - # ../../nixos/nvidia.nix # CHANGEME: Remove this line if you don't have an Nvidia GPU - # ../../nixos/prime.nix # CHANGEME: Remove this line if you don't have an Nvidia GPU - ../../nixos/audio.nix ../../nixos/auto-upgrade.nix ../../nixos/bluetooth.nix @@ -13,7 +14,8 @@ ../../nixos/systemd-boot.nix ../../nixos/timezone.nix ../../nixos/tuigreet.nix - ../../nixos/tlp.nix + # ../../nixos/tlp.nix + ../../nixos/upower.nix ../../nixos/users.nix ../../nixos/utils.nix ../../nixos/virtualisation.nix @@ -34,8 +36,8 @@ programs.nm-applet.enable = true; networking.hosts = { - "192.168.122.52" = [ "websiteku.lokal" ]; - "127.0.0.1" = [ "dimensi.lokal" "sisfokampus.ddev.site" ]; + "192.168.122.52" = ["websiteku.lokal"]; + "127.0.0.1" = ["dimensi.lokal" "sisfokampus.ddev.site"]; # "10.230.4.15" = [ "www.yapeim.my" ]; # "43.239.205.20" = [ "dimensi.my" ]; # "103.106.6.124" = [ "dimensi.my" ]; diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 9481f16..599d27b 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -1,11 +1,16 @@ -{ pkgs, config, inputs, ... }: { - +{ + pkgs, + config, + lib, + ... +}: { imports = [ ./variables.nix # Programs ../../home/programs/kitty - ../../home/programs/nfv + ../../home/programs/nvf + ../../home/programs/helix ../../home/programs/shell ../../home/programs/pass ../../home/programs/fetch @@ -23,18 +28,19 @@ ../../home/scripts # All scripts # System (Desktop environment like stuff) - ../../home/system/hyprland - ../../home/system/hypridle - ../../home/system/hyprlock - ../../home/system/hyprpaper - ../../home/system/wofi + # ../../home/system/hyprland + # ../../home/system/hypridle + # ../../home/system/hyprlock + # ../../home/system/hyprpaper + # ../../home/system/wofi + # ../../home/system/waybar + # ../../home/system/dunst ../../home/system/batsignal ../../home/system/zathura ../../home/system/mime ../../home/system/udiskie ../../home/system/clipman - ../../home/system/waybar - ../../home/system/dunst + ../../home/system/niri # ./secrets # CHANGEME: You should probably remove this line, this is where I store my secrets ]; @@ -51,6 +57,8 @@ }; }; + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) ["intelephense" "spotify"]; home = { inherit (config.var) username; homeDirectory = "/home/" + config.var.username; @@ -80,7 +88,7 @@ }; doCheck = false; pyproject = true; - propagatedBuildInputs = [ pip setuptools pyyaml mypy ]; + propagatedBuildInputs = [pip setuptools pyyaml mypy]; }) ])) jq @@ -145,7 +153,7 @@ ]; # Import my profile picture, used by the hyprpanel dashboard - file.".profile_picture.png" = { source = ./profile_picture.png; }; + file.".profile_picture.png" = {source = ./profile_picture.png;}; # Don't touch this stateVersion = "24.05"; diff --git a/hosts/laptop/variables.nix b/hosts/laptop/variables.nix index 1222e5a..8d39308 100644 --- a/hosts/laptop/variables.nix +++ b/hosts/laptop/variables.nix @@ -1,14 +1,13 @@ -{ config, ... }: { - imports = [ ../../nixos/variables-config.nix ]; +{config, ...}: { + imports = [../../nixos/variables-config.nix]; config.var = { hostname = "dark"; username = "dim"; + fullname = "Dhimas Widrayato"; uid = 1000; - hashedPassword = - "$y$j9T$OqKMt8etf8DgTrZhN9jzy/$biMoM3P.WPZMpk0DAK.QhaHjGOL23pEgxlSvfu9LEPD"; - configDirectory = "/home/" + config.var.username - + "/.config/nixos"; # The path of the nixos configuration directory + hashedPassword = "$y$j9T$OqKMt8etf8DgTrZhN9jzy/$biMoM3P.WPZMpk0DAK.QhaHjGOL23pEgxlSvfu9LEPD"; + configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory keyboardLayout = "us"; @@ -29,8 +28,7 @@ autoUpgrade = false; autoGarbageCollector = false; - cpuTempSensor = - "/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp1_input"; + cpuTempSensor = "/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp1_input"; theme = import ../../themes/var/nixy.nix; }; diff --git a/nixos/nix.nix b/nixos/nix.nix index be9f9e7..78202b1 100644 --- a/nixos/nix.nix +++ b/nixos/nix.nix @@ -1,6 +1,13 @@ { config, inputs, ... }: let autoGarbageCollector = config.var.autoGarbageCollector; in { + security.sudo.extraRules = [{ + users = [ config.var.username ]; + commands = [{ + command = "/run/current-system/sw/bin/nixos-rebuild"; + options = [ "NOPASSWD" ]; + }]; + }]; nixpkgs.config = { allowUnfree = true; allowBroken = true; diff --git a/nixos/tuigreet.nix b/nixos/tuigreet.nix index 6d6b538..7486ae7 100644 --- a/nixos/tuigreet.nix +++ b/nixos/tuigreet.nix @@ -1,17 +1,16 @@ -{ pkgs, ... }: { +{pkgs, ...}: { services.greetd = { enable = true; settings = { default_session = { - command = - "${pkgs.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a • %h | %F' --cmd Hyprland"; + command = "${pkgs.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a • %h | %F' --cmd niri-session"; user = "greeter"; }; }; }; security.pam.services.greetd.enableGnomeKeyring = true; - environment.systemPackages = with pkgs; [ tuigreet ]; + environment.systemPackages = with pkgs; [tuigreet]; # this is a life saver. # literally no documentation about this anywhere. @@ -37,5 +36,4 @@ # WatchdogDevice = "/dev/watchdog"; DefaultTimeoutStopSec = "10s"; }; - } diff --git a/nixos/upower.nix b/nixos/upower.nix new file mode 100644 index 0000000..ced199c --- /dev/null +++ b/nixos/upower.nix @@ -0,0 +1,5 @@ +{ + services.tlp.enable = false; + services.tuned.enable = true; + services.upower.enable = true; +} diff --git a/nixos/users.nix b/nixos/users.nix index 5e32e69..65e7dee 100644 --- a/nixos/users.nix +++ b/nixos/users.nix @@ -1,5 +1,9 @@ -{ config, pkgs, inputs, ... }: -let +{ + config, + pkgs, + inputs, + ... +}: let username = config.var.username; hashedPassword = config.var.hashedPassword; userId = config.var.uid; @@ -14,10 +18,10 @@ in { programs.xfconf.enable = true; services.tumbler.enable = true; - hardware.graphics = { - package = - inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.mesa; - }; + # hardware.graphics = { + # package = + # inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.mesa; + # }; users = { defaultUserShell = pkgs.zsh; @@ -25,8 +29,8 @@ in { hashedPassword = "${hashedPassword}"; uid = userId; isNormalUser = true; - description = "${username} account"; - extraGroups = [ "networkmanager" "wheel" "audio" "video" "input" ]; + description = config.var.fullname; + extraGroups = ["networkmanager" "wheel" "audio" "video" "input"]; }; }; } diff --git a/nixos/xdg-portal.nix b/nixos/xdg-portal.nix index 4888faf..0815329 100644 --- a/nixos/xdg-portal.nix +++ b/nixos/xdg-portal.nix @@ -1,9 +1,29 @@ -{ pkgs, ... }: { +{pkgs, ...}: { + # xdg.portal = { + # enable = true; + # config.common.default = "*"; + # wlr.enable = true; + # xdgOpenUsePortal = true; + # extraPortals = [ pkgs.xdg-desktop-portal pkgs.xdg-desktop-portal-gtk ]; + # }; xdg.portal = { enable = true; - config.common.default = "*"; - wlr.enable = true; xdgOpenUsePortal = true; - extraPortals = [ pkgs.xdg-desktop-portal pkgs.xdg-desktop-portal-gtk ]; + wlr.enable = true; + config = { + common = { + default = [ + "gtk" + "gnome" + ]; + }; + niri = { + default = [ + "gtk" + "gnome" + ]; + }; + }; }; + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-wlr pkgs.xdg-desktop-portal-gtk]; }