summaryrefslogtreecommitdiff
path: root/modules/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos')
-rw-r--r--modules/nixos/bluetooth.nix12
-rw-r--r--modules/nixos/default.nix11
-rw-r--r--modules/nixos/environment.nix18
-rw-r--r--modules/nixos/hyprland.nix3
-rw-r--r--modules/nixos/kde-connect.nix7
-rw-r--r--modules/nixos/nix-common.nix19
-rw-r--r--modules/nixos/services.nix50
-rw-r--r--modules/nixos/steam.nix7
-rw-r--r--modules/nixos/sway.nix40
-rw-r--r--modules/nixos/system-packages.nix78
10 files changed, 245 insertions, 0 deletions
diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix
new file mode 100644
index 0000000..36e8f8f
--- /dev/null
+++ b/modules/nixos/bluetooth.nix
@@ -0,0 +1,12 @@
+{ config, pkgs, lib, ... }: {
+
+ hardware.bluetooth = {
+ enable = true;
+ # config = "
+ # [General]
+ # Enable=Source,Sink,Media,Socket
+ # ";
+ };
+
+ services.blueman.enable = true;
+}
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
new file mode 100644
index 0000000..a6d62e3
--- /dev/null
+++ b/modules/nixos/default.nix
@@ -0,0 +1,11 @@
+{
+ bluetooth = import ./bluetooth.nix;
+ environment = import ./environment.nix;
+ hyprland = import ./hyprland.nix;
+ kde-connect = import ./kde-connect.nix;
+ nix-common = import ./nix-common.nix;
+ services = import ./services.nix;
+ steam = import ./steam.nix;
+ sway = import ./sway.nix;
+ system-packages = import ./system-packages.nix;
+}
diff --git a/modules/nixos/environment.nix b/modules/nixos/environment.nix
new file mode 100644
index 0000000..225ddda
--- /dev/null
+++ b/modules/nixos/environment.nix
@@ -0,0 +1,18 @@
+{ config, lib, ... }: {
+ environment = {
+ # include user channels in NIX_PATH
+ # shellInit = ''export NIXPATH="/nix/var/nix/profiles/per-user/$USER/channels:nixos-config=/etc/nixos/machines/zenbook/configuration.nix"'';
+ # List packages installed in system profile. To search, run:
+ # $ nix search wget
+ sessionVariables = {
+ NIXOS_OZONE_WL = "1";
+ };
+ variables = {
+ # PATH = "/home/defin/.local/share/gem/ruby/3.0.0/bin:";
+ # PAGER = "sh -c 'col -bx | bat -f'";
+ MANPAGER = "sh -c 'col -bx | bat -l man -p'";
+ EDITOR = "hx";
+ ZEIT_DB = "/home/defin/Documents/zeit";
+ };
+ };
+}
diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix
new file mode 100644
index 0000000..c754eae
--- /dev/null
+++ b/modules/nixos/hyprland.nix
@@ -0,0 +1,3 @@
+{ config, lib, ...}: {
+ programs.hyprland.enable = true;
+} \ No newline at end of file
diff --git a/modules/nixos/kde-connect.nix b/modules/nixos/kde-connect.nix
new file mode 100644
index 0000000..3705c44
--- /dev/null
+++ b/modules/nixos/kde-connect.nix
@@ -0,0 +1,7 @@
+{ config, lib, ... }: {
+ networking.firewall = {
+ allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
+ allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];
+ };
+ programs.kdeconnect.enable = true;
+}
diff --git a/modules/nixos/nix-common.nix b/modules/nixos/nix-common.nix
new file mode 100644
index 0000000..6e4d373
--- /dev/null
+++ b/modules/nixos/nix-common.nix
@@ -0,0 +1,19 @@
+{ config, pkgs, ... }: {
+
+ nix = {
+ settings = {
+ allowed-users = [ "@wheel" "@builders" "@video" ];
+ experimental-features = [ "nix-command" "flakes" ];
+ };
+
+ # Clean up old generations after 30 days
+ gc = {
+ automatic = true;
+ dates = "weekly";
+ options = "--delete-older-than 30d";
+ };
+
+ # Users allowed to run nix
+ # allowedUsers = [ "root" ];
+ };
+}
diff --git a/modules/nixos/services.nix b/modules/nixos/services.nix
new file mode 100644
index 0000000..336d132
--- /dev/null
+++ b/modules/nixos/services.nix
@@ -0,0 +1,50 @@
+{ config, pkgs, ... }:
+{
+ services = {
+ pipewire = {
+ enable = true;
+ alsa.enable = true;
+ pulse.enable = true;
+ };
+ spotifyd.enable = true;
+
+ #FOR: sway
+ dbus.enable = true;
+
+ #FROM: configuration.nix
+ # localtimed.enable = true;
+ xserver = {
+ # Enable the X11 windowing system.
+ enable = true;
+
+ # Enable touchpad support (enabled default in most desktopManager).
+ libinput.enable = true;
+
+ # Configure keymap in X11
+ # layout = "us";
+ # xkbOptions = "eurosign:e,caps:escape";
+
+ # Enable the Plasma 5 Desktop Environment.
+ desktopManager.plasma5.enable = true;
+ displayManager = {
+ sddm.enable = true;
+ defaultSession = "plasmawayland";
+ };
+ };
+
+ # Enable CUPS to print documents.
+ printing = {
+ enable = true;
+ drivers = with pkgs; [ epson-escpr gutenprint ];
+ };
+ avahi = {
+ enable = true;
+ nssmdns = true;
+ # for a WiFi printer
+ openFirewall = true;
+ };
+
+ # Enable the OpenSSH daemon.
+ # openssh.enable = true;
+ };
+}
diff --git a/modules/nixos/steam.nix b/modules/nixos/steam.nix
new file mode 100644
index 0000000..91c5b67
--- /dev/null
+++ b/modules/nixos/steam.nix
@@ -0,0 +1,7 @@
+{ config, ... }: {
+ programs.steam = {
+ enable = true;
+ remotePlay.openFirewall = true;
+ # dedicatedServer.openfirewall = true;
+ };
+}
diff --git a/modules/nixos/sway.nix b/modules/nixos/sway.nix
new file mode 100644
index 0000000..8d4d664
--- /dev/null
+++ b/modules/nixos/sway.nix
@@ -0,0 +1,40 @@
+{ config, pkgs, lib, ... }:
+{
+ environment.systemPackages = with pkgs; [
+ ];
+
+ # xdg-desktop-portal works by exposing a series of D-Bus interfaces
+ # known as portals under a well-known name
+ # (org.freedesktop.portal.Desktop) and object path
+ # (/org/freedesktop/portal/desktop).
+ # The portal interfaces include APIs for file access, opening URIs,
+ # printing and others.
+ xdg.portal = {
+ enable = true;
+ wlr.enable = true;
+ # gtk portal needed to make gtk apps happy
+ extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
+ };
+
+ # enable sway window manager
+ programs.sway = {
+ enable = true;
+ wrapperFeatures.gtk = true;
+ };
+
+ # kanshi systemd service
+ systemd.user.services.kanshi = {
+ description = "kanshi daemon";
+ serviceConfig = {
+ Type = "simple";
+ ExecStart = ''${pkgs.kanshi}/bin/kanshi -c kanshi_config_file'';
+ };
+ };
+
+ security.pam.services.swaylock.text = ''
+ # PAM configuration file for the swaylock screen locker. By default, it includes
+ # the 'login' configuration file (see /etc/pam.d/login)
+ auth include login
+ '';
+}
+
diff --git a/modules/nixos/system-packages.nix b/modules/nixos/system-packages.nix
new file mode 100644
index 0000000..1ffa540
--- /dev/null
+++ b/modules/nixos/system-packages.nix
@@ -0,0 +1,78 @@
+{ pkgs, ...}:
+let
+
+ # bash script to let dbus know about important env variables and
+ # propagate them to relevent services run at the end of sway config
+ # see
+ # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
+ # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
+ # some user services to make sure they have the correct environment variables
+ dbus-sway-environment = pkgs.writeTextFile {
+ name = "dbus-sway-environment";
+ destination = "/bin/dbus-sway-environment";
+ executable = true;
+
+ text = ''
+ dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
+ systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
+ systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
+ '';
+ };
+
+ # currently, there is some friction between sway and gtk:
+ # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
+ # the suggested way to set gtk settings is with gsettings
+ # for gsettings to work, we need to tell it where the schemas are
+ # using the XDG_DATA_DIR environment variable
+ # run at the end of sway config
+ configure-gtk = pkgs.writeTextFile {
+ name = "configure-gtk";
+ destination = "/bin/configure-gtk";
+ executable = true;
+ text = let
+ schema = pkgs.gsettings-desktop-schemas;
+ datadir = "${schema}/share/gsettings-schemas/${schema.name}";
+ in ''
+ export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
+ gnome_schema=org.gnome.desktop.interface
+ gsettings set $gnome_schema gtk-theme 'Dracula'
+ '';
+ };
+
+in
+
+{
+ programs.partition-manager.enable = true;
+ environment.systemPackages = with pkgs; [
+ #For root
+ nushell
+ bat
+ helix
+ wget
+ unzip
+ git
+ wl-clipboard
+ pciutils
+ #For hyprland
+ waybar
+ #For sway
+ alacritty # gpu accelerated terminal
+ dbus-sway-environment
+ configure-gtk
+ wayland
+ waybar
+ xdg-utils # for opening default programs when clicking links
+ glib # gsettings
+ dracula-theme # gtk theme
+ gnome3.adwaita-icon-theme # default gnome cursors
+ swaylock
+ swayidle
+ grim # screenshot functionality
+ slurp # screenshot functionality
+ bemenu # wayland clone of dmenu
+ mako # notification system developed by swaywm maintainer
+ wdisplays # tool to configure displays
+ wofi
+ (writeShellScriptBin "rofi" "exec -a $0 ${wofi}/bin/wofi $@") #Lets qutebrowser select passwords
+ ];
+}