From 58dcc86ca8c125dbeed437f5945e99fc95e140ca Mon Sep 17 00:00:00 2001 From: Jurn Wubben Date: Thu, 27 Mar 2025 01:15:02 +0100 Subject: [PATCH] Added somcli. Updated whole lot of stuff. Added game binds to hyprland (stlil have to add steam). Added minimal nixos config. Combined pipewire sink. Todo list. Beginning of server config --- flake.lock | 107 ++++++++++++++++++++++- flake.nix | 1 + home/programs/games.nix | 12 +++ home/programs/nixcord.nix | 8 +- home/shell/other.nix | 28 +++--- home/shell/yazi.nix | 4 +- home/wayland/hyprland/binds.nix | 23 ++++- home/wayland/hyprland/settings.nix | 7 ++ hosts/default.nix | 11 ++- hosts/laptop/virt.nix | 5 +- hosts/minimal/default.nix | 14 +++ hosts/minimal/hardware-configuration.nix | 32 +++++++ system/core/boot.nix | 9 +- system/programs/games.nix | 3 + system/server/caddy.nix | 3 + system/server/default.nix | 4 + system/services/pipewire.nix | 34 +++++++ todo.txt | 1 + 18 files changed, 280 insertions(+), 26 deletions(-) create mode 100644 hosts/minimal/default.nix create mode 100644 hosts/minimal/hardware-configuration.nix create mode 100644 system/server/caddy.nix create mode 100644 system/server/default.nix create mode 100644 todo.txt diff --git a/flake.lock b/flake.lock index 1b1e20f..38744d4 100644 --- a/flake.lock +++ b/flake.lock @@ -189,6 +189,24 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { "inputs": { "systems": [ "stylix", @@ -347,6 +365,24 @@ "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1739824009, + "narHash": "sha256-fcNrCMUWVLMG3gKC5M9CBqVOAnJtyRvGPxptQFl5mVg=", + "owner": "nix-community", + "repo": "naersk", + "rev": "e5130d37369bfa600144c2424270c96f0ef0e11d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "nil": { "inputs": { "flake-utils": [ @@ -470,6 +506,35 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 1741516043, + "narHash": "sha256-Hv0S630U4GVZBM1Q+NCEwyN5ct7cic+8r6qLIaUaVqI=", + "path": "/nix/store/5nkj4k35df77lwjwvbs6hmpkqhpc5x0c-source", + "rev": "8adda98a4e637d0d8a867f19ace5ed6680ecc94a", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1742707865, + "narHash": "sha256-RVQQZy38O3Zb8yoRJhuFgWo/iDIDj0hEdRTVfhOtzRk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dd613136ee91f67e5dba3f3f41ac99ae89c5406b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1740367490, "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", @@ -557,6 +622,7 @@ "nixcord": "nixcord", "nixpkgs": "nixpkgs_3", "nvf": "nvf", + "somcli": "somcli", "stylix": "stylix" } }, @@ -582,6 +648,26 @@ "type": "github" } }, + "somcli": { + "inputs": { + "flake-utils": "flake-utils_2", + "naersk": "naersk", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1743031501, + "narHash": "sha256-LF4J5P+tDhEv3els7PIBa+2+peSeURNzx4I1MwCHWy8=", + "owner": "jsw08", + "repo": "somcli", + "rev": "aa84a75691e3098000e7b885b966d7af1e81318f", + "type": "github" + }, + "original": { + "owner": "jsw08", + "repo": "somcli", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -590,13 +676,13 @@ "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_6", "nur": "nur", - "systems": "systems_4", + "systems": "systems_5", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", @@ -676,6 +762,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index a129299..4ca194a 100644 --- a/flake.nix +++ b/flake.nix @@ -45,5 +45,6 @@ }; nixcord.url = "github:kaylorben/nixcord"; + somcli.url = "github:jsw08/somcli"; }; } diff --git a/home/programs/games.nix b/home/programs/games.nix index 66ba85c..d57229f 100644 --- a/home/programs/games.nix +++ b/home/programs/games.nix @@ -8,5 +8,17 @@ home.packages = lib.mkIf osConfig.niksos.games [ pkgs.dolphin-emu pkgs.suyu + + # ( + # pkgs.appimageTools.wrapType1 rec { + # pname = "nx-optimizer"; + # version = "3.0.1"; + # + # src = pkgs.fetchurl { + # url = "https://github.com/MaxLastBreath/TOTK-mods/releases/download/manager-3.0.1/NX.Optimizer.3.0.1.AppImage"; + # hash = "sha256-2InXpoLm4bfuj0FYRXruRxggBA/E6XiJFeuNbyAMk5s="; + # }; + # } + # ) ]; } diff --git a/home/programs/nixcord.nix b/home/programs/nixcord.nix index 9d994ec..f7e630e 100644 --- a/home/programs/nixcord.nix +++ b/home/programs/nixcord.nix @@ -1,8 +1,12 @@ -{inputs, ...}: { +{ + inputs, + osConfig, + ... +}: { imports = [inputs.nixcord.homeManagerModules.nixcord]; programs.nixcord = { - enable = true; + enable = osConfig.niksos.neovim; discord.enable = false; vesktop.enable = true; diff --git a/home/shell/other.nix b/home/shell/other.nix index 9000fb7..e288c97 100644 --- a/home/shell/other.nix +++ b/home/shell/other.nix @@ -1,11 +1,19 @@ -{pkgs, ...}: { - home.packages = [ - pkgs.gh - pkgs.ripgrep - - pkgs.ear2ctl # FIXME: only when bluetooth enabled - pkgs.bluetui - - pkgs.typst #FIXME: move to flake shell - ]; +{ + pkgs, + lib, + osConfig, + inputs, + ... +}: { + home.packages = + [ + pkgs.gh + pkgs.ripgrep + ] + ++ lib.optionals osConfig.niksos.desktop [ + inputs.somcli.defaultPackage.${pkgs.system} + ] + ++ lib.optionals osConfig.niksos.bluetooth [ + pkgs.ear2ctl + ]; } diff --git a/home/shell/yazi.nix b/home/shell/yazi.nix index 2ae4438..15a37b5 100644 --- a/home/shell/yazi.nix +++ b/home/shell/yazi.nix @@ -1,3 +1,5 @@ { - programs.yazi.enable = true; + programs.yazi = { + enable = true; + }; } diff --git a/home/wayland/hyprland/binds.nix b/home/wayland/hyprland/binds.nix index 728e6d3..6328310 100644 --- a/home/wayland/hyprland/binds.nix +++ b/home/wayland/hyprland/binds.nix @@ -3,6 +3,7 @@ osConfig, lib, pkgs, + inputs, ... }: let inherit (lib) getExe; @@ -20,7 +21,7 @@ termapp = termapp: "${foot} '${termapp}'"; termappE = termappE: termapp (getExe termappE); - foot = appE pkgs.foot; + foot = appE config.programs.foot.package; fuzzel = appE config.programs.fuzzel.package; firefox = appE config.programs.firefox.package; playerctl = appE pkgs.playerctl; @@ -33,6 +34,16 @@ bluetui = termappE pkgs.bluetui; nmtui = termapp "${pkgs.networkmanager}/bin/nmtui"; + somcli = let + interactiveSom = pkgs.writeShellScriptBin "somcli" '' + ${getExe inputs.somcli.defaultPackage.${pkgs.system}} && sleep 5 + ''; + termSom = pkgs.writeShellScriptBin "somfoot" '' + ${foot} -a "foot-somcli" ${getExe interactiveSom} + ''; + in + appE termSom; + # toggle = program: let # prog = builtins.substring 0 14 program; # in "pkill ${prog} || ${uwsm} app -- ${program}"; @@ -77,6 +88,7 @@ in { "$mod, Return, exec, ${foot}" "$mod Shift, Return, exec, ${firefox}" "$mod, Escape, exec, ${hyprlock}" + "$mod Shift, S, exec, ${somcli}" "$mod, A, exec, ${pulsemixer}" "$mod, B, exec, ${bluetui}" @@ -98,7 +110,14 @@ in { "$mod SHIFT, k, movewindow, u" "$mod SHIFT, j, movewindow, d" ] - ++ workspaces; + ++ workspaces + ++ lib.optionals osConfig.niksos.games (let + suyu = "${appE pkgs.suyu} -ql"; + dolphin = appE pkgs.dolphin-emu; + in [ + "Super, s, exec, ${suyu}" + "Super, d, exec, ${dolphin}" + ]); bindl = [ # media controls diff --git a/home/wayland/hyprland/settings.nix b/home/wayland/hyprland/settings.nix index dfdcb4c..396c799 100644 --- a/home/wayland/hyprland/settings.nix +++ b/home/wayland/hyprland/settings.nix @@ -1,5 +1,9 @@ { wayland.windowManager.hyprland.settings = { + xwayland = { + force_zero_scaling = true; + }; + general = { gaps_in = 5; gaps_out = 5; @@ -86,7 +90,10 @@ }; windowrulev2 = [ + # FIXME: change to `windowrule` after hyprland update. "float, class:com.github.phase1geo.annotator" + "float, class:foot-somcli" + "size >30% >30%, class:foot-somcli" ]; }; } diff --git a/hosts/default.nix b/hosts/default.nix index 58832fd..6f9b6e0 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -16,6 +16,7 @@ in { flake = let systems = [ "laptop" + "minimal" ]; in { # Systems @@ -45,10 +46,16 @@ in { modules ++ [ { + boot.plymouth.enable = false; + services.fwupd.enable = false; networking.hostName = "vm"; - nixpkgs.hostPlatform = pkgs.system; - boot.plymouth.enable = lib.mkForce false; + niksos = { + desktop = true; + neovim = true; + }; + + nixpkgs.hostPlatform = pkgs.system; } ]; }; diff --git a/hosts/laptop/virt.nix b/hosts/laptop/virt.nix index fef0c84..cc9eaf0 100644 --- a/hosts/laptop/virt.nix +++ b/hosts/laptop/virt.nix @@ -1,9 +1,8 @@ { programs.virt-manager.enable = true; - users.groups.libvirtd.members = ["jsw"]; - virtualisation.libvirtd.enable = true; - virtualisation.spiceUSBRedirection.enable = true; + + virtualisation.podman.enable = true; } diff --git a/hosts/minimal/default.nix b/hosts/minimal/default.nix new file mode 100644 index 0000000..d26559f --- /dev/null +++ b/hosts/minimal/default.nix @@ -0,0 +1,14 @@ +{ + imports = [ + ./hardware-configuration.nix + ]; + + boot.plymouth.enable = false; + services.fwupd.enable = false; + + # Other stuff that's enabled by default because i'll use it but it's still bloat is (note that this list shares a lot of resources): + # - graphics drivers (~1.8gb) + # - networkmanager (~1.25gb) + # - polkit (~1.25gb) + # - other stuff.. total: 4.68gb +} diff --git a/hosts/minimal/hardware-configuration.nix b/hosts/minimal/hardware-configuration.nix new file mode 100644 index 0000000..9860c2d --- /dev/null +++ b/hosts/minimal/hardware-configuration.nix @@ -0,0 +1,32 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [(modulesPath + "/profiles/qemu-guest.nix")]; + + boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "virtio_scsi" "usbhid"]; + + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + options = ["noatime" "discard" "compress=zstd"]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + }; + + swapDevices = []; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/system/core/boot.nix b/system/core/boot.nix index 94d56fe..0222ac6 100644 --- a/system/core/boot.nix +++ b/system/core/boot.nix @@ -1,8 +1,11 @@ { pkgs, config, + lib, ... -}: { +}: let + plymouth = config.boot.plymouth.enable; +in { boot = { bootspec.enable = true; @@ -15,7 +18,7 @@ kernelPackages = pkgs.linuxPackages_latest; consoleLogLevel = 3; - kernelParams = [ + kernelParams = lib.mkIf plymouth [ "quiet" "systemd.show_status=auto" "rd.udev.log_level=3" @@ -30,6 +33,6 @@ timeout = 0; }; - plymouth.enable = true; + plymouth.enable = lib.mkDefault true; }; } diff --git a/system/programs/games.nix b/system/programs/games.nix index 1a97134..d8a0f4a 100644 --- a/system/programs/games.nix +++ b/system/programs/games.nix @@ -60,5 +60,8 @@ gamescopeSession.enable = true; }; }; + environment.variables = { + "STEAM_FORCE_DESKTOP_UI_SCALING" = "1.5"; + }; }; } diff --git a/system/server/caddy.nix b/system/server/caddy.nix new file mode 100644 index 0000000..16ea214 --- /dev/null +++ b/system/server/caddy.nix @@ -0,0 +1,3 @@ +{config, ...}: { + niksos.server.enable = config.niksos.server.enable; +} diff --git a/system/server/default.nix b/system/server/default.nix new file mode 100644 index 0000000..747b76a --- /dev/null +++ b/system/server/default.nix @@ -0,0 +1,4 @@ +{lib, ...}: { + imports = [./caddy.nix]; + options.niksos.server.enable = lib.mKEnableOption "server servcies (such as caddy)."; +} diff --git a/system/services/pipewire.nix b/system/services/pipewire.nix index 7450c98..4d4f59d 100644 --- a/system/services/pipewire.nix +++ b/system/services/pipewire.nix @@ -5,12 +5,46 @@ ... }: { config = lib.mkIf config.niksos.desktop { + security.rtkit.enable = true; + services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; jack.enable = true; pulse.enable = true; + + extraConfig.pipewire = { + "10-combined-sink" = { + "context.modules" = [ + { + name = "libpipewire-module-combine-stream"; + args = { + "combine.mode" = "sink"; + "node.name" = "combined_sink"; + "node.description" = "All audio outputs combined."; + "combine.latency-compensate" = false; + "combine.props" = { + "audio.position" = ["FL" "FR"]; + }; + "stream.props" = {}; + "stream.rules" = [ + { + matches = [ + { + "media.class" = "Audio/Sink"; + } + ]; + actions = { + create-stream = {}; + }; + } + ]; + }; + } + ]; + }; + }; }; environment.systemPackages = [pkgs.pulsemixer]; diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..006afaf --- /dev/null +++ b/todo.txt @@ -0,0 +1 @@ +Import modules at flake instead of per file