Rewrote systemwide system, fixed broken build

This commit is contained in:
Jan-Bulthuis 2025-02-17 12:53:45 +01:00
parent 42040403b1
commit 036f619673
16 changed files with 93 additions and 179 deletions

View File

@ -31,9 +31,6 @@ let
in in
{ {
imports = [ imports = [
# Import system wide configuration required for user modules
../../user-modules/systemwide/default.nix
# Import systemwide configuration # Import systemwide configuration
./systemwide.nix ./systemwide.nix
]; ];

View File

@ -1,13 +1,33 @@
{ {
lib,
config, config,
lib,
... ...
}: }:
with lib; with lib;
let let
configuration = (map (user: user.systemwide) (attrValues config.home-manager.users)); moduleFiles = [
../../user-modules/desktop/systemwide.nix
../../user-modules/development/systemwide.nix
../../user-modules/gaming/systemwide.nix
../../user-modules/keyring/systemwide.nix
];
moduleConfig = lists.foldr (file: acc: recursiveUpdate acc (import file)) { } moduleFiles;
moduleNames = attrNames moduleConfig;
mkModule =
name: moduleConfig:
{ pkgs, ... }:
{
config = mkIf (any (user: user.modules.${name}.enable) (attrValues config.home-manager.users)) (
if (isAttrs moduleConfig) then moduleConfig else (moduleConfig { inherit config pkgs; })
);
};
imports = map (name: mkModule name moduleConfig."${name}") moduleNames;
in in
{ {
config = configuration; imports = imports;
} }

View File

@ -27,7 +27,6 @@
./shell/bash.nix ./shell/bash.nix
./shell/fish.nix ./shell/fish.nix
./spotify/default.nix ./spotify/default.nix
./systemwide/default.nix
./terminal/default.nix ./terminal/default.nix
./terminal/foot/default.nix ./terminal/foot/default.nix
./theming/default.nix ./theming/default.nix

View File

@ -12,7 +12,6 @@ in
{ {
imports = [ imports = [
# Import desktop environment modules # Import desktop environment modules
./background/glpaper/default.nix
./bar/waybar.nix ./bar/waybar.nix
./lock-screen/waylock.nix ./lock-screen/waylock.nix
./window-manager/i3.nix ./window-manager/i3.nix
@ -83,13 +82,14 @@ in
} }
( (
# TODO: Move to dedicated module within desktop or maybe theming? # TODO: Move to dedicated module within desktop or maybe theming?
if cfg.decorations == null then # if cfg.decorations == null then
{ } # { }
else # else
{ # {
csd = { }; # csd = { };
ssd = { }; # ssd = { };
} # }
."${cfg.decorations}" # ."${cfg.decorations}"
{ }
); );
} }

View File

@ -16,10 +16,5 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = (with pkgs; [ waylock ]); home.packages = (with pkgs; [ waylock ]);
# Systemwide configuration
systemwide = {
security.pam.services.waylock = { };
};
}; };
} }

View File

@ -23,23 +23,5 @@ in
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;
}; };
# Systemwide configuration
systemwide = {
services.xserver = {
layout = "us";
xkbVariant = "";
enable = true;
windowManager.i3.enable = true;
desktopManager = {
xterm.enable = true;
xfce = {
enable = true;
# noDesktop = false;
# enableXfwm = false;
};
};
};
};
}; };
} }

View File

@ -36,11 +36,6 @@ in
river river
''; '';
# Systemwide configuration
systemwide = {
programs.river.enable = true;
};
# TODO: Fix this # TODO: Fix this
# modules.desktop.reloadScript = '' # modules.desktop.reloadScript = ''
# ${pkgs.river}/bin/riverctl background-color 0x${config.theming.colors.bg} # ${pkgs.river}/bin/riverctl background-color 0x${config.theming.colors.bg}
@ -118,7 +113,8 @@ in
spawn = [ spawn = [
"\"${layout} ${layoutOptions}\"" "\"${layout} ${layoutOptions}\""
"waybar" # TODO: Decouple "waybar" # TODO: Decouple
"\"glpaper eDP-1 ${toString config.modules.glpaper.shader}\"" # TODO: Generic background options
# "\"glpaper eDP-1 ${toString config.modules.glpaper.shader}\""
"udiskie" "udiskie"
]; ];
map = ( map = (

View File

@ -1,95 +1,5 @@
{ ... }:
{ {
lib, imports = [ ./custom/default.nix ];
pkgs,
config,
...
}:
with lib;
let
cfg = config.modules.desktop;
in
{
imports = [
# Import desktop environment modules
./background/glpaper/default.nix
./bar/waybar.nix
./lock-screen/waylock.nix
./window-manager/i3.nix
./window-manager/river.nix
];
options.modules.desktop = {
wayland = mkEnableOption "wayland";
# TODO: Remove, not needed with session/display manager
initScript = mkOption {
type = types.lines;
default = "${pkgs.bash}/bin/bash";
description = "Bash script to execute after logging in.";
};
# TODO: Find a nicer way to do this as this is also executed on startup
reloadScript = mkOption {
type = types.lines;
default = "";
description = "Shell script to execute after reload/rebuild.";
};
decorations = mkOption {
type = types.nullOr (
types.enum [
"csd"
"ssd"
]
);
default = null;
description = "Window decorations to use.";
};
};
config =
lib.recursiveUpdate
{
# Ensure desktop related systemd services (xdg) have access to session variables.
systemd.user.sessionVariables = config.home.sessionVariables;
home.packages = optionals cfg.wayland (
with pkgs;
[
wl-clipboard
wtype
grim
slurp
]
);
home.activation = {
customReloadScript = lib.hm.dag.entryAfter [ "writeBoundary" ] (
''
#!${pkgs.bash}/bin/bash
''
+ cfg.reloadScript
);
};
home.file.".initrc" = {
enable = true;
executable = true;
text =
''
#!${pkgs.bash}/bin/bash
''
+ cfg.initScript;
};
}
(
# TODO: Move to dedicated module within desktop or maybe theming?
if cfg.decorations == null then
{ }
else
{
csd = { };
ssd = { };
}
."${cfg.decorations}"
);
} }

View File

@ -0,0 +1,22 @@
{
waylock = {
security.pam.services.waylock = { };
};
river = {
programs.river.enable = true;
};
i3 = {
services.xserver = {
layout = "us";
xkbVariant = "";
enable = true;
windowManager.i3.enable = true;
desktopManager = {
xterm.enable = true;
xfce = {
enable = true;
};
};
};
};
}

View File

@ -0,0 +1,6 @@
{
docker = {
virtualisation.docker.enable = true;
machine.sudo-groups = [ "docker" ];
};
}

View File

@ -37,11 +37,5 @@ in
# Neovim configuration # Neovim configuration
programs.nixvim = { }; programs.nixvim = { };
# Systemwide configuration
systemwide = {
virtualisation.docker.enable = true;
machine.sudo-groups = [ "docker" ];
};
}; };
} }

View File

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
@ -12,22 +11,6 @@ with lib;
}; };
config = mkIf config.modules.steam.enable { config = mkIf config.modules.steam.enable {
# Systemwide configuration # Steam must be installed systemwide as of time of writing
systemwide = {
modules.unfree.allowedPackages = [
"steam"
"steam-original"
"steam-unwrapped"
];
programs.steam.enable = true;
# Make steam create desktop entries in a subfolder
programs.steam.package = pkgs.steam.override {
extraBwrapArgs = [
"--bind $HOME/.local/share/applications/Steam $HOME/.local/share/applications"
];
};
};
}; };
} }

View File

@ -0,0 +1,20 @@
{
steam =
{ pkgs, ... }:
{
modules.unfree.allowedPackages = [
"steam"
"steam-original"
"steam-unwrapped"
];
programs.steam.enable = true;
# Make steam create desktop entries in a subfolder
programs.steam.package = pkgs.steam.override {
extraBwrapArgs = [
"--bind $HOME/.local/share/applications/Steam $HOME/.local/share/applications"
];
};
};
}

View File

@ -19,12 +19,5 @@ in
home.packages = with pkgs; [ home.packages = with pkgs; [
seahorse seahorse
]; ];
# Systemwide configuration
systemwide = {
services.gnome.gnome-keyring = {
enable = true;
};
};
}; };
} }

View File

@ -0,0 +1,7 @@
{
keyring = {
services.gnome.gnome-keyring = {
enable = true;
};
};
}

View File

@ -1,10 +0,0 @@
{ lib, ... }:
with lib;
{
options.systemwide = mkOption {
type = types.attrsOf types.anything;
default = { };
description = "Systemwide configuration required for user-specific settings.";
};
}