From b51f9bc1014ce350abe73f2c419e0bf6512194c2 Mon Sep 17 00:00:00 2001 From: Andrey0189 Date: Wed, 17 Apr 2024 05:52:14 +0500 Subject: [PATCH] Initial commit --- disko.nix | 41 +++ flake.lock | 323 ++++++++++++++++ flake.nix | 46 +++ home-manager/home.nix | 13 + home-manager/modules/alacritty.nix | 19 + home-manager/modules/bundle.nix | 12 + home-manager/modules/cursor.nix | 14 + home-manager/modules/git.nix | 7 + home-manager/modules/htop.nix | 8 + home-manager/modules/qt.nix | 16 + home-manager/modules/wms/hyprland.nix | 210 +++++++++++ home-manager/modules/wms/waybar.nix | 345 ++++++++++++++++++ home-manager/zsh.nix | 37 ++ nixos/configuration.nix | 21 ++ nixos/hardware-configuration.nix | 37 ++ nixos/modules/bootloader.nix | 6 + nixos/modules/bundle.nix | 15 + nixos/modules/env.nix | 8 + nixos/modules/hyprland.nix | 3 + nixos/modules/nixvim/autocmds.nix | 10 + nixos/modules/nixvim/keymaps.nix | 15 + nixos/modules/nixvim/nixvim.nix | 16 + nixos/modules/nixvim/opts.nix | 64 ++++ nixos/modules/nixvim/plugins/barbar.nix | 12 + nixos/modules/nixvim/plugins/cmp.nix | 32 ++ nixos/modules/nixvim/plugins/comment.nix | 10 + nixos/modules/nixvim/plugins/floaterm.nix | 12 + nixos/modules/nixvim/plugins/lsp.nix | 46 +++ nixos/modules/nixvim/plugins/lualine.nix | 47 +++ nixos/modules/nixvim/plugins/mini.nix | 20 + nixos/modules/nixvim/plugins/neotree.nix | 7 + nixos/modules/nixvim/plugins/nix.nix | 3 + .../modules/nixvim/plugins/plugins-bundle.nix | 15 + nixos/modules/nixvim/plugins/telescope.nix | 29 ++ nixos/modules/nixvim/plugins/transparent.nix | 3 + nixos/modules/nm.nix | 3 + nixos/modules/sound.nix | 18 + nixos/modules/trim.nix | 3 + nixos/modules/user.nix | 17 + nixos/modules/virtmanager.nix | 8 + nixos/modules/xserver.nix | 26 ++ nixos/modules/zram.nix | 8 + nixos/packages.nix | 116 ++++++ 43 files changed, 1721 insertions(+) create mode 100644 disko.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home-manager/home.nix create mode 100644 home-manager/modules/alacritty.nix create mode 100644 home-manager/modules/bundle.nix create mode 100644 home-manager/modules/cursor.nix create mode 100644 home-manager/modules/git.nix create mode 100644 home-manager/modules/htop.nix create mode 100644 home-manager/modules/qt.nix create mode 100644 home-manager/modules/wms/hyprland.nix create mode 100644 home-manager/modules/wms/waybar.nix create mode 100644 home-manager/zsh.nix create mode 100644 nixos/configuration.nix create mode 100644 nixos/hardware-configuration.nix create mode 100644 nixos/modules/bootloader.nix create mode 100644 nixos/modules/bundle.nix create mode 100644 nixos/modules/env.nix create mode 100644 nixos/modules/hyprland.nix create mode 100644 nixos/modules/nixvim/autocmds.nix create mode 100644 nixos/modules/nixvim/keymaps.nix create mode 100644 nixos/modules/nixvim/nixvim.nix create mode 100644 nixos/modules/nixvim/opts.nix create mode 100644 nixos/modules/nixvim/plugins/barbar.nix create mode 100644 nixos/modules/nixvim/plugins/cmp.nix create mode 100644 nixos/modules/nixvim/plugins/comment.nix create mode 100644 nixos/modules/nixvim/plugins/floaterm.nix create mode 100644 nixos/modules/nixvim/plugins/lsp.nix create mode 100644 nixos/modules/nixvim/plugins/lualine.nix create mode 100644 nixos/modules/nixvim/plugins/mini.nix create mode 100644 nixos/modules/nixvim/plugins/neotree.nix create mode 100644 nixos/modules/nixvim/plugins/nix.nix create mode 100644 nixos/modules/nixvim/plugins/plugins-bundle.nix create mode 100644 nixos/modules/nixvim/plugins/telescope.nix create mode 100644 nixos/modules/nixvim/plugins/transparent.nix create mode 100644 nixos/modules/nm.nix create mode 100644 nixos/modules/sound.nix create mode 100644 nixos/modules/trim.nix create mode 100644 nixos/modules/user.nix create mode 100644 nixos/modules/virtmanager.nix create mode 100644 nixos/modules/xserver.nix create mode 100644 nixos/modules/zram.nix create mode 100644 nixos/packages.nix diff --git a/disko.nix b/disko.nix new file mode 100644 index 0000000..6046c50 --- /dev/null +++ b/disko.nix @@ -0,0 +1,41 @@ +{ + disko.devices = { + disk = { + my-disk = { + device = "/dev/sdb"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "256M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + + swap = { + size = "8G"; + content = { + type = "swap"; + resumeDevice = true; + }; + }; + + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8d18527 --- /dev/null +++ b/flake.lock @@ -0,0 +1,323 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711099426, + "narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=", + "owner": "numtide", + "repo": "devshell", + "rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713294767, + "narHash": "sha256-LmaabaQZdx52MPGKPRt9Opoc9Gd9RbwvCdysUUYQoXI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "fa8c16e2452bf092ac76f09ee1fb1e9f7d0796e7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712989663, + "narHash": "sha256-r2X/DIAyKOLiHoncjcxUk1TENWDTTaigRBaY53Cts/w=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "40ab43ae98cb3e6f07eaeaa3f3ed56d589da21b0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711763326, + "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1713248628, + "narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1713145326, + "narHash": "sha256-m7+IWM6mkWOg22EC5kRUFCycXsXLSU7hWmHdmBfmC3s=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1713294906, + "narHash": "sha256-xJJZdCBzVFpVppaYyUK4lTTNOnbAxrjhodoJL3Oi91E=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "514a51877df9fe41ffc38c5237e3c4e5327e7607", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712897695, + "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..70c1df0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + description = "My system configuration"; + + inputs = { + + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... }@inputs: + + let + system = "x86_64-linux"; + in { + + # nixos - system hostname + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + specialArgs = { + pkgs-stable = import nixpkgs-stable { + inherit system; + config.allowUnfree = true; + }; + inherit inputs system; + }; + modules = [ + ./nixos/configuration.nix + inputs.nixvim.nixosModules.nixvim + ]; + }; + + homeConfigurations.amper = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.${system}; + modules = [ ./home-manager/home.nix ]; + }; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..e2ea67f --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,13 @@ +{ + + imports = [ + ./zsh.nix + ./modules/bundle.nix + ]; + + home = { + username = "amper"; + homeDirectory = "/home/amper"; + stateVersion = "23.11"; + }; +} diff --git a/home-manager/modules/alacritty.nix b/home-manager/modules/alacritty.nix new file mode 100644 index 0000000..4b986c6 --- /dev/null +++ b/home-manager/modules/alacritty.nix @@ -0,0 +1,19 @@ +{ + programs.alacritty = { + enable = true; + settings = { + window.opacity = 0.95; + + font = { + size = 13.0; + # draw_bold_text_with_bright_colors = true; + normal = { + family = "JetBrains Mono"; + style = "Bold"; + }; + }; + + colors.primary.background = "#1d2021"; + }; + }; +} diff --git a/home-manager/modules/bundle.nix b/home-manager/modules/bundle.nix new file mode 100644 index 0000000..3f58742 --- /dev/null +++ b/home-manager/modules/bundle.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ./cursor.nix + ./git.nix + ./htop.nix + ./alacritty.nix + ./qt.nix + + ./wms/hyprland.nix + ./wms/waybar.nix + ]; +} diff --git a/home-manager/modules/cursor.nix b/home-manager/modules/cursor.nix new file mode 100644 index 0000000..85bea31 --- /dev/null +++ b/home-manager/modules/cursor.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: { + home = { + pointerCursor = { + package = pkgs.vanilla-dmz; + name = "Vanilla-DMZ"; + size = 36; + gtk.enable = true; + x11 = { + enable = true; + defaultCursor = true; + }; + }; + }; +} diff --git a/home-manager/modules/git.nix b/home-manager/modules/git.nix new file mode 100644 index 0000000..c3dbae7 --- /dev/null +++ b/home-manager/modules/git.nix @@ -0,0 +1,7 @@ +{ + programs.git = { + enable = true; + userName = "Andrey0189"; + userEmail = "varnavsky06@gmail.com"; + }; +} diff --git a/home-manager/modules/htop.nix b/home-manager/modules/htop.nix new file mode 100644 index 0000000..a781214 --- /dev/null +++ b/home-manager/modules/htop.nix @@ -0,0 +1,8 @@ +{ + programs.htop = { + enable = true; + settings = { + tree_view = 1; + }; + }; +} diff --git a/home-manager/modules/qt.nix b/home-manager/modules/qt.nix new file mode 100644 index 0000000..795b2d3 --- /dev/null +++ b/home-manager/modules/qt.nix @@ -0,0 +1,16 @@ +{ + qt = { + enable = true; + platformTheme = "qtct"; + style.name = "kvantum"; + }; + + # xdg.configFile = { + # "Kvantum/kvantum.kvconfig".text = '' + # [General] + # theme=GraphiteNordDark + # ''; + # + # "Kvantum/GraphiteNord".source = "${pkgs.graphite-kde-theme}/share/Kvantum/GraphiteNord"; + # }; +} diff --git a/home-manager/modules/wms/hyprland.nix b/home-manager/modules/wms/hyprland.nix new file mode 100644 index 0000000..9f52da2 --- /dev/null +++ b/home-manager/modules/wms/hyprland.nix @@ -0,0 +1,210 @@ +{ + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + + settings = { + "$mainMod" = "SUPER"; + + monitor = ",preferred,auto,1"; + + env = [ + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + "XCURSOR_SIZE,36" + "QT_QPA_PLATFORM,wayland" + "XDG_SCREENSHOTS_DIR,~/screens" + ]; + + debug = { + disable_logs = false; + enable_stdout_logs = true; + }; + + input = { + kb_layout = "us,ru"; + kb_variant = "lang"; + kb_options = "grp:caps_toggle"; + + follow_mouse = 1; + + touchpad = { + natural_scroll = false; + }; + + sensitivity = 0; # -1.0 - 1.0, 0 means no modification. + }; + + general = { + gaps_in = 5; + gaps_out = 20; + border_size = 3; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + + layout = "dwindle"; + + no_cursor_warps = false; + }; + + decoration = { + rounding = 10; + + blur = { + enabled = true; + size = 16; + passes = 2; + new_optimizations = true; + }; + + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + "col.shadow" = "rgba(1a1a1aee)"; + }; + + animations = { + enabled = true; + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + # bezier = "myBezier, 0.33, 0.82, 0.9, -0.08"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true; # you probably want this + }; + + master = { + new_is_master = true; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 3; + workspace_swipe_invert = false; + workspace_swipe_distance = 200; + }; + + misc = { + animate_manual_resizes = true; + animate_mouse_windowdragging = true; + enable_swallow = true; + render_ahead_of_time = false; + disable_hyprland_logo = true; + }; + + windowrule = [ + "float, ^(imv)$" + "float, ^(mpv)$" + ]; + + exec-once = [ + "swww init" + "swww img ~/Downloads/nixos-chan.png" + "waybar" + "wl-paste --type text --watch cliphist store" + "wl-paste --type image --watch cliphist store" + ]; + + bind = [ + "$mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy" + + "$mainMod, Return, exec, alacritty" + "$mainMod, Q, killactive," + "$mainMod, M, exit," + "$mainMod, E, exec, dolphin" + "$mainMod, F, togglefloating," + "$mainMod, D, exec, wofi --show drun" + "$mainMod, P, pseudo, # dwindle" + "$mainMod, J, togglesplit, # dwindle" + + # Move focus with mainMod + arrow keys + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + # Moving windows + "$mainMod SHIFT, left, swapwindow, l" + "$mainMod SHIFT, right, swapwindow, r" + "$mainMod SHIFT, up, swapwindow, u" + "$mainMod SHIFT, down, swapwindow, d" + + # Window resizing X Y + "$mainMod CTRL, left, resizeactive, -60 0" + "$mainMod CTRL, right, resizeactive, 60 0" + "$mainMod CTRL, up, resizeactive, 0 -60" + "$mainMod CTRL, down, resizeactive, 0 60" + + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, movetoworkspacesilent, 9" + "$mainMod SHIFT, 0, movetoworkspacesilent, 10" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + + # Keyboard backlight + "$mainMod, F3, exec, brightnessctl -d *::kbd_backlight set +33%" + "$mainMod, F2, exec, brightnessctl -d *::kbd_backlight set 33%-" + + # Volume and Media Control + ", XF86AudioRaiseVolume, exec, pamixer -i 5 " + ", XF86AudioLowerVolume, exec, pamixer -d 5 " + ", XF86AudioMute, exec, pamixer -t" + ", XF86AudioMicMute, exec, pamixer --default-source -m" + + # Configuration files + ''$mainMod SHIFT, N, exec, alacritty -e sh -c "rb"'' + ''$mainMod SHIFT, C, exec, alacritty -e sh -c "conf"'' + ''$mainMod SHIFT, H, exec, alacritty -e sh -c "nvim ~/nix/home-manager/modules/wms/hyprland.nix"'' + ''$mainMod SHIFT, W, exec, alacritty -e sh -c "nvim ~/nix/home-manager/modules/wms/waybar.nix'' + '', Print, exec, grim -g "$(slurp)" - | swappy -f -'' + + # Waybar + "$mainMod, B, exec, pkill -SIGUSR1 waybar" + "$mainMod, W, exec, pkill -SIGUSR2 waybar" + + # Disable all effects + "$mainMod Shift, G, exec, ~/.config/hypr/gamemode.sh " + ]; + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; + }; +} diff --git a/home-manager/modules/wms/waybar.nix b/home-manager/modules/wms/waybar.nix new file mode 100644 index 0000000..34e8e43 --- /dev/null +++ b/home-manager/modules/wms/waybar.nix @@ -0,0 +1,345 @@ +{ + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + margin = "9 13 -10 18"; + + modules-left = ["hyprland/workspaces" "hyprland/language" "keyboard-state" "hyprland/submap"]; + modules-center = ["clock" "custom/weather"]; + modules-right = ["pulseaudio" "custom/mem" "cpu" "backlight" "battery" "tray"]; + + "hyprland/workspaces" = { + disable-scroll = true; + }; + + "hyprland/language" = { + format-en = "US"; + format-ru = "RU"; + min-length = 5; + tooltip = false; + }; + + "keyboard-state" = { + #numlock = true; + capslock = true; + format = "{icon} "; + format-icons = { + locked = " "; + unlocked = ""; + }; + }; + + "clock" = { + # timezone = "America/New_York"; + tooltip-format = "{:%Y %B}\n{calendar}"; + format = "{:%a; %d %b, %I:%M %p}"; + }; + + "custom/weather" = { + format = "{}"; + tooltip = true; + interval = 1800; + exec = "$HOME/.config/waybar/scripts/wttr.py"; + return-type = "json"; + }; + + "pulseaudio" = { + # scroll-step = 1; # %, can be a float + reverse-scrolling = 1; + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + min-length = 13; + }; + + "custom/mem" = { + format = "{} "; + interval = 3; + exec = "free -h | awk '/Mem:/{printf $3}'"; + tooltip = false; + }; + + "cpu" = { + interval = 2; + format = "{usage}% "; + min-length = 6; + }; + + "temperature" = { + # thermal-zone = 2; + # hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + # format-critical = "{temperatureC}°C {icon}"; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" "" "" ""]; + tooltip = false; + }; + + "backlight" = { + device = "intel_backlight"; + format = "{percent}% {icon}"; + format-icons = [""]; + min-length = 7; + }; + + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-icons = ["" "" "" "" "" "" "" "" "" ""]; + on-update = "$HOME/.config/waybar/scripts/check_battery.sh"; + }; + + tray = { + icon-size = 16; + spacing = 0; + }; + + }; + }; + + style = + '' +* { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: JetBrains Mono; + font-weight: bold; + min-height: 20px; +} + +window#waybar { + background: transparent; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#workspaces { + margin-right: 8px; + border-radius: 10px; + transition: none; + background: #383c4a; +} + +#workspaces button { + transition: none; + color: #7c818c; + background: transparent; + padding: 5px; + font-size: 18px; +} + +#workspaces button.persistent { + color: #7c818c; + font-size: 12px; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button:hover { + transition: none; + box-shadow: inherit; + text-shadow: inherit; + border-radius: inherit; + color: #383c4a; + background: #7c818c; +} + +#workspaces button.active { + background: #4e5263; + color: white; + border-radius: inherit; +} + +#language { + padding-left: 16px; + padding-right: 8px; + border-radius: 10px 0px 0px 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#keyboard-state { + margin-right: 8px; + padding-right: 16px; + border-radius: 0px 10px 10px 0px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#custom-pacman { + padding-left: 16px; + padding-right: 8px; + border-radius: 10px 0px 0px 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#custom-mail { + margin-right: 8px; + padding-right: 16px; + border-radius: 0px 10px 10px 0px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#submap { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#clock { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px 0px 0px 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#custom-weather { + padding-right: 16px; + border-radius: 0px 10px 10px 0px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#pulseaudio { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#custom-mem { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#cpu { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#temperature { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#backlight { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#battery { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#battery.charging { + color: #ffffff; + background-color: #26A65B; +} + +#battery.warning:not(.charging) { + background-color: #ffbe61; + color: black; +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#tray { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + ''; + }; +} diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix new file mode 100644 index 0000000..7ce1349 --- /dev/null +++ b/home-manager/zsh.nix @@ -0,0 +1,37 @@ +{ config, ... }: { + programs.zsh = { + enable = true; + enableCompletion = true; + # enableAutosuggestions = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + shellAliases = + let + flakeDir = "~/nix"; + in { + rb = "sudo nixos-rebuild switch --flake ${flakeDir}"; + upd = "nix flake update ${flakeDir}"; + upg = "sudo nixos-rebuild switch --upgrade --flake ${flakeDir}"; + + hms = "home-manager switch --flake ${flakeDir}"; + + conf = "nvim ${flakeDir}/nixos/configuration.nix"; + pkgs = "nvim ${flakeDir}/nixos/packages.nix"; + + ll = "ls -l"; + v = "nvim"; + se = "sudoedit"; + ff = "fastfetch"; + }; + + history.size = 10000; + history.path = "${config.xdg.dataHome}/zsh/history"; + + oh-my-zsh = { + enable = true; + plugins = [ "git" "sudo" ]; + theme = "agnoster"; # blinks is also really nice + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..b23d606 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,21 @@ +{ + imports = [ + ./hardware-configuration.nix + ./packages.nix + ./modules/bundle.nix + ]; + + disabledModules = [ + ./modules/xserver.nix + ]; + + networking.hostName = "nixos"; # Define your hostname. + + time.timeZone = "Asia/Tashkent"; # Set your time zone. + + i18n.defaultLocale = "en_US.UTF-8"; # Select internationalisation properties. + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; # Enabling flakes + + system.stateVersion = "23.05"; # Don't change it bro +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix new file mode 100644 index 0000000..70f17b6 --- /dev/null +++ b/nixos/hardware-configuration.nix @@ -0,0 +1,37 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/c3c28b79-eb8b-4a45-8ee2-5576e82cb4e5"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3e9f0c85-9a78-44ad-a29c-84afc3b257cc"; } + { device = "/dev/disk/by-uuid/d80806ff-1b8c-4cac-b7f8-593e030abcda"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.virbr0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/modules/bootloader.nix b/nixos/modules/bootloader.nix new file mode 100644 index 0000000..4134e89 --- /dev/null +++ b/nixos/modules/bootloader.nix @@ -0,0 +1,6 @@ +{ + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.kernelModules = [ "amdgpu" ]; + boot.kernelParams = [ "psmouse.synaptics_intertouch=0" ]; +} diff --git a/nixos/modules/bundle.nix b/nixos/modules/bundle.nix new file mode 100644 index 0000000..642194f --- /dev/null +++ b/nixos/modules/bundle.nix @@ -0,0 +1,15 @@ +{ + imports = [ + ./bootloader.nix + ./sound.nix + ./zram.nix + ./env.nix + ./user.nix + ./xserver.nix + ./nm.nix + ./virtmanager.nix + ./hyprland.nix + ./trim.nix + ./nixvim/nixvim.nix + ]; +} diff --git a/nixos/modules/env.nix b/nixos/modules/env.nix new file mode 100644 index 0000000..0353b25 --- /dev/null +++ b/nixos/modules/env.nix @@ -0,0 +1,8 @@ +{ + environment.variables = { + EDITOR = "nvim"; + RANGER_LOAD_DEFAULT_RC = "FALSE"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + GSETTINGS_BACKEND = "keyfile"; + }; +} diff --git a/nixos/modules/hyprland.nix b/nixos/modules/hyprland.nix new file mode 100644 index 0000000..98dfe35 --- /dev/null +++ b/nixos/modules/hyprland.nix @@ -0,0 +1,3 @@ +{ + programs.hyprland.enable = true; +} diff --git a/nixos/modules/nixvim/autocmds.nix b/nixos/modules/nixvim/autocmds.nix new file mode 100644 index 0000000..4fca334 --- /dev/null +++ b/nixos/modules/nixvim/autocmds.nix @@ -0,0 +1,10 @@ +{ + programs.nixvim = { + autoCmd = [ + { + event = [ "VimEnter" ]; + command = ":TransparentEnable"; + } + ]; + }; +} diff --git a/nixos/modules/nixvim/keymaps.nix b/nixos/modules/nixvim/keymaps.nix new file mode 100644 index 0000000..e792ea0 --- /dev/null +++ b/nixos/modules/nixvim/keymaps.nix @@ -0,0 +1,15 @@ +{ + programs.nixvim = { + globals = { + mapleader = "\\"; + maplocalleader = "\\"; + }; + + keymaps = [ + { + key = "n"; + action = "Neotree"; + } + ]; + }; +} diff --git a/nixos/modules/nixvim/nixvim.nix b/nixos/modules/nixvim/nixvim.nix new file mode 100644 index 0000000..df97be1 --- /dev/null +++ b/nixos/modules/nixvim/nixvim.nix @@ -0,0 +1,16 @@ +{ + + imports = [ + ./opts.nix + ./keymaps.nix + ./autocmds.nix + ./plugins/plugins-bundle.nix + ]; + + programs.nixvim = { + enable = true; + + defaultEditor = true; + colorschemes.oxocarbon.enable = true; + }; +} diff --git a/nixos/modules/nixvim/opts.nix b/nixos/modules/nixvim/opts.nix new file mode 100644 index 0000000..d3d7822 --- /dev/null +++ b/nixos/modules/nixvim/opts.nix @@ -0,0 +1,64 @@ +{ + programs.nixvim = { + + clipboard = { + register = "unnamedplus"; + providers.wl-copy.enable = true; + }; + + opts = { + updatetime = 100; # Faster completion + + relativenumber = true; # Relative line numbers + number = true; # Display the absolute line number of the current line + + hidden = true; # Keep closed buffer open in the background + + mouse = "a"; # Enable mouse control + mousemodel = "extend"; # Mouse right-click extends the current selection + + splitbelow = true; # A new window is put below the current one + splitright = true; # A new window is put right of the current one + + swapfile = false; # Disable the swap file + + modeline = true; # Tags such as 'vim:ft=sh' + modelines = 100; # Sets the type of modelines + + undofile = true; # Automatically save and restore undo history + + incsearch = true; # Incremental search: show match for partly typed search command + + inccommand = "split"; # Search and replace: preview changes in quickfix list + ignorecase = true; # When the search query is lower-case, match both lower and upper-case + smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper + + scrolloff = 12; # Number of screen lines to show around the cursor + + cursorline = false; # Highlight the screen line of the cursor + cursorcolumn = false; # Highlight the screen column of the cursor + signcolumn = "yes"; # Whether to show the signcolumn + colorcolumn = "100"; # Columns to highlight + + laststatus = 3; # When to use a status line for the last window + + fileencoding = "utf-8"; # File-content encoding for the current buffer + + termguicolors = false; # Disables 24-bit RGB color in the |TUI| + + spell = false; # Highlight spelling mistakes (local to window) + wrap = false; # Prevent text from wrapping + + tabstop = 2; # Number of spaces a in the text stands for (local to buffer) + shiftwidth = 2; # Number of spaces used for each step of (auto)indent (local to buffer) + expandtab = true; # Expand to spaces in Insert mode (local to buffer) + autoindent = true; # Do clever autoindenting + + textwidth = 0; # Maximum width of text that is being inserted. A longer line will be + + foldlevel = 99; # Folds with a level higher than this number will be closed + + completeopt = ["menu" "menuone" "noselect"]; # For CMP plugin + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/barbar.nix b/nixos/modules/nixvim/plugins/barbar.nix new file mode 100644 index 0000000..516ec13 --- /dev/null +++ b/nixos/modules/nixvim/plugins/barbar.nix @@ -0,0 +1,12 @@ +{ + programs.nixvim.plugins.barbar = { + enable = true; + keymaps = { + silent = true; + + next = ""; + previous = ""; + close = ""; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/cmp.nix b/nixos/modules/nixvim/plugins/cmp.nix new file mode 100644 index 0000000..66afc03 --- /dev/null +++ b/nixos/modules/nixvim/plugins/cmp.nix @@ -0,0 +1,32 @@ +{ + programs.nixvim.plugins.cmp = { + enable = true; + + settings = { + snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + + mapping = { + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; + "" = "cmp.mapping.confirm({ select = true })"; + }; + + sources = [ + {name = "path";} + {name = "nvim_lsp";} + {name = "cmp_tabby";} + {name = "luasnip";} + { + name = "buffer"; + # Words from other open buffers can also be suggested. + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + } + {name = "neorg";} + ]; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/comment.nix b/nixos/modules/nixvim/plugins/comment.nix new file mode 100644 index 0000000..5aa38ad --- /dev/null +++ b/nixos/modules/nixvim/plugins/comment.nix @@ -0,0 +1,10 @@ +{ + programs.nixvim.plugins.comment = { + enable = true; + + settings = { + opleader.line = "gcc"; + toggler.line = "gcc"; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/floaterm.nix b/nixos/modules/nixvim/plugins/floaterm.nix new file mode 100644 index 0000000..7185d66 --- /dev/null +++ b/nixos/modules/nixvim/plugins/floaterm.nix @@ -0,0 +1,12 @@ +{ + programs.nixvim.plugins.floaterm = { + enable = true; + + width = 0.8; + height = 0.8; + + title = ""; + + keymaps.toggle = ""; + }; +} diff --git a/nixos/modules/nixvim/plugins/lsp.nix b/nixos/modules/nixvim/plugins/lsp.nix new file mode 100644 index 0000000..045f7ed --- /dev/null +++ b/nixos/modules/nixvim/plugins/lsp.nix @@ -0,0 +1,46 @@ +{ + programs.nixvim.plugins = { + + treesitter = { + enable = true; + nixvimInjections = true; + folding = true; + indent = true; + }; + + treesitter-refactor = { + enable = true; + highlightDefinitions = { + enable = true; + # Set to false if you have an `updatetime` of ~100. + clearOnCursorMove = false; + }; + }; + + hmts.enable = true; + + # lspkind = { + # enable = true; + # + # cmp = { + # enable = true; + # menu = { + # nvim_lsp = "[LSP]"; + # nvim_lua = "[api]"; + # path = "[path]"; + # luasnip = "[snip]"; + # buffer = "[buffer]"; + # neorg = "[neorg]"; + # cmp_tabby = "[Tabby]"; + # }; + # }; + # }; + + lsp = { + enable = true; + servers = { + nil_ls.enable = true; + }; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/lualine.nix b/nixos/modules/nixvim/plugins/lualine.nix new file mode 100644 index 0000000..4fa95d7 --- /dev/null +++ b/nixos/modules/nixvim/plugins/lualine.nix @@ -0,0 +1,47 @@ +{ + programs.nixvim.plugins.lualine = { + + enable = true; + globalstatus = true; + + # +-------------------------------------------------+ + # | A | B | C X | Y | Z | + # +-------------------------------------------------+ + + sections = { + lualine_a = ["mode"]; + lualine_b = ["branch"]; + lualine_c = ["filename" "diff"]; + + lualine_x = [ + "diagnostics" + + # Show active language server + { + name.__raw = '' + function() + local msg = "" + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end + ''; + icon = " "; + # color.fg = "#ffffff"; + } + "encoding" + "fileformat" + "filetype" + ]; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/mini.nix b/nixos/modules/nixvim/plugins/mini.nix new file mode 100644 index 0000000..bd41a68 --- /dev/null +++ b/nixos/modules/nixvim/plugins/mini.nix @@ -0,0 +1,20 @@ +{ + programs.nixvim.plugins.mini = { + enable = true; + + modules = { + align = {}; + basics = { + options.extra_ui = true; + }; + clue = {}; + cursorword = {}; + doc = {}; + extra = {}; + indentscope = {}; + trailspace = {}; + misc = {}; + surround = {}; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/neotree.nix b/nixos/modules/nixvim/plugins/neotree.nix new file mode 100644 index 0000000..b0c19be --- /dev/null +++ b/nixos/modules/nixvim/plugins/neotree.nix @@ -0,0 +1,7 @@ +{ + programs.nixvim.plugins.neo-tree = { + enable = true; + filesystem.followCurrentFile.enabled = true; + closeIfLastWindow = true; + }; +} diff --git a/nixos/modules/nixvim/plugins/nix.nix b/nixos/modules/nixvim/plugins/nix.nix new file mode 100644 index 0000000..295695a --- /dev/null +++ b/nixos/modules/nixvim/plugins/nix.nix @@ -0,0 +1,3 @@ +{ + programs.nixvim.plugins.nix.enable = true; +} diff --git a/nixos/modules/nixvim/plugins/plugins-bundle.nix b/nixos/modules/nixvim/plugins/plugins-bundle.nix new file mode 100644 index 0000000..9dd1140 --- /dev/null +++ b/nixos/modules/nixvim/plugins/plugins-bundle.nix @@ -0,0 +1,15 @@ +{ + imports = [ + ./lualine.nix + ./transparent.nix + ./neotree.nix + ./mini.nix + ./comment.nix + ./floaterm.nix + ./telescope.nix + ./barbar.nix + ./nix.nix + ./lsp.nix + ./cmp.nix + ]; +} diff --git a/nixos/modules/nixvim/plugins/telescope.nix b/nixos/modules/nixvim/plugins/telescope.nix new file mode 100644 index 0000000..1309eca --- /dev/null +++ b/nixos/modules/nixvim/plugins/telescope.nix @@ -0,0 +1,29 @@ +{ + programs.nixvim.plugins.telescope = { + enable = true; + + keymaps = { + "ff" = "find_files"; + "b" = "buffers"; + "fh" = "help_tags"; + "gf" = "git_files"; + "of" = "oldfiles"; + # "fg" = "live_grep"; + # "fd" = "diagnostics"; + }; + + keymapsSilent = true; + + settings.defaults = { + file_ignore_patterns = [ + "^.git/" + "^.mypy_cache/" + "^__pycache__/" + "^output/" + "^data/" + "%.ipynb" + ]; + set_env.COLORTERM = "truecolor"; + }; + }; +} diff --git a/nixos/modules/nixvim/plugins/transparent.nix b/nixos/modules/nixvim/plugins/transparent.nix new file mode 100644 index 0000000..d2139ee --- /dev/null +++ b/nixos/modules/nixvim/plugins/transparent.nix @@ -0,0 +1,3 @@ +{ + programs.nixvim.plugins.transparent.enable = true; +} diff --git a/nixos/modules/nm.nix b/nixos/modules/nm.nix new file mode 100644 index 0000000..f29d881 --- /dev/null +++ b/nixos/modules/nm.nix @@ -0,0 +1,3 @@ +{ + networking.networkmanager.enable = true; +} diff --git a/nixos/modules/sound.nix b/nixos/modules/sound.nix new file mode 100644 index 0000000..21a7a28 --- /dev/null +++ b/nixos/modules/sound.nix @@ -0,0 +1,18 @@ +{ + hardware.pulseaudio.enable = false; + sound.enable = true; + + # rtkit is optional but recommended + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; +} diff --git a/nixos/modules/trim.nix b/nixos/modules/trim.nix new file mode 100644 index 0000000..84d7613 --- /dev/null +++ b/nixos/modules/trim.nix @@ -0,0 +1,3 @@ +{ + services.fstrim.enable = true; +} diff --git a/nixos/modules/user.nix b/nixos/modules/user.nix new file mode 100644 index 0000000..ea59b78 --- /dev/null +++ b/nixos/modules/user.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: { + programs.zsh.enable = true; + + users = { + defaultUserShell = pkgs.zsh; + + users.amper = { + isNormalUser = true; + description = "Ampersand"; + extraGroups = [ "networkmanager" "wheel" "input" "libvirtd" ]; + packages = with pkgs; []; + }; + }; + + # Enable automatic login for the user. + services.getty.autologinUser = "amper"; +} diff --git a/nixos/modules/virtmanager.nix b/nixos/modules/virtmanager.nix new file mode 100644 index 0000000..a86f94b --- /dev/null +++ b/nixos/modules/virtmanager.nix @@ -0,0 +1,8 @@ +{ pkgs-stable, ... }: { + virtualisation.libvirtd.enable = true; + programs.virt-manager = { + enable = true; + package = pkgs-stable.virt-manager; + }; +} + diff --git a/nixos/modules/xserver.nix b/nixos/modules/xserver.nix new file mode 100644 index 0000000..9011cc2 --- /dev/null +++ b/nixos/modules/xserver.nix @@ -0,0 +1,26 @@ +{ + services.xserver = { + enable = true; + windowManager.herbstluftwm.enable = true; + + # displayManager = { + # autoLogin.enable = true; + # autoLogin.user = "amper"; + # lightdm.enable = true; + # }; + + layout = "us"; + xkbVariant = ""; + + libinput = { + enable = true; + mouse.accelProfile = "flat"; + touchpad.accelProfile = "flat"; + }; + + videoDrivers = [ "amdgpu" ]; + deviceSection = ''Option "TearFree" "True"''; + #displayManager.gdm.enable = true; + #desktopManager.gnome.enable = true; + }; +} diff --git a/nixos/modules/zram.nix b/nixos/modules/zram.nix new file mode 100644 index 0000000..33c9e07 --- /dev/null +++ b/nixos/modules/zram.nix @@ -0,0 +1,8 @@ +{ + zramSwap = { + enable = true; + algorithm = "lz4"; + memoryPercent = 100; + priority = 999; + }; +} diff --git a/nixos/packages.nix b/nixos/packages.nix new file mode 100644 index 0000000..47ad8d5 --- /dev/null +++ b/nixos/packages.nix @@ -0,0 +1,116 @@ +{ pkgs, ... }: { + nixpkgs.config = { + allowUnfree = true; + permittedInsecurePackages = ["python-2.7.18.8" "electron-25.9.0"]; + }; + + environment.systemPackages = with pkgs; [ + # Desktop apps + chromium + telegram-desktop + alacritty + obs-studio + rofi + wofi + mpv + kdenlive + discord + gparted + obsidian + zoom-us + pcmanfm-qt + + # Coding stuff + gnumake + gcc + nodejs + python + (python3.withPackages (ps: with ps; [ requests ])) + + # CLI utils + neofetch + file + tree + wget + git + fastfetch + htop + nix-index + unzip + scrot + ffmpeg + light + lux + mediainfo + ranger + zram-generator + cava + zip + ntfs3g + yt-dlp + brightnessctl + swww + openssl + + # GUI utils + feh + imv + dmenu + screenkey + mako + gromit-mpx + + # Xorg stuff + #xterm + #xclip + #xorg.xbacklight + + # Wayland stuff + xwayland + wl-clipboard + cliphist + + # WMs and stuff + herbstluftwm + hyprland + seatd + xdg-desktop-portal-hyprland + polybar + waybar + + # Sound + pipewire + pulseaudio + pamixer + + # GPU stuff + amdvlk + rocm-opencl-icd + glaxnimate + + # Screenshotting + grim + grimblast + slurp + flameshot + swappy + + # Other + home-manager + spice-vdagent + libsForQt5.qtstyleplugin-kvantum + libsForQt5.qt5ct + papirus-nord + ]; + + fonts.packages = with pkgs; [ + jetbrains-mono + noto-fonts + noto-fonts-emoji + twemoji-color-font + font-awesome + powerline-fonts + powerline-symbols + (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) + ]; +}