diff --git a/Snapchat-941139056.jpg b/Snapchat-941139056.jpg new file mode 100644 index 0000000..cbf4e83 Binary files /dev/null and b/Snapchat-941139056.jpg differ diff --git a/configuration.nix b/configuration.nix index 07256df..842fb7b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,22 +1,18 @@ -{ inputs, pkgs, options, config, ... }: -let - hostName = "clhickey-nixos"; - username = "clhickey"; - wireguardInterface = "wg0"; - wireguardIP = "10.100.0.3"; -in +{ inputs, pkgs, options, config, lib, ... }: { imports = [ ./hardware-configuration.nix "${inputs.home-manager}/nixos" inputs.mapnix.nixosModules.default + ./cos.nix + ./docker-kubernetes.nix + ./mainWireguard.nix + ./hyprland.nix ]; - - services.mapnix = { - openstreetmap-carto-src = inputs.osm-bikeability; - enable = false; - }; + + cos.username = "clhickey"; + cos.hostName = "clhickey-nixos"; boot = { loader = { @@ -33,40 +29,6 @@ in }; }; - networking = { - inherit hostName; - networkmanager.enable = true; - firewall = { - interfaces = { - ${wireguardInterface} = { - allowedUDPPorts = [ - config.networking.wireguard.interfaces.${wireguardInterface}.listenPort - ]; - }; - }; - }; - wireguard = { - enable = true; - interfaces = { - ${wireguardInterface} = { - ips = [ "${wireguardIP}/24" ]; - listenPort = 51820; - - privateKeyFile = "/home/${username}/wireguard-keys/private"; - - peers = [ - { - publicKey = "raOzdkhoag+sN2/KXz18F9ncmeTWhdmPJxQJkqsJ7FI="; - allowedIPs = [ "10.100.0.0/24" ]; - endpoint = "50.116.49.95:51820"; - persistentKeepalive = 25; - } - ]; - }; - }; - }; - }; - time.timeZone = "America/New_York"; i18n = { @@ -82,67 +44,75 @@ in LC_TELEPHONE = "en_US.UTF-8"; LC_TIME = "en_US.UTF-8"; }; - inputMethod = { - enable = true; - type = "fcitx5"; - fcitx5 = { - waylandFrontend = true; - addons = with pkgs; [ - fcitx5-gtk - fcitx5-configtool - fcitx5-mozc - ]; - }; - }; }; + networking = { + hostName = config.cos.hostName; + networkmanager.enable = true; + }; + + services.mapnix = { + openstreetmap-carto-src = inputs.osm-bikeability; + enable = false; + }; + + cos.mainWireguard = { + enable = true; + ip = "10.100.0.3"; + privateKeyFile = "/home/${config.cos.username}/wireguard-keys/private"; + }; + + cos.hyprland = { + enable = true; + wallpaper = builtins.toString ./Snapchat-941139056.jpg; + }; + + hardware.bluetooth.enable = true; + + # For languini + networking.firewall.interfaces.${config.cos.mainWireguard.interface}.allowedTCPPorts = [ + 8000 + 8080 + ]; + services = { - xserver = { + openssh = { enable = true; - xkb = { - layout = "us"; - variant = ""; + settings = { + PasswordAuthentication = true; + AllowUsers = null; }; + listenAddresses = [ + { + port = 22; + addr = config.cos.mainWireguard.ip; + } + ]; }; - displayManager.sddm.enable = true; - printing.enable = true; - pulseaudio.enable = false; - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - gvfs.enable = true; # for sftp }; virtualisation = { - libvirtd.enable = true; - spiceUSBRedirection.enable = true; - docker = { + waydroid = { + enable = false; + }; + libvirtd = { enable = true; - rootless = { - enable = true; - setSocketVariable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; }; }; - # For kubernetes - containerd = { + virtualbox.host = { enable = true; + enableKvm = true; + addNetworkInterface = false; + enableExtensionPack = true; }; + spiceUSBRedirection.enable = true; }; - hardware = { - bluetooth.enable = true; - opentabletdriver.enable = true; - }; - - security = { - rtkit.enable = true; - polkit.enable = true; - }; - - users.users.${username} = { + users.users.${config.cos.username} = { isNormalUser = true; description = "Clayton Lopez Hickey"; extraGroups = [ @@ -162,6 +132,10 @@ in "nix-command" "flakes" ]; + nix.settings.trusted-users = [ + "root" + "@wheel" + ]; environment = { systemPackages = with pkgs; [ @@ -177,9 +151,8 @@ in htop helvum libreoffice-fresh - obsidian anki-bin - gimp + gimp3 audacity ffmpeg zoom-us @@ -201,35 +174,31 @@ in inputs.penn-nix.packages.x86_64-linux.waypoint-client inputs.cnvim.packages.x86_64-linux.default osu-lazer-bin - wl-clipboard thunderbird-bin itch element-desktop gh - vscode-fhs code-cursor firefox popsicle - kdePackages.kget nixfmt-rfc-style graphviz - wdisplays - pwvucontrol alacritty - pcmanfm - kdePackages.okular prismlauncher - kdePackages.ark - wireguard-tools - # For pennlabs - kind - kubectl - awscli2 - k9s + google-chrome + trilium-next-desktop + joplin-desktop + sshfs + unityhub + man-pages + man-pages-posix + vulkan-tools + wireshark + dotnetCorePackages.sdk_9_0_1xx-bin # for unit dev + vscode-fhs ]; sessionVariables = { EDITOR = "${inputs.cnvim.packages.x86_64-linux.default}/bin/nvim"; - CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE = 1; }; }; @@ -260,6 +229,20 @@ in enable = true; package = pkgs.jdk; }; + #vscode = { + # enable = true; + # package = pkgs.vscode-fhs; + # extensions = with pkgs.vscode-extensions; [ + # # For Unity & C# + # visualstudiotoolsforunity.vstuc + # ms-dotnettools.csdevkit + # ms-dotnettools.vscode-dotnet-runtime + # ms-dotnettools.csharp + + # # Personalization + # vscodevim.vim + # ]; + #}; nix-ld = { enable = true; libraries = options.programs.nix-ld.libraries.default ++ [ @@ -273,204 +256,16 @@ in }; virt-manager.enable = true; ladybird = { - enable = true; + enable = true; }; git = { - enable = true; - }; - gnupg.agent = { - enable = true; - }; - hyprland = { enable = true; }; }; - home-manager.users.${username} = { pkgs, ... }: { - wayland.windowManager.hyprland = { - enable = true; - plugins = [ - #pkgs.hyprlandPlugins.hy3 - ]; - settings = { - env = [ - # Base on https://wiki.hyprland.org/Configuring/Environment-variables/ - "GDK_BACKEND,wayland,x11,*" - "QT_QPA_PLATFORM,wayland;xcb" - "SDL_VIDEODRIVER,wayland" - "CLUTTER_BACKEND,wayland" - ]; - "$terminal" = "${pkgs.alacritty}/bin/alacritty"; - "exec-once" = [ - "${pkgs.waybar}/bin/waybar" - "${pkgs.fcitx5}/bin/fcitx5 -r -s 5" - "${pkgs.hypridle}/bin/hypridle" - ]; - "$mod" = "SUPER"; - bind = [ - "$mod, RETURN, exec, $terminal" - "$mod, Q, killactive" - "$mod&SHIFT, Q, forcekillactive" - "$mod, E, exec, ${pkgs.wofi}/bin/wofi --show run" - "$mod, F, fullscreen, 0" - "$mod&SHIFT, W, movewindow, u" - "$mod&SHIFT, A, movewindow, l" - "$mod&SHIFT, S, movewindow, d" - "$mod&SHIFT, D, movewindow, r" - "$mod, W, movefocus, u" - "$mod, A, movefocus, l" - "$mod, S, movefocus, d" - "$mod, D, movefocus, r" - "$mod, H, moveactive, -25 0" - "$mod, J, moveactive, 0 25" - "$mod, K, moveactive, 0 -25" - "$mod, L, moveactive, 25 0" - "$mod&SHIFT, H, resizeactive, -25 0" - "$mod&SHIFT, J, resizeactive, 0 -25" - "$mod&SHIFT, K, resizeactive, 0 25" - "$mod&SHIFT, L, resizeactive, 25 0" - "$mod, space, togglefloating" - "$mod, G, togglegroup" - "$mod&SHIFT, G, moveoutofgroup" - "$mod&CTRL, W, moveintogroup, u" - "$mod&CTRL, A, moveintogroup, l" - "$mod&CTRL, S, moveintogroup, d" - "$mod&CTRL, D, moveintogroup, r" - "$mod, tab, changegroupactive, f" - "$mod&SHIFT, tab, changegroupactive, b" - "$mod&CTRL, D, movegroupwindow, f" - "$mod&CTRL, A, movegroupwindow, b" - ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+" - ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" - ", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" - ", XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous" - ", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next" - ", Print, exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" -t png - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png" - "$mod&SHIFT, V, exec, ${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.coreutils}/bin/tee \"$(${pkgs.zenity}/bin/zenity --file-selection --save --confirm-overwrite)\"" - ]++ ( - builtins.concatLists ( - builtins.genList (i: - [ - "$mod, code:1${toString i}, workspace, ${toString (i+1)}" - "$mod SHIFT, code:1${toString i}, movetoworkspacesilent, ${toString (i+1)}" - ] - ) - 9 - ) - )++ [ - "$mod, code:19, workspace, 10" - "$mod SHIFT, code:19, movetoworkspacesilent, 10" - ]; - monitor = "eDP-1, 2256x1504, 0x0, 1.333333"; - general = { - gaps_in = 0; - gaps_out = 0; - }; - input = { - accel_profile = "flat"; - sensitivity = 1.0; - }; - #xwayland = { - # force_zero_scaling = true; - #}; - }; - }; - - services = { - hyprpolkitagent.enable = true; - - hypridle = { - enable = true; - }; - }; - - programs.waybar = { - enable = true; - settings = { - mainBar = { - height = 30; - spacing = 4; - "modules-left" = [ - "hyprland/workspaces" - "sway/mode" - "sway/scratchpad" - "custom/media" - ]; - "modules-center" = [ - "sway/window" - ]; - "modules-right" = [ - "mpd" - "pulseaudio" - "network" - "cpu" - "memory" - "temperature" - "backlight" - "keyboard-state" - "sway/language" - "battery" - "clock" - "tray" - ]; - pulseaudio = { - "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"; - }; - network = { - "format-wifi" = "{essid} ({signalStrength}%)"; - "format-ethernet" = "{ipaddr}/{cidr}"; - "tooltip-format" = "{ifname} via {gwaddr}"; - "format-linked" = "{ifname} (No IP)"; - "format-disconnected" = "Disconnected"; - "format-alt" = "{ifname}: {ipaddr}/{cidr}"; - }; - battery = { - states = { - warning = 30; - critical = 15; - }; - format = "{capacity}% {icon}"; - "format-charging" = "{capacity}% "; - "format-plugged" = "{capacity}% "; - "format-alt" = "{time} {icon}"; - "format-icons" = [ - "" - "" - "" - "" - "" - ]; - }; - clock = { - "tooltip-format" = "{:%Y %B}\n{calendar}"; - "format-alt" = "{:%Y-%m-%d}"; - format = "{:%H:%M:%S}"; - interval = 1; - }; - }; - }; - }; + documentation.dev.enable = true; + home-manager.users.${config.cos.username} = { pkgs, ... }: { home.stateVersion = "24.11"; }; diff --git a/cos.nix b/cos.nix new file mode 100644 index 0000000..8df4925 --- /dev/null +++ b/cos.nix @@ -0,0 +1,11 @@ +{ lib, ... }: +{ + options.cos = { + username = lib.mkOption { + type = lib.types.str; + }; + hostName = lib.mkOption { + type = lib.types.str; + }; + }; +} diff --git a/docker-kubernetes.nix b/docker-kubernetes.nix new file mode 100644 index 0000000..ec7a18b --- /dev/null +++ b/docker-kubernetes.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + virtualisation = { + docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + # For kubernetes + containerd = { + enable = true; + }; + }; + + environment.systemPackages = with pkgs; [ + # For pennlabs + kind + kubectl + awscli2 + k9s + ]; + + environment.sessionVariables = { + CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE = 1; + }; +} diff --git a/flake.lock b/flake.lock index c979157..9302f30 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "nixvimFlake": "nixvimFlake" }, "locked": { - "lastModified": 1742749395, - "narHash": "sha256-0NKRMQKQUt/iTOVMrsbbLgGWctfAo0FKchLZ0EEHcFU=", + "lastModified": 1757189331, + "narHash": "sha256-AQXcrJyuR4wUoSQYMZJHa3rcFYv/bUL6w6rk4C7LbEo=", "owner": "clay53", "repo": "cnvim", - "rev": "79327b238f8722683a6fbc02759e40569a358799", + "rev": "17f85dbb8c74f6c24db0da7e25455b39034edd54", "type": "github" }, "original": { @@ -21,42 +21,6 @@ "type": "github" } }, - "devshell": { - "inputs": { - "nixpkgs": [ - "cnvim", - "nixvimFlake", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1735644329, - "narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=", - "owner": "numtide", - "repo": "devshell", - "rev": "f7795ede5b02664b57035b3b757876703e2c3eac", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "flake-compat": { - "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "revCount": 69, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -66,11 +30,11 @@ ] }, "locked": { - "lastModified": 1738453229, - "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "lastModified": 1754487366, + "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18", "type": "github" }, "original": { @@ -99,7 +63,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1731533236, @@ -115,91 +79,18 @@ "type": "github" } }, - "git-hooks": { - "inputs": { - "flake-compat": [ - "cnvim", - "nixvimFlake", - "flake-compat" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "cnvim", - "nixvimFlake", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1737465171, - "narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "cnvim", - "nixvimFlake", - "git-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": [ - "cnvim", - "nixvimFlake", "nixpkgs" ] }, "locked": { - "lastModified": 1738878603, - "narHash": "sha256-fmhq8B3MvQLawLbMO+LWLcdC2ftLMmwSk+P29icJ3tE=", + "lastModified": 1756669196, + "narHash": "sha256-E/l+K8WIjbH5AUv/B17RX1hzx1CsuPaT86g1xDwiYY8=", "owner": "nix-community", "repo": "home-manager", - "rev": "433799271274c9f2ab520a49527ebfe2992dcfbd", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager_2": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1746287478, - "narHash": "sha256-z3HiHR2CNAdwyZTWPM2kkzhE1gD1G6ExPxkaiQfNh7s=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "75268f62525920c4936404a056f37b91e299c97e", + "rev": "b4b5f008d772c0e8e9c420cfa0d240a447747e0a", "type": "github" }, "original": { @@ -224,16 +115,16 @@ ] }, "locked": { - "lastModified": 1729958008, - "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "lastModified": 1754860581, + "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", "owner": "NuschtOS", "repo": "ixx", - "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.0.6", + "ref": "v0.1.1", "repo": "ixx", "type": "github" } @@ -256,35 +147,13 @@ "type": "github" } }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "cnvim", - "nixvimFlake", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1738743987, - "narHash": "sha256-O3bnAfsObto6l2tQOmQlrO6Z2kD6yKwOWfs7pA0CpOc=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "ae406c04577ff9a64087018c79b4fdc02468c87c", - "type": "github" - }, - "original": { - "owner": "lnl7", - "repo": "nix-darwin", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1746232882, - "narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=", + "lastModified": 1756542300, + "narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008", + "rev": "d7600c775f877cd87b4f5a831c28aa94137377aa", "type": "github" }, "original": { @@ -312,25 +181,20 @@ }, "nixvimFlake": { "inputs": { - "devshell": "devshell", - "flake-compat": "flake-compat", "flake-parts": "flake-parts", - "git-hooks": "git-hooks", - "home-manager": "home-manager", - "nix-darwin": "nix-darwin", "nixpkgs": [ "cnvim", "nixpkgs" ], "nuschtosSearch": "nuschtosSearch", - "treefmt-nix": "treefmt-nix" + "systems": "systems_2" }, "locked": { - "lastModified": 1739353096, - "narHash": "sha256-w/T2uYCoq4k6K46GX2CMGWsKfMvcqnxC41LIgnvGifE=", + "lastModified": 1757176284, + "narHash": "sha256-j4SBmYsARwNG0DHljZ1uzZlGqCIU5fzCMA2g+GjD0xw=", "owner": "nix-community", "repo": "nixvim", - "rev": "78b6f8e1e5b37a7789216e17a96ebc117660f0e7", + "rev": "7afdd40b96c9168aa4cb49b86fc67eccd441cae5", "type": "github" }, "original": { @@ -350,11 +214,11 @@ ] }, "locked": { - "lastModified": 1738508923, - "narHash": "sha256-4DaDrQDAIxlWhTjH6h/+xfG05jt3qDZrZE/7zDLQaS4=", + "lastModified": 1755555503, + "narHash": "sha256-WiOO7GUOsJ4/DoMy2IC5InnqRDSo2U11la48vCCIjjY=", "owner": "NuschtOS", "repo": "search", - "rev": "86e2038290859006e05ca7201425ea5b5de4aecb", + "rev": "6f3efef888b92e6520f10eae15b86ff537e1d2ea", "type": "github" }, "original": { @@ -417,7 +281,7 @@ "root": { "inputs": { "cnvim": "cnvim", - "home-manager": "home-manager_2", + "home-manager": "home-manager", "mapnix": "mapnix", "nixpkgs": "nixpkgs", "osm-bikeability": "osm-bikeability", @@ -454,25 +318,18 @@ "type": "github" } }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "cnvim", - "nixvimFlake", - "nixpkgs" - ] - }, + "systems_3": { "locked": { - "lastModified": 1738680491, - "narHash": "sha256-8X7tR3kFGkE7WEF5EXVkt4apgaN85oHZdoTGutCFs6I=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "64dbb922d51a42c0ced6a7668ca008dded61c483", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "numtide", - "repo": "treefmt-nix", + "owner": "nix-systems", + "repo": "default", "type": "github" } } diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 4f118dc..a9c2e21 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -25,11 +25,11 @@ }; fileSystems."/home" = - { device = "/dev/disk/by-uuid/48efcacd-13e3-42fa-8691-0343e3d075b3"; + { device = "/dev/disk/by-uuid/7afa7b67-4486-43a7-b58b-a7548beb4e20"; fsType = "ext4"; }; - boot.initrd.luks.devices."luks-8f683174-f693-4185-a018-bfdbeb80b411".device = "/dev/disk/by-uuid/8f683174-f693-4185-a018-bfdbeb80b411"; + boot.initrd.luks.devices."luks-c705edf8-6321-4956-8780-f6c00a62e77e".device = "/dev/disk/by-uuid/c705edf8-6321-4956-8780-f6c00a62e77e"; swapDevices = [ ]; @@ -42,4 +42,8 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + hardware.graphics = { + enable = true; + }; } diff --git a/hyprland.nix b/hyprland.nix new file mode 100644 index 0000000..d51d88d --- /dev/null +++ b/hyprland.nix @@ -0,0 +1,281 @@ +{config, pkgs, lib, ...}: +let cfg = config.cos.hyprland; in +{ + options.cos.hyprland = { + enable = lib.mkEnableOption "preconfigured Hyprland"; + wallpaper = lib.mkOption { + type = lib.types.str; + }; + }; + + config = lib.mkIf cfg.enable { + programs.hyprland.enable = true; + + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.printing.enable = true; + services.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + services.blueman.enable = lib.mkIf config.hardware.bluetooth.enable true; + + hardware.opentabletdriver.enable = true; + + security = { + rtkit.enable = true; + polkit.enable = true; + }; + + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5 = { + waylandFrontend = true; + addons = with pkgs; [ + fcitx5-gtk + fcitx5-configtool + fcitx5-mozc + ]; + }; + }; + + services.gnome.gnome-keyring.enable = true; + + environment.systemPackages = with pkgs; [ + wl-clipboard + kdePackages.kget + wdisplays + pwvucontrol + pcmanfm + kdePackages.okular + kdePackages.ark + kdePackages.gwenview + yaru-theme + ]; + + home-manager.users.${config.cos.username} = {pkgs, ...}: { + wayland.windowManager.hyprland = { + enable = true; + plugins = [ + #pkgs.hyprlandPlugins.hy3 + ]; + settings = { + env = [ + # Base on https://wiki.hyprland.org/Configuring/Environment-variables/ + "GDK_BACKEND,wayland,x11,*" + "QT_QPA_PLATFORM,wayland;xcb" + "SDL_VIDEODRIVER,wayland" + "CLUTTER_BACKEND,wayland" + "XCURSOR_THEME,Yaru" + "XCURSOR_SIZE,32" + "GDK_SCALE,1.333333" + ]; + "$terminal" = "${pkgs.alacritty}/bin/alacritty"; + "exec-once" = [ + "${pkgs.waybar}/bin/waybar" + "fcitx5 -d" + "hyprpaper" + "hypridle" + "${pkgs.hyprland}/bin/hyprctl setcursor Yaru 24" + "${pkgs.nextcloud-client}/bin/nextcloud" + "hyprlock" + ]; + "$mod" = "SUPER"; + bind = [ + "$mod, RETURN, exec, $terminal" + "$mod, Q, killactive" + "$mod&SHIFT, Q, forcekillactive" + "$mod, E, exec, ${pkgs.wofi}/bin/wofi --show run" + "$mod, F, fullscreen, 3" + "$mod&SHIFT, W, movewindow, u" + "$mod&SHIFT, A, movewindow, l" + "$mod&SHIFT, S, movewindow, d" + "$mod&SHIFT, D, movewindow, r" + "$mod, W, movefocus, u" + "$mod, A, movefocus, l" + "$mod, S, movefocus, d" + "$mod, D, movefocus, r" + "$mod, H, moveactive, -25 0" + "$mod, J, moveactive, 0 25" + "$mod, K, moveactive, 0 -25" + "$mod, L, moveactive, 25 0" + "$mod&SHIFT, H, resizeactive, -25 0" + "$mod&SHIFT, J, resizeactive, 0 -25" + "$mod&SHIFT, K, resizeactive, 0 25" + "$mod&SHIFT, L, resizeactive, 25 0" + "$mod, space, togglefloating" + "$mod, G, togglegroup" + "$mod&SHIFT, G, moveoutofgroup" + "$mod&CTRL, W, moveintogroup, u" + "$mod&CTRL, A, moveintogroup, l" + "$mod&CTRL, S, moveintogroup, d" + "$mod&CTRL, D, moveintogroup, r" + "$mod, tab, changegroupactive, f" + "$mod&SHIFT, tab, changegroupactive, b" + "$mod&CTRL, D, movegroupwindow, f" + "$mod&CTRL, A, movegroupwindow, b" + ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+" + ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" + ", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" + ", XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous" + ", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next" + ", Print, exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" -t png - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png" + "$mod&SHIFT, V, exec, ${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.coreutils}/bin/tee \"$(${pkgs.zenity}/bin/zenity --file-selection --save --confirm-overwrite)\"" + ]++ ( + builtins.concatLists ( + builtins.genList (i: + [ + "$mod, code:1${toString i}, workspace, ${toString (i+1)}" + "$mod SHIFT, code:1${toString i}, movetoworkspacesilent, ${toString (i+1)}" + ] + ) + 9 + ) + )++ [ + "$mod, code:19, workspace, 10" + "$mod SHIFT, code:19, movetoworkspacesilent, 10" + ]; + monitor = "eDP-1, 2256x1504, 0x0, 1.333333"; + general = { + gaps_in = 0; + gaps_out = 0; + }; + input = { + accel_profile = "flat"; + sensitivity = 1.0; + touchpad = { + disable_while_typing = false; + }; + }; + xwayland = { + force_zero_scaling = true; + }; + }; + }; + + services = { + hyprpolkitagent.enable = true; + + hyprpaper = { + enable = true; + settings = { + ipc = true; + preload = [ + cfg.wallpaper + ]; + wallpaper = [ + ",${cfg.wallpaper}" + ]; + }; + }; + + hypridle = { + enable = true; + }; + }; + + programs.hyprlock = { + enable = true; + }; + + programs.waybar = { + enable = true; + settings = { + mainBar = { + height = 30; + spacing = 4; + "modules-left" = [ + "hyprland/workspaces" + "sway/mode" + "sway/scratchpad" + "custom/media" + ]; + "modules-center" = [ + "sway/window" + ]; + "modules-right" = [ + "mpd" + "pulseaudio" + "network" + "cpu" + "memory" + "backlight" + "battery" + "clock" + "tray" + ]; + backlight = { + format = "{percent}% {icon}"; + format-icons = [""]; + tooltip = false; + }; + pulseaudio = { + "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"; + }; + cpu = { + format = "{usage}% "; + }; + memory = { + format = "{used}/{total} GiB"; + tooltip = false; + }; + network = { + "format-wifi" = "{essid} ({signalStrength}%) "; + "format-ethernet" = "{ipaddr}/{cidr} 󰊗"; + "tooltip-format" = "{ifname} via {gwaddr}"; + "format-linked" = "{ifname} (No IP)"; + "format-disconnected" = "Disconnected"; + "format-alt" = "{ifname}: {ipaddr}/{cidr}"; + }; + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon} {time}"; + "format-icons" = [ + "" + "" + "" + "" + "" + ]; + "format-charging" = "{capacity}%  {time}"; + "format-plugged" = "{capacity}%  {time}"; + tooltip = false; + }; + clock = { + "tooltip-format" = "{:%Y %B}\n{calendar}"; + format = "{:%Y-%m-%d %H:%M:%S}"; + interval = 1; + }; + }; + }; + }; + }; + }; +} diff --git a/mainWireguard.nix b/mainWireguard.nix new file mode 100644 index 0000000..d368e48 --- /dev/null +++ b/mainWireguard.nix @@ -0,0 +1,54 @@ +{config, lib, pkgs, ...}: +let + cfg = config.cos.mainWireguard; +in +{ + options.cos.mainWireguard = { + enable = lib.mkEnableOption "enable"; + interface = lib.mkOption { + type = lib.types.str; + default = "wg0"; + }; + ip = lib.mkOption { + type = lib.types.str; + }; + port = lib.mkOption { + type = lib.types.int; + default = 51820; + }; + privateKeyFile = lib.mkOption { + type = lib.types.str; + }; + }; + + config = lib.mkIf cfg.enable { + networking.firewall.interfaces.${cfg.interface}.allowedUDPPorts = [ + cfg.port + ]; + + environment.systemPackages = with pkgs; [ + wireguard-tools + ]; + + networking.wireguard = { + enable = true; + interfaces = { + ${cfg.interface} = { + ips = [ "${cfg.ip}/24" ]; + listenPort = 51820; + + privateKeyFile = cfg.privateKeyFile; + + peers = [ + { + publicKey = "raOzdkhoag+sN2/KXz18F9ncmeTWhdmPJxQJkqsJ7FI="; + allowedIPs = [ "10.100.0.0/24" ]; + endpoint = "50.116.49.95:51820"; + persistentKeepalive = 25; + } + ]; + }; + }; + }; + }; +}