mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
Compare commits
3 commits
c39c07bf31
...
34fe48801d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34fe48801d | ||
|
|
1c75dd7022 | ||
|
|
0a5a165aca |
9 changed files with 167 additions and 15 deletions
14
modules/misc/news/2025/11/2025-11-03_22-56-50.nix
Normal file
14
modules/misc/news/2025/11/2025-11-03_22-56-50.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
time = "2025-11-03T21:56:50+00:00";
|
||||||
|
condition = config.programs.ghostty.enable && pkgs.stdenv.hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
Ghostty: now enables the user systemd service by default.
|
||||||
|
|
||||||
|
Running Ghostty via these systemd units is the recommended way to run
|
||||||
|
Ghostty. The two most important benefits provided by Ghostty's systemd
|
||||||
|
integrations are: instantaneous launching and centralized logging.
|
||||||
|
|
||||||
|
See https://ghostty.org/docs/linux/systemd for all details
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -114,6 +114,24 @@ in
|
||||||
defaultText = lib.literalMD "`true` if programs.ghostty.package is not null";
|
defaultText = lib.literalMD "`true` if programs.ghostty.package is not null";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd = lib.mkOption {
|
||||||
|
type = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
enable = lib.mkEnableOption "the Ghostty systemd user service" // {
|
||||||
|
default = pkgs.stdenv.hostPlatform.isLinux;
|
||||||
|
defaultText = lib.literalMD "`true` on Linux, `false` otherwise";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Configuration for Ghostty's systemd integration.
|
||||||
|
This enables additional speed and features.
|
||||||
|
|
||||||
|
See <https://ghostty.org/docs/linux/systemd> for more information.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
enableBashIntegration = mkShellIntegrationOption (
|
enableBashIntegration = mkShellIntegrationOption (
|
||||||
lib.hm.shell.mkBashIntegrationOption { inherit config; }
|
lib.hm.shell.mkBashIntegrationOption { inherit config; }
|
||||||
);
|
);
|
||||||
|
|
@ -195,6 +213,22 @@ in
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(lib.mkIf cfg.systemd.enable {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.systemd.enable -> cfg.package != null;
|
||||||
|
message = "programs.ghostty.systemd.enable cannot be true when programs.ghostty.package is null";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.systemd.enable -> pkgs.stdenv.hostPlatform.isLinux;
|
||||||
|
message = "Ghostty systemd integration cannot be enabled for non-linux platforms";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
xdg.configFile."systemd/user/app-com.mitchellh.ghostty.service".source =
|
||||||
|
"${cfg.package}/share/systemd/user/app-com.mitchellh.ghostty.service";
|
||||||
|
dbus.packages = [ cfg.package ];
|
||||||
|
})
|
||||||
|
|
||||||
(lib.mkIf cfg.enableBashIntegration {
|
(lib.mkIf cfg.enableBashIntegration {
|
||||||
# Make order 101 to be placed exactly after bash completions, as Ghostty
|
# Make order 101 to be placed exactly after bash completions, as Ghostty
|
||||||
# documentation suggests sourcing the script as soon as possible
|
# documentation suggests sourcing the script as soon as possible
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.programs.superfile;
|
cfg = config.programs.superfile;
|
||||||
|
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
jsonFormat = pkgs.formats.json { };
|
||||||
|
|
||||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
literalExpression
|
literalExpression
|
||||||
|
|
@ -23,6 +26,29 @@ let
|
||||||
types
|
types
|
||||||
hm
|
hm
|
||||||
;
|
;
|
||||||
|
|
||||||
|
pinnedFolderModule = types.submodule {
|
||||||
|
freeformType = jsonFormat.type;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
name = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "Nix Store";
|
||||||
|
description = ''
|
||||||
|
Name that will be shown.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
location = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
example = "/nix/store";
|
||||||
|
description = ''
|
||||||
|
Location of the pinned entry.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
meta.maintainers = [ hm.maintainers.LucasWagler ];
|
meta.maintainers = [ hm.maintainers.LucasWagler ];
|
||||||
|
|
@ -106,11 +132,38 @@ in
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
firstUseCheck = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Enables the first time use popup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
pinnedFolders = mkOption {
|
||||||
|
type = types.listOf pinnedFolderModule;
|
||||||
|
default = [ ];
|
||||||
|
example = literalExpression ''
|
||||||
|
[
|
||||||
|
{
|
||||||
|
name = "Nix Store";
|
||||||
|
location = "/nix/store";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Entries that get added to the pinned panel.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
enableXdgConfig = !isDarwin || config.xdg.enable;
|
enableXdgConfig = !isDarwin || config.xdg.enable;
|
||||||
|
baseConfigPath = if enableXdgConfig then "superfile" else "Library/Application Support/superfile";
|
||||||
|
baseDataPath = if enableXdgConfig then "superfile" else "Library/Application Support/superfile";
|
||||||
|
|
||||||
themeSetting =
|
themeSetting =
|
||||||
if (!(cfg.settings ? theme) && cfg.themes != { }) then
|
if (!(cfg.settings ? theme) && cfg.themes != { }) then
|
||||||
{
|
{
|
||||||
|
|
@ -118,7 +171,6 @@ in
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ };
|
{ };
|
||||||
baseConfigPath = if enableXdgConfig then "superfile" else "Library/Application Support/superfile";
|
|
||||||
configFile = mkIf (cfg.settings != { }) {
|
configFile = mkIf (cfg.settings != { }) {
|
||||||
"${baseConfigPath}/config.toml".source = tomlFormat.generate "superfile-config.toml" (
|
"${baseConfigPath}/config.toml".source = tomlFormat.generate "superfile-config.toml" (
|
||||||
recursiveUpdate themeSetting cfg.settings
|
recursiveUpdate themeSetting cfg.settings
|
||||||
|
|
@ -139,24 +191,48 @@ in
|
||||||
(tomlFormat.generate "superfile-theme-${name}.toml" value);
|
(tomlFormat.generate "superfile-theme-${name}.toml" value);
|
||||||
}
|
}
|
||||||
) cfg.themes;
|
) cfg.themes;
|
||||||
|
|
||||||
|
firstUseCheckFile = mkIf (!cfg.firstUseCheck) { "${baseDataPath}/firstUseCheck".text = ""; };
|
||||||
|
pinnedFile = mkIf (cfg.pinnedFolders != [ ]) {
|
||||||
|
"${baseDataPath}/pinned.json".source = jsonFormat.generate "pinned.json" cfg.pinnedFolders;
|
||||||
|
};
|
||||||
|
|
||||||
|
files = mkMerge [
|
||||||
|
configFile
|
||||||
|
hotkeysFile
|
||||||
|
themeFiles
|
||||||
|
|
||||||
|
firstUseCheckFile
|
||||||
|
pinnedFile
|
||||||
|
];
|
||||||
configFiles = mkMerge [
|
configFiles = mkMerge [
|
||||||
configFile
|
configFile
|
||||||
hotkeysFile
|
hotkeysFile
|
||||||
themeFiles
|
themeFiles
|
||||||
];
|
];
|
||||||
|
dataFiles = mkMerge [
|
||||||
|
firstUseCheckFile
|
||||||
|
pinnedFile
|
||||||
|
];
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
home.packages = mkIf (cfg.package != null) (
|
home = {
|
||||||
[ cfg.package ]
|
packages = mkIf (cfg.package != null) (
|
||||||
++ optional (
|
[ cfg.package ]
|
||||||
cfg.metadataPackage != null && cfg.settings ? metadata && cfg.settings.metadata
|
++ optional (
|
||||||
) cfg.metadataPackage
|
cfg.metadataPackage != null && cfg.settings ? metadata && cfg.settings.metadata
|
||||||
++ optional (
|
) cfg.metadataPackage
|
||||||
cfg.zoxidePackage != null && cfg.settings ? zoxide_support && cfg.settings.zoxide_support
|
++ optional (
|
||||||
) cfg.zoxidePackage
|
cfg.zoxidePackage != null && cfg.settings ? zoxide_support && cfg.settings.zoxide_support
|
||||||
);
|
) cfg.zoxidePackage
|
||||||
|
);
|
||||||
|
|
||||||
xdg.configFile = mkIf enableXdgConfig configFiles;
|
file = mkIf (!enableXdgConfig) files;
|
||||||
home.file = mkIf (!enableXdgConfig) configFiles;
|
};
|
||||||
|
|
||||||
|
xdg = {
|
||||||
|
configFile = mkIf enableXdgConfig configFiles;
|
||||||
|
dataFile = mkIf enableXdgConfig dataFiles;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ in
|
||||||
existing_profiles=$(jq '.userDataProfiles // [] | map({ (.name): .location }) | add // {}' "$file")
|
existing_profiles=$(jq '.userDataProfiles // [] | map({ (.name): .location }) | add // {}' "$file")
|
||||||
|
|
||||||
for profile in "''${profiles[@]}"; do
|
for profile in "''${profiles[@]}"; do
|
||||||
if [[ "$(echo $existing_profiles | jq --arg profile $profile 'has ($profile)')" != "true" ]] || [[ "$(echo $existing_profiles | jq --arg profile $profile 'has ($profile)')" == "true" && "$(echo $existing_profiles | jq --arg profile $profile '.[$profile]')" != "\"$profile\"" ]]; then
|
if [[ "$(echo $existing_profiles | jq --arg profile "$profile" 'has ($profile)')" != "true" ]] || [[ "$(echo $existing_profiles | jq --arg profile "$profile" 'has ($profile)')" == "true" && "$(echo $existing_profiles | jq --arg profile "$profile" '.[$profile]')" != "\"$profile\"" ]]; then
|
||||||
file_write="$file_write$([ "$file_write" != "" ] && echo "...")$profile"
|
file_write="$file_write$([ "$file_write" != "" ] && echo "...")$profile"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
programs.ghostty.enable = true;
|
programs.ghostty = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage { outPath = null; };
|
||||||
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertPathNotExists home-files/.config/ghostty/config
|
assertPathNotExists home-files/.config/ghostty/config
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
programs.ghostty = {
|
programs.ghostty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = config.lib.test.mkStubPackage { };
|
package = config.lib.test.mkStubPackage { outPath = null; };
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
theme = "catppuccin-mocha";
|
theme = "catppuccin-mocha";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
programs.ghostty = {
|
programs.ghostty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage { outPath = null; };
|
||||||
|
|
||||||
themes = {
|
themes = {
|
||||||
catppuccin-mocha = {
|
catppuccin-mocha = {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"location": "/nix/store",
|
||||||
|
"name": "Nix Store"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -53,6 +53,13 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
firstUseCheck = false;
|
||||||
|
pinnedFolders = [
|
||||||
|
{
|
||||||
|
name = "Nix Store";
|
||||||
|
location = "/nix/store";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script =
|
nmt.script =
|
||||||
|
|
@ -60,6 +67,10 @@
|
||||||
configSubPath =
|
configSubPath =
|
||||||
if !pkgs.stdenv.isDarwin then ".config/superfile" else "Library/Application Support/superfile";
|
if !pkgs.stdenv.isDarwin then ".config/superfile" else "Library/Application Support/superfile";
|
||||||
configBasePath = "home-files/" + configSubPath;
|
configBasePath = "home-files/" + configSubPath;
|
||||||
|
|
||||||
|
dataSubPath =
|
||||||
|
if !pkgs.stdenv.isDarwin then ".local/share/superfile" else "Library/Application Support/superfile";
|
||||||
|
dataBasePath = "home-files/" + dataSubPath;
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
assertFileExists "${configBasePath}/config.toml"
|
assertFileExists "${configBasePath}/config.toml"
|
||||||
|
|
@ -82,5 +93,10 @@
|
||||||
assertFileContent \
|
assertFileContent \
|
||||||
"${configBasePath}/theme/test2.toml" \
|
"${configBasePath}/theme/test2.toml" \
|
||||||
${./example-theme2-expected.toml}
|
${./example-theme2-expected.toml}
|
||||||
|
assertFileExists "${dataBasePath}/firstUseCheck"
|
||||||
|
assertFileExists "${dataBasePath}/pinned.json"
|
||||||
|
assertFileContent \
|
||||||
|
"${dataBasePath}/pinned.json" \
|
||||||
|
${./example-pinned-folders.json}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue