Factor out default terminal and web browser
This commit is contained in:
parent
076079aea1
commit
0a0e396ddf
|
@ -37,12 +37,8 @@
|
||||||
# Enable X11 configuration
|
# Enable X11 configuration
|
||||||
linux.graphical.type = "wayland";
|
linux.graphical.type = "wayland";
|
||||||
linux.graphical.wallpaper = ./images/pixiv_18776904.png;
|
linux.graphical.wallpaper = ./images/pixiv_18776904.png;
|
||||||
linux.graphical.startup = with pkgs; [
|
linux.graphical.defaults.webBrowser.package = pkgs.zen-browser-bin;
|
||||||
zen-browser-bin
|
linux.graphical.defaults.webBrowser.desktopFile = "zen.desktop";
|
||||||
thunderbird
|
|
||||||
vesktop
|
|
||||||
];
|
|
||||||
linux.graphical.defaults.webBrowser = "zen.desktop";
|
|
||||||
programs.my-sway.enable = true;
|
programs.my-sway.enable = true;
|
||||||
programs.my-sway.fontSize = 15.0;
|
programs.my-sway.fontSize = 15.0;
|
||||||
programs.my-sway.enableLaptop = true;
|
programs.my-sway.enableLaptop = true;
|
||||||
|
|
|
@ -17,6 +17,24 @@ let
|
||||||
echo $wifi_output
|
echo $wifi_output
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
mkPackageWithDesktopOption = opts: mkOption ({
|
||||||
|
type = types.submodule {
|
||||||
|
options = {
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
description = "The package for " + description;
|
||||||
|
};
|
||||||
|
desktopFile = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "The desktop file name for " + description + ", defaults to [packagename].desktop";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} // opts);
|
||||||
|
|
||||||
|
desktopFileOf = cfg: if cfg.desktopFile == null then "${cfg.package}/share/applications/${cfg.package.pname}.desktop" else cfg.desktopFile;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./x11.nix ./wayland.nix ./alacritty.nix ];
|
imports = [ ./x11.nix ./wayland.nix ./alacritty.nix ];
|
||||||
|
@ -35,21 +53,23 @@ in
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
description = "List of packages to include in ~/.config/autostart";
|
description = "List of packages to include in ~/.config/autostart";
|
||||||
default = with pkgs; [
|
default = with pkgs; [
|
||||||
librewolf
|
cfg.defaults.webBrowser.package
|
||||||
thunderbird
|
thunderbird
|
||||||
vesktop
|
vesktop
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
defaults.webBrowser = mkOption {
|
defaults = {
|
||||||
type = types.str;
|
webBrowser = mkPackageWithDesktopOption { description = "default web browser"; };
|
||||||
default = "librewolf.desktop";
|
terminal = mkPackageWithDesktopOption { description = "default terminal"; default.package = pkgs.kitty; };
|
||||||
description = "Desktop file of the default web browser";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = mkIf (cfg.type != null) {
|
config = mkIf (cfg.type != null) {
|
||||||
# Packages
|
# Packages
|
||||||
|
|
||||||
home.packages = (with pkgs; [
|
home.packages = (with pkgs; [
|
||||||
|
cfg.defaults.webBrowser.package
|
||||||
|
cfg.defaults.terminal.package
|
||||||
|
|
||||||
## GUI stuff
|
## GUI stuff
|
||||||
evince # PDF reader
|
evince # PDF reader
|
||||||
gparted
|
gparted
|
||||||
|
@ -150,14 +170,14 @@ in
|
||||||
"application/x-extension-rss" = [ "thunderbird.desktop" ];
|
"application/x-extension-rss" = [ "thunderbird.desktop" ];
|
||||||
|
|
||||||
# Default web browser stuff
|
# Default web browser stuff
|
||||||
"text/html" = [ cfg.defaults.webBrowser ];
|
"text/html" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/about" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/about" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/unknown" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/unknown" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/http" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/http" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/https" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/https" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/ftp" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/ftp" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/ftps" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/ftps" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
"x-scheme-handler/file" = [ cfg.defaults.webBrowser ];
|
"x-scheme-handler/file" = [ (desktopFileOf cfg.defaults.webBrowser) ];
|
||||||
|
|
||||||
# Torrent
|
# Torrent
|
||||||
"application/x-bittorrent" = [ "deluge.desktop" ];
|
"application/x-bittorrent" = [ "deluge.desktop" ];
|
||||||
|
|
|
@ -19,6 +19,11 @@ with lib;
|
||||||
|
|
||||||
options.nki.programs.kitty = {
|
options.nki.programs.kitty = {
|
||||||
enable = mkEnableOption "Enable kitty";
|
enable = mkEnableOption "Enable kitty";
|
||||||
|
setDefault = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "Set kitty as default terminal";
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -51,6 +56,10 @@ with lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config.linux.graphical = mkIf (cfg.enable && cfg.setDefault) {
|
||||||
|
defaults.terminal.package = cfg.package;
|
||||||
|
};
|
||||||
|
|
||||||
config.programs.kitty = mkIf cfg.enable {
|
config.programs.kitty = mkIf cfg.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,12 @@ in
|
||||||
terminal = mkOption {
|
terminal = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The command to the terminal emulator to be used";
|
description = "The command to the terminal emulator to be used";
|
||||||
default = "${config.programs.kitty.package}/bin/kitty";
|
default = lib.getExe config.linux.graphical.defaults.terminal.package;
|
||||||
};
|
};
|
||||||
browser = mkOption {
|
browser = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The command for the browser";
|
description = "The command for the browser";
|
||||||
default = "${pkgs.firefox-wayland}/bin/firefox";
|
default = lib.getExe config.linux.graphical.defaults.webBrowser.package;
|
||||||
};
|
};
|
||||||
|
|
||||||
enableLaptop = lib.mkOption {
|
enableLaptop = lib.mkOption {
|
||||||
|
@ -276,6 +276,7 @@ in
|
||||||
"${builtins.elemAt workspaces 0}" = [
|
"${builtins.elemAt workspaces 0}" = [
|
||||||
{ app_id = "^firefox$"; }
|
{ app_id = "^firefox$"; }
|
||||||
{ app_id = "^librewolf$"; }
|
{ app_id = "^librewolf$"; }
|
||||||
|
{ app_id = "^zen$"; }
|
||||||
];
|
];
|
||||||
"${builtins.elemAt workspaces 1}" = [
|
"${builtins.elemAt workspaces 1}" = [
|
||||||
{ class = "^((d|D)iscord|((A|a)rm(c|C)ord))$"; }
|
{ class = "^((d|D)iscord|((A|a)rm(c|C)ord))$"; }
|
||||||
|
|
|
@ -29,12 +29,10 @@
|
||||||
# Graphical set up
|
# Graphical set up
|
||||||
linux.graphical.type = "wayland";
|
linux.graphical.type = "wayland";
|
||||||
linux.graphical.wallpaper = ./images/wallpaper_0.png;
|
linux.graphical.wallpaper = ./images/wallpaper_0.png;
|
||||||
linux.graphical.defaults.webBrowser = "librewolf.desktop";
|
linux.graphical.defaults.webBrowser.package = pkgs.librewolf;
|
||||||
# Enable sway
|
# Enable sway
|
||||||
programs.my-sway.enable = true;
|
programs.my-sway.enable = true;
|
||||||
programs.my-sway.fontSize = 14.0;
|
programs.my-sway.fontSize = 14.0;
|
||||||
programs.my-sway.terminal = "${config.programs.kitty.package}/bin/kitty";
|
|
||||||
programs.my-sway.browser = "librewolf";
|
|
||||||
wayland.windowManager.sway.config = {
|
wayland.windowManager.sway.config = {
|
||||||
# Keyboard support
|
# Keyboard support
|
||||||
input."*".xkb_layout = "jp";
|
input."*".xkb_layout = "jp";
|
||||||
|
|
|
@ -30,12 +30,11 @@
|
||||||
linux.graphical.type = "wayland";
|
linux.graphical.type = "wayland";
|
||||||
linux.graphical.wallpaper = ./images/wallpaper_0.png;
|
linux.graphical.wallpaper = ./images/wallpaper_0.png;
|
||||||
linux.graphical.startup = with pkgs; [ zen-browser-bin thunderbird vesktop slack ];
|
linux.graphical.startup = with pkgs; [ zen-browser-bin thunderbird vesktop slack ];
|
||||||
linux.graphical.defaults.webBrowser = "zen.desktop";
|
linux.graphical.defaults.webBrowser.package = pkgs.zen-browser-bin;
|
||||||
|
linux.graphical.defaults.webBrowser.desktopFile = "zen.desktop";
|
||||||
# Enable sway
|
# Enable sway
|
||||||
programs.my-sway.enable = true;
|
programs.my-sway.enable = true;
|
||||||
programs.my-sway.fontSize = 14.0;
|
programs.my-sway.fontSize = 14.0;
|
||||||
programs.my-sway.terminal = "${config.programs.kitty.package}/bin/kitty";
|
|
||||||
programs.my-sway.browser = "librewolf";
|
|
||||||
wayland.windowManager.sway.config = {
|
wayland.windowManager.sway.config = {
|
||||||
# Keyboard support
|
# Keyboard support
|
||||||
input."*".xkb_layout = "jp";
|
input."*".xkb_layout = "jp";
|
||||||
|
|
Loading…
Reference in a new issue