feat: add isGraphical target option
This commit is contained in:
parent
4ac4130f5e
commit
d9cbfc07dc
18 changed files with 546 additions and 498 deletions
|
@ -31,16 +31,19 @@
|
|||
system = "aarch64-darwin";
|
||||
username = "winston";
|
||||
extraModules = [inputs.nekowinston-nur.darwinModules.default];
|
||||
isGraphical = true;
|
||||
}
|
||||
{
|
||||
host = "futomaki";
|
||||
system = "x86_64-linux";
|
||||
username = "winston";
|
||||
isGraphical = true;
|
||||
}
|
||||
{
|
||||
host = "bento";
|
||||
system = "x86_64-linux";
|
||||
username = "w";
|
||||
isGraphical = true;
|
||||
}
|
||||
];
|
||||
imports = [inputs.pre-commit-hooks.flakeModule];
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isLinux;
|
||||
inherit (pkgs.stdenv) isLinux;
|
||||
in {
|
||||
config = lib.mkIf config.isGraphical {
|
||||
programs.chromium = {
|
||||
enable = true;
|
||||
enable = isLinux;
|
||||
package = pkgs.ungoogled-chromium;
|
||||
};
|
||||
|
||||
|
@ -152,9 +154,11 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = lib.mkIf isLinux [
|
||||
pkgs.nekowinston-nur.sizzy
|
||||
];
|
||||
|
||||
xdg.mimeApps.defaultApplications = {
|
||||
"text/html" = "chromium.desktop";
|
||||
"x-scheme-handler/http" = "chromium.desktop";
|
||||
|
@ -162,4 +166,5 @@ in {
|
|||
"x-scheme-handler/about" = "chromium.desktop";
|
||||
"x-scheme-handler/unknown" = "chromium.desktop";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
# TODO: de-duplicate across modules
|
||||
lat = 48.210033;
|
||||
lng = 16.363449;
|
||||
inherit (pkgs.stdenv) isLinux;
|
||||
inherit (pkgs.stdenv) isDarwin isLinux;
|
||||
in {
|
||||
config = lib.mkIf config.isGraphical {
|
||||
home.packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "dark-mode-ternary";
|
||||
runtimeInputs = [pkgs.gnugrep];
|
||||
text = let
|
||||
queryCommand =
|
||||
if pkgs.stdenv.isLinux
|
||||
if isLinux
|
||||
then "dbus-send --session --print-reply=literal --reply-timeout=5 --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' | grep -q 'uint32 1'"
|
||||
else if pkgs.stdenv.isDarwin
|
||||
else if isDarwin
|
||||
then "defaults read -g AppleInterfaceStyle &>/dev/null"
|
||||
else throw "Unsupported platform";
|
||||
in ''
|
||||
|
@ -55,4 +57,5 @@ in {
|
|||
};
|
||||
|
||||
programs.zsh.shellAliases.cat = "bat --theme=$(dark-mode-ternary 'Catppuccin-mocha' 'Catppuccin-latte')";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./browsers.nix
|
||||
./colorscheme-sync.nix
|
||||
|
@ -18,4 +22,10 @@
|
|||
./wezterm.nix
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
options.isGraphical = lib.mkOption {
|
||||
default = osConfig.isGraphical;
|
||||
description = "Whether the system is a graphical target";
|
||||
type = lib.types.bool;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (pkgs.stdenv) isDarwin isLinux;
|
||||
in {
|
||||
config = lib.mkIf config.isGraphical {
|
||||
home.packages = with pkgs; [
|
||||
(discord.override {
|
||||
withOpenASAR = true;
|
||||
|
@ -73,4 +74,5 @@ in {
|
|||
mkdir -p "$(dirname "${path}")"
|
||||
cp -f "${json}" "${path}"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: {
|
||||
config = lib.mkIf config.isGraphical {
|
||||
home.activation = {
|
||||
installCustomFonts = let
|
||||
fontDirectory =
|
||||
|
@ -24,4 +25,5 @@
|
|||
ibm-plex
|
||||
xkcd-font
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{pkgs, ...}: let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isLinux isDarwin;
|
||||
key = "0x0B89BC45007EE9CC";
|
||||
mailvelopeConfig = builtins.toJSON {
|
||||
|
@ -97,6 +101,9 @@ in {
|
|||
enable = isLinux;
|
||||
enableExtraSocket = true;
|
||||
enableSshSupport = true;
|
||||
pinentryFlavor = "gnome3";
|
||||
pinentryFlavor =
|
||||
if config.isGraphical
|
||||
then "gnome3"
|
||||
else "curses";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,14 +4,16 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv) isLinux;
|
||||
themeDir = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}";
|
||||
in {
|
||||
home.pointerCursor = lib.mkIf isLinux {
|
||||
config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux) {
|
||||
home.pointerCursor = {
|
||||
name = "macOS-Monterey";
|
||||
package = pkgs.nur.repos.nekowinston.apple-cursor;
|
||||
size = 24;
|
||||
};
|
||||
gtk = lib.mkIf isLinux {
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
iconTheme = {
|
||||
name = "Papirus-Dark";
|
||||
|
@ -43,10 +45,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
xdg = let
|
||||
themeDir = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}";
|
||||
in
|
||||
lib.mkIf config.gtk.enable {
|
||||
xdg = {
|
||||
configFile."gtk-4.0/assets" = {
|
||||
source = "${themeDir}/gtk-4.0/assets";
|
||||
recursive = true;
|
||||
|
@ -54,4 +53,5 @@ in {
|
|||
configFile."gtk-4.0/gtk.css".source = "${themeDir}/gtk-4.0/gtk.css";
|
||||
configFile."gtk-4.0/gtk-dark.css".source = "${themeDir}/gtk-4.0/gtk-dark.css";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||
in {
|
||||
programs.imv = {
|
||||
enable = isLinux;
|
||||
};
|
||||
config = lib.mkIf config.isGraphical {
|
||||
programs.imv.enable = isLinux;
|
||||
programs.mpv.enable = isLinux;
|
||||
programs.zathura.enable = isLinux;
|
||||
|
||||
|
@ -24,4 +24,5 @@ in {
|
|||
"video/mp4" = "mpv.desktop";
|
||||
"video/webm" = "mpv.desktop";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
|
@ -13,6 +14,7 @@
|
|||
mauve = "#cba6f7";
|
||||
};
|
||||
in {
|
||||
config = lib.mkIf config.isGraphical {
|
||||
programs.i3status-rust = lib.mkIf isLinux {
|
||||
enable = true;
|
||||
bars.top = {
|
||||
|
@ -124,4 +126,5 @@ in {
|
|||
ring-wrong-color = "f38ba8";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isLinux;
|
||||
fonts = {
|
||||
names = ["IBM Plex Sans" "Symbols Nerd Font"];
|
||||
size = 12.0;
|
||||
|
@ -21,9 +20,10 @@
|
|||
lat = 48.210033;
|
||||
lng = 16.363449;
|
||||
in {
|
||||
config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux) {
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
home = lib.mkIf isLinux {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
blueberry
|
||||
kooha
|
||||
|
@ -35,7 +35,7 @@ in {
|
|||
];
|
||||
};
|
||||
|
||||
services = lib.mkIf isLinux {
|
||||
services = {
|
||||
clipman.enable = true;
|
||||
gnome-keyring = {
|
||||
enable = true;
|
||||
|
@ -51,8 +51,7 @@ in {
|
|||
|
||||
wayland.windowManager.sway = let
|
||||
modifier = "Mod4";
|
||||
in
|
||||
lib.mkIf isLinux {
|
||||
in {
|
||||
enable = true;
|
||||
package = null;
|
||||
config = rec {
|
||||
|
@ -350,4 +349,5 @@ in {
|
|||
xdgAutostart = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
keybindingsJSON = config.lib.file.mkOutOfStoreSymlink "${flakePath}/home/apps/vscode/keybindings.json";
|
||||
in {
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
enable = config.isGraphical;
|
||||
extensions = with pkgs.vscode-marketplace; [
|
||||
pkgs.vscode-extensions.valentjn.vscode-ltex
|
||||
adrianwilczynski.alpine-js-intellisense
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
{
|
||||
config,
|
||||
flakePath,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
mkSymlink = path: config.lib.file.mkOutOfStoreSymlink "${flakePath}/home/apps/wezterm/${path}";
|
||||
in {
|
||||
# use the GUI version & config when we have a gui, else just get terminfo
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (!config.isGraphical) {
|
||||
home.packages = [pkgs.wezterm.terminfo];
|
||||
})
|
||||
|
||||
(lib.mkIf config.isGraphical {
|
||||
programs.wezterm.enable = true;
|
||||
|
||||
xdg.configFile = {
|
||||
|
@ -34,4 +42,6 @@ in {
|
|||
source ${config.programs.wezterm.package}/etc/profile.d/wezterm.sh
|
||||
fi
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ in {
|
|||
wakatime
|
||||
watchexec
|
||||
]
|
||||
++ lib.optionals isLinux [
|
||||
++ lib.optionals (config.isGraphical && isLinux) [
|
||||
_1password-gui
|
||||
nekowinston-nur.uhk-agent
|
||||
]);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
then "/Users/${username}"
|
||||
else throw "Unsupported system";
|
||||
home.username = username;
|
||||
isGraphical = false;
|
||||
targets.genericLinux.enable = isLinux;
|
||||
xdg.mime.enable = isLinux;
|
||||
};
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
then "/home"
|
||||
else throw "Unsupported OS";
|
||||
in {
|
||||
users.users."${config.dotfiles.username}" =
|
||||
users.users."${config.lib.dotfiles.username}" =
|
||||
{
|
||||
home = "${homeRoot}/${config.dotfiles.username}";
|
||||
home = "${homeRoot}/${config.lib.dotfiles.username}";
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILm0O46zW/XfVOSwz0okRWYeOAg+wCVkCtCAoVTpZsOh"];
|
||||
shell = pkgs.zsh;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
virtualisation.podman.enable = true;
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
users.users."${config.dotfiles.username}".extraGroups = ["libvirtd" "transmission"];
|
||||
users.users."${config.lib.dotfiles.username}".extraGroups = ["libvirtd" "transmission"];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
cabextract
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
host,
|
||||
system,
|
||||
username,
|
||||
isGraphical ? false,
|
||||
extraModules ? [],
|
||||
}: let
|
||||
ldTernary = l: d:
|
||||
|
@ -46,11 +47,11 @@
|
|||
modules = with inputs;
|
||||
[
|
||||
{
|
||||
options.dotfiles.username = with pkgs.lib;
|
||||
mkOption {
|
||||
description = "Main user of this configuration.";
|
||||
type = types.str;
|
||||
default = username;
|
||||
config.lib.dotfiles = {inherit username;};
|
||||
options.isGraphical = pkgs.lib.mkOption {
|
||||
type = pkgs.lib.types.bool;
|
||||
default = isGraphical;
|
||||
description = "Whether the system is a isGraphical target";
|
||||
};
|
||||
}
|
||||
./common/shared
|
||||
|
|
Loading…
Reference in a new issue