Modularize scripts

This commit is contained in:
DashieTM 2024-08-25 14:09:28 +02:00
parent 96b410a358
commit 225da437c5
30 changed files with 590 additions and 423 deletions

View file

@ -34,35 +34,64 @@ nixosConfigurations = (inputs.dashNix.dashNixLib.build_systems [
``` ```
In order for your configuration to work, you are required to at least provide a single config file with a further config file being optional for custom configuration. In order for your configuration to work, you are required to at least provide a single config file with a further config file being optional for custom configuration.
The hardware.nix specifies additional NixOS configuration, while home.nix specifies additional home-manager configuration. (both optional)
|- flake.nix\ |- flake.nix\
|- flake.lock\ |- flake.lock\
|- system1/\ |- system1/\
|---- system1.nix (required)\ |---- configuration.nix (required)\
|---- configuration.nix (optional)\ |---- hardware.nix (optional)\
|---- home.nix (optional)
|- system2/\ |- system2/\
|---- system2.nix (required)\ |---- configuration.nix (required)\
|---- configuration.nix (optional)\ |---- hardware.nix (optional)\
|---- home.nix (optional)
|- system3/\ |- system3/\
|---- system3.nix (required)\ |---- configuration.nix (required)
|---- configuration.nix (optional) |---- hardware.nix (optional)\
|---- home.nix (optional)
Here is a minimal required configuration.nix (the TODOs mention a required change):
Here is a minimal required configuration (the TODOs mention a required change):
```nix ```nix
{ {
# variables for system # variables for system
# TODO important changes
conf = { conf = {
# TODO change this to your monitor and your pc name # change this to your monitor and your pc name
# should be something like DP-1 # should be something like DP-1
monitor = "YOURMONITOR"; monitor = "YOURMONITOR";
# your username
username = "YOURNAME"; username = "YOURNAME";
# the name of your system # the name of your system
hostname = "YOURNAME"; hostname = "YOURNAME";
# TODO only needed when you use intel -> amd is default # TODO only needed when you use intel -> amd is default
# cpu = "intel"; # cpu = "intel";
locale = "something.UTF-8";
timezone = "CONTINENT/CITY";
}; };
# modules # modules
mods = { mods = {
# default disk config has root home boot and swap partition, overwrite if you want something different
defaultDrives.enable = false;
extraDrives = [
{
name = "boot";
drive = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ];
};
}
{
name = "";
drive = {
device = "/dev/disk/by-label/ROOT";
fsType = "ext4";
options = [ "noatime" "nodiratime" "discard" ];
};
}
];
sops.enable = false; sops.enable = false;
nextcloud.enable = false; nextcloud.enable = false;
hyprland.monitor = [ hyprland.monitor = [
@ -81,6 +110,8 @@ Here is a minimal required configuration (the TODOs mention a required change):
}; };
} }
``` ```
## First Login
After logging in the first time, your password will be set to "firstlogin", please change this to whatever you like.
# Modules # Modules
@ -118,3 +149,4 @@ For package lists, please check the individual modules, as the lists can be long
- sops: Enables sops-nix - sops: Enables sops-nix
- fish: Enables and configures fish shell - fish: Enables and configures fish shell
- kitty: Enables and configures kitty terminal - kitty: Enables and configures kitty terminal
- oxi: My own programs, can be selectively disabled, or as a whole

View file

@ -4,28 +4,49 @@ in {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
# Bootloader. # Bootloader.
boot.loader.systemd-boot = { boot = {
loader = {
systemd-boot = {
enable = true; enable = true;
configurationLimit = 5; configurationLimit = 5;
}; };
boot.loader.efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
boot.plymouth = { enable = true; }; };
plymouth = { enable = true; };
kernelPackages = config.conf.kernel;
initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
kernelParams = [ ''resume="PARTLABEL=SWAP"'' ] ++ config.conf.boot_params;
};
# Enable networking # Enable networking
networking.useDHCP = lib.mkDefault true; networking = {
networking.networkmanager.enable = true; useDHCP = lib.mkDefault true;
networking.hostName = config.conf.hostname; networkmanager.enable = true;
hostName = config.conf.hostname;
services.flatpak.enable = true; };
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Zurich"; time.timeZone = config.conf.timezone;
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = config.conf.locale;
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; services = {
flatpak.enable = true;
xserver.enable = true;
fstrim.enable = lib.mkDefault true;
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
jack.enable = true;
pulse.enable = true;
};
};
nixpkgs.hostPlatform = lib.mkDefault config.conf.system; nixpkgs.hostPlatform = lib.mkDefault config.conf.system;
nix = { nix = {
@ -43,33 +64,23 @@ in {
}; };
# Enable sound with pipewire. # Enable sound with pipewire.
hardware.pulseaudio.enable = false; hardware = {
hardware.cpu.${config.conf.cpu}.updateMicrocode = pulseaudio.enable = false;
cpu.${config.conf.cpu}.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware; lib.mkDefault config.hardware.enableRedistributableFirmware;
services.fstrim.enable = lib.mkDefault true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
}; };
security.rtkit.enable = true;
environment.variables = { environment.variables = {
XDG_CACHE_HOME = "$HOME/.cache"; XDG_CACHE_HOME = "$HOME/.cache";
DIRENV_LOG_FORMAT = ""; DIRENV_LOG_FORMAT = "";
}; };
boot.kernelPackages = config.conf.kernel;
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.kernelParams = [ ''resume="PARTLABEL=SWAP"'' ]
++ config.conf.boot_params;
# allows user change later on # allows user change later on
users.mutableUsers = true; users = {
users.users.${username} = { mutableUsers = true;
users.${username} = {
isNormalUser = true; isNormalUser = true;
description = username; description = username;
extraGroups = [ extraGroups = [
@ -86,5 +97,6 @@ in {
# e.g. login, then change to whatever else, this also ensures no public hash is available # e.g. login, then change to whatever else, this also ensures no public hash is available
password = "firstlogin"; password = "firstlogin";
}; };
};
} }

View file

@ -1,5 +1,6 @@
{ pkgs, config, ... }: { { pkgs, config, ... }: {
environment.variables = { environment = {
variables = {
GSETTINGS_SCHEMA_DIR = GSETTINGS_SCHEMA_DIR =
"${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}";
NEOVIDE_MAXIMIZED = "0"; NEOVIDE_MAXIMIZED = "0";
@ -8,9 +9,10 @@
SUDO_EDITOR = "neovide --no-fork"; SUDO_EDITOR = "neovide --no-fork";
SCRIPTS = "$HOME/.config/scripts"; SCRIPTS = "$HOME/.config/scripts";
}; };
environment.sessionVariables = { sessionVariables = {
NIXOS_OZONE_WL = "1"; NIXOS_OZONE_WL = "1";
GOPATH = "$HOME/.go"; GOPATH = "$HOME/.go";
FLAKE = config.conf.nix_path; FLAKE = config.conf.nix_path;
}; };
};
} }

View file

@ -1,21 +1,26 @@
{ {
# variables for system # variables for system
# TODO important changes
conf = { conf = {
# TODO change this to your monitor and your pc name # change this to your monitor and your pc name
# should be something like DP-1 # should be something like DP-1
monitor = "YOURMONITOR"; monitor = "YOURMONITOR";
# your username
username = "YOURNAME"; username = "YOURNAME";
# the name of your system # the name of your system
hostname = "YOURNAME"; hostname = "YOURNAME";
# TODO only needed when you use intel -> amd is default # TODO only needed when you use intel -> amd is default
# cpu = "intel"; # cpu = "intel";
locale = "something.UTF-8";
timezone = "CONTINENT/CITY";
}; };
# modules # modules
mods = { mods = {
# default disk config has root home boot and swap partition, overwrite if you want something different
defaultDrives.enable = false; defaultDrives.enable = false;
extraDrives = [ extraDrives = [
{ {
name = "/boot"; name = "boot";
drive = { drive = {
device = "/dev/disk/by-label/BOOT"; device = "/dev/disk/by-label/BOOT";
fsType = "vfat"; fsType = "vfat";
@ -23,7 +28,7 @@
}; };
} }
{ {
name = "/root"; name = "";
drive = { drive = {
device = "/dev/disk/by-label/ROOT"; device = "/dev/disk/by-label/ROOT";
fsType = "ext4"; fsType = "ext4";

View file

@ -1,4 +1,4 @@
{ inputs, pkgs, config, lib, mod, ... }: { inputs, pkgs, config, lib, mod, additionalHomeConfig, ... }:
let let
base_imports = [ base_imports = [
inputs.anyrun.homeManagerModules.default inputs.anyrun.homeManagerModules.default
@ -16,7 +16,6 @@ let
inputs.dashvim.homeManagerModules.dashvim inputs.dashvim.homeManagerModules.dashvim
../modules ../modules
]; ];
usernamePassed = config.conf.username;
in { in {
xdg = { xdg = {
portal.config.common.default = "*"; portal.config.common.default = "*";
@ -30,14 +29,11 @@ in {
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
users.${usernamePassed} = { users.${config.conf.username} = {
imports = [ imports = [ ./common.nix ./xdg.nix ./themes ./sync.nix ] ++ base_imports
./common.nix ++ lib.optional (builtins.pathExists mod) mod
./xdg.nix ++ lib.optional (builtins.pathExists additionalHomeConfig)
./oxi/default.nix additionalHomeConfig;
./themes/default.nix
./sync.nix
] ++ base_imports ++ lib.optional (builtins.pathExists mod) mod;
}; };
}; };
} }

View file

@ -6,18 +6,19 @@ in {
name = name; name = name;
value = let value = let
mod = root + /${name}/configuration.nix; mod = root + /${name}/configuration.nix;
additionalConfig = root + /${name}/${name}.nix; additionalNixosConfig = root + /${name}/hardware.nix;
additionalHomeConfig = root + /${name}/home.nix;
in inputs.nixpkgs.lib.nixosSystem { in inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs pkgs mod; }; specialArgs = { inherit inputs pkgs mod additionalHomeConfig; };
modules = [ modules = [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
../base ../base
../programs ../home
../modules ../modules
mod mod
] ++ inputs.nixpkgs.lib.optional (builtins.pathExists additionalConfig) ] ++ inputs.nixpkgs.lib.optional
additionalConfig (builtins.pathExists additionalNixosConfig) additionalNixosConfig
++ inputs.nixpkgs.lib.optional (builtins.pathExists mod) mod; ++ inputs.nixpkgs.lib.optional (builtins.pathExists mod) mod;
}; };
}) systems); }) systems);

View file

@ -101,6 +101,24 @@
''; '';
}; };
timezone = lib.mkOption {
default = "Europe/Zurich";
example = "Europe/Berlin";
type = lib.types.str;
description = ''
The timezone.
'';
};
locale = lib.mkOption {
default = "en_US.UTF-8";
example = "de_DE.UTF-8";
type = lib.types.str;
description = ''
The locale.
'';
};
nixos-config-path = lib.mkOption { nixos-config-path = lib.mkOption {
default = "/home/${config.conf.username}/gits/nixos/."; default = "/home/${config.conf.username}/gits/nixos/.";
example = "yourpath/."; example = "yourpath/.";

View file

@ -17,12 +17,15 @@
./hyprland ./hyprland
./kde_connect.nix ./kde_connect.nix
./keepassxc.nix ./keepassxc.nix
./kitty.nix
./layout.nix ./layout.nix
./media.nix ./media.nix
./ncspot.nix ./ncspot.nix
./nextcloud.nix ./nextcloud.nix
./oxi
./piper.nix ./piper.nix
./printing.nix ./printing.nix
./scripts.nix
./sops.nix ./sops.nix
./starship.nix ./starship.nix
./stylix.nix ./stylix.nix
@ -30,6 +33,5 @@
./virtualbox.nix ./virtualbox.nix
./xone.nix ./xone.nix
./yazi ./yazi
./kitty.nix
]; ];
} }

View file

@ -69,12 +69,8 @@
#my own programs #my own programs
programs = { programs = {
oxicalc.enable = true;
oxinoti.enable = true;
oxidash.enable = true;
oxishut.enable = true;
oxipaste.enable = true;
hyprdock.enable = true; hyprdock.enable = true;
oxicalc.enable = true;
ReSet.enable = true; ReSet.enable = true;
ReSet.config.plugins = [ ReSet.config.plugins = [
inputs.reset-plugins.packages."x86_64-linux".monitor inputs.reset-plugins.packages."x86_64-linux".monitor

View file

@ -1,8 +1,4 @@
{ config, lib, options, pkgs, ... }: { { config, lib, options, pkgs, ... }: {
imports = [
];
options.mods = { options.mods = {
hyprland = { hyprland = {
enable = lib.mkOption { enable = lib.mkOption {
@ -92,11 +88,9 @@
bind = [ bind = [
# screenshots # screenshots
''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy'' ''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy''
''
$mod SUPERSHIFTALT,S,exec, grim -g "$(slurp)" $HOME/gits/ost-5semester/Screenshots/$(date +'%Y_%m_%d_%I_%M_%S.png') && (date +'%Y_%m_%d_%I_%M_%S.png') | wl-copy''
''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -'' ''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -''
'' ''
$mod SUPERCONTROLSHIFT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' $mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy''
# regular programs # regular programs
"$mod SUPER,F,exec,firefox" "$mod SUPER,F,exec,firefox"
@ -114,14 +108,19 @@
"$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate" "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate"
# media keys # media keys
",XF86AudioMute,exec, $HOME/.config/scripts/audio_control.sh mute" (lib.mkIf config.mods.scripts.audio-control
",XF86AudioLowerVolume,exec, $HOME/.config/scripts/audio_control.sh sink -5%" ",XF86AudioMute,exec, audio-control mute")
",XF86AudioRaiseVolume,exec, $HOME/.config/scripts/audio_control.sh sink +5%" (lib.mkIf config.mods.scripts.audio-control
",XF86AudioLowerVolume,exec, audio-control sink -5%")
(lib.mkIf config.mods.scripts.audio-control
",XF86AudioRaiseVolume,exec, audio-control sink +5%")
",XF86AudioPlay,exec, playerctl play-pause" ",XF86AudioPlay,exec, playerctl play-pause"
",XF86AudioNext,exec, playerctl next" ",XF86AudioNext,exec, playerctl next"
",XF86AudioPrev,exec, playerctl previous" ",XF86AudioPrev,exec, playerctl previous"
",XF86MonBrightnessDown,exec, $HOME/.config/scripts/change-brightness brightness 10%-" (lib.mkIf config.mods.scripts.change-brightness
",XF86MonBrightnessUp,exec, $HOME/.config/scripts/change-brightness brightness +10%" ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-")
(lib.mkIf config.mods.scripts.change-brightness
",XF86MonBrightnessUp,exec, change-brightness brightness +10%")
# hyprland keybinds # hyprland keybinds
# misc # misc

View file

@ -0,0 +1,57 @@
{ lib, config, options, inputs, ... }: {
imports = [ ./oxidash.nix ./oxinoti.nix ./oxishut.nix ./oxipaste.nix ];
options.mods.oxi = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables oxi programs";
};
ReSet = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables and configures ReSet";
};
};
hyprdock = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables hyprdock";
};
};
oxicalc = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables hyprdock";
};
};
};
config = lib.mkIf config.mods.oxi.enable
(lib.optionalAttrs (options ? home.packages) {
programs = {
hyprdock.enable = lib.mkIf config.mods.oxi.hyprdock.enable true;
oxicalc.enable = lib.mkIf config.mods.oxi.oxicalc.enable true;
ReSet = lib.mkIf config.mods.oxi.ReSet.enable {
enable = true;
config = {
plugins = [
inputs.reset-plugins.packages."x86_64-linux".monitor
inputs.reset-plugins.packages."x86_64-linux".keyboard
];
plugin_config = {
Keyboard = {
path =
"/home/${config.conf.username}/.config/reset/keyboard.conf";
};
};
};
};
};
});
}

View file

@ -0,0 +1,64 @@
{ lib, config, options, ... }: {
options.mods.oxi.oxidash = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables and configures oxidash";
};
};
config = lib.mkIf (config.mods.oxi.oxidash.enable && config.mods.oxi.enable)
(lib.optionalAttrs (options ? xdg.configFile) {
programs.oxidash.enable = true;
xdg.configFile."oxidash/style.css" = {
text = ''
#MainWindow {
border-radius: 10px;
}
#MainBox {
border-radius: 10px;
}
#MainButtonBox {
padding: 10px;
margin: 5px 0px 5px 0px;
border-radius: 5px;
border: solid 2px #327cd5;
}
#DoNotDisturbButton {
}
#ExitButton {
}
#ClearNotificationsButton {
}
#NotificationsWindow {
}
.debugimage {
border: solid 3px blue;
}
.Notification {
padding: 10px;
margin: 5px 0px 5px 0px;
border: solid 2px #327cd5;
border-radius: 5px;
}
.CloseNotificationButton {
margin: 0px 5px 0px 10px;
}
.PictureButtonBox {
}
.BaseBox {
}
}
'';
};
});
}

View file

@ -0,0 +1,104 @@
{ lib, config, options, ... }: {
options.mods.oxi.oxinoti = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables and configures oxinoti";
};
};
config = lib.mkIf (config.mods.oxi.oxinoti.enable && config.mods.oxi.enable)
(lib.optionalAttrs (options ? xdg.configFile) {
programs.oxinoti.enable = true;
xdg.configFile."oxinoti/style.css" = {
text = # css
''
@import url("/home/${config.conf.username}/.config/gtk-3.0/gtk.css");
#MainWindow {
background-color: transparent;
padding: 0px;
/* opacity: 0; */
}
.MainBox {
background-color: transparent;
padding: 0px;
/* opacity: 0; */
}
.NotificationBox {
background-color: #353747;
border-radius: 5px;
border: solid 1px;
margin: 0px;
padding: 5px;
}
.NotificationLow {
border-color: green;
}
.NotificationNormal {
border-color: purple;
}
.NotificationUrgent {
border-color: red;
}
.miscbox {
margin: 0px 10px 0px 0px;
}
.bodybox {
}
.imagebox {
margin: 0px 0px 0px 10px;
}
.appname {
font-size: 0.8rem;
}
.timestamp {
font-size: 0.8rem;
}
.summary {
font-size: 0.8rem;
}
.body {
font-size: 1.2rem;
}
.icon {
font-size: 2rem;
}
.image {
}
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration-line: underline;
}
'';
};
xdg.configFile."oxinoti/oxinoti.toml" = {
text = ''
timeout = 3
dnd_override = 2
'';
};
});
}

View file

@ -0,0 +1,42 @@
{ lib, config, options, ... }: {
options.mods.oxi.oxipaste = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables and configures oxipaste";
};
};
config = lib.mkIf (config.mods.oxi.oxipaste.enable && config.mods.oxi.enable)
(lib.optionalAttrs (options ? xdg.configFile) {
programs.oxipaste.enable = true;
xdg.configFile."oxipaste/style.css" = {
text = ''
.main-window {
padding: 10px;
border-radius: 10px;
border: 2px solid #2AC3DE;
}
.item-window {
padding: 10px;
border-radius: 10px;
border: 2px solid #C0CAF5;
}
.item-button {
background-color: #1A1B26;
border-radius: 5px;
border: 1px solid #6D728D;
}
.delete-button {
margin: 5px 25px 5px 5px;
}
.item-box {
}
'';
};
});
}

View file

@ -0,0 +1,36 @@
{ lib, config, options, ... }: {
options.mods.oxi.oxishut = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables and configures oxishut";
};
};
config = lib.mkIf (config.mods.oxi.oxishut.enable && config.mods.oxi.enable)
(lib.optionalAttrs (options ? xdg.configFile) {
programs.oxishut.enable = true;
xdg.configFile."oxishut/style.css" = {
text = ''
#mainwindow {
border-radius: 10px;
}
.mainbox {
border-radius: 5px;
padding: 20px;
}
.button {
margin: 5px;
background-color: #2b2c3b;
-gtk-icon-size: 5rem;
}
.button:hover {
background-color: #3e4152;
}
'';
};
});
}

View file

@ -0,0 +1,120 @@
{ lib, config, options, pkgs, ... }: {
options.mods.scripts = {
change-brightness = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables the change-brightness script";
};
audio-control = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables the audio-control script";
};
scripts = lib.mkOption {
default = [ ];
example = [ ];
description =
"More scripts to be passed. (check existing ones for types and examples)";
};
};
config = (lib.optionalAttrs (options ? home.packages) {
home.packages = [
(lib.mkIf config.mods.scripts.change-brightness
(pkgs.writeShellScriptBin "change-brightness" ''
set_brightness() {
brightnessctl set "$1"
CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}')
dunstify -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: $\{CURRENT\}%"
}
if [ "$1" == "brightness" ]; then
set_brightness "$2"
fi
''))
(lib.mkIf config.mods.scripts.audio-control
(pkgs.writeShellScriptBin "audio-control" ''
ncspot() {
NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n')
CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n')
pactl set-sink-input-volume "$CHANGE" "$1"
VOLUME=$(pactl list sink-inputs | rg "$NUM" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%')
notify-send -a "ncspot" -r 990 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Spotify Volume: $\{VOLUME\}%"
}
firefox() {
STRING=$(pactl list clients short | rg "firefox" | awk -F 'PipeWire' ' { print $1 "," } ' | tr -d ' \t\n')
# NUMS=',' read -r -a array <<< "$STRING"
readarray -td, NUMS <<<"$STRING"
declare -p NUMS
for index in "$\{!NUMS[@]\}"; do #"$\{!array[@]\}"
NUM=$(echo "$\{NUMS[index]\}" | tr -d ' \t\n')
CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n')
pactl set-sink-input-volume "$CHANGE" "$1"
done
VOLUME=$(pactl list sink-inputs | rg "$\{NUMS[0]\}" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%')
notify-send -a "Firefox" -r 991 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Firefox Volume: $\{VOLUME\}%"
}
internal() {
SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }')
if [ "$SPEAKER" != "" ]; then
pactl set-default-sink "$SPEAKER"
pactl set-sink-mute "$SPEAKER" false
DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ')
notify-send "changed audio to "$DEVICE" "
else
notify-send "failed, not available!"
fi
}
set_volume_sink() {
pactl set-sink-volume @DEFAULT_SINK@ "$1"
CURRENT=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %')
notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Output Volume: $\{CURRENT\}%"
}
set_volume_source() {
pactl set-source-volume @DEFAULT_SOURCE@ "$1"
CURRENT=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %')
notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Input Volume: $\{CURRENT\}%"
}
bluetooth() {
SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }')
if [ "$SPEAKER" != "" ]; then
pactl set-default-sink "$SPEAKER"
pactl set-sink-mute "$SPEAKER" false
DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ')
notify-send "changed audio to "$DEVICE" "
else
notify-send "failed, not available!"
fi
}
mute() {
pactl set-sink-mute @DEFAULT_SINK@ toggle
MUTE=$(pactl get-sink-mute @DEFAULT_SINK@)
notify-send -a "Audio" -r 994 -u low -i audio-volume-high "Audio: $MUTE"
}
if [ "$1" == "internal" ]; then
internal
elif [ "$1" == "bluetooth" ]; then
bluetooth
elif [ "$1" == "firefox" ]; then
firefox "$2"
elif [ "$1" == "ncspot" ]; then
ncspot "$2"
elif [ "$1" == "mute" ]; then
mute
elif [ "$1" == "sink" ]; then
set_volume_sink "$2"
elif [ "$1" == "source" ]; then
set_volume_source "$2"
fi
''))
] ++ config.mods.scripts.scripts;
});
}

View file

@ -1,2 +0,0 @@
{ imports = [ ./oxipaste.nix ./oxinoti.nix ./oxishut.nix ./oxidash.nix ]; }

View file

@ -1,52 +0,0 @@
{
xdg.configFile."oxidash/style.css" = {
text = ''
#MainWindow {
border-radius: 10px;
}
#MainBox {
border-radius: 10px;
}
#MainButtonBox {
padding: 10px;
margin: 5px 0px 5px 0px;
border-radius: 5px;
border: solid 2px #327cd5;
}
#DoNotDisturbButton {
}
#ExitButton {
}
#ClearNotificationsButton {
}
#NotificationsWindow {
}
.debugimage {
border: solid 3px blue;
}
.Notification {
padding: 10px;
margin: 5px 0px 5px 0px;
border: solid 2px #327cd5;
border-radius: 5px;
}
.CloseNotificationButton {
margin: 0px 5px 0px 10px;
}
.PictureButtonBox {
}
.BaseBox {
}
}
'';
};
}

View file

@ -1,92 +0,0 @@
{ config, ... }: {
xdg.configFile."oxinoti/style.css" = {
text = # css
''
@import url("/home/${config.conf.username}/.config/gtk-3.0/gtk.css");
#MainWindow {
background-color: transparent;
padding: 0px;
/* opacity: 0; */
}
.MainBox {
background-color: transparent;
padding: 0px;
/* opacity: 0; */
}
.NotificationBox {
background-color: #353747;
border-radius: 5px;
border: solid 1px;
margin: 0px;
padding: 5px;
}
.NotificationLow {
border-color: green;
}
.NotificationNormal {
border-color: purple;
}
.NotificationUrgent {
border-color: red;
}
.miscbox {
margin: 0px 10px 0px 0px;
}
.bodybox {
}
.imagebox {
margin: 0px 0px 0px 10px;
}
.appname {
font-size: 0.8rem;
}
.timestamp {
font-size: 0.8rem;
}
.summary {
font-size: 0.8rem;
}
.body {
font-size: 1.2rem;
}
.icon {
font-size: 2rem;
}
.image {
}
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration-line: underline;
}
'';
};
xdg.configFile."oxinoti/oxinoti.toml" = {
text = ''
timeout = 3
dnd_override = 2
'';
};
}

View file

@ -1,30 +0,0 @@
{
xdg.configFile."oxipaste/style.css" = {
text = ''
.main-window {
padding: 10px;
border-radius: 10px;
border: 2px solid #2AC3DE;
}
.item-window {
padding: 10px;
border-radius: 10px;
border: 2px solid #C0CAF5;
}
.item-button {
background-color: #1A1B26;
border-radius: 5px;
border: 1px solid #6D728D;
}
.delete-button {
margin: 5px 25px 5px 5px;
}
.item-box {
}
'';
};
}

View file

@ -1,24 +0,0 @@
{
xdg.configFile."oxishut/style.css" = {
text = ''
#mainwindow {
border-radius: 10px;
}
.mainbox {
border-radius: 5px;
padding: 20px;
}
.button {
margin: 5px;
background-color: #2b2c3b;
-gtk-icon-size: 5rem;
}
.button:hover {
background-color: #3e4152;
}
'';
};
}

View file

@ -1,80 +0,0 @@
ncspot() {
NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n')
CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n')
pactl set-sink-input-volume "$CHANGE" "$1"
VOLUME=$(pactl list sink-inputs | rg "$NUM" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%')
notify-send -a "ncspot" -r 990 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Spotify Volume: ${VOLUME}%"
}
firefox() {
STRING=$(pactl list clients short | rg "firefox" | awk -F 'PipeWire' ' { print $1 "," } ' | tr -d ' \t\n')
# NUMS=',' read -r -a array <<< "$STRING"
readarray -td, NUMS <<<"$STRING"
declare -p NUMS
for index in "${!NUMS[@]}"; do #"${!array[@]}"
NUM=$(echo "${NUMS[index]}" | tr -d ' \t\n')
CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n')
pactl set-sink-input-volume "$CHANGE" "$1"
done
VOLUME=$(pactl list sink-inputs | rg "${NUMS[0]}" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%')
notify-send -a "Firefox" -r 991 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Firefox Volume: ${VOLUME}%"
}
internal() {
SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }')
if [ "$SPEAKER" != "" ]; then
pactl set-default-sink "$SPEAKER"
pactl set-sink-mute "$SPEAKER" false
DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ')
notify-send "changed audio to "$DEVICE" "
else
notify-send "failed, not available!"
fi
}
set_volume_sink() {
pactl set-sink-volume @DEFAULT_SINK@ "$1"
CURRENT=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %')
notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Output Volume: ${CURRENT}%"
}
set_volume_source() {
pactl set-source-volume @DEFAULT_SOURCE@ "$1"
CURRENT=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %')
notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Input Volume: ${CURRENT}%"
}
bluetooth() {
SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }')
if [ "$SPEAKER" != "" ]; then
pactl set-default-sink "$SPEAKER"
pactl set-sink-mute "$SPEAKER" false
DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ')
notify-send "changed audio to "$DEVICE" "
else
notify-send "failed, not available!"
fi
}
mute() {
pactl set-sink-mute @DEFAULT_SINK@ toggle
MUTE=$(pactl get-sink-mute @DEFAULT_SINK@)
notify-send -a "Audio" -r 994 -u low -i audio-volume-high "Audio: $MUTE"
}
if [ "$1" == "internal" ]; then
internal
elif [ "$1" == "bluetooth" ]; then
bluetooth
elif [ "$1" == "firefox" ]; then
firefox "$2"
elif [ "$1" == "ncspot" ]; then
ncspot "$2"
elif [ "$1" == "mute" ]; then
mute
elif [ "$1" == "sink" ]; then
set_volume_sink "$2"
elif [ "$1" == "source" ]; then
set_volume_source "$2"
fi

View file

@ -1,12 +0,0 @@
#! /bin/bash
set_brightness() {
brightnessctl set "$1"
CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}')
dunstify -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ${CURRENT}%"
}
if [ "$1" == "brightness" ]; then
set_brightness "$2"
fi

View file

@ -1,23 +0,0 @@
read -p "formatting disk $1 with hostname $2 is this correct? " IN
read -p "is the disk an nvme drive? " NVME
if [ "$IN" == "y" ]; then
echo "commencing"
#format disk
parted $1 mklabel gpt mkpart primary fat32 1MiB 512MiB mkpart primary linux-swap 512MiB 31029MiB mkpart primary btrfs 31029MiB 40% mkpart primary btrfs 40% 100%
if [ "$NVME" == "y" ]; then
e2label $1p1 BOOT
e2label $1p2 SWAP
e2label $1p3 ROOT
e2label $1p4 HOME
else
e2label "$1"1 BOOT
e2label "$1"2 SWAP
e2label "$1"3 ROOT
e2label "$1"4 HOME
fi
# install nixos
echo "formatting finished, continuing to install system"
nixos-install --flake ./nix/.#$2 --no-root-passwd
else
echo "aborting"
fi

View file

@ -1 +0,0 @@
echo "Do you have time to talk about the lord and savior PenguinOS?" | wl-copy

View file

@ -1,3 +0,0 @@
echo "Are you tired about ads on your operating system? About forced telemetry? About arbitrary installation requirements like online accounts or forced hardware upgrades?
Fear not penguin is for you, free of charge and free to change. Penguin does not control you, you control penguin.
Don't delay, install penguin today: https://distrochooser.de/" | wl-copy