zenix: add musnix and mpd

This commit is contained in:
tristan 2024-11-19 20:40:58 +00:00
parent 2202ebef0b
commit 53f5a52ceb
8 changed files with 124 additions and 84 deletions

45
flake.lock generated
View file

@ -427,6 +427,24 @@
"type": "github"
}
},
"musnix": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1730699102,
"narHash": "sha256-xkplzGzjywMPOpfTOw5oXbwuH4X14VfXEa3m10aHqrY=",
"owner": "musnix",
"repo": "musnix",
"rev": "3feabdc65fb3466f07f306fa5f4e9c43234186e6",
"type": "github"
},
"original": {
"owner": "musnix",
"repo": "musnix",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -451,7 +469,7 @@
"nixos-cosmic": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable",
"rust-overlay": "rust-overlay"
},
@ -549,6 +567,22 @@
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1730200266,
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1729665710,
"narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=",
@ -564,7 +598,7 @@
"type": "github"
}
},
"nixpkgs_4": {
"nixpkgs_5": {
"locked": {
"lastModified": 1729265718,
"narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=",
@ -580,7 +614,7 @@
"type": "github"
}
},
"nixpkgs_5": {
"nixpkgs_6": {
"locked": {
"lastModified": 1725194671,
"narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=",
@ -651,6 +685,7 @@
"inputs": {
"hm-cosmic": "hm-cosmic",
"home-manager": "home-manager_2",
"musnix": "musnix",
"nixos-cosmic": "nixos-cosmic",
"nixpkgs": [
"nixos-cosmic",
@ -685,7 +720,7 @@
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_4",
"nixpkgs": "nixpkgs_5",
"nixpkgs-stable": "nixpkgs-stable_3"
},
"locked": {
@ -712,7 +747,7 @@
"flake-utils": "flake-utils_2",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_4",
"nixpkgs": "nixpkgs_5",
"nixpkgs": "nixpkgs_6",
"systems": "systems_2",
"tinted-foot": "tinted-foot",
"tinted-kitty": "tinted-kitty",

View file

@ -2,6 +2,7 @@
description = "A flake using my config";
inputs = {
# nixpkgs.url = "nixpkgs/nixos-unstable";
musnix.url = "github:musnix/musnix";
nixpkgs.follows = "nixos-cosmic/nixpkgs";
nixpkgs-stable.url = "nixpkgs/nixos-24.05";
home-manager = {
@ -38,9 +39,12 @@
./nixos/programs/cosmic.nix
./nixos/programs/gamer.nix
./nixos/programs/personal.nix
./nixos/services/musnix.nix
./nixos/workstation.nix
./nixos/programs/hyprland.nix
];
home-modules = [
./home/programs/mpd.nix
./home/programs/graphical.nix
./home/programs/gamer.nix
./home/programs/personal/.

View file

@ -23,7 +23,7 @@ in {
xdg.portal = {
enable = true;
configPackages = [pkgs.hyprland];
extraPortals = [pkgs.xdg-desktop-portal-gtk];
extraPortals = [pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr];
};
services.hypridle = {

View file

@ -1,77 +0,0 @@
{
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.roles.mpd;
terminal = config.programs.terminal;
termcmd = "${terminal}/bin/${terminal.pname}";
in {
options.roles.mpd = {
enable = mkEnableOption "setup mpd client";
host = mkOption {default = "192.168.1.2";};
};
config = mkIf cfg.enable {
programs.ncmpcpp = {
enable = true;
settings.mpd_host = cfg.host;
bindings = [
{
key = "j";
command = "scroll_down";
}
{
key = "k";
command = "scroll_up";
}
{
key = "l";
command = "next_column";
}
{
key = "h";
command = "previous_column";
}
{
key = "J";
command = ["select_item" "scroll_down"];
}
{
key = "K";
command = ["select_item" "scroll_up"];
}
];
};
services.mpd-mpris = {
enable = true;
mpd.host = cfg.host;
};
programs.waybar.settings.mainBar.mpd.server = cfg.host;
programs.scripts = [
{
name = "ncmpcpp";
text = ''
${termcmd} -e ${pkgs.ncmpcpp}/bin/ncmpcpp
'';
hotkeys = [{key = "M";}];
install = false;
}
];
systemd.user.services = {
snapclient = {
Unit = {
Description = "Snapclient";
};
Service = {
ExecStart = "${pkgs.snapcast}/bin/snapclient -h ${cfg.host}";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
};
}

70
home/programs/mpd.nix Normal file
View file

@ -0,0 +1,70 @@
{
lib,
pkgs,
config,
...
}:
let
terminal = config.programs.terminal;
termcmd = "${terminal}/bin/${terminal.pname}";
host = "alpine";
in {
programs.ncmpcpp = {
enable = true;
settings.mpd_host = host;
bindings = [
{
key = "j";
command = "scroll_down";
}
{
key = "k";
command = "scroll_up";
}
{
key = "l";
command = "next_column";
}
{
key = "h";
command = "previous_column";
}
{
key = "J";
command = ["select_item" "scroll_down"];
}
{
key = "K";
command = ["select_item" "scroll_up"];
}
];
};
services.mpd-mpris = {
enable = true;
mpd.host = host;
};
programs.waybar.settings.mainBar.mpd.server = host;
programs.scripts = [
{
name = "ncmpcpp";
text = ''
${termcmd} -e ${pkgs.ncmpcpp}/bin/ncmpcpp
'';
hotkeys = [{key = "M";}];
install = false;
}
];
systemd.user.services = {
snapclient = {
Unit = {
Description = "Snapclient";
};
Service = {
ExecStart = "${pkgs.snapcast}/bin/snapclient -h ${host}";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
}

View file

@ -1,6 +1,9 @@
{pkgs, ...}: {
programs.mpv = {
enable = true;
config = {
keep-open = true;
};
bindings = {
l = "seek 5";
h = "seek -5";

View file

@ -17,7 +17,7 @@
};
in
nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs stable-pkgs;};
specialArgs = {inherit inputs stable-pkgs user userFullname;};
inherit system;

View file

@ -0,0 +1,5 @@
{ inputs, user, ... }: {
imports = [inputs.musnix.nixosModules.musnix];
users.users.${user}.extraGroups = ["music"];
musnix.enable = true;
}