diff --git a/common/base-graphical/default.nix b/common/base-graphical/default.nix index 40542ce..f651ce0 100644 --- a/common/base-graphical/default.nix +++ b/common/base-graphical/default.nix @@ -14,5 +14,11 @@ in config = mkIf cfg.enable { services.xserver.enable = true; + services.libinput.enable = true; + services.printing.enable = true; + + fonts.packages = with pkgs; [ + corefonts + ]; }; } diff --git a/common/environment.nix b/common/environment.nix index 433a2a9..122e2f5 100644 --- a/common/environment.nix +++ b/common/environment.nix @@ -16,6 +16,7 @@ # used for nix config colmena agenix + rc2nix ]; environment.wordlist.enable = true; diff --git a/flake.lock b/flake.lock index afd4ee1..3ecf0fb 100644 --- a/flake.lock +++ b/flake.lock @@ -112,13 +112,37 @@ "type": "github" } }, + "plasma-manager": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1725914634, + "narHash": "sha256-U74hu15xSb6JNySMOwyJrsh4uk1DVa182bdHLeHdYMc=", + "owner": "nix-community", + "repo": "plasma-manager", + "rev": "60becd0e994e25b372c8d0500fc944396f6c1085", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "plasma-manager", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "birdsong": "birdsong", "home-manager": "home-manager_2", "nixpkgs": "nixpkgs", - "nur": "nur" + "nur": "nur", + "plasma-manager": "plasma-manager" } }, "systems": { diff --git a/flake.nix b/flake.nix index 3e5ffdb..a5348a3 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,12 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + plasma-manager = { + url = "github:nix-community/plasma-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + nur.url = "github:nix-community/NUR"; agenix = { @@ -20,7 +26,7 @@ birdsong.url = "git+https://git.qenya.tel/qenya/birdsong?ref=main"; }; - outputs = inputs@{ self, nixpkgs, home-manager, nur, agenix, birdsong, ... }: { + outputs = inputs@{ self, nixpkgs, home-manager, plasma-manager, nur, agenix, birdsong, ... }: { colmena = { meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; @@ -38,12 +44,14 @@ nixpkgs.config.packageOverrides = pkgs: { agenix = inputs.agenix.packages.${config.nixpkgs.hostPlatform.system}.default; + rc2nix = inputs.plasma-manager.packages.${config.nixpkgs.hostPlatform.system}.rc2nix; }; nixpkgs.overlays = [ inputs.nur.overlay ]; home-manager = { useUserPackages = true; useGlobalPkgs = true; + sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; }; imports = [ diff --git a/home/qenya/default.nix b/home/qenya/default.nix index 4923dcb..14e552b 100644 --- a/home/qenya/default.nix +++ b/home/qenya/default.nix @@ -1,6 +1,7 @@ { imports = [ ./dconf + ./plasma ./cli.nix ./firefox.nix ./git.nix diff --git a/home/qenya/firefox.nix b/home/qenya/firefox.nix index ebfd2ca..8e4d3bb 100644 --- a/home/qenya/firefox.nix +++ b/home/qenya/firefox.nix @@ -45,6 +45,10 @@ "dom.private-attribution.submission.enabled" = false; # disable "Privacy-Preserving Attribution for Advertising" "extensions.autoDisableScopes" = 0; # automatically enable extensions installed through nix + + # external password manager + "signon.rememberSignons" = false; + "extensions.formautofill.creditCards.enabled" = false; }; }; }; diff --git a/home/qenya/plasma/default.nix b/home/qenya/plasma/default.nix new file mode 100644 index 0000000..f35d05c --- /dev/null +++ b/home/qenya/plasma/default.nix @@ -0,0 +1,11 @@ +{ config, lib, pkgs, osConfig, ... }: + +let + isPlasma = osConfig.services.desktopManager.plasma6.enable || osConfig.services.xserver.desktopManager.plasma5.enable; +in +{ + programs.plasma.enable = isPlasma; + programs.plasma.overrideConfig = true; + + imports = [ ]; +} diff --git a/hosts/kilgharrah/default.nix b/hosts/kilgharrah/default.nix index b4e969f..4418b4a 100644 --- a/hosts/kilgharrah/default.nix +++ b/hosts/kilgharrah/default.nix @@ -24,7 +24,7 @@ console.keyMap = "uk"; services.xserver.xkb.layout = "gb"; - services.printing.enable = true; + qenya.services.pipewire.lowLatency.enable = true; age.secrets.user-password-kilgharrah-qenya.file = ../../secrets/user-password-kilgharrah-qenya.age; users.users.qenya.hashedPasswordFile = config.age.secrets.user-password-kilgharrah-qenya.path; diff --git a/hosts/tohru/default.nix b/hosts/tohru/default.nix index eab9a11..53fb544 100644 --- a/hosts/tohru/default.nix +++ b/hosts/tohru/default.nix @@ -25,8 +25,6 @@ console.keyMap = "uk"; services.xserver.xkb.layout = "gb"; - services.printing.enable = true; - age.secrets.user-password-tohru-qenya.file = ../../secrets/user-password-tohru-qenya.age; users.users.qenya.hashedPasswordFile = config.age.secrets.user-password-tohru-qenya.path; users.users.qenya.extraGroups = [ @@ -38,7 +36,6 @@ programs.evolution.enable = true; # not in home-manager yet; not declaratively configurable yet programs.steam.enable = true; - qenya.services.fonts.enable = true; system.stateVersion = "23.11"; } diff --git a/services/default.nix b/services/default.nix index d9c3ff2..fddd93c 100644 --- a/services/default.nix +++ b/services/default.nix @@ -1,6 +1,6 @@ { imports = [ - ./fonts.nix ./forgejo.nix + ./pipewire-low-latency.nix ]; } \ No newline at end of file diff --git a/services/fonts.nix b/services/fonts.nix deleted file mode 100644 index dcd9d1b..0000000 --- a/services/fonts.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.qenya.services.fonts; -in -{ - options.qenya.services.fonts = { - enable = mkEnableOption "Fonts"; - }; - - config = mkIf cfg.enable { - fonts.packages = with pkgs; [ - corefonts - ]; - }; -} diff --git a/services/pipewire-low-latency.nix b/services/pipewire-low-latency.nix new file mode 100644 index 0000000..0ba2709 --- /dev/null +++ b/services/pipewire-low-latency.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkIf mkEnableOption; + cfg = config.qenya.services.pipewire.lowLatency; +in +{ + options.qenya.services.pipewire.lowLatency = { + enable = mkEnableOption "config to decrease sound latency (increasing CPU load) for e.g. streaming"; + # TODO: might be an idea to have the numbers be configurable + }; + + config = mkIf cfg.enable { + # TODO: needs more testing + services.pipewire.extraConfig = { + pipewire."92-low-latency" = { + context.properties = { + default.clock.rate = 48000; + default.clock.quantum = 32; + default.clock.min-quantum = 32; + default.clock.max-quantum = 32; + }; + }; + pipewire-pulse."92-low-latency" = { + context.modules = [ + { + name = "libpipewire-module-protocol-pulse"; + args = { + pulse.min.req = "32/48000"; + pulse.default.req = "32/48000"; + pulse.max.req = "32/48000"; + pulse.min.quantum = "32/48000"; + pulse.max.quantum = "32/48000"; + }; + } + ]; + stream.properties = { + node.latency = "32/48000"; + resample.quality = 1; + }; + }; + }; + # Available from NixOS 24.11. Lifted from https://nixos.wiki/wiki/PipeWire - probably need to adjust numbers + # services.pipewire.wireplumber.extraLuaConfig.main."99-alsa-lowlatency" = '' + # alsa_monitor.rules = { + # { + # matches = {{{ "node.name", "matches", "alsa_output.*" }}}; + # apply_properties = { + # ["audio.format"] = "S32LE", + # ["audio.rate"] = "96000", -- for USB soundcards it should be twice your desired rate + # ["api.alsa.period-size"] = 2, -- defaults to 1024, tweak by trial-and-error + # -- ["api.alsa.disable-batch"] = true, -- generally, USB soundcards use the batch mode + # }, + # }, + # } + # ''; + }; +}