diff --git a/flake.lock b/flake.lock index 429fc4f..02945b8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,7 +1,125 @@ { "nodes": { + "chaotic": { + "inputs": { + "flake-schemas": "flake-schemas", + "home-manager": "home-manager", + "jovian": "jovian", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1761548673, + "narHash": "sha256-/513FfwpfbeppPdGDbmLhgcctLqEHdx8Rs92jImKA3M=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "25ef687b6a0a13e9d39c3949e7de05873f5571a9", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761513701, + "narHash": "sha256-w7qOcQb1FSMZASvWe01r99QqZ5LnHO0k3rgs5ryyig0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "255b6a0ef2f488a2fad051361699cc67db57338c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761376732, + "narHash": "sha256-wavx9gROyuRZKSvPCCBh78gOur7o88ndRi545njNRrM=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "8bef482d65425d0cff6b20c11a5f054f85569a38", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "chaotic", + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { - "flake": false, + "locked": { + "lastModified": 1761373498, + "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1761512058, "narHash": "sha256-FYDC/VM/Tu7bJ9uwxmZqIhkz7QblCcp65+LMb4StGTY=", @@ -19,7 +137,29 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "chaotic": "chaotic", + "nixpkgs": "nixpkgs_2" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761446259, + "narHash": "sha256-JNNOtIIVIX+yBIsh1rq1Nxhc1LZq168vuQB5sqrZbCY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "95098bb4d55ebe167c082fc40705a73ef76b58e4", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 13f3467..ce3da36 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,12 @@ description = "config!!!"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/42060c40fd43c114af7010980168f8dcba734d3b"; - inputs.nixpkgs.flake = false; + inputs.chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; outputs = flakeInputs: let - lib = import "${flakeInputs.nixpkgs}/lib"; + lib = flakeInputs.nixpkgs.lib; tlib = import ./lib lib; l = lib; diff --git a/hosts/chernobog/default.nix b/hosts/chernobog/default.nix index 3d9f40c..01f797e 100644 --- a/hosts/chernobog/default.nix +++ b/hosts/chernobog/default.nix @@ -45,15 +45,6 @@ ]; }; - services.pipewire = { - enable = true; - audio.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - fonts = { enableDefaultPackages = true; packages = with pkgs; [ diff --git a/hosts/chernobog/modules/ananicy.nix b/hosts/chernobog/modules/ananicy.nix new file mode 100644 index 0000000..23850d0 --- /dev/null +++ b/hosts/chernobog/modules/ananicy.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + services.ananicy = { + enable = true; + package = pkgs.ananicy-cpp; + rulesProvider = pkgs.ananicy-rules-cachyos_git; + }; +} diff --git a/hosts/chernobog/modules/audio.nix b/hosts/chernobog/modules/audio.nix new file mode 100644 index 0000000..6a14959 --- /dev/null +++ b/hosts/chernobog/modules/audio.nix @@ -0,0 +1,53 @@ +{ pkgs, ... }: +let + rate = 48000; + quant = 256; + quantRateMax = "${toString quant}/${toString rate}"; + quantRateMin = "${toString (quant / 2)}/${toString rate}"; +in +{ + imports = [ ../../../modules/audio/desktop-audio.nix ]; + + environment.systemPackages = with pkgs; [ + helvum + pwvucontrol + ]; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + audio.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + services.pipewire.extraConfig.pipewire."92-low-latency" = { + "context.properties" = { + "default.clock.rate" = rate; + "default.clock.quantum" = quant; + "default.clock.min-quantum" = quant / 2; + "default.clock.max-quantum" = quant; + }; + }; + + services.pipewire.extraConfig.pipewire-pulse."92-low-latency" = { + context.modules = [ + { + name = "libpipewire-module-protocol-pulse"; + args = { + pulse.min.req = quantRateMin; + pulse.default.req = quantRateMax; + pulse.max.req = quantRateMax; + pulse.min.quantum = quantRateMin; + pulse.max.quantum = quantRateMax; + }; + } + ]; + stream.properties = { + node.latency = quantRateMax; + resample.quality = 1; + }; + }; +} diff --git a/hosts/chernobog/modules/kernel.nix b/hosts/chernobog/modules/kernel.nix new file mode 100644 index 0000000..a859048 --- /dev/null +++ b/hosts/chernobog/modules/kernel.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + boot.kernelPackages = pkgs.linuxPackages_cachyos-lto; +} diff --git a/hosts/default.nix b/hosts/default.nix index e84b185..b5ea117 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -11,8 +11,13 @@ let inherit lib; system = null; modules = [ + # set.inputs.nixpkgs.nixosModules.readOnlyPkgs { networking.hostName = name; } - { nixpkgs.pkgs = set.pkgs; } + { + nixpkgs.pkgs = set.pkgs; + chaotic.nyx.overlay.enable = false; + } + set.inputs.chaotic.nixosModules.default (import (./. + "/${name}/default.nix")) ]; specialArgs = { diff --git a/hosts/dzwonek/modules/tailscale.nix b/hosts/dzwonek/modules/tailscale.nix index 2573b4d..1547462 100644 --- a/hosts/dzwonek/modules/tailscale.nix +++ b/hosts/dzwonek/modules/tailscale.nix @@ -4,4 +4,9 @@ # age.secrets.tailscaleAuthKey.file = ../../../secrets/tailscaleAuthKey.age; # services.tailscale.authKeyFile = config.age.secrets.tailscaleAuthKey.path; + + services.tailscale = { + extraSetFlags = [ "--advertise-exit-node" ]; + useRoutingFeatures = "both"; + }; } diff --git a/hosts/wolumonde/modules/tailscale.nix b/hosts/wolumonde/modules/tailscale.nix index 361fbb4..fac61bc 100644 --- a/hosts/wolumonde/modules/tailscale.nix +++ b/hosts/wolumonde/modules/tailscale.nix @@ -4,6 +4,10 @@ # age.secrets.tailscaleAuthKey.file = ../../../secrets/tailscaleAuthKey.age; # services.tailscale.authKeyFile = config.age.secrets.tailscaleAuthKey.path; + services.tailscale = { + extraSetFlags = [ "--advertise-exit-node" ]; + useRoutingFeatures = "both"; + }; networking.firewall.public.tailscale.allowedUDPPorts = [ config.services.tailscale.port diff --git a/modules/audio/desktop-audio.nix b/modules/audio/desktop-audio.nix new file mode 100644 index 0000000..7dd7357 --- /dev/null +++ b/modules/audio/desktop-audio.nix @@ -0,0 +1,18 @@ +{ + services.pipewire.extraConfig.pipewire = { + "10-virtual-sink" = { + "context.objects" = [ + { + factory = "adapter"; + args = { + "factory.name" = "support.null-audio-sink"; + "node.name" = "virtual_sink"; + "node.description" = "Virtual Sink for Recording"; + "media.class" = "Audio/Sink"; + "audio.position" = "FL,FR"; + }; + } + ]; + }; + }; +} diff --git a/modules/network/tailscale.nix b/modules/network/tailscale.nix index 5af761e..dc68f12 100644 --- a/modules/network/tailscale.nix +++ b/modules/network/tailscale.nix @@ -3,10 +3,8 @@ services.tailscale = { enable = true; port = 41641; - extraSetFlags = [ "--advertise-exit-node" ]; # extraUpFlags = [ "--ssh" ]; extraDaemonFlags = [ "--no-logs-no-support" ]; - useRoutingFeatures = "both"; openFirewall = true; }; diff --git a/pkgs-set/default.nix b/pkgs-set/default.nix index 039dfc1..5f10987 100644 --- a/pkgs-set/default.nix +++ b/pkgs-set/default.nix @@ -22,20 +22,19 @@ let ; }; inputs = (l.mapAttrs (_: inp: inp // { __toString = s: toString s.src; }) _inputs) // flakeInputs; - pkgs = _pkgs.appendOverlays ( - l.flatten ( - l.mapAttrsToList ( - name: _: - if name != "disabled" then - let - o = import "${./overlays}/${name}"; - in - if (l.functionArgs o) ? inputs then o { inherit inputs; } else o - else - [ ] - ) (l.readDir ./overlays) - ) + overlays = l.flatten ( + l.mapAttrsToList ( + name: _: + if name != "disabled" then + let + o = import "${./overlays}/${name}"; + in + if (l.functionArgs o) ? inputs then o { inherit inputs; } else o + else + [ ] + ) (l.readDir ./overlays) ); + pkgs = _pkgs.appendOverlays (overlays ++ [ flakeInputs.chaotic.overlays.cache-friendly ]); terraPkgs = pkgs.lib.makeScope pkgs.newScope ( self: l.genAttrs (l.map (l.removeSuffix ".nix") (l.attrNames (l.readDir ./pkgs))) ( diff --git a/users/modules/discord/default.nix b/users/modules/discord/default.nix index 9c18924..a59b4f7 100644 --- a/users/modules/discord/default.nix +++ b/users/modules/discord/default.nix @@ -2,16 +2,50 @@ pkgs, terra, inputs, + lib, ... }: +let + pkg = pkgs.discord.override { + withMoonlight = true; + inherit (terra) moonlight; + withOpenASAR = true; + withTTS = false; + }; +in { # imports = ["${inputs.moonlight}/nix/home-manager.nix"]; home.packages = [ - (pkgs.discord.override { - withMoonlight = true; - inherit (terra) moonlight; - withOpenASAR = true; + (pkgs.symlinkJoin { + name = "discord"; + paths = [ pkg ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/discord \ + --add-flags "--proxy-server=socks5://127.0.0.1:1337" + wrapProgram $out/bin/Discord \ + --add-flags "--proxy-server=socks5://127.0.0.1:1337" + ''; }) ]; + + systemd.user.services.discord-socks-proxy = { + Unit = { + Description = "SSH SOCKS5 proxy for Discord"; + After = [ "network-online.target" ]; + Wants = [ "network-online.target" ]; + }; + + Service = { + Type = "simple"; + ExecStart = "${pkgs.openssh}/bin/ssh -N -D 127.0.0.1:1337 root@wolumonde"; + Restart = "on-failure"; + RestartSec = "3s"; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; } diff --git a/users/modules/rofi/default.nix b/users/modules/rofi/default.nix index f507a6a..b176fa2 100644 --- a/users/modules/rofi/default.nix +++ b/users/modules/rofi/default.nix @@ -3,8 +3,5 @@ stylix.targets.rofi.enable = true; programs.rofi = { enable = true; - package = pkgs.rofi.overrideAttrs (old: rec { - buildInputs = builtins.filter (x: x.pname != "gdk-pixbuf") old.buildInputs; - }); }; } diff --git a/users/modules/sway/default.nix b/users/modules/sway/default.nix index 44a9497..faf7cfb 100644 --- a/users/modules/sway/default.nix +++ b/users/modules/sway/default.nix @@ -10,9 +10,10 @@ imports = [ ../wayland ../swaylock + ../swayidle ../wlsunset ../mako - ../rofi + ../tofi # ./swayidle.nix ]; @@ -20,9 +21,6 @@ wayland.windowManager = { sway = let - mkRofiCmd = - args: - "${config.programs.rofi.package}/bin/rofi ${lib.concatStringsSep " " args} | ${pkgs.sway}/bin/swaymsg --"; inherit (tlib) pkgBin; in { @@ -35,10 +33,7 @@ border = 0; titlebar = false; }; - menu = mkRofiCmd [ - "-show" - "drun" - ]; + menu = "${config.programs.tofi.package}/bin/tofi-drun"; modifier = "Mod4"; terminal = config.settings.terminal.binary; startup = [ @@ -61,7 +56,7 @@ shotFile = config.home.homeDirectory + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; shotDir = config.home.homeDirectory + "/shots"; in - { + lib.mkOptionDefault { "${mod}+d" = "exec ${config.wayland.windowManager.sway.config.menu}"; "${mod}+Return" = "exec ${config.wayland.windowManager.sway.config.terminal}"; "${mod}+Escape" = "exec ${wlogout} -p layer-shell"; @@ -77,10 +72,11 @@ exec export SFILE="${shotFile}.png" && mkdir -p ${shotDir} && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png ''; # record screen - "Mod1+r" = ''exec mkdir -p ${shotDir} && ${wf-recorder} -x yuv420p -f "${shotFile}.mp4"''; + "Mod1+r" = + ''exec mkdir -p ${shotDir} && ${wf-recorder} --audio-backend=pipewire --audio=alsa_output.pci-0000_09_00.4.pro-output-0.monitor -f "${shotFile}.mp4"''; # record an area "Mod1+Shift+r" = - ''exec mkdir -p ${shotDir} && ${wf-recorder} -x yuv420p -g "$(${slurp})" -f "${shotFile}.mp4"''; + ''exec mkdir -p ${shotDir} && ${wf-recorder} --audio-backend=pipewire --audio=alsa_output.pci-0000_09_00.4.pro-output-0.monitor -g "$(${slurp})" -f "${shotFile}.mp4"''; # stop recording "Mod1+c" = "exec pkill -INT wf-recorder"; "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; diff --git a/users/modules/swayidle/default.nix b/users/modules/swayidle/default.nix new file mode 100644 index 0000000..3663e56 --- /dev/null +++ b/users/modules/swayidle/default.nix @@ -0,0 +1,45 @@ +{ pkgs, ... }: +{ + services.swayidle = + let + # Lock command + lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; + display = status: "swaymsg 'output * power ${status}'"; + in + { + enable = true; + timeouts = [ + { + timeout = 60; + command = display "off"; + resumeCommand = display "on"; + } + { + timeout = 60 * 5; + command = lock; + } + { + timeout = 60 * 10; + command = "${pkgs.systemd}/bin/systemctl suspend"; + } + ]; + events = [ + { + event = "before-sleep"; + command = (display "off") + "; " + lock; + } + { + event = "after-resume"; + command = display "on"; + } + { + event = "lock"; + command = (display "off") + "; " + lock; + } + { + event = "unlock"; + command = display "on"; + } + ]; + }; +} diff --git a/users/modules/tofi/default.nix b/users/modules/tofi/default.nix new file mode 100644 index 0000000..de06126 --- /dev/null +++ b/users/modules/tofi/default.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: +{ + stylix.targets.tofi.enable = true; + programs.tofi = { + enable = true; + settings = { + outline-width = 0; + border-width = 0; + width = "48%"; + height = "20%"; + num-results = 7; + font = lib.mkForce "${config.stylix.fonts.serif.package}/share/fonts/truetype/ComicRelief.ttf"; + hint-font = false; + ascii-input = true; + drun-launch = true; + }; + }; +}