Refactor home manager, and add desktop node on sparky.

This commit is contained in:
2025-10-20 16:27:13 +01:00
parent bd15987f8d
commit 1465213c90
8 changed files with 148 additions and 64 deletions

56
common/desktop-node.nix Normal file
View File

@@ -0,0 +1,56 @@
{ pkgs, ... }:
{
# Enable Hyprland (Wayland compositor)
programs.hyprland = {
enable = true;
xwayland.enable = true; # For compatibility with X11 apps if needed
};
# Essential desktop services
services.dbus.enable = true;
# polkit for privilege escalation
security.polkit.enable = true;
# Enable sound with pipewire
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# XDG portal for screen sharing, file pickers, etc.
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
};
# Fonts
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
liberation_ttf
fira-code
fira-code-symbols
];
# Enable GDM for login (can also use greetd or ly for lighter options)
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
user = "greeter";
};
};
};
# Environment variables for Wayland
environment.sessionVariables = {
NIXOS_OZONE_WL = "1"; # Hint electron apps to use Wayland
WLR_NO_HARDWARE_CURSORS = "1"; # Fix cursor rendering on some hardware
};
}

View File

@@ -54,8 +54,8 @@
};
};
mkNixos =
system: modules:
mkHost =
system: profile: modules:
nixpkgs.lib.nixosSystem {
system = system;
modules = [
@@ -69,31 +69,30 @@
disko.nixosModules.disko
sops-nix.nixosModules.sops
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.ppetru = {
imports = [
(inputs.impermanence + "/home-manager.nix")
inputs.nix-index-database.homeModules.nix-index
inputs.nixvim.homeModules.nixvim
./home
];
};
extraSpecialArgs = {
inherit profile;
};
};
}
] ++ modules;
specialArgs = {
inherit inputs self;
};
};
mkHMNixos =
system: modules:
mkNixos system ([
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.ppetru = {
imports = [
(inputs.impermanence + "/home-manager.nix")
inputs.nix-index-database.homeModules.nix-index
inputs.nixvim.homeModules.nixvim
./home
];
};
};
}] ++ modules);
pkgsFor =
system:
import nixpkgs {
@@ -119,16 +118,16 @@
in
{
nixosConfigurations = {
c1 = mkHMNixos "x86_64-linux" [ ./hosts/c1 ];
c2 = mkHMNixos "x86_64-linux" [ ./hosts/c2 ];
c3 = mkHMNixos "x86_64-linux" [ ./hosts/c3 ];
alo-cloud-1 = mkHMNixos "aarch64-linux" [ ./hosts/alo-cloud-1 ];
zippy = mkHMNixos "x86_64-linux" [
c1 = mkHost "x86_64-linux" "server" [ ./hosts/c1 ];
c2 = mkHost "x86_64-linux" "server" [ ./hosts/c2 ];
c3 = mkHost "x86_64-linux" "server" [ ./hosts/c3 ];
alo-cloud-1 = mkHost "aarch64-linux" "server" [ ./hosts/alo-cloud-1 ];
zippy = mkHost "x86_64-linux" "workstation" [
ethereum-nix.nixosModules.default
./hosts/zippy
];
chilly = mkHMNixos "x86_64-linux" [ ./hosts/chilly ];
sparky = mkHMNixos "x86_64-linux" [ ./hosts/sparky ];
chilly = mkHost "x86_64-linux" "workstation" [ ./hosts/chilly ];
sparky = mkHost "x86_64-linux" "desktop" [ ./hosts/sparky ];
};
deploy = {

View File

@@ -1,7 +1,7 @@
{ pkgs, ... }:
{ pkgs, profile ? "cli", ... }:
{
home = {
packages = (import ./packages.nix { inherit pkgs; }).packages;
packages = (import ./packages.nix { inherit pkgs profile; }).packages;
stateVersion = "24.05"; # TODO: unify this with the references in flake.nix:inputs
sessionVariables = {

View File

@@ -1,38 +1,7 @@
{ pkgs }:
{ pkgs, profile ? "workstation" }:
let
corePkgs = with pkgs; [
unstable.claude-code
unstable.codex
unstable.chromium
unstable.gemini-cli
unstable.playwright
unstable.playwright-driver.browsers
unstable.playwright-mcp
direnv
fzf
git
mosh
ripgrep
tmux
zsh
];
pythonEnv = pkgs.unstable.python3.withPackages (ps: [
# unstable only
# ps.aider-chat
ps.google-generativeai
ps.ipython
ps.llm
ps.llm-gemini
]);
fishPkgs = with pkgs.fishPlugins; [
pure
# don't add failed commands to history
sponge
transient-fish
];
profilePackages = import ./profiles/${profile}.nix { inherit pkgs; };
in
{
packages = corePkgs ++ [ pythonEnv ] ++ fishPkgs;
packages = profilePackages.packages;
}

12
home/profiles/desktop.nix Normal file
View File

@@ -0,0 +1,12 @@
{ pkgs }:
let
workstationProfile = import ./workstation.nix { inherit pkgs; };
desktopPkgs = with pkgs; [
unstable.chromium
foot # Wayland-native terminal emulator
];
in
{
packages = workstationProfile.packages ++ desktopPkgs;
}

27
home/profiles/server.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs }:
let
corePkgs = with pkgs; [
direnv
fzf
git
mosh
ripgrep
tmux
zsh
];
pythonEnv = pkgs.unstable.python3.withPackages (ps: [
ps.google-generativeai
ps.ipython
]);
fishPkgs = with pkgs.fishPlugins; [
pure
# don't add failed commands to history
sponge
transient-fish
];
in
{
packages = corePkgs ++ [ pythonEnv ] ++ fishPkgs;
}

View File

@@ -0,0 +1,20 @@
{ pkgs }:
let
serverProfile = import ./server.nix { inherit pkgs; };
cliPkgs = with pkgs; [
unstable.claude-code
unstable.codex
unstable.gemini-cli
];
pythonEnv = pkgs.unstable.python3.withPackages (ps: [
ps.google-generativeai
ps.ipython
ps.llm
ps.llm-gemini
]);
in
{
packages = serverProfile.packages ++ cliPkgs ++ [ pythonEnv ];
}

View File

@@ -5,6 +5,7 @@
../../common/global
../../common/base-node.nix
../../common/dev-node.nix
../../common/desktop-node.nix
./hardware.nix
];