From 8cf0c7c1604701dd8dc1a8d7f627c565173374eb Mon Sep 17 00:00:00 2001 From: xZecora <111700bh@gmail.com> Date: Wed, 15 Jul 2026 19:00:18 -0400 Subject: [PATCH] audio/dinit: init --- audio/dinit/README.md | 18 ++++++++++++++++++ audio/dinit/audio.nix | 40 ++++++++++++++++++++++++++++++++++++++++ audio/dinit/flake.nix | 30 ++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 audio/dinit/README.md create mode 100644 audio/dinit/audio.nix create mode 100644 audio/dinit/flake.nix diff --git a/audio/dinit/README.md b/audio/dinit/README.md new file mode 100644 index 0000000..51e131d --- /dev/null +++ b/audio/dinit/README.md @@ -0,0 +1,18 @@ +# A `turnstiled` and `dinit` based pipewire configuration + +This example shows what is needed to get a user level service running pipewire +that launches at user log in and exits at user log out. + +_**NOTE:**_ This guide assumes that the user already has `hjem` configured. +Initial `hjem` configuration is outside the scope of this example. + +[`audio.nix`](./audio.nix) is a module that can be changed to use the correct +username dropped into your configuration and imported however you import +configuration modules, provided you've imported the correct modules however you +do so. + +[`flake.nix`](./flake.nix) is an example flake (that can't be a drop in for your +system) which shows the repo's that need to be used as inputs as well as the +modules to import as well as how to import them if you use flakes. If you use +methods other than flakes, feel free to contribute a configuration for your +preferred method. diff --git a/audio/dinit/audio.nix b/audio/dinit/audio.nix new file mode 100644 index 0000000..7826a54 --- /dev/null +++ b/audio/dinit/audio.nix @@ -0,0 +1,40 @@ +{ + lib, + config, + ... +}: +{ + services.turnstile = { + enable = true; + settings.manage_rundir = "yes"; + }; + + programs = { + pipewire = { + enable = true; + alsa.enable = true; + }; + wireplumber.enable = true; + }; + + hjem.users..dinit.services = { + pipewire = { + type = "process"; + command = "${lib.getExe' config.programs.pipewire.package "pipewire"}"; + restart = true; + depends-ms = [ "login.target" ]; + }; + pipewire-pulse = { + type = "process"; + command = "${lib.getExe' config.programs.pipewire.package "pipewire-pulse"}"; + restart = true; + prepared-by = [ "pipewire" ]; + }; + wireplumber = { + type = "process"; + command = "${lib.getExe' config.programs.wireplumber.package "wireplumber"}"; + restart = true; + prepared-by = [ "pipewire-pulse" ]; + }; + }; +} diff --git a/audio/dinit/flake.nix b/audio/dinit/flake.nix new file mode 100644 index 0000000..ec015f0 --- /dev/null +++ b/audio/dinit/flake.nix @@ -0,0 +1,30 @@ +{ + description = "A partial flake example for audio configuration. Do not use for system"; + + inputs = { + finix.url = "github:finix-community/finix"; + community.url = "github:xzecora/community-modules/dinit-turnstiled"; + }; + + outputs = + { + self, + finix, + community, + ... + }: + { + nixosConfigurations.finix = finix.lib.finixSystem { + modules = [ + finix.nixosModules.pipewire + finix.nixosModules.wireplumber + { + hjem.extraModules = [ + community.hjemModules.dinit + ]; + } + community.nixosModules.turnstile + ]; + }; + }; +}