refactor: simplify 'user' options
This commit is contained in:
@@ -5,9 +5,6 @@
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
username = "hektor";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
@@ -57,8 +54,8 @@ in
|
||||
|
||||
home = {
|
||||
stateVersion = "25.05";
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
username = "hektor";
|
||||
homeDirectory = "/home/${config.home.username}";
|
||||
};
|
||||
|
||||
targets.genericLinux.nixGL = {
|
||||
|
||||
@@ -6,25 +6,32 @@
|
||||
}:
|
||||
|
||||
{
|
||||
options.nixgl.wrap = lib.mkOption {
|
||||
type = lib.types.functionTo lib.types.package;
|
||||
default = if config.lib ? nixGL then config.lib.nixGL.wrap else lib.id;
|
||||
readOnly = true;
|
||||
};
|
||||
options = {
|
||||
host.username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.home.username;
|
||||
};
|
||||
|
||||
options.wrapApp = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
default =
|
||||
pkg: flags:
|
||||
if config.lib ? nixGL then
|
||||
pkg.overrideAttrs (old: {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ];
|
||||
postInstall = (old.postInstall or "") + ''
|
||||
wrapProgram $out/bin/${pkg.meta.mainProgram} --add-flags "${flags}"
|
||||
'';
|
||||
})
|
||||
else
|
||||
pkg;
|
||||
readOnly = true;
|
||||
nixgl.wrap = lib.mkOption {
|
||||
type = lib.types.functionTo lib.types.package;
|
||||
default = if config.lib ? nixGL then config.lib.nixGL.wrap else lib.id;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
wrapApp = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
default =
|
||||
pkg: flags:
|
||||
if config.lib ? nixGL then
|
||||
pkg.overrideAttrs (old: {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ];
|
||||
postInstall = (old.postInstall or "") + ''
|
||||
wrapProgram $out/bin/${pkg.meta.mainProgram} --add-flags "${flags}"
|
||||
'';
|
||||
})
|
||||
else
|
||||
pkg;
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user