treewide: use hjem fork, remove shared module

This commit is contained in:
Anthony Rodriguez 2025-02-02 23:03:42 +01:00
parent 9e65cad8fc
commit 45f8e26757
Signed by: nezia
SSH key fingerprint: SHA256:Ihfpl0rUpqDevYqnzSR34OYfVLbDNkBiUjs3CpX4ykA
4 changed files with 36 additions and 88 deletions

View file

@ -1,10 +1,8 @@
{ {
lib,
pkgs, pkgs,
config, config,
... ...
}: let }: let
inherit (lib) mkIf;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
in { in {
nix = { nix = {

View file

@ -3,7 +3,6 @@
config, config,
... ...
}: let }: let
inherit (lib.filesystem) listFilesRecursive;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
in { in {
config = lib.mkIf (!config.local.profiles.server.enable) { config = lib.mkIf (!config.local.profiles.server.enable) {
@ -25,9 +24,10 @@ in {
enable = true; enable = true;
directory = "/home/${username}"; directory = "/home/${username}";
user = "${username}"; user = "${username}";
environment.enable = true; environment = {
forceOverride = true;
};
}; };
extraModules = listFilesRecursive ../../shared/modules/hjem;
}; };
}; };
} }

View file

@ -3,37 +3,51 @@
inputs, inputs,
pkgs, pkgs,
config, config,
lib',
... ...
}: }:
# thanks https://git.jacekpoz.pl/poz/niksos/src/commit/f8d5e7ccd9c769f7c0b564f10dff419285e75248/modules/services/greetd.nix # thanks https://git.jacekpoz.pl/poz/niksos/src/commit/f8d5e7ccd9c769f7c0b564f10dff419285e75248/modules/services/greetd.nix
let let
inherit (lib) getExe getExe'; inherit (lib.attrsets) optionalAttrs;
inherit (lib.meta) getExe getExe';
inherit (inputs.hyprland.packages.${pkgs.stdenv.system}) hyprland; inherit (inputs.hyprland.packages.${pkgs.stdenv.system}) hyprland;
inherit (lib'.generators) toHyprConf;
styleCfg = config.local.style;
hyprctl = getExe' hyprland "hyprctl"; hyprctl = getExe' hyprland "hyprctl";
Hyprland = getExe' hyprland "Hyprland"; Hyprland = getExe' hyprland "Hyprland";
greeter = getExe pkgs.greetd.gtkgreet; greeter = getExe pkgs.greetd.gtkgreet;
hyprlandConfig = hyprlandConfig = pkgs.writeText "greetd-hyprland-config" (toHyprConf {
pkgs.writeText "greetd-hyprland-config" attrs =
'' {
misc { misc = {
disable_hyprland_logo=true disable_hyprland_logo = true;
force_default_wallpaper=false force_default_wallpaper = false;
focus_on_activate=true focus_on_activate = true;
};
animations = {
enabled = false;
first_launch_animation = false;
};
workspace = "1,default:true,gapsout:0,gapsin:0,border:false,decorate:false";
exec-once = [
"[workspace 1;fullscreen;noanim] ${greeter} -l; ${hyprctl} dispatch exit"
"${hyprctl} dispatch focuswindow ${greeter}"
];
} }
// optionalAttrs styleCfg.enable {
animations { env = {
enabled=false HYPRCURSOR_THEME = styleCfg.cursorTheme.name;
first_launch_animation=false HYPRCURSOR_SIZE = styleCfg.cursorTheme.size;
} };
};
workspace=1,default:true,gapsout:0,gapsin:0,border:false,decorate:false });
exec-once=[workspace 1;fullscreen;noanim] ${greeter} -l; ${hyprctl} dispatch exit
exec-once=${hyprctl} dispatch focuswindow ${greeter}
'';
in { in {
# TODO: perhaps turn this into a more generic module if we wanna use other wayland compositors # TODO: perhaps turn this into a more generic module if we wanna use other wayland compositors
config = lib.mkIf config.local.modules.hyprland.enable { config = lib.mkIf config.local.modules.hyprland.enable {

View file

@ -1,64 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib) concatStringsSep mapAttrsToList;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf listOf oneOf int path str;
envFile = "99-user-env.conf";
cfg = config.environment;
toString = env:
if builtins.isList env
then concatStringsSep ":" env
else builtins.toString env;
toConf = attrs:
concatStringsSep "\n"
(mapAttrsToList (name: value: "${name}=\"${toString value}\"") attrs);
in {
options.environment = {
enable = mkEnableOption "environment management";
variables = mkOption {
default = {};
example = {
EDITOR = "nvim";
VISUAL = "nvim";
};
description = ''
A set of environment variables used in the user environment.
These variables will be set as systemd environment
variables, using `environment.d`. The value of each
variable can be either a string or a list of strings. The
latter is concatenated, interspersed with colon
characters.
'';
type = attrsOf (oneOf [(listOf (oneOf [int str path])) int str path]);
};
};
config =
mkIf cfg.enable
{
files.".config/environment.d/${envFile}".text = toConf cfg.variables;
warnings = let
overlappingVars = builtins.filter (x: builtins.elem x (builtins.attrNames config.environment.variables)) (builtins.attrNames cfg.variables);
in
if overlappingVars != []
then
map (name: ''
The environment variable '${name}' is defined in both
`hjem.users.<name>.environment.variables` and
`config.environment.variables`. This may lead to conflicts.
If you want the one defined in hjem to take precedence, make sure you
unset it manually in `environment.extraInit` (`unset ${name}`).
'')
overlappingVars
else [];
};
}