1
1
Fork 0

Compare commits

...

4 commits

Author SHA1 Message Date
534097ff53
waybar/swaync: disable border
Signed-off-by: Myned <dev@bjork.tech>
2024-12-23 14:46:33 -05:00
4bf206e533
niri: modify config
Signed-off-by: Myned <dev@bjork.tech>
2024-12-23 14:46:12 -05:00
7544c8bc18
custom: increase rounding
Signed-off-by: Myned <dev@bjork.tech>
2024-12-23 14:45:57 -05:00
5a7d93217e
security: separate sudo/polkit into modules
Signed-off-by: Myned <dev@bjork.tech>
2024-12-23 14:45:36 -05:00
11 changed files with 101 additions and 56 deletions

View file

@ -33,7 +33,7 @@ in {
gap = mkOption {default = 15;};
padding = mkOption {default = 51;}; # ?? journalctl --user -u waybar.service | grep height:
rounding = mkOption {default = 10;};
rounding = mkOption {default = 15;};
### Misc
wallpaper = mkOption {default = false;};

View file

@ -10,6 +10,7 @@ with lib; let
in {
options.custom.desktops.niri = {
enable = mkOption {default = false;};
polkit = mkOption {default = false;};
xwayland = mkOption {default = true;};
};
@ -34,7 +35,7 @@ in {
#!! Disabled bundled KDE polkit agent
# https://github.com/sodiboo/niri-flake?tab=readme-ov-file#additional-notes
systemd.user.services.niri-flake-polkit.enable = false;
systemd.user.services.niri-flake-polkit.enable = cfg.polkit;
# Enable rootless Xwayland
custom.services.xwayland-satellite.enable = cfg.xwayland;

View file

@ -27,7 +27,6 @@ in {
preset-column-widths = [
{proportion = 0.5;}
{proportion = 0.3;}
{proportion = 1.0;}
{proportion = 0.7;} # Default
];
@ -44,7 +43,7 @@ in {
enable = true;
width = config.custom.border;
active.color = "#d33682";
inactive.color = "#586e75";
inactive.color = "#00000000";
};
focus-ring.enable = false;

View file

@ -28,7 +28,7 @@ in {
};
hotkey-overlay.skip-at-startup = true;
prefer-no-csd = true; # Electron windows have odd borders otherwise
prefer-no-csd = true;
# https://github.com/YaLTeR/niri/wiki/Configuration:-Switch-Events
switch-events = {

View file

@ -17,7 +17,9 @@ with lib; {
nh.enable = true;
nix-index.enable = true;
nushell.enable = true;
polkit.enable = true;
ssh.enable = true;
sudo.enable = true;
tmux.enable = true;
})

View file

@ -0,0 +1,52 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
polkit-gnome-authentication-agent-1 = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
cfg = config.custom.programs.polkit;
in {
options.custom.programs.polkit = {
enable = mkOption {default = false;};
agent = mkOption {default = true;};
bypass = mkOption {default = false;};
};
config = mkIf cfg.enable {
# https://wiki.nixos.org/wiki/Polkit
#?? pkexec echo
security.polkit = {
enable = true;
# https://wiki.archlinux.org/title/Polkit#Bypass_password_prompt
extraConfig = mkIf cfg.bypass ''
polkit.addRule(function(action, subject) {
if (subject.isInGroup("wheel")) { return polkit.Result.YES; }
});
'';
};
# https://wiki.nixos.org/wiki/Polkit#Authentication_agents
systemd.user.services.polkit-gnome-authentication-agent-1 = mkIf cfg.agent {
enable = true;
wantedBy = ["graphical-session.target"];
unitConfig = {
Description = "polkit-gnome-authentication-agent-1";
After = ["graphical-session.target"];
Wants = ["graphical-session.target"];
};
serviceConfig = {
Type = "simple";
ExecStart = polkit-gnome-authentication-agent-1;
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
}

View file

@ -0,0 +1,40 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.custom.programs.sudo;
in {
options.custom.programs.sudo = {
enable = mkOption {default = false;};
bypass = mkOption {default = true;};
confirm = mkOption {default = true;};
};
config = mkIf cfg.enable {
# https://wiki.nixos.org/wiki/Sudo
#?? sudo echo
security.sudo = {
enable = true;
wheelNeedsPassword = !cfg.bypass;
};
environment.shellAliases = mkIf cfg.confirm {
# Interactive confirmation prompt
sudo = pkgs.writeShellScript "sudo" ''
read -p "Execute as root? [Y/n] "
case "$REPLY" in
"" | [Yy])
command sudo "$@"
;;
*)
exit 1
;;
esac
'';
};
};
}

View file

@ -42,7 +42,7 @@ tooltip label {
.horizontal > box {
background: #002b36;
border: 2px #586e75 solid;
/* border: 2px #586e75 solid; */
padding: 4px;
}

View file

@ -43,7 +43,7 @@ https://github.com/ErikReider/SwayNotificationCenter/blob/main/data/style/style.
}
.control-center {
border: 2px solid #073642;
/* border: 2px solid #073642; */
margin: 10px; /* Gap size */
padding: 16px;
}

View file

@ -11,7 +11,6 @@ with lib; {
hardware.enable = true;
networking.enable = true;
packages.enable = true;
security.enable = true;
storage.enable = true;
users.enable = true;
})

View file

@ -1,48 +0,0 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.custom.settings.security;
in {
options.custom.settings.security.enable = mkOption {default = false;};
config = mkIf cfg.enable {
# Bypass password prompts
security = {
sudo = {
enable = true;
wheelNeedsPassword = false;
};
# https://wiki.nixos.org/wiki/Sway#Using_Home_Manager
# https://wiki.archlinux.org/title/Polkit#Bypass_password_prompt
polkit = {
enable = true;
extraConfig = ''
polkit.addRule(function(action, subject) {
if (subject.isInGroup("wheel")) { return polkit.Result.YES; }
});
'';
};
};
environment.shellAliases = {
# Sudo confirmation prompt
sudo = pkgs.writeShellScript "sudo" ''
read -p "Execute as root? [Y/n] "
case "$REPLY" in
"" | [Yy])
command sudo "$@"
;;
*)
exit 1
;;
esac
'';
};
};
}