Move colors and machinevars into modules

This commit is contained in:
Oystein Kristoffer Tveit 2022-06-21 01:47:36 +02:00
parent 2eae0e5ebf
commit 79a995e19e
27 changed files with 456 additions and 275 deletions

View File

@ -1,30 +0,0 @@
rec {
monokai = {
foreground = monokai.white;
background = monokai.black;
black = "#272822";
red = "#f92672";
green = "#a6e22e";
yellow = "#f4bf75";
blue = "#66d9ef";
magenta = "#ae81ff";
cyan = "#a1efe4";
white = "#f8f8f2";
};
paper = {
background = "#f2e3bd";
foreground = "#2f343f";
black = "#222222";
red = "#C30771";
green = "#10A778";
yellow = "#A89C14";
blue = "#008ec4";
magenta = "#523C79";
cyan = "#20A5BA";
white = "#f7f3ee";
};
default = monokai;
}

View File

@ -25,6 +25,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
vscode-server = {
url = "github:msteen/nixos-vscode-server";
flake = false;
};
# Nix expressions and keys (TODO: move keys to another solution like agenix) # Nix expressions and keys (TODO: move keys to another solution like agenix)
# which should be kept from the main repo for privacy reasons. # which should be kept from the main repo for privacy reasons.
# #
@ -36,10 +41,11 @@
}; };
}; };
outputs = { outputs = inputs@{
self, self,
nixpkgs, nixpkgs,
home-manager, home-manager,
vscode-server,
secrets, secrets,
fonts, fonts,
dotfiles, dotfiles,
@ -59,19 +65,6 @@
overlays = [ self.overlays.lib ]; overlays = [ self.overlays.lib ];
}; };
specialArgs = {
secrets = secrets.outputs.default;
colorTheme = import ./common/colors.nix;
inputs = {
inherit self;
inherit home-manager;
inherit dotfiles;
inherit fonts;
inherit website;
inherit secrets;
};
};
in { in {
overlays = { overlays = {
lib = import ./overlays/lib; lib = import ./overlays/lib;
@ -86,65 +79,45 @@
inherit system; inherit system;
inherit pkgs; inherit pkgs;
extraSpecialArgs = specialArgs // {
machineVars = {
hostname = "machine";
headless = false;
screens = 1;
gaming = true;
laptop = false;
};
};
username = "h7x4"; username = "h7x4";
homeDirectory = "/home/h7x4"; homeDirectory = "/home/h7x4";
stateVersion = "22.05"; stateVersion = "22.05";
configuration = { configuration = {
imports = [ imports = [
./home.nix ./home.nix
./modules
]; ];
machineVars = {
headless = false;
fixDisplayCommand = "echo 'not available'";
gaming = true;
development = true;
laptop = false;
};
}; };
}; };
}; };
nixosConfigurations = let nixosConfigurations = let
nixSys = name:
# String -> AttrSet -> AttrSet
nixSys = name: extraOpts: machineVars:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
inherit pkgs; inherit pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
specialArgs = specialArgs // { inherit machineVars; };
modules = [ modules = [
"${home-manager}/nixos" "${home-manager}/nixos"
./modules
./hosts/common.nix ./hosts/common.nix
./hosts/${name}/configuration.nix ./hosts/${name}/configuration.nix
"${vscode-server}/default.nix"
{ config._module.args = { inherit inputs; secrets = secrets.outputs.default; }; }
]; ];
} // extraOpts; };
in { in {
Tsuki = nixSys "tsuki" {} { Tsuki = nixSys "tsuki";
hostname = "tsuki"; Eisei = nixSys "eisei";
headless = true; kasei = nixSys "kasei";
gaming = false;
laptop = false;
};
Eisei = nixSys "eisei" {} {
hostname = "eisei";
headless = false;
screens = 1;
gaming = false;
laptop = true;
};
kasei = nixSys "kasei" {} {
hostname = "kasei";
headless = false;
screens = 2;
gaming = true;
laptop = false;
};
}; };
}; };
} }

View File

@ -1,7 +1,7 @@
{ pkgs, machineVars, inputs, ... } @ args: let { pkgs, config, inputs, ... } @ args: let
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (pkgs.lib) mkForce mkIf optionals; inherit (pkgs.lib) mkForce mkIf optionals;
graphics = !machineVars.headless; graphics = !config.machineVars.headless;
in { in {
imports = [ imports = [
./shellOptions.nix ./shellOptions.nix
@ -17,6 +17,8 @@ in {
./programs/tmux.nix ./programs/tmux.nix
./programs/zsh ./programs/zsh
./modules
inputs.secrets.outputs.nixosModule inputs.secrets.outputs.nixosModule
] ++ optionals graphics [ ] ++ optionals graphics [
./misc/mimetypes.nix ./misc/mimetypes.nix
@ -38,6 +40,8 @@ in {
./services/sxhkd.nix ./services/sxhkd.nix
]; ];
inherit (config) machineVars colors;
home = { home = {
stateVersion = "22.05"; stateVersion = "22.05";
username = "h7x4"; username = "h7x4";

View File

@ -1,14 +1,17 @@
{ pkgs, config, inputs, specialArgs, ... }: { pkgs, config, inputs, secrets, ... }:
let let
inherit (pkgs) lib; inherit (pkgs) lib;
# inherit (specialArgs) machineVars;
inherit (config) machineVars;
has_graphics = !config.machineVars.headless;
in { in {
time.timeZone = "Europe/Oslo"; time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
# nixpkgs.config = { nixpkgs.config = {
# allowUnfree = true; allowUnfree = true;
# }; };
console = { console = {
font = "Lat2-Terminus16"; font = "Lat2-Terminus16";
@ -30,7 +33,7 @@ in {
builders-use-substitutes = true builders-use-substitutes = true
''; '';
distributedBuilds = config.networking.hostname != "Tsuki"; distributedBuilds = (config.networking.hostName != "Tsuki");
binaryCaches = [ binaryCaches = [
"https://cache.nixos.org/" "https://cache.nixos.org/"
]; ];
@ -58,11 +61,11 @@ in {
VISUAL = "nvim"; VISUAL = "nvim";
}; };
systemPackages = with pkgs; [ systemPackages = with pkgs; ([
wget wget
] + lib.optionals (!machineVars.headless) [ ] ++ (lib.optionals (!machineVars.headless) [
haskellPackages.xmobar haskellPackages.xmobar
]; ]));
shells = with pkgs; [ shells = with pkgs; [
bashInteractive bashInteractive
@ -101,6 +104,8 @@ in {
fonts = { fonts = {
enableDefaultFonts = true; enableDefaultFonts = true;
fontDir.enable = true;
fonts = with pkgs; [ fonts = with pkgs; [
cm_unicode cm_unicode
dejavu_fonts dejavu_fonts
@ -154,18 +159,19 @@ in {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
extraSpecialArgs = specialArgs; extraSpecialArgs = { inherit inputs; inherit secrets; };
# TODO: figure out why specialArgs isn't accessible from the root home file. # TODO: figure out why specialArgs isn't accessible from the root home file.
users.h7x4 = import ../home.nix { users.h7x4 = import ../home.nix {
inherit pkgs; inherit pkgs;
inherit (specialArgs) machineVars inputs; inherit inputs;
inherit config;
}; };
}; };
services = { services = {
tumbler.enable = !machineVars.headless; tumbler.enable = !config.machineVars.headless;
gnome.gnome-keyring.enable = !machineVars.headless; gnome.gnome-keyring.enable = !config.machineVars.headless;
openssh = { openssh = {
# enable = true; # enable = true;
@ -175,7 +181,7 @@ in {
}; };
dbus = { dbus = {
enable = !machineVars.headless; # enable = !machineVars.headless;
packages = with pkgs; [ packages = with pkgs; [
gcr gcr
dconf dconf
@ -183,7 +189,17 @@ in {
}; };
xserver = { xserver = {
enable = !machineVars.headless; # TODO: What is going on here?
# For some reason, this leads to infinite recursion.
# This needs to be fixed!
# Same with `displayManager.lightdm.enable`
# options are defined in each hosts config file for the time being.
#
# I have a hypothesis that there are some asserts within xserver that
# makes it so that other software can not be activated at the same time
# and that those asserts triggers some kind of evaluation chain that
# recurses infinitely.
# enable = !config.machineVars.headless;
layout = "us"; layout = "us";
xkbOptions = "caps:escape"; xkbOptions = "caps:escape";
@ -194,7 +210,7 @@ in {
desktopManager = { desktopManager = {
xterm.enable = false; xterm.enable = false;
xfce.enable = true; xfce.enable = !config.machineVars.headless;
}; };
windowManager.xmonad = { windowManager.xmonad = {
@ -204,16 +220,16 @@ in {
# displayManager.startx.enable = true; # displayManager.startx.enable = true;
# displayManager.gdm.enable = true; # displayManager.gdm.enable = true;
displayManager.lightdm.enable = true; # displayManager.lightdm.enable = !config.machineVars.headless;
displayManager.defaultSession = "none+xmonad"; displayManager.defaultSession = "none+xmonad";
}; };
}; };
programs = { programs = {
dconf.enable = !machineVars.headless; dconf.enable = !config.machineVars.headless;
git.enable = true; git.enable = true;
light.enable = !machineVars.headless; light.enable = !config.machineVars.headless;
npm.enable = true; npm.enable = true;
tmux.enable = true; tmux.enable = true;
@ -252,12 +268,63 @@ in {
}; };
}; };
environment.shellAliases.fixDisplay = let
inherit (config.machineVars) screens headless fixDisplayCommand;
screenToArgs = screen: with screen;
"--output ${name} --mode ${resolution}"
+ (lib.optionalString (frequency != null) " --rate ${frequency}");
screenArgs = lib.concatStringsSep " " (lib.mapAttrsToList screenToArgs screens);
in lib.mkIf (!headless)
(lib.mkMerge [
"xrandr ${screenArgs}"
(lib.mkIf (fixDisplayCommand != null) fixDisplayCommand)
]);
system.extraDependencies =
lib.optionals (config.machineVars.development) (with pkgs; [
asciidoc
asciidoctor
cabal2nix
clang
dart
dotnet-sdk
dotnet-sdk_3
dotnet-sdk_5
dotnetPackages.Nuget
elm2nix
elmPackages.elm
flutter
gcc
ghc
ghcid
haskellPackages.Cabal_3_6_3_0
maven
nixfmt
nixpkgs-fmt
# nixpkgs-hammering
nodePackages.node2nix
nodePackages.npm
nodePackages.sass
nodePackages.typescript
nodePackages.yarn
nodejs
plantuml
python3
rustc
rustc
rustup
sqlcheck
sqlint
sqlite
sqlite-web
]);
sound = { sound = {
enable = !machineVars.headless; enable = !config.machineVars.headless;
mediaKeys.enable = true; mediaKeys.enable = true;
}; };
hardware.pulseaudio.enable = !machineVars.headless; hardware.pulseaudio.enable = !config.machineVars.headless;
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
Defaults lecture = always Defaults lecture = always

View File

@ -6,9 +6,27 @@
in { in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../pluggables/tools/programming.nix
]; ];
# TODO: See ../common.nix
services.xserver.enable = true;
services.xserver.displayManager.lightdm.enable = true;
machineVars = {
gaming = true;
creative = true;
development = true;
headless = false;
laptop = true;
screens = {
"eDP-1" = {
resolution = "1920x1080";
};
};
};
systemd.targets = { systemd.targets = {
sleep.enable = false; sleep.enable = false;
suspend.enable = false; suspend.enable = false;

View File

@ -2,9 +2,12 @@
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../pluggables/tools/programming.nix
]; ];
# TODO: See ../common.nix
services.xserver.enable = true;
services.xserver.displayManager.lightdm.enable = true;
systemd.targets = { systemd.targets = {
sleep.enable = false; sleep.enable = false;
suspend.enable = false; suspend.enable = false;

View File

@ -1,29 +1,36 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = imports = [
[
./hardware-configuration.nix ./hardware-configuration.nix
../../pluggables/tools/programming.nix # ./services/calibre.nix
./services/nginx.nix
# ./services/dokuwiki.nix # ./services/dokuwiki.nix
./services/gitea
# ./services/gitlab # ./services/gitlab
./services/gitea ./services/grafana.nix
./services/hydra.nix
./services/jitsi.nix ./services/jitsi.nix
# ./services/keycloak.nix
# ./services/libvirt.nix
./services/matrix.nix
./services/nginx.nix
# ./services/openldap.nix # ./services/openldap.nix
./services/plex.nix
./services/hydra.nix
./services/matrix.nix
# ./services/libvirt.nix
./services/grafana.nix
# ./services/calibre.nix
./services/openvpn.nix ./services/openvpn.nix
./services/plex.nix
# ./services/samba.nix # ./services/samba.nix
./services/searx.nix ./services/searx.nix
# ./services/syncthing.nix # ./services/syncthing.nix
./services/vscode-server.nix
]; ];
# TODO: See ../common.nix
services.xserver.enable = false;
services.xserver.displayManager.lightdm.enable = false;
machineVars = {
headless = true;
};
systemd.targets = { systemd.targets = {
sleep.enable = false; sleep.enable = false;
suspend.enable = false; suspend.enable = false;

View File

@ -0,0 +1,9 @@
{ }:
{
services.keycloak = {
enable = true;
database = {
type = "postgresql";
};
};
}

View File

@ -21,7 +21,10 @@
listeners = [ listeners = [
{ {
port = secrets.ports.matrix.listener; port = secrets.ports.matrix.listener;
bind_address = "::1"; bind_addresses = [
"0.0.0.0"
"::1"
];
type = "http"; type = "http";
tls = false; tls = false;
x_forwarded = true; x_forwarded = true;
@ -58,7 +61,7 @@
}; };
}; };
services.redis.enable = true; # services.redis.enable = true;
services.mx-puppet-discord = { services.mx-puppet-discord = {
enable = true; enable = true;

View File

@ -0,0 +1,17 @@
{ config, pkgs, lib, secrets, ... }: {
services.postgresql = {
enable = true;
# port = secrets.ports.postgres
# dataDir =
# settings = {};
};
services.pgadmin = {
enable = true;
openFirewall = true;
# port = secrets.ports.pgadmin
# settings = {
# };
};
}

View File

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
(fetchTarball "https://github.com/msteen/nixos-vscode-server/tarball/master")
];
services.vscode-server.enable = true;
}

72
modules/colors.nix Normal file
View File

@ -0,0 +1,72 @@
{ pkgs, lib, config, ... }:
let
cfg = config.colors;
inherit (lib) types mkOption;
in {
options.colors = let
colorType = types.str;
mkColorOption = mkOption {
# name =
type = colorType;
};
colorSetType = types.submodule ({ name, ... }: {
name = mkOption {
type = types.str;
default = name;
};
foreground = mkColorOption;
background = mkColorOption;
black = mkColorOption;
red = mkColorOption;
green = mkColorOption;
yellow = mkColorOption;
blue = mkColorOption;
magenta = mkColorOption;
cyan = mkColorOption;
white = mkColorOption;
});
in {
colorSets = mkOption {
type = types.attrsof colorSetType;
};
defaultColorSet = mkOption {
description = "the default color to use for applications";
type = colorSetType;
default = cfg.color.colorSets.monokai;
};
};
config = {
colors.colorSets = {
monokai = rec {
foreground = white;
background = black;
black = "#272822";
red = "#f92672";
green = "#a6e22e";
yellow = "#f4bf75";
blue = "#66d9ef";
magenta = "#ae81ff";
cyan = "#a1efe4";
white = "#f8f8f2";
};
paper = {
background = "#f2e3bd";
foreground = "#2f343f";
black = "#222222";
red = "#C30771";
green = "#10A778";
yellow = "#A89C14";
blue = "#008ec4";
magenta = "#523C79";
cyan = "#20A5BA";
white = "#f7f3ee";
};
};
};
}

7
modules/default.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./colors.nix
./machineVars.nix
];
}

72
modules/machineVars.nix Normal file
View File

@ -0,0 +1,72 @@
{ pkgs, config, ... }:
let
inherit (pkgs) lib;
inherit (lib) types mkEnableOption mkOption mkIf;
cfg = config.machineVars;
in {
options.machineVars = {
headless = mkEnableOption "Whether or not the machine should have graphical output.";
screens = mkOption {
type = types.attrsOf (types.submodule ( { name, ...}: {
options = {
resolution = mkOption {
type = types.str;
example = "1920x1080";
description = "The resolution of the screen";
};
name = mkOption {
type = types.str;
default = name;
example = "DP-1";
description = "The name of the screen";
};
freq = mkOption {
type = types.nullOr types.str;
example = "60.00";
description = "The update frequency of the screen, defined in Hz";
};
};
}));
default = { };
description = "A detailed description of the machines screens.";
};
gaming = mkEnableOption "Whether or not the machine should have gaming software installed.";
development = mkEnableOption "Whether or not the machine should come with developmen
t tools preinstalled.";
creative = mkEnableOption "Whether or not the machine should have creative software
(music, video and image editing) installed.";
laptop = mkEnableOption "Whether the machine is a laptop";
fixDisplayCommand = mkOption {
type = types.nullOr types.str;
default = null;
};
};
config = {
assertions = [
{
assertion = cfg.headless -> !cfg.creative;
message = "A headless machine can't have creative software installed.";
}
{
assertion = cfg.headless -> !cfg.gaming;
message = "A headless machine can't have gaming software installed.";
}
{
assertion = cfg.headless -> (cfg.screens == { } && cfg.fixDisplayCommand == null);
message = "A headless machine can't have any screens.";
}
];
warnings = lib.optionals (0 < (lib.length (builtins.attrNames cfg.screens)) && (cfg.fixDisplayCommand != null)) [
"You are overriding the fixDisplayCommand even though machineVars.screens is defined. One of these should be omitted"
];
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, machineVars, ... }: { pkgs, config, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
asciidoctor asciidoctor
@ -51,13 +51,14 @@
mmv mmv
mps-youtube mps-youtube
mtr mtr
navi
neofetch neofetch
nix-diff nix-diff
nix-index nix-index
nix-output-monitor nix-output-monitor
nix-tree nix-tree
nix-zsh-completions nix-zsh-completions
nixops # nixops
nmap nmap
ouch ouch
pandoc pandoc
@ -86,6 +87,8 @@
wavemon wavemon
wiki-tui wiki-tui
youtube-dl youtube-dl
yq
zip
# Needed for VSCode liveshare # Needed for VSCode liveshare
desktop-file-utils desktop-file-utils
@ -94,76 +97,74 @@
icu icu
openssl openssl
xorg.xprop xorg.xprop
] ++ ( ] ++ lib.optionals (!config.machineVars.headless) [
lib.optionals (!machineVars.headless) [ ahoviewer
ahoviewer anki
anki audacity
audacity calibre
calibre cool-retro-term
cool-retro-term copyq
copyq darktable
darktable discord
discord element-desktop
element-desktop fcitx
fcitx geogebra
geogebra gnome.gnome-font-viewer
gnome.gnome-font-viewer google-chrome
google-chrome inkscape
inkscape insomnia
insomnia iwgtk
iwgtk kid3
kid3 koreader
koreader krita
krita ktouch
ktouch libreoffice-fresh
libreoffice-fresh light
light maim
maim mopidy
mopidy mopidy-mpd
mopidy-mpd mopidy-soundcloud
mopidy-soundcloud mopidy-spotify
mopidy-spotify mopidy-youtube
mopidy-youtube mpc_cli
mpc_cli nyxt
nyxt pulseaudio
pulseaudio pulsemixer
pulsemixer scrcpy
scrcpy shellcheck
shellcheck slack
slack sublime3
sublime3 sxiv
sxiv tagainijisho
tagainijisho teams
teams tenacity
tenacity transcribe
transcribe wireshark
wireshark xcalib
xcalib xclip
xclip xdotool
xdotool xfce.thunar
xfce.thunar xfce.thunar-archive-plugin
xfce.thunar-archive-plugin xfce.thunar-dropbox-plugin
xfce.thunar-dropbox-plugin xfce.thunar-media-tags-plugin
xfce.thunar-media-tags-plugin xfce.thunar-volman
xfce.thunar-volman # xsnow # Wait until christmas
# xsnow # Wait until christmas yuzu-mainline
yuzu-mainline zeal
zeal zoom-us
zoom-us zotero
zotero ] ++ lib.optionals (config.machineVars.laptop) [
] ++ lib.optionals (machineVars.laptop) [ touchegg
touchegg ] ++ lib.optionals (config.machineVars.gaming) [
] ++ lib.optionals (machineVars.gaming) [ citra
citra desmume
desmume minecraft
minecraft osu-lazer
osu-lazer retroarchFull
retroarchFull steam
steam steam-tui
steam-tui stepmania
stepmania taisei
taisei ];
]
);
} }

View File

@ -1,26 +0,0 @@
{ pkgs }:
{
services.deluge = {
enable = true;
user = "h7x4";
# https://git.deluge-torrent.org/deluge/tree/deluge/core/preferencesmanager.py#n41
# config = {
# download_location = "";
# share_ratio_limit = "";
# daemon_port = "";
# listen_ports = "";
# };
openFirewall = true;
# authFile =
declarative = true;
web = {
enable = true;
# port =
openFirewall = true;
};
};
}

View File

@ -1,41 +0,0 @@
{ pkgs, ... }:
{
system.extraDependencies = with pkgs; [
asciidoc
asciidoctor
cabal2nix
clang
dart
dotnet-sdk
dotnet-sdk_3
dotnet-sdk_5
dotnetPackages.Nuget
elm2nix
elmPackages.elm
flutter
gcc
ghc
ghcid
haskellPackages.Cabal_3_6_2_0
maven
nixfmt
nixpkgs-fmt
# nixpkgs-hammering
nodePackages.node2nix
nodePackages.npm
nodePackages.sass
nodePackages.typescript
nodePackages.yarn
nodejs
plantuml
python3
rustc
rustc
rustup
sqlcheck
sqlint
sqlite
sqlite-web
];
}

View File

@ -1,4 +1,4 @@
{ lib, pkgs, colorTheme, ... }: { pkgs, lib, config, ... }:
{ {
programs.alacritty = { programs.alacritty = {
enable = true; enable = true;
@ -22,10 +22,10 @@
primaryColors = [ "foreground" "background" ]; primaryColors = [ "foreground" "background" ];
in in
{ {
primary = getAttrs primaryColors colorTheme.default; primary = getAttrs primaryColors config.colors.defaultColorSet;
normal = let normal = let
removePrimaryColorAttrs = n: v: !(any (pc: n ? pc) primaryColors); removePrimaryColorAttrs = n: v: !(any (pc: n ? pc) primaryColors);
in filterAttrs removePrimaryColorAttrs colorTheme.default; in filterAttrs removePrimaryColorAttrs config.colors.defaultColorSet;
}; };
background_opacity = 1.0; background_opacity = 1.0;

View File

@ -1,13 +1,36 @@
{ pkgs, colorTheme, ... }: let { pkgs, config, ... }: let
inherit (pkgs) lib; inherit (pkgs) lib;
in { in {
programs.xmobar = let programs.xmobar = let
networkCard = "wlp2s0f0u7u4"; networkCard = "wlp2s0f0u7u4";
disks = [ disks = [
"/" "/"
"/data" "/data"
"/data/disks/data2" "/data/disks/data2"
]; ];
mpd_status_script = pkgs.writeShellScript "mpd-status" ''
MPD_STATUS=$(${pkgs.mpc}/bin/mpc 2>/dev/null | sed -n '2{p;q}' | cut -d ' ' -f1)
case "$MPD_STATUS" in
"[playing]")
echo "<fn=2><fc=#00ff00></fc></fn>"
# echo "[<fn=2><fc=#00ff00>行</fc></fn>]"
exit 0
;;
"[paused]")
echo "<fn=2><fc=#ff0000></fc></fn>"
# echo "[<fn=1><fc=#ff0000>止</fc></fn>]"
exit 0
;;
*)
echo "<fn=2><fc=#AA0000></fc></fn>"
# echo "[<fn=1><fc=#AA0000>無</fc></fn>]"
exit 0
;;
esac
'';
in { in {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
@ -22,7 +45,7 @@ in {
] ]
, borderColor = "black" , borderColor = "black"
, border = TopB , border = TopB
, bgColor = "#272822" , bgColor = "${config.colors.defaultColorSet.background}"
, fgColor = "grey" , fgColor = "grey"
, alpha = 255 , alpha = 255
, position = Static { xpos = 0 , ypos = 0, width = 1920, height = 40 } , position = Static { xpos = 0 , ypos = 0, width = 1920, height = 40 }
@ -48,7 +71,7 @@ in {
Run Memory ["-t","<usedratio>%"] 10, Run Memory ["-t","<usedratio>%"] 10,
Run Swap ["-t", "<usedratio>%"] 100, Run Swap ["-t", "<usedratio>%"] 100,
Run Date "%a %_d %b - %H:%M - W%W" "date" 10, Run Date "%a %_d %b - %H:%M - W%W" "date" 10,
Run Com "${./scripts/mpd_status.sh}" [] "mpc" 10, Run Com "${mpd_status_script}" [] "mpc" 10,
-- Run Com "${./scripts/wireless.sh}" [] "wi" 100, -- Run Com "${./scripts/wireless.sh}" [] "wi" 100,
Run Com "${./scripts/volume.py}" [] "vol" 10, Run Com "${./scripts/volume.py}" [] "vol" 10,
Run UnsafeStdinReader, Run UnsafeStdinReader,

View File

@ -1,4 +1,4 @@
{ colorTheme, ... }: { config, ... }:
{ {
services.stalonetray = { services.stalonetray = {
enable = true; enable = true;
@ -7,7 +7,7 @@
transparent = false; transparent = false;
dockapp_mode = "none"; dockapp_mode = "none";
geometry = "8x1-0+0"; geometry = "8x1-0+0";
background = colorTheme.default.background; background = config.colors.defaultColorSet.background;
kludges = "force_icons_size"; kludges = "force_icons_size";
grow_gravity = "NW"; grow_gravity = "NW";
icon_gravity = "NW"; icon_gravity = "NW";

View File

@ -1,4 +1,4 @@
{ pkgs, config, machineVars, ... }: let { pkgs, config, ... }: let
# FIXME: lib should be imported directly as a module argument. # FIXME: lib should be imported directly as a module argument.
inherit (pkgs) lib; inherit (pkgs) lib;
@ -141,6 +141,7 @@ in rec {
hms = "home-manager switch"; hms = "home-manager switch";
nxr = "sudo nixos-rebuild switch"; nxr = "sudo nixos-rebuild switch";
nxp = "nix-shell -p ";
nxc = "sudoedit /etc/nixos/configuration.nix"; nxc = "sudoedit /etc/nixos/configuration.nix";
nxh = "vim ~/.config/nixpkgs/home.nix"; nxh = "vim ~/.config/nixpkgs/home.nix";
@ -262,13 +263,6 @@ in rec {
view-latex = "${texlive.combined.scheme-full}/bin/latexmk -pdf -pvc main.tex"; view-latex = "${texlive.combined.scheme-full}/bin/latexmk -pdf -pvc main.tex";
reload-tmux = "${tmux}/bin/tmux source $HOME/.config/tmux/tmux.conf"; reload-tmux = "${tmux}/bin/tmux source $HOME/.config/tmux/tmux.conf";
fixdisplay = let
commands = {
"kasei" = "xrandr --output DVI-I-1 --mode 1920x1080 --pos 1920x0 -r 60 --primary --output DP-3 --mode 1920x1080 --pos 0x0 -r 144";
};
in
if commands ? ${machineVars.hostname} then commands.${machineVars.hostname} else "echo \"fixdisplay not defined for this hostname\"";
}; };
# ░█▀▀░█▀▀░█▀█░█▀▀░█▀▄░█▀█░▀█▀░█▀▀░█▀▄ # ░█▀▀░█▀▀░█▀█░█▀▀░█▀▄░█▀█░▀█▀░█▀▀░█▀▄