From 2a79b770054d1cd4699cdaaae8eab83a8ca92006 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 29 Aug 2023 12:15:22 +0530 Subject: repo: update the project structure --- configuration.nix | 4 +-- features/development.nix | 14 ---------- features/kaysshfs.nix | 22 --------------- features/wayland.nix | 72 ------------------------------------------------ features/xdp.nix | 27 ------------------ hardware/cez.nix | 32 --------------------- hardware/kay.nix | 5 ---- hosts/cez.nix | 32 +++++++++++++++++++++ hosts/kay.nix | 5 ++++ modules/dev.nix | 14 ++++++++++ modules/kaysshfs.nix | 20 ++++++++++++++ modules/wayland.nix | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ modules/xdp.nix | 27 ++++++++++++++++++ overlays/dwl-sinan.nix | 4 +-- overlays/wmenu-sinan.nix | 4 +-- 15 files changed, 174 insertions(+), 180 deletions(-) delete mode 100644 features/development.nix delete mode 100644 features/kaysshfs.nix delete mode 100644 features/wayland.nix delete mode 100644 features/xdp.nix delete mode 100644 hardware/cez.nix delete mode 100644 hardware/kay.nix create mode 100644 hosts/cez.nix create mode 100644 hosts/kay.nix create mode 100644 modules/dev.nix create mode 100644 modules/kaysshfs.nix create mode 100644 modules/wayland.nix create mode 100644 modules/xdp.nix diff --git a/configuration.nix b/configuration.nix index 68a6159..9c4febb 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, options, ... }: +{ pkgs, options, ... }: let user = "sinan"; @@ -6,7 +6,7 @@ in { imports = [ ./hardware-configuration.nix # hw scan - ./hardware/cez.nix + ./hosts/cez.nix ]; # boot diff --git a/features/development.nix b/features/development.nix deleted file mode 100644 index 464b2e0..0000000 --- a/features/development.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - nodePackages.bash-language-server - nil - ccls - lua-language-server - man-pages - man-pages-posix - ]; - - documentation.dev.enable = true; -} diff --git a/features/kaysshfs.nix b/features/kaysshfs.nix deleted file mode 100644 index 83cb68e..0000000 --- a/features/kaysshfs.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, pkgs, ... }: - -{ - system.fsPackages = with pkgs; [ - sshfs - ]; - - fileSystems."/mnt/kay" = { - device = "sinansftp@sinanmohd.com:"; - fsType = "sshfs"; - options = [ - "allow_other" # for non-root access - "_netdev" # this is a network fs - "x-systemd.automount" # mount on demand - - # SSH options - "reconnect" # handle connection drops - "ServerAliveInterval=15" # keep connections alive - "IdentityFile=/var/secrets/kaysftp-key" - ]; - }; -} diff --git a/features/wayland.nix b/features/wayland.nix deleted file mode 100644 index 1eb1289..0000000 --- a/features/wayland.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, pkgs, ... }: - -{ - # pkgs - environment.systemPackages = with pkgs; [ - dwl-sinan - zathura - pinentry-gnome - mpv - qemu - OVMFFull - element-desktop - swaylock - swayidle - swaybg - foot - grim - slurp - wl-clipboard - wmenu-sinan - mako - wayland - xdg-utils - imv - libnotify - wob - wlr-randr - tor-browser-bundle-bin - wtype - ]; - - # font - fonts = { - packages = with pkgs; [ - terminus-nerdfont - dm-sans - ]; - enableDefaultPackages = true; - fontconfig = { - hinting.style = "full"; - defaultFonts = { - monospace = [ "Terminess Nerd Font" ]; - serif = [ "DeepMind Sans" ]; - sansSerif = [ "DeepMind Sans" ]; - }; - }; - }; - - # misc - hardware.opengl.enable = true; - - services.dbus.enable = true; - programs = { - xwayland.enable = true; - gnupg.agent = { - enable = true; - pinentryFlavor = "gnome3"; - }; - firefox = { - enable = true; - preferences = { - "media.ffmpeg.vaapi.enabled" = true; - "gfx.webrender.all" = true; - }; - }; - }; - - security = { - polkit.enable = true; - pam.services.swaylock.text = "auth include login"; - }; -} diff --git a/features/xdp.nix b/features/xdp.nix deleted file mode 100644 index 98d97a4..0000000 --- a/features/xdp.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, pkgs, ... }: - -let - # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist - dbus-xdp-environment = pkgs.writeTextFile { - name = "dbus-xdp-environment"; - destination = "/bin/dbus-xdp-environment"; - executable = true; - - text = '' - dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=wlroots - systemctl --user stop pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr - systemctl --user start pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr - ''; - }; -in -{ - # pkgs - environment.systemPackages = [ dbus-xdp-environment ]; - - # xdg desktop portal - xdg.portal = { - enable = true; - wlr.enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - }; -} diff --git a/hardware/cez.nix b/hardware/cez.nix deleted file mode 100644 index dd46c86..0000000 --- a/hardware/cez.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, ... }: - -{ - imports = [ - ../features/wayland.nix - ../features/kaysshfs.nix - ../features/development.nix - ]; - - boot = { - initrd.luks.reusePassphrases = true; - consoleLogLevel = 3; - }; - - networking = { - hostName = "cez"; - dhcpcd.wait = "background"; - wireless.iwd.enable = true; - }; - - sound = { - enable = true; - extraConfig = '' - defaults.pcm.card 1 - defaults.ctl.card 1 - ''; - }; - services.pipewire = { - enable = true; - pulse.enable = true; - }; -} diff --git a/hardware/kay.nix b/hardware/kay.nix deleted file mode 100644 index a79c1fc..0000000 --- a/hardware/kay.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ tmux ]; -} diff --git a/hosts/cez.nix b/hosts/cez.nix new file mode 100644 index 0000000..dfac196 --- /dev/null +++ b/hosts/cez.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + imports = [ + ../modules/wayland.nix + ../modules/kaysshfs.nix + ../modules/dev.nix + ]; + + boot = { + initrd.luks.reusePassphrases = true; + consoleLogLevel = 3; + }; + + networking = { + hostName = "cez"; + dhcpcd.wait = "background"; + wireless.iwd.enable = true; + }; + + sound = { + enable = true; + extraConfig = '' + defaults.pcm.card 1 + defaults.ctl.card 1 + ''; + }; + services.pipewire = { + enable = true; + pulse.enable = true; + }; +} diff --git a/hosts/kay.nix b/hosts/kay.nix new file mode 100644 index 0000000..49a17c0 --- /dev/null +++ b/hosts/kay.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ tmux ]; +} diff --git a/modules/dev.nix b/modules/dev.nix new file mode 100644 index 0000000..75e0967 --- /dev/null +++ b/modules/dev.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + nodePackages.bash-language-server + nil + ccls + lua-language-server + man-pages + man-pages-posix + ]; + + documentation.dev.enable = true; +} diff --git a/modules/kaysshfs.nix b/modules/kaysshfs.nix new file mode 100644 index 0000000..c526927 --- /dev/null +++ b/modules/kaysshfs.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + system.fsPackages = with pkgs; [ sshfs ]; + + fileSystems."/mnt/kay" = { + device = "sinansftp@sinanmohd.com:"; + fsType = "sshfs"; + options = [ + "allow_other" # for non-root access + "_netdev" # this is a network fs + "x-systemd.automount" # mount on demand + + # SSH options + "reconnect" # handle connection drops + "ServerAliveInterval=15" # keep connections alive + "IdentityFile=/var/secrets/kaysftp-key" + ]; + }; +} diff --git a/modules/wayland.nix b/modules/wayland.nix new file mode 100644 index 0000000..65eb0e0 --- /dev/null +++ b/modules/wayland.nix @@ -0,0 +1,72 @@ +{ pkgs, ... }: + +{ + # pkgs + environment.systemPackages = with pkgs; [ + dwl-sinan + zathura + pinentry-gnome + mpv + qemu + OVMFFull + element-desktop + swaylock + swayidle + swaybg + foot + grim + slurp + wl-clipboard + wmenu-sinan + mako + wayland + xdg-utils + imv + libnotify + wob + wlr-randr + tor-browser-bundle-bin + wtype + ]; + + # font + fonts = { + packages = with pkgs; [ + terminus-nerdfont + dm-sans + ]; + enableDefaultPackages = true; + fontconfig = { + hinting.style = "full"; + defaultFonts = { + monospace = [ "Terminess Nerd Font" ]; + serif = [ "DeepMind Sans" ]; + sansSerif = [ "DeepMind Sans" ]; + }; + }; + }; + + # misc + hardware.opengl.enable = true; + + services.dbus.enable = true; + programs = { + xwayland.enable = true; + gnupg.agent = { + enable = true; + pinentryFlavor = "gnome3"; + }; + firefox = { + enable = true; + preferences = { + "media.ffmpeg.vaapi.enabled" = true; + "gfx.webrender.all" = true; + }; + }; + }; + + security = { + polkit.enable = true; + pam.services.swaylock.text = "auth include login"; + }; +} diff --git a/modules/xdp.nix b/modules/xdp.nix new file mode 100644 index 0000000..a7adfa5 --- /dev/null +++ b/modules/xdp.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: + +let + # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist + dbus-xdp-environment = pkgs.writeTextFile { + name = "dbus-xdp-environment"; + destination = "/bin/dbus-xdp-environment"; + executable = true; + + text = '' + dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=wlroots + systemctl --user stop pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr + systemctl --user start pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr + ''; + }; +in +{ + # pkgs + environment.systemPackages = [ dbus-xdp-environment ]; + + # xdg desktop portal + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; +} diff --git a/overlays/dwl-sinan.nix b/overlays/dwl-sinan.nix index ff5c999..b3c39b0 100644 --- a/overlays/dwl-sinan.nix +++ b/overlays/dwl-sinan.nix @@ -1,6 +1,4 @@ -final: prev: - -{ +final: prev: { dwl-sinan = prev.dwl.overrideAttrs (finalAttrs: prevAttrs: { pname = prevAttrs.pname + "-sinan"; diff --git a/overlays/wmenu-sinan.nix b/overlays/wmenu-sinan.nix index c304efb..c525ab9 100644 --- a/overlays/wmenu-sinan.nix +++ b/overlays/wmenu-sinan.nix @@ -1,6 +1,4 @@ -final: prev: - -{ +final: prev: { wmenu-sinan = prev.wmenu.overrideAttrs (finalAttrs: prevAttrs: { pname = prevAttrs.pname + "-sinan"; -- cgit v1.2.3