Refactor home manager profile

This commit is contained in:
Jan-Bulthuis 2025-05-25 11:55:51 +02:00
parent 63386512a8
commit 6c452c6649
10 changed files with 493 additions and 107 deletions

View File

@ -1,98 +1,9 @@
{
pkgs,
...
}:
{
home.stateVersion = "24.11";
home.packages = with pkgs; [
libreoffice-still
remmina
thunderbird
signal-desktop
prusa-slicer
freecad-wayland
inkscape
ente-auth
bitwarden
carla
winbox
whatsapp-for-linux
discord
steam
spotify
# feishin # TODO: Fix or replace as insecure
eduvpn-client
river # TODO: Move
firefox # TODO: Move to dediated module
ryubing
dconf-editor
bottles
];
modules = {
# Desktop environment
desktop.gnome.enable = true;
# desktop.tiling.enable = true;
# Browser
# firefox = {
# enable = true;
# default = false;
# };
# qutebrowser = {
# enable = true;
# default = true;
# };
# Gaming
# retroarch.enable = true;
# ryujinx.enable = true;
# Tools
git = {
enable = true;
user = "Jan-Bulthuis";
email = "git@bulthuis.dev";
# TODO: Move
ignores = [
".envrc"
".direnv"
"flake.nix"
"flake.lock"
];
};
# btop.enable = true;
direnv.enable = true;
fish.enable = true;
# bluetuith.enable = false;
# obsidian.enable = true;
# zathura.enable = true;
# keyring.enable = true;
# scripts.enable = true;
xpra = {
enable = true;
hosts = [
"mixer@10.20.60.251"
];
};
# Development
# neovim.enable = true;
vscode.enable = true;
# docker.enable = true;
# matlab.enable = true;
# mathematica.enable = true;
# Languages
haskell.enable = false;
js.enable = true;
nix.enable = true;
rust.enable = true;
python.enable = true;
cpp.enable = true;
tex.enable = true;
jupyter.enable = false;
};
modules.profiles.jan.enable = true;
}

View File

@ -0,0 +1,7 @@
{ ... }:
{
home.stateVersion = "24.11";
modules.profiles.gnome.enable = true;
}

View File

@ -1,17 +0,0 @@
{
pkgs,
...
}:
{
home.stateVersion = "24.11";
home.packages = with pkgs; [
];
modules = {
# Desktop environment
# desktop.gnome.enable = true;
# desktop.tiling.enable = true;
};
}

View File

@ -0,0 +1,240 @@
{
lib,
pkgs,
config,
...
}:
{
# State version
system.stateVersion = "24.11";
# Machine hostname
networking.hostName = "vm-audio";
# Enabled modules
modules = {
pipewire.enable = true;
spotifyd.enable = true;
};
# Install system packages
environment.systemPackages = with pkgs; [
carla
xpra
alsa-utils
pulsemixer
adwaita-icon-theme
open-stage-control
carla_osc_bridge
# Add LV2 plugins
lsp-plugins
airwindows-lv2
distrho-ports
cardinal
calf
];
# Setup firewall
networking.firewall = {
allowedTCPPorts = [
8080
10402
15151
22752
];
allowedUDPPorts = [
8080
10402
15151
22752
];
};
# Setup dependencies
environment.variables.LD_LIBRARY_PATH = lib.mkForce "${lib.makeLibraryPath (
with pkgs;
[
cairo
pipewire.jack
]
)}";
qt = {
enable = true;
style = "adwaita";
};
xdg.icons = {
enable = true;
fallbackCursorThemes = [ "Adwaita" ];
};
hardware.graphics.enable = true;
# User for audio mixing
users.users.mixer = {
isNormalUser = true;
group = "mixer";
extraGroups = [ "systemd-journal" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq jan@bulthuis.dev"
];
};
users.groups.mixer = { };
users.groups.audio = {
members = [
"mixer"
];
};
users.groups.bluetooth = {
members = [
"mixer"
];
};
# Xpra service
systemd.user.services.xpra = {
description = "Xpra Service";
wantedBy = [ "default.target" ];
after = [
"network.target"
];
unitConfig = {
ConditionUser = "mixer";
};
serviceConfig = {
ExecStart = "${pkgs.xpra}/bin/xpra start :7 --bind-tcp=0.0.0.0:15151 --daemon=no";
Restart = "always";
RestartSec = 5;
};
};
# Carla service
systemd.user.services.carla = {
description = "Carla Service";
wantedBy = [ "default.target" ];
after = [
"network.target"
"sound.target"
];
requires = [
"xpra.service"
];
unitConfig = {
ConditionUser = "mixer";
};
serviceConfig = {
ExecStart = "${pkgs.carla}/bin/carla /home/mixer/Default.carxp -platform xcb";
Environment = "\"DISPLAY=:7\"";
Restart = "always";
RestartSec = 5;
};
};
# Carla service
systemd.user.services.carla-bridge = {
description = "Carla OSC Bridge";
wantedBy = [ "default.target" ];
after = [
"network.target"
"sound.target"
];
requires = [
"carla.service"
];
unitConfig = {
ConditionUser = "mixer";
};
serviceConfig = {
ExecStart = "${pkgs.carla_osc_bridge}/bin/carla_osc_bridge --clients \"127.0.0.1:8080\"";
Restart = "always";
RestartSec = 5;
};
};
# Open stage control service
systemd.user.services.osc = {
description = "OSC Service";
wantedBy = [ "default.target" ];
after = [
"network.target"
];
requires = [
"carla.service"
];
unitConfig = {
ConditionUser = "mixer";
};
serviceConfig = {
ExecStart = "${pkgs.open-stage-control}/bin/open-stage-control --no-gui --send 127.0.0.1:10402 --load /home/mixer/open-stage-control/session.json --theme /home/mixer/open-stage-control/theme.css";
Environment = "\"ELECTRON_RUN_AS_NODE=1\"";
Restart = "always";
RestartSec = 5;
};
};
# Create bluetooth A2DP source
hardware.bluetooth = {
enable = true;
disabledPlugins = [ "hostname" ];
settings.General = {
Name = "Linox";
Class = "0x240414";
DiscoverableTimeout = 0;
AlwaysPairable = true;
PairableTimeout = 0;
FastConnectable = true;
JustWorksRepairing = "always";
};
};
services.pipewire.wireplumber.extraConfig."50-bluetooth-a2dp" = {
"monitor.bluez.properties" = {
"bluez5.roles" = [ "a2dp_source" ];
};
};
# Create null sinks
services.pipewire.extraConfig.pipewire."91-null-sinks" = {
"context.objects" = [
{
factory = "adapter";
args = {
"factory.name" = "support.null-audio-sink";
"node.name" = "Speaker-Proxy";
"node.description" = "Proxy for Speaker Output";
"media.class" = "Audio/Sink";
"audio.position" = "L,R";
};
}
{
factory = "adapter";
args = {
"factory.name" = "support.null-audio-sink";
"node.name" = "Headphone-Proxy";
"node.description" = "Proxy for Headphone Output";
"media.class" = "Audio/Sink";
"audio.position" = "L,R";
};
}
{
factory = "adapter";
args = {
"factory.name" = "support.null-audio-sink";
"node.name" = "SpotifyD-Proxy";
"node.description" = "Proxy for SpotifyD";
"media.class" = "Audio/Sink";
"audio.position" = "L,R";
};
}
{
factory = "adapter";
args = {
"factory.name" = "support.null-audio-sink";
"node.name" = "AnalogIn-Proxy";
"node.description" = "Proxy for the analog input";
"media.class" = "Audio/Source/Virtual";
"audio.position" = "L,R";
};
}
];
};
}

View File

@ -0,0 +1,7 @@
{ ... }:
{
home.stateVersion = "24.11";
modules.profiles.local.enable = true;
}

View File

@ -48,6 +48,8 @@ in
gnome-text-editor
showtime
file-roller
mission-center
dconf-editor
# For theming gtk3
adw-gtk3
@ -56,6 +58,7 @@ in
gsconnect
disable-workspace-animation
wallpaper-slideshow
media-progress
]);
# Enable and set the gtk themes

View File

@ -0,0 +1,31 @@
{
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.modules.profiles.base;
in
{
options.modules.profiles.base = {
enable = mkEnableOption "Base home-manager profile";
};
config = mkIf cfg.enable {
modules = {
# btop.enable = true;
direnv.enable = true;
fish.enable = true;
# scripts.enable = true;
# Development
# neovim.enable = true;
# Languages
nix.enable = true;
};
};
}

View File

@ -0,0 +1,48 @@
{
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.modules.profiles.gnome;
in
{
options.modules.profiles.gnome = {
enable = mkEnableOption "Graphical GNOME environment";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
firefox # TODO: Move to dediated module
];
modules = {
profiles.base.enable = true;
# Desktop environment
desktop.gnome.enable = true;
# desktop.tiling.enable = true;
# Browser
# firefox = {
# enable = true;
# default = false;
# };
# qutebrowser = {
# enable = true;
# default = true;
# };
# Tools
# obsidian.enable = true;
# zathura.enable = true;
# Development
# neovim.enable = true;
vscode.enable = true;
};
};
}

View File

@ -0,0 +1,86 @@
{
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.modules.profiles.jan;
in
{
options.modules.profiles.jan = {
enable = mkEnableOption "Jan's personal profile";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
libreoffice-still
remmina
thunderbird
signal-desktop
prusa-slicer
freecad-wayland
inkscape
ente-auth
bitwarden
carla
winbox
whatsapp-for-linux
discord
steam
spotify
# feishin # TODO: Fix or replace as insecure
eduvpn-client
river # TODO: Move
ryubing
bottles
prismlauncher
foliate
];
modules = {
profiles.gnome.enable = true;
# Gaming
# retroarch.enable = true;
# ryujinx.enable = true;
# Tools
git = {
enable = true;
user = "Jan-Bulthuis";
email = "git@bulthuis.dev";
# TODO: Move
ignores = [
".envrc"
".direnv"
"flake.nix"
"flake.lock"
];
};
xpra = {
enable = true;
hosts = [
"mixer@10.20.60.251"
];
};
# Development
# docker.enable = true;
# matlab.enable = true;
mathematica.enable = true;
# Languages
haskell.enable = false;
js.enable = true;
nix.enable = true;
rust.enable = true;
python.enable = true;
cpp.enable = true;
tex.enable = true;
jupyter.enable = false;
};
};
}

View File

@ -0,0 +1,70 @@
{
mkModule,
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.modules.profiles.vm;
in
{
options.modules.profiles.vm = {
enable = mkEnableOption "Base VM profile";
};
config = mkIf cfg.enable {
# Machine hostname
networking.hostName = lib.mkDefault "vm-base";
# Enabled modules
modules = {
profiles.base.enable = true;
base.enable = true;
ssh.enable = true;
};
# Enable qemu guest agent
services.qemuGuest.enable = true;
# Hardware configuration
hardware.enableRedistributableFirmware = true;
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
hardware.cpu.intel.updateMicrocode = true;
# Filesystems
fileSystems."/" = {
device = "/dev/disk/by-partlabel/root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-partlabel/EFI";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
# Swapfile
swapDevices = [
{
device = "/var/lib/swapfile";
size = 6 * 1024;
}
];
};
}