diff --git a/hosts/extern/default.nix b/hosts/extern/default.nix index 6e236f6..afffadf 100644 --- a/hosts/extern/default.nix +++ b/hosts/extern/default.nix @@ -10,6 +10,8 @@ ../../modules/system ]; + networking.enableB43Firmware = true; + system.wireguard.client.enable = true; networking.wireguard.interfaces.wgc.ips = [ "10.100.0.21/24" ]; diff --git a/hosts/lacros/boot/default.nix b/hosts/lacros/boot/default.nix index a838a6a..cc98a84 100644 --- a/hosts/lacros/boot/default.nix +++ b/hosts/lacros/boot/default.nix @@ -2,38 +2,6 @@ { boot = { kernelPackages = pkgs.linuxPackages_latest; - kernel.sysctl."vm.max_map_count" = 2147483642; - initrd = { - systemd = { - enable = true; - services.root-reset = { - description = "Reset root and snapshot last boot"; - wantedBy = [ "initrd.target" ]; - after = [ "dev-${config.networking.hostName}-root.device" ]; - before = [ "sysroot.mount" ]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = '' - mkdir -p /mnt - mount /dev/${config.networking.hostName}/root /mnt - - if [[ -e /mnt/prev ]]; then - btrfs subvolume delete /mnt/prev - fi - - btrfs subvolume snapshot /mnt/root /mnt/prev - - btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do - btrfs subvolume delete "/mnt/$subvolume" - done - - btrfs subvolume delete /mnt/root - btrfs subvolume create /mnt/root - - umount /mnt - ''; - }; - }; - }; + kernel.sysctl."vm.max_map_count" = 2147483642; }; } diff --git a/hosts/lacros/default.nix b/hosts/lacros/default.nix index 7b20b9d..6e08959 100644 --- a/hosts/lacros/default.nix +++ b/hosts/lacros/default.nix @@ -3,26 +3,10 @@ imports = [ ./boot ./disko + ./filesystems ./hardware - ./wireguard - - # Apps and programs - ../../../modules/system - ../../../modules/system/accounts - ../../../modules/system/desktop - ../../../modules/system/programs - ../../../modules/system/services - - # Devices and hardware - ../../../modules/system/devices - ../../../modules/system/devices/boot/lanzaboote - ../../../modules/system/devices/networking/wireless - ../../../modules/system/devices/networking/firewall/pc - ../../../modules/system/devices/networking/wireguard/pc - - # Extras - ../../../overlays - ../../../variables + ./users + ../../modules/system ]; services.keyd.keyboards.default.settings.main = { @@ -31,5 +15,8 @@ f13 = lib.mkForce "delete"; }; + system.lanzaboote.enable = true; + networking.hostName = "lacros"; + system.stateVersion = "24.11"; } diff --git a/hosts/lacros/disko/default.nix b/hosts/lacros/disko/default.nix index e52c45d..45560d7 100644 --- a/hosts/lacros/disko/default.nix +++ b/hosts/lacros/disko/default.nix @@ -6,25 +6,26 @@ disk = { "${config.networking.hostName}" = { type = "disk"; - device = "/dev/nvme0n1"; + device = "/dev/mmcblk0"; content = { type = "gpt"; partitions = { ESP = { - size = "2G"; + priority = 1; + size = "1500M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "fmask=0022" "dmask=0022" ]; + mountOptions = [ "umask=0077" ]; }; }; luks = { size = "100%"; content = { type = "luks"; - name = "crypt-nvme"; + name = "${config.networking.hostName}-disk"; settings.allowDiscards = true; passwordFile = "/tmp/secret.key"; content = { @@ -50,34 +51,34 @@ subvolumes = { "/root" = { mountpoint = "/"; - mountOptions = [ "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; }; "/prev" = { mountpoint = "/prev"; - mountOptions = [ "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ]; }; "/nix" = { mountpoint = "/nix"; - mountOptions = [ "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; }; # Impermanence "/persist" = { mountpoint = "/persist"; - mountOptions = [ "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; }; "/persist/.snapshots" = { }; "/jimbo" = { mountpoint = "/persist/home/jimbo"; - mountOptions = [ "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; }; "/jimbo/.snapshots" = { }; }; }; }; swap = { - size = "8G"; + size = "1500M"; content = { type = "swap"; discardPolicy = "both"; diff --git a/hosts/lacros/filesystems/default.nix b/hosts/lacros/filesystems/default.nix new file mode 100644 index 0000000..4696462 --- /dev/null +++ b/hosts/lacros/filesystems/default.nix @@ -0,0 +1,11 @@ +{ config, ... }: +{ + fileSystems = { + # Network mounts + "/home/jimbo/JimboNFS" = { + device = "10.100.0.1:/export/JimboNFS"; + fsType = "nfs4"; + options = [ "x-systemd.automount" "noauto" "soft" "_netdev" ]; + }; + }; +} diff --git a/hosts/lacros/hardware/default.nix b/hosts/lacros/hardware/default.nix index 08182c5..8e73a23 100644 --- a/hosts/lacros/hardware/default.nix +++ b/hosts/lacros/hardware/default.nix @@ -1,22 +1,9 @@ -{ config, lib, modulesPath, ... }: +{ config, lib, ... }: { - boot = { - kernelModules = [ "kvm-intel" ]; - initrd = { - availableKernelModules = [ "xhci_pci" "sdhci_pci" ]; - kernelModules = [ "dm-snapshot" ]; - }; - }; - - fileSystems = { - # Remote - "/home/jimbo/JimboNFS" = { - device = "${config.ips.wgSpan}.1:/export/JimboNFS"; - fsType = "nfs4"; - options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ]; - }; - }; + boot.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "sdhci_pci" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/hosts/lacros/id_ed25519.pub b/hosts/lacros/id_ed25519.pub index 1fa6123..e36a85d 100644 --- a/hosts/lacros/id_ed25519.pub +++ b/hosts/lacros/id_ed25519.pub @@ -1 +1 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBk6ALxn+zKrRys6/c1oYSoWJaUUEo3nAM224ElhjJQR +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC2lMkUd+BbXITE5LTg94hEzmA6UKsIIbaf5YOjGoLzl diff --git a/hosts/lacros/users/default.nix b/hosts/lacros/users/default.nix new file mode 100644 index 0000000..a0f4778 --- /dev/null +++ b/hosts/lacros/users/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./jimbo ]; +} diff --git a/hosts/lacros/users/jimbo/default.nix b/hosts/lacros/users/jimbo/default.nix new file mode 100644 index 0000000..d93c068 --- /dev/null +++ b/hosts/lacros/users/jimbo/default.nix @@ -0,0 +1,6 @@ +{ lib, ... }: +{ + home-manager.users.jimbo = { + home.stateVersion = lib.mkForce "24.11"; + }; +} diff --git a/hosts/lacros/wireguard/default.nix b/hosts/lacros/wireguard/default.nix deleted file mode 100644 index 88a6dce..0000000 --- a/hosts/lacros/wireguard/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ lib, config, ... }: -{ - networking = { - firewall = { - allowedUDPPorts = [ 51820 ]; - trustedInterfaces = [ "wgc" ]; - }; - - wireguard.interfaces.wgc = { - ips = [ "${config.ips.wgSpan}.18/24" ]; - listenPort = 51820; - privateKey = config.secrets.wgClientPriv; - peers = [ - { # Cyberspark Server - publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8="; - allowedIPs = [ "10.100.0.0/24" ]; - endpoint = "sv.${config.domains.jim1}:51820"; - persistentKeepalive = 25; - } - ]; - }; - }; -} diff --git a/hosts/tower/boot/default.nix b/hosts/tower/boot/default.nix index 9bb39a2..e9f1ddc 100644 --- a/hosts/tower/boot/default.nix +++ b/hosts/tower/boot/default.nix @@ -35,15 +35,13 @@ in { # Use second GPU on boot specialisation.gputwo.configuration = { boot.kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:2504,10de:228e" ]; + environment.sessionVariables.WLR_RENDERER = lib.mkForce "gles2"; }; # Use Nouveau specialisation.nouveau.configuration.config = { - environment.sessionVariables = { - NIXOS_OZONE_WL = lib.mkForce "0"; - WLR_RENDERER = lib.mkForce "vulkan"; - }; system.video.nvidia.enable = lib.mkForce false; system.video.nouveau.enable = lib.mkForce true; + environment.sessionVariables.NIXOS_OZONE_WL = lib.mkForce "0"; }; } diff --git a/modules/home/programs/terminal/zsh/default.nix b/modules/home/programs/terminal/zsh/default.nix index 17c18ea..7144d30 100644 --- a/modules/home/programs/terminal/zsh/default.nix +++ b/modules/home/programs/terminal/zsh/default.nix @@ -9,30 +9,6 @@ theme = "agnoster"; plugins = [ "git" ]; }; - shellAliases = { - # NixOS - flakedate = "doas nix flake update --flake /etc/nixos"; - nhs = "doas nh os switch -R /etc/nixos"; - nhu = "flakedate && nhs"; - ns = "nix-shell -p"; - - nixclean = "doas nix-store --gc; nix-collect-garbage -d"; - nixpurge = "doas nix-collect-garbage --delete-old"; - nixoptimize = "doas nix store optimise"; - nixscrub = "nixclean; nixpurge; nixoptimize"; - - # Shortcuts - ff = "clear && fastfetch"; - ip = "ip -c"; - ls = "${pkgs.eza}/bin/eza -a --color=always --group-directories-first --icons"; - cat = "${pkgs.bat}/bin/bat --paging never"; - copycat = "wl-copy <"; - myip = "curl ifconfig.co"; - seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; - - # Deny - rm = ''echo "Use trash."; false''; - }; initExtra = '' ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin; pfetch source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh diff --git a/modules/home/settings/aliases/default.nix b/modules/home/settings/aliases/default.nix new file mode 100644 index 0000000..e251b01 --- /dev/null +++ b/modules/home/settings/aliases/default.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + home.shellAliases = { + # NixOS + flakedate = "doas nix flake update --flake /etc/nixos"; + nhs = "doas nh os switch -R /etc/nixos"; + nhu = "flakedate && nhs"; + ns = "nix-shell -p"; + + nixclean = "doas nix-store --gc; nix-collect-garbage -d"; + nixpurge = "doas nix-collect-garbage --delete-old"; + nixoptimize = "doas nix store optimise"; + nixscrub = "nixclean; nixpurge; nixoptimize"; + + # Shortcuts + ff = "clear && fastfetch"; + ip = "ip -c"; + ls = "${pkgs.eza}/bin/eza -a --color=always --group-directories-first --icons"; + cat = "${pkgs.bat}/bin/bat --paging never"; + copycat = "wl-copy <"; + myip = "curl ifconfig.co"; + seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; + + # Deny + rm = ''echo "Use trash."; false''; + }; +} diff --git a/modules/home/settings/cursor/default.nix b/modules/home/settings/cursor/default.nix index 1920cbb..e730036 100644 --- a/modules/home/settings/cursor/default.nix +++ b/modules/home/settings/cursor/default.nix @@ -2,6 +2,7 @@ { home.pointerCursor = { gtk.enable = true; + x11.enable = true; name = "Simp1e-Dark"; package = pkgs.simp1e-cursors; size = 24; diff --git a/modules/home/settings/default.nix b/modules/home/settings/default.nix index 91ac0a4..839720c 100644 --- a/modules/home/settings/default.nix +++ b/modules/home/settings/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./aliases ./cursor ./dconf ./fonts diff --git a/modules/home/user/default.nix b/modules/home/user/default.nix index ceae3d9..72b52d8 100644 --- a/modules/home/user/default.nix +++ b/modules/home/user/default.nix @@ -9,8 +9,8 @@ LIBVIRT_DEFAULT_URI = "qemu:///system"; HISTCONTROL = "ignoreboth"; QT_QPA_PLATFORMTHEME = "gtk3"; + XDG_SCREENSHOTS_DIR = "$XDG_PICTURES_DIR/Screenshots"; NIXPKGS_ALLOW_UNFREE = 1; - NIXOS_OZONE_WL = 1; }; }; } diff --git a/modules/home/wms/programs/default.nix b/modules/home/wms/programs/default.nix index 51d4e42..1c48ab5 100644 --- a/modules/home/wms/programs/default.nix +++ b/modules/home/wms/programs/default.nix @@ -1,8 +1,10 @@ { pkgs, ... }: { imports = [ + ./grimedit ./hyprpaper ./mako + ./swappy ./swaylock ./waybar ./wlpicker @@ -10,11 +12,8 @@ home.packages = with pkgs; [ clipman - hyprpicker libnotify - grimblast wl-clipboard wdisplays - jq ]; } diff --git a/modules/home/wms/programs/grimedit/default.nix b/modules/home/wms/programs/grimedit/default.nix new file mode 100644 index 0000000..b98da64 --- /dev/null +++ b/modules/home/wms/programs/grimedit/default.nix @@ -0,0 +1,34 @@ +{ pkgs, config, ... }: +{ + home.packages = with pkgs; [ + (pkgs.writeScriptBin "grimedit" '' + # Freeze the screen using hyprpicker + ${pkgs.hyprpicker}/bin/hyprpicker -r -z & + HYPRPICKER_PID=$! + sleep 0.1 + + # Select area + GEOM=$(${pkgs.slurp}/bin/slurp -w 3 -c ${config.look.colors.prime} -B 00000066 -b 00000099) + + # Check selection is canceled + if [ -z "$GEOM" ]; then + kill $HYPRPICKER_PID 2>/dev/null + notify-send -t 3000 -a grimblast "Error" "No area selected." + exit 1 + fi + + # Define screenshot destination + FILE="''${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots/$(date -Ins).png" + + # Save and edit screenshot + grim -g "$GEOM" "$FILE" + swappy -f $FILE & + + # Notify user that the screenshot is saved + notify-send -a grim "Screenshot" "Area saved to $FILE" -i "$FILE" + + # Kill picker after selection + kill %1 2>/dev/null + '') + ]; +} diff --git a/modules/home/wms/programs/swappy/default.nix b/modules/home/wms/programs/swappy/default.nix new file mode 100644 index 0000000..e343544 --- /dev/null +++ b/modules/home/wms/programs/swappy/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +{ + home = { + packages = with pkgs; [ swappy ]; + file.".config/swappy/config".text = '' + [Default] + early_exit=true + save_dir=$HOME/Pictures/Screenshots + ''; + }; +} diff --git a/modules/home/wms/programs/waybar/default.nix b/modules/home/wms/programs/waybar/default.nix index 4fa8827..26e93da 100644 --- a/modules/home/wms/programs/waybar/default.nix +++ b/modules/home/wms/programs/waybar/default.nix @@ -136,11 +136,10 @@ gamemodeModule = { format = "{glyph}"; - glyph = "󰖺"; hide-not-running = true; use-icon = true; icon-size = 19; - icon-spacing = 3; + icon-spacing = 0; tooltip = true; }; diff --git a/modules/home/wms/sway/hotkeys/default.nix b/modules/home/wms/sway/hotkeys/default.nix index 9b00543..4079521 100644 --- a/modules/home/wms/sway/hotkeys/default.nix +++ b/modules/home/wms/sway/hotkeys/default.nix @@ -60,7 +60,7 @@ "${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a''; # Screenshots - "${secMod}+f" = ''exec shot-sway --swappy''; + "${secMod}+f" = ''exec grimedit''; "${secMod}+Shift+f" = ''exec shot-sway --screen''; # Display and keyboard brightness diff --git a/modules/home/wms/sway/outputs/default.nix b/modules/home/wms/sway/outputs/default.nix index b8baf34..2d9ea2b 100644 --- a/modules/home/wms/sway/outputs/default.nix +++ b/modules/home/wms/sway/outputs/default.nix @@ -47,7 +47,7 @@ pos = "3840 405"; mode = "1920x1080@143.980Hz"; max_render_time = "3"; - adaptive_sync = "on"; + allow_tearing = "yes"; }; ${config.displays.d2} = { pos = "1920 405"; diff --git a/modules/home/wms/sway/rules/default.nix b/modules/home/wms/sway/rules/default.nix index 36f961e..4696387 100644 --- a/modules/home/wms/sway/rules/default.nix +++ b/modules/home/wms/sway/rules/default.nix @@ -30,10 +30,6 @@ criteria = { con_mark = "giveborder"; }; command = ''border pixel ${config.look.border.string}''; } - { - criteria = { app_id = "com.github.wwmm.easyeffects"; }; - command = ''mark giveborder''; - } { criteria = { class = "steam"; }; command = ''mark giveborder''; @@ -50,12 +46,6 @@ criteria = { window_role = "pop-up"; }; command = ''mark giveborder''; } - - # Misc - { - criteria = { title = "^GlobalShot"; }; - command = ''floating enable, fullscreen enable global''; - } ]; }; assigns = { diff --git a/modules/system/devices/networking/wireless/default.nix b/modules/system/devices/networking/wireless/default.nix index 73f9d76..63c1201 100644 --- a/modules/system/devices/networking/wireless/default.nix +++ b/modules/system/devices/networking/wireless/default.nix @@ -6,10 +6,7 @@ }; config = lib.mkIf config.system.wireless.enable { - networking = { - wireless.iwd.enable = true; - enableB43Firmware = true; - }; + networking.wireless.iwd.enable = true; environment = { systemPackages = with pkgs; [ impala ]; diff --git a/modules/system/programs/desktops/default.nix b/modules/system/programs/desktops/default.nix index 77701b1..ad4fbdf 100644 --- a/modules/system/programs/desktops/default.nix +++ b/modules/system/programs/desktops/default.nix @@ -7,6 +7,11 @@ xwayland.enable = lib.mkForce true; }; + environment.sessionVariables = { + WLR_RENDERER = "vulkan"; + NIXOS_OZONE_WL = "1"; + }; + services.dbus.enable = config.system.desktop.enable; security.pam.services.swaylock = {}; } diff --git a/modules/system/services/general/keyd/default.nix b/modules/system/services/general/keyd/default.nix index f3c707f..96f440f 100644 --- a/modules/system/services/general/keyd/default.nix +++ b/modules/system/services/general/keyd/default.nix @@ -10,10 +10,6 @@ leftcontrol = "overload(ctrlmod,noop)"; esc = "`"; rightcontrol = "esc"; - left = "noop"; - down = "noop"; - up = "noop"; - right = "noop"; }; ctrlmod = {