From 096f2ffa9138abe7bf0a02994c6b4bc85bb98b5e Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 11 Sep 2023 21:40:35 +0200 Subject: [PATCH] Introduce colmena config and add shairport-sync host --- config/hosts/audio/configuration.nix | 10 ++++++++++ config/hosts/audio/default.nix | 7 +++++++ config/hosts/audio/shairport-sync.nix | 8 ++++++++ flake.lock | 19 ++++++++++++++++++- flake.nix | 26 +++++++++++++++++++++++++- 5 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 config/hosts/audio/configuration.nix create mode 100644 config/hosts/audio/default.nix create mode 100644 config/hosts/audio/shairport-sync.nix diff --git a/config/hosts/audio/configuration.nix b/config/hosts/audio/configuration.nix new file mode 100644 index 0000000..d32cf74 --- /dev/null +++ b/config/hosts/audio/configuration.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + networking = { + hostName = "audio"; + }; + + sound.enable = true; + + system.stateVersion = "23.05"; +} diff --git a/config/hosts/audio/default.nix b/config/hosts/audio/default.nix new file mode 100644 index 0000000..619f28d --- /dev/null +++ b/config/hosts/audio/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./configuration.nix + ./shairport-sync.nix + ]; +} diff --git a/config/hosts/audio/shairport-sync.nix b/config/hosts/audio/shairport-sync.nix new file mode 100644 index 0000000..f8b1a29 --- /dev/null +++ b/config/hosts/audio/shairport-sync.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + services.shairport-sync = { + enable = true; + openFirewall = true; + arguments = "-vvv -o alsa -- -d plughw:1,0 -r 48000"; + }; +} diff --git a/flake.lock b/flake.lock index f668a24..9acb519 100644 --- a/flake.lock +++ b/flake.lock @@ -52,10 +52,27 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1694183432, + "narHash": "sha256-YyPGNapgZNNj51ylQMw9lAgvxtM2ai1HZVUu3GS8Fng=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "db9208ab987cdeeedf78ad9b4cf3c55f5ebd269b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" } } }, diff --git a/flake.nix b/flake.nix index de95e12..bbea05f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,8 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Add nixos-generators as an input. # See here: https://github.com/nix-community/nixos-generators#using-in-a-flake nixos-generators = { @@ -11,7 +13,29 @@ }; }; - outputs = { nixpkgs, nixos-generators, ... }: { + outputs = { nixpkgs, nixpkgs-unstable, nixos-generators, ... }: { + colmena = { + meta = { + nixpkgs = nixpkgs.legacyPackages."x86_64-linux"; + nodeNixpkgs = { + audio = nixpkgs-unstable.legacyPackages."x86_64-linux"; + }; + }; + + audio = { + deployment = { + targetHost = "audio.z9.ccchh.net"; + targetPort = 22; + targetUser = "chaos"; + }; + imports = [ + ./config/common + ./config/proxmox-vm + ./config/hosts/audio + ]; + }; + }; + packages.x86_64-linux = { proxmox = nixos-generators.nixosGenerate { system = "x86_64-linux";