b12f restructure #1

Merged
teutat3s merged 218 commits from b12f into main 2020-11-24 18:27:01 +00:00
9 changed files with 76 additions and 34 deletions
Showing only changes of commit 391749bba2 - Show all commits

View file

@ -23,9 +23,13 @@ in
}; };
}; };
config = { config = {
# disable NetworkManager-wait-online by default
systemd.services.NetworkManager-wait-online.enable = lib.mkDefault false;
networking.networkmanager = { networking.networkmanager = {
# Enable networkmanager. REMEMBER to add yourself to group in order to use nm related stuff. # Enable networkmanager. REMEMBER to add yourself to group in order to use nm related stuff.
enable = true; enable = true;
wifi.backend = "iwd";
}; };
# Customized binary caches list (with fallback to official binary cache) # Customized binary caches list (with fallback to official binary cache)

View file

@ -20,5 +20,6 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
pub-solar.core.hibernation.enable = true; pub-solar.core.hibernation.enable = true;
services.logind.lidSwitch = "hibernate";
}; };
} }

View file

@ -5,4 +5,4 @@
# https://github.com/swaywm/sway/wiki/Systemd-integration # https://github.com/swaywm/sway/wiki/Systemd-integration
# Also, import the most important environment variables into the D-Bus and systemd # Also, import the most important environment variables into the D-Bus and systemd
# user environments (e.g. required for screen sharing and Pinentry prompts): # user environments (e.g. required for screen sharing and Pinentry prompts):
exec "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target; exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemd-cat --identifier=sway sway" exec "systemctl --user import-environment; systemctl --user start sway-session.target; exec dbus-update-activation-environment --systemd $IMPORT_ENVIRONMENT_ENV_LIST DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemd-cat --identifier=sway sway"

View file

@ -5,7 +5,6 @@
Documentation = [ "man:mako(1)" ]; Documentation = [ "man:mako(1)" ];
BindsTo = [ "sway-session.target" ]; BindsTo = [ "sway-session.target" ];
After = [ "sway-session.target" ]; After = [ "sway-session.target" ];
# ConditionEnvironment requires systemd v247 to work correctly
ConditionEnvironment = [ "WAYLAND_DISPLAY" ]; ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
}; };
Service = { Service = {

View file

@ -10,18 +10,15 @@
Service = { Service = {
Type = "simple"; Type = "simple";
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin"; Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
ExecStart = ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \
if psCfg.paranoia.enable then '' after-resume 'swaymsg "output * dpms on"' \
${pkgs.swayidle}/bin/swayidle -w \ before-sleep 'swaylock-bg' '' + (if psCfg.paranoia.enable then '' \
timeout 120 'swaymsg "output * dpms off"' \ timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
timeout 150 'systemctl hibernate' \ timeout 150 'systemctl hibernate'
'' else '' '' else '' \
${pkgs.swayidle}/bin/swayidle -w \ timeout 600 'swaylock-bg'
timeout 600 'swaylock-bg' \ timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
timeout 900 'swaymsg "output * dpms off"' \ '');
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock-bg'
'';
}; };
Install = { Install = {
WantedBy = [ "sway-session.target" ]; WantedBy = [ "sway-session.target" ];

View file

@ -4,8 +4,9 @@
Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors."; Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki/"; Documentation = "https://github.com/Alexays/Waybar/wiki/";
BindsTo = [ "sway-session.target" ]; BindsTo = [ "sway-session.target" ];
After = [ "graphical-session-pre.target" "network-online.target" ]; After = [ "sway-session.target" "network-online.target" ];
Wants = [ "graphical-session-pre.target" "network-online.target" "blueman-applet.service" ]; Wants = [ "graphical-session-pre.target" "network-online.target" "blueman-applet.service" ];
ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
}; };
Service = { Service = {

View file

@ -39,21 +39,49 @@ in
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
}; };
zplug = {
enable = true;
plugins = [ plugins = [
{ {
name = "plugins/z"; # will source ohmyzsh/plugins/z/
tags = [ "from:oh-my-zsh" ]; name = "zsh-plugins-z";
file = "plugins/z/z.sh";
src = pkgs.fetchFromGitHub {
owner = "ohmyzsh";
repo = "ohmyzsh";
rev = "249c708ed3a4a7a63d16a6e911a46b6fb9623cbd";
sha256 = "sha256-NAVotL5RxpS/zKnO+ngMIjv787lqc1dj/c4blQrQcvU=";
};
} }
{ {
name = "romkatv/powerlevel10k"; name = "zsh-powerlevel10k";
tags = [ "as:theme" "depth:1" ]; file = "powerlevel10k.zsh-theme";
} src = pkgs.fetchFromGitHub {
{ name = "zdharma/fast-syntax-highlighting"; } owner = "romkatv";
{ name = "chisui/zsh-nix-shell"; } repo = "powerlevel10k";
]; rev = "2dd6a29e4d7a33bfef10973d6550e087be37ddee";
sha256 = "sha256-9vc4cMBCNOmPOyzGwnPeMrXXyQUq4pC9Du3AWl9+Rys=";
}; };
}
{
name = "zsh-fast-syntax-highlighting";
file = "F-Sy-H.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "z-shell";
repo = "F-Sy-H";
rev = "c4bdc485b67b58351a24f21fcac92c9e0232b939";
sha256 = "sha256-uXBGIdJwubuueNhQRdGxPUi0eJN17cflYAuHTjeQ8FQ=";
};
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08";
sha256 = "sha256-BjgMhILEL/qdgfno4LR64LSB8n9pC9R+gG7IQWwgyfQ=";
};
}
];
initExtra = '' initExtra = ''
bindkey -v bindkey -v

View file

@ -1,6 +1,6 @@
self: with self; '' self: with self; ''
# first import environment variables from the login manager # first import environment variables from the login manager
systemctl --user import-environment systemctl --user import-environment $IMPORT_ENVIRONMENT_ENV_LIST DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP PATH;
# then start the service # then start the service
exec systemctl --wait --user start sway.service exec systemctl --wait --user start sway.service
'' ''

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let let
psCfg = config.pub-solar; psCfg = config.pub-solar;
wlroots = psCfg.graphical.wayland; wlroots = psCfg.graphical.wayland;
@ -77,10 +77,22 @@ let
# TELEMETRY BS # TELEMETRY BS
VUEDX_TELEMETRY = "off"; VUEDX_TELEMETRY = "off";
}; };
envListNames = lib.attrsets.mapAttrsToList (name: value: name) variables;
# Here we merge an extra variable into the attrset called FULL_ENV_LIST.
# It's a list of the variable names defined above.
# We can use this to tell `systemctl import-environment` to import the full list above.
variablesWithMeta = lib.attrsets.zipAttrsWith (name: values: builtins.head values) [
variables
{ IMPORT_ENVIRONMENT_ENV_LIST = lib.lists.foldl (a: b: a + " " + b) "IMPORT_ENVIRONMENT_ENV_LIST" envListNames; }
];
in in
{ {
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
home.sessionVariables = variables; home.sessionVariables = variablesWithMeta;
systemd.user.sessionVariables = variables; systemd.user.sessionVariables = variablesWithMeta;
}; };
environment.variables = variablesWithMeta;
} }