a bunch of stuff, including upgrade to wayland and ndi streaming to imac

This commit is contained in:
Sebastian Moser
2025-01-12 18:50:01 +01:00
parent cfd9bfccbd
commit 40f190de88
29 changed files with 1813 additions and 55 deletions

View File

@@ -25,7 +25,7 @@
''; '';
nix.settings = { nix.settings = {
experimental-features = lib.mkDefault "nix-command flakes repl-flake"; experimental-features = lib.mkDefault "nix-command flakes";
trusted-users = [ "root" "@wheel" ]; trusted-users = [ "root" "@wheel" ];
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;

View File

@@ -4,6 +4,10 @@
../mods/battery_monitor.nix ../mods/battery_monitor.nix
]; ];
# after firefox 1.122 the cursor did not change on links anymore.....
# so i had a firefox-tmp binary, which was built with
# sudo nix build github:c2vi/nixos/1b07ba88b21e7f46a6012ecadc0ca3a86eda7281#nixosConfigurations.main.config.home-manager.users.me.programs.firefox.package -L
modules.battery_monitor.enable = true; modules.battery_monitor.enable = true;
# Enable the X11 windowing system. # Enable the X11 windowing system.
@@ -67,6 +71,11 @@
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
services.blueman.enable = true; services.blueman.enable = true;
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).

1085
common/nixos-wayland.nix Normal file

File diff suppressed because it is too large Load Diff

2
flake.lock generated
View File

@@ -2911,8 +2911,8 @@
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "release-24.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b9562c824b11473587286eb499680129c2d0d4f1",
"type": "github" "type": "github"
} }
}, },

View File

@@ -3,7 +3,8 @@
################################### INPUTS ######################################### ################################### INPUTS #########################################
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; #nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
nixpkgs.url = "github:NixOS/nixpkgs/b9562c824b11473587286eb499680129c2d0d4f1";
#nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; #nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -89,7 +90,7 @@
let let
confDir = "/home/me/work/config"; confDir = "/home/me/work/config";
workDir = "/home/me/work"; workDir = "/home/me/work";
secretsDir = "/home/me/work/here/secrets"; secretsDir = "/home/me/secrets";
persistentDir = "/home/me/work/app-data"; persistentDir = "/home/me/work/app-data";
tunepkgs = import nixpkgs { tunepkgs = import nixpkgs {
@@ -123,12 +124,19 @@
}; };
specialArgs = { specialArgs = {
inherit inputs confDir workDir secretsDir persistentDir self tunepkgs; inherit inputs confDir workDir secretsDir persistentDir self tunepkgs unstable nur;
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = mypkgs; pkgs = mypkgs;
}; };
eachSystem = inputs.flake-utils.outputs.lib.eachSystem; eachSystem = inputs.flake-utils.outputs.lib.eachSystem;
allSystems = inputs.flake-utils.outputs.lib.allSystems; allSystems = inputs.flake-utils.outputs.lib.allSystems;
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
};
nur = import inputs.nur { pkgs = mypkgs; };
in in
################################### EACH SYSTEM OUPUTS ######################################### ################################### EACH SYSTEM OUPUTS #########################################
@@ -286,6 +294,14 @@
]; ];
}; };
"mac" = nixpkgs.lib.nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
./hosts/mac.nix
];
};
"gui" = nixpkgs.lib.nixosSystem { "gui" = nixpkgs.lib.nixosSystem {
inherit specialArgs; inherit specialArgs;
system = "x86_64-linux"; system = "x86_64-linux";
@@ -544,3 +560,4 @@
}; };
}; };
} }

View File

@@ -23,6 +23,11 @@
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" =
{ device = "/dev/disk/by-label/FUSU-BOOT";
fsType = "vfat";
};
swapDevices = [ ]; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View File

@@ -23,8 +23,18 @@
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices = {
root = {
#name = "root";
device = "/dev/disk/by-partuuid/ffc93316-5bcf-478a-9143-9ccacd428f48";
preLVM = true;
allowDiscards = true;
};
};
/*
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/6518e61e-7120-48ef-81a3-5eae0f67297e"; device = "/dev/disk/by-uuid/6518e61e-7120-48ef-81a3-5eae0f67297e";
fsType = "btrfs"; fsType = "btrfs";
@@ -34,6 +44,16 @@
device = "/dev/disk/by-uuid/0E6C-F209"; device = "/dev/disk/by-uuid/0E6C-F209";
fsType = "vfat"; fsType = "vfat";
}; };
*/
fileSystems."/" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/MAIN-BOOT";
fsType = "vfat";
};
#swapDevices = [ #swapDevices = [
#{ device = "/dev/disk/by-uuid/418bf0d8-e548-45d5-802a-53de72707ebc"; } #{ device = "/dev/disk/by-uuid/418bf0d8-e548-45d5-802a-53de72707ebc"; }

View File

@@ -9,25 +9,36 @@
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
../users/me/headless.nix ../users/me/headless.nix
../users/root/default.nix ../users/root/default.nix
../users/server/headles.nix ../users/files/headless.nix
]; ];
# mac address for wakeonlan: 00:19:99:fd:28:23 # mac address for wakeonlan: 00:19:99:fd:28:23
# allow acern to ssh into server # allow acern to ssh into server
users.users.server.openssh.authorizedKeys.keys = [ #users.users.server.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTV1VoNAjMha5IP+qb8XABDo02pW3iN0yPBIbSqZA27 me@acern" #"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTV1VoNAjMha5IP+qb8XABDo02pW3iN0yPBIbSqZA27 me@acern"
]; #];
# allow server user to shutdown fusu # allow server user to shutdown fusu
security.sudo.extraRules = [ #security.sudo.extraRules = [
{ #{
users = [ "server" ]; #users = [ "server" ];
commands = [ { command = "/run/current-system/sw/bin/shutdown"; options = [ "SETENV" "NOPASSWD" ]; } ]; #commands = [ { command = "/run/current-system/sw/bin/shutdown"; options = [ "SETENV" "NOPASSWD" ]; } ];
} #}
]; #];
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.package = pkgs.zfs_unstable;
boot.zfs.forceImportRoot = false;
networking.hostId = "7552c83e";
fileSystems."/home/files/storage" = {
device = "storage";
fsType = "zfs";
};
virtualisation.libvirtd = { virtualisation.libvirtd = {
enable = true; enable = true;
@@ -39,7 +50,8 @@
# Use the GRUB 2 boot loader. # Use the GRUB 2 boot loader.
boot.loader.grub = { boot.loader.grub = {
enable = true; enable = true;
device = "/dev/disk/by-id/ata-TOSHIBA_MQ04ABF100_11MYT5RBT"; #device = "/dev/disk/by-id/ata-TOSHIBA_MQ04ABF100_11MYT5RBT";
device = "nodev"; # don't install, when i do nixre -h fusu ... but when installing onto the two discs (sata hdd and nvme ssd) change to the device like above
efiSupport = false; efiSupport = false;
extraConfig = '' extraConfig = ''
set timeout=2 set timeout=2
@@ -57,6 +69,7 @@
settings.PasswordAuthentication = false; settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false; settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
ports = [ 49388 ];
settings.X11Forwarding = true; settings.X11Forwarding = true;
@@ -76,11 +89,9 @@
8080 # for mitm proxy 8080 # for mitm proxy
5901 # vnc 5901 # vnc
25565 # mc server
25566 # mc server
]; ];
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = false; # Easiest to use and most distros use this by default.
# to build rpi images # to build rpi images
boot.binfmt.emulatedSystems = [ boot.binfmt.emulatedSystems = [
@@ -111,7 +122,7 @@
prefixLength = 24; prefixLength = 24;
} ]; } ];
networking = { networking = {
#usePredictableInterfaceNames = false; usePredictableInterfaceNames = true;
defaultGateway = { defaultGateway = {
address = "192.168.1.1"; address = "192.168.1.1";
interface = "br0"; interface = "br0";

157
hosts/mac.nix Normal file
View File

@@ -0,0 +1,157 @@
{ pkgs, inputs, ... }: let
myobs = pkgs.wrapOBS {
plugins = with pkgs.obs-studio-plugins; [
obs-ndi
obs-teleport
];
};
in {
imports = [
../common/all.nix
../common/nixos.nix
../common/building.nix
inputs.home-manager.nixosModules.home-manager
../users/me/headless.nix
../users/root/default.nix
];
networking.hostName = "mac";
networking.firewall.enable = false;
networking.useDHCP = true;
services.avahi = {
enable = true;
nssmdns = true;
publish = {
enable = true;
addresses = true;
domain = true;
hinfo = true;
userServices = true;
workstation = true;
};
};
# Use the GRUB 2 boot loader.
boot.loader.grub = {
enable = true;
#device = "/dev/nbd1";
device = "nodev";
efiSupport = true;
extraConfig = ''
set timeout=2
'';
};
environment.systemPackages = with pkgs; [
mount
pkgs.hicolor-icon-theme
efibootmgr
tcpdump
];
fileSystems."/" = {
device = "/dev/disk/by-label/mac-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/EFI";
fsType = "vfat";
};
networking = {
#usePredictableInterfaceNames = false;
defaultGateway = {
address = "192.168.1.1";
interface = "enp2s0";
};
nameservers = [ "1.1.1.1" "8.8.8.8" ];
interfaces = {
"enp2s0" = {
name = "enp2s0";
ipv4.addresses = [
{ address = "192.168.1.33"; prefixLength = 24;}
];
};
};
};
services.openssh = {
enable = true;
# require public key authentication for better security
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "no";
settings.X11Forwarding = true;
extraConfig = ''
X11UseLocalhost no
'';
};
###################################################### the kiosk stuff
boot.plymouth.enable = true;
services.dbus.enable = true;
fonts.enableDefaultPackages = true;
xdg.icons.enable = true;
gtk.iconCache.enable = true;
services.udisks2.enable = false;
hardware.opengl.enable = true;
hardware.enableRedistributableFirmware = true;
systemd.services."cage@" = {
enable = true;
after = [ "systemd-user-sessions.service" "dbus.socket" "systemd-logind.service" "getty@%i.service" "plymouth-deactivate.service" "plymouth-quit.service" ];
before = [ "graphical.target" ];
wants = [ "dbus.socket" "systemd-logind.service" "plymouth-deactivate.service" ];
wantedBy = [ "graphical.target" ];
conflicts = [ "getty@%i.service" ]; # "plymouth-quit.service" "plymouth-quit-wait.service"
restartIfChanged = false;
serviceConfig = {
ExecStart = "${pkgs.cage}/bin/cage -d -- ${myobs}/bin/obs";
User = "root";
# ConditionPathExists = "/dev/tty0";
IgnoreSIGPIPE = "no";
# Log this user with utmp, letting it show up with commands 'w' and
# 'who'. This is needed since we replace (a)getty.
UtmpIdentifier = "%I";
UtmpMode = "user";
# A virtual terminal is needed.
TTYPath = "/dev/%I";
TTYReset = "yes";
TTYVHangup = "yes";
TTYVTDisallocate = "yes";
# Fail to start if not controlling the virtual terminal.
StandardInput = "tty-fail";
#StandardOutput = "syslog";
#StandardError = "syslog";
# Set up a full (custom) user session for the user, required by Cage.
PAMName = "cage";
};
};
security.pam.services.cage.text = ''
auth required pam_unix.so nullok
account required pam_unix.so
session required pam_unix.so
session required ${pkgs.systemd}/lib/security/pam_systemd.so
'';
systemd.targets.graphical.wants = [ "cage@tty1.service" ];
systemd.defaultUnit = "graphical.target";
}

View File

@@ -10,6 +10,34 @@
# ??????????? TODO # ??????????? TODO
# fileSystems."/".options = [ "noatime" "nodiratime" "discard" ]; # fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];
/*
services.xserver.displayManager.gdm.enable = true;
services.xserver.displayManager.gdm.wayland = false;
services.xserver.desktopManager.plasma5.enable = true;
modules.battery_monitor.enable = true;
services.blueman.enable = true;
hardware.bluetooth.enable = true;
# Enable the gnome-keyring secrets vault.
# Will be exposed through DBus to programs willing to store secrets.
services.gnome.gnome-keyring.enable = true;
# enable Sway window manager
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
*/
#services.openssh.enable = true;
virtualisation.vmVariant.services.timesyncd.enable = lib.mkForce false;
services.nscd.enable = lib.mkForce false; services.nscd.enable = lib.mkForce false;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
@@ -21,6 +49,8 @@
''; '';
services.xserver.displayManager.xserverArgs = [ "-listen tcp" ]; services.xserver.displayManager.xserverArgs = [ "-listen tcp" ];
nixpkgs.config.allowUnfree = lib.mkForce true;
programs.nix-ld.enable = true; programs.nix-ld.enable = true;
programs.steam.enable = true; programs.steam.enable = true;
@@ -33,8 +63,10 @@
imports = [ imports = [
../common/all.nix ../common/all.nix
../common/nixos-headless.nix ../common/nixos-headless.nix
../common/nixos-graphical.nix #../common/nixos-graphical.nix
../common/nixos-wayland.nix
../common/building.nix ../common/building.nix
../mods/battery_monitor.nix
inputs.networkmanager.nixosModules.networkmanager inputs.networkmanager.nixosModules.networkmanager
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
@@ -48,6 +80,17 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
grim # screenshot functionality
slurp # screenshot functionality
wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout
mako # notification system developed by swaywm maintainer
(pkgs.wrapOBS {
plugins = with obs-studio-plugins; [
obs-ndi
obs-teleport
];
})
slint-lsp slint-lsp
cifs-utils cifs-utils
nfs-utils nfs-utils
@@ -159,8 +202,19 @@
security.polkit.enable = true; security.polkit.enable = true;
services.rpcbind.enable = true; services.rpcbind.enable = true;
services.avahi.enable = true; #services.avahi.hostName = "c2vi";
services.avahi.hostName = "c2vi"; services.avahi = {
enable = true;
nssmdns = true;
publish = {
enable = true;
addresses = true;
domain = true;
hinfo = true;
userServices = true;
workstation = true;
};
};
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
#networking.networkmanager.extraConfig = '' #networking.networkmanager.extraConfig = ''
@@ -170,7 +224,7 @@
#networking.useDHCP = lib.mkForce true; #networking.useDHCP = lib.mkForce true;
networking.firewall.allowPing = true; networking.firewall.allowPing = true;
networking.firewall.enable = true; networking.firewall.enable = false;
services.samba.openFirewall = true; services.samba.openFirewall = true;
@@ -190,7 +244,7 @@
53 # allow dns 53 # allow dns
]; ];
networking.search = [ "c2vi.local" ]; #networking.search = [ "c2vi.local" ];
#networking.hosts = { #networking.hosts = {
#"10.1.1.3" = [ "phone" ]; #"10.1.1.3" = [ "phone" ];
#}; #};
@@ -489,8 +543,8 @@
############################## swap and hibernate ################################### ############################## swap and hibernate ###################################
swapDevices = [ { device = "/dev/lvm0/swap"; } ]; swapDevices = [ { device = "/swapfile"; } ];
boot.resumeDevice = "/dev/lvm0/swap"; boot.resumeDevice = "/swapfile";
services.logind = { services.logind = {
extraConfig = '' extraConfig = ''
HandlePowerKey=suspend-then-hibernate HandlePowerKey=suspend-then-hibernate
@@ -500,7 +554,7 @@
lidSwitchDocked = "ignore"; lidSwitchDocked = "ignore";
}; };
systemd.sleep.extraConfig = '' systemd.sleep.extraConfig = ''
HibernateDelaySec=2h HibernateDelaySec=27h
HibernateMode=shutdown HibernateMode=shutdown
''; '';
} }

View File

@@ -1 +0,0 @@
hi

View File

@@ -1,9 +1,8 @@
192.168.1.6 hpm 192.168.1.6 hpm
192.168.1.3 fusu 192.168.1.2 fusu
192.168.1.2 rpi
192.168.1.2 files 192.168.1.2 files
192.168.1.2 rpis
192.168.1.5 acern 192.168.1.5 acern
192.168.1.22 fasu 192.168.1.22 fasu
192.168.1.1 rou 192.168.1.1 rou
192.168.1.1 router 192.168.1.1 router
192.168.1.33 mac

View File

@@ -0,0 +1,54 @@
{ stdenv
, fetchFromGitHub
, lib
, ndi
}:
stdenv.mkDerivation rec {
pname = "ndi-monitor";
version = "0.3.2";
src = fetchFromGitHub {
owner = "lplassman";
repo = "NDI-Monitor";
rev = "f4ae6506d308b1b847e449833aa4cea3555caf15";
sha256 = "sha256-YLNvFdyqKb6DJV/cmdF8O5hmxOOqCCFbwGlFxI6rpW0=";
};
patches = [ ./ndi-monitor.patch ];
nativeBuildInputs = [
ndi
];
buildPhase = ''
g++ -std=c++14 -pthread -Wl,--allow-shlib-undefined -Wl,--as-needed -Iinclude/ -I${ndi}/include/ -L lib -o ndi_monitor ndi_monitor.cpp mongoose.c mjson.c -lndi -ldl
'';
installPhase = ''
mkdir -p $out/bin
cp ndi_monitor $out/bin/ndi-monitor
cp -r $src/assets $out
'';
buildInputs = [
#ncurses
];
meta = with lib; {
description = "A small pogram to display network traffic of interfaces in realtime";
longDescription = ''
Simple curses-based GUI.
It is useful for Internet or LAN speed tests, measuring the velocity of a link, to establish a benchmark or to monitor your connections.
CBM can be used with virtual, wired or wireless networks.
Originally imported from some tarballs from the Debian Project: http://snapshot.debian.org/package/cbm/. Now maintained by volunteers.
'';
homepage = "https://github.com/resurrecting-open-source-projects/cbm";
license = licenses.gpl2Only;
#maintainers = [ ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/ndi_monitor.cpp b/ndi_monitor.cpp
index 6de4dff..6b5c35b 100644
--- a/ndi_monitor.cpp
+++ b/ndi_monitor.cpp
@@ -84,7 +84,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data){
}else if(mg_http_match_uri(hm, "/rest")) { //handle REST events
mg_http_reply(c, 200, "", "{\"result\": %d}\n", 123);
}else{ // Serve static files
- struct mg_http_serve_opts opts = {.root_dir = "/opt/ndi_monitor/assets/"};
+ struct mg_http_serve_opts opts = {.root_dir = getenv("NDI_MONITOR_ASSETS_DIR")};
mg_http_serve_dir(c, (mg_http_message*)ev_data, &opts);
}
}else if (ev == MG_EV_WS_MSG){

View File

@@ -1,12 +1,9 @@
#!/bin/sh #!/bin/sh
if [ -f "htldoc.nix" ]; then if [ -f "htldoc.nix" ]; then
echo -en "" htldocUrl=$(nix eval --expr 'let config = (import ./htldoc.nix {}); in if builtins.hasAttr "htldocVersion" config then config.htldocVersion else "github:c2vi/htldoc/master"' --impure)
nix run $htldocUrl -- $@
else else
echo "There is not htldoc.nix in this directory" >&2 nix run github:c2vi/htldoc/master -- $@
exit 1
fi fi
htldocUrl=$(nix eval --expr 'let config = (import ./htldoc.nix {}); in if builtins.hasAttr "htldocVersion" config then config.htldocVersion else "github:c2vi/htldoc/master"' --impure)
nix run $htldocUrl

View File

@@ -17,6 +17,11 @@ then
ssh tab "rm /sdcard/note/CUR/*" ssh tab "rm /sdcard/note/CUR/*"
elif [ "$1" == "du" ]
then
du -d 1 -h $2 | sort -h -r
elif [ "$1" == "mnt-wechner" ] elif [ "$1" == "mnt-wechner" ]
then then
rclone mount --vfs-cache-mode full -vvvv onedrive-school:projekt-autobatterie ~/work/htl/projekt/wechner/mnt rclone mount --vfs-cache-mode full -vvvv onedrive-school:projekt-autobatterie ~/work/htl/projekt/wechner/mnt
@@ -104,7 +109,7 @@ sudo systemctl hibernate
elif [ "$1" == "suspend" ] elif [ "$1" == "suspend" ]
then then
sudo systemctl suspend sudo systemctl suspend-then-hibernate
fi fi

View File

@@ -164,7 +164,7 @@
set shellopts "-eu" set shellopts "-eu"
set ifs "\n" set ifs "\n"
set shell "bash" set shell "bash"
set ruler "df:acc:progress:selection:filter:ind" #set ruler "df:acc:progress:selection:filter:ind"
''; '';
}; };
} }

View File

@@ -31,10 +31,6 @@
hostname = "127.0.0.1"; hostname = "127.0.0.1";
user = "me"; user = "me";
}; };
rpi = {
port = 49388;
user = "me";
};
files = { files = {
port = 49388; port = 49388;
user = "files"; user = "files";
@@ -59,11 +55,6 @@
hpm = { hpm = {
user = "me"; user = "me";
}; };
fusus = {
hostname = "fusu";
user = "server";
};
fasu = { fasu = {
hostname = "fasu"; hostname = "fasu";
user = "me"; user = "me";
@@ -74,6 +65,7 @@
}; };
fusu = { fusu = {
port = 49388;
hostname = "fusu"; hostname = "fusu";
user = "me"; user = "me";
}; };

View File

@@ -40,6 +40,58 @@ in rec {
}; };
#######################################################################
# make an iso
#to build: nix build .#random.iso.config.system.build.isoImage
# an old old nixpkgs: https://github.com/NixOS/nixpkgs/tree/release-15.09
iso = let
oldNixpkgsSrc = pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "cc7c26173149348ba43f0799fac3f3823a2d21fc"; # 15.09
#rev = "3ba3d8d8cbec36605095d3a30ff6b82902af289c";
#rev = "71db8c7a02f3be7cb49b495786050ce1913246d3";
hash = "sha256-Bu0ECsynGNuj4lYK/QcvuKqKCKd6b1j8jlE7fLjE+t0=";
};
oldPkgs = import oldNixpkgsSrc { system = "x86_64-linux"; };
# ${nixpkgs-repo}/nixos/default.nix holds a function, that takes a system and a configuration and outputs just what nixpkgs.lib.nixosSystem outputs
# so we can make our own nixosSystem func
oldNixosSystem = { system, modules, ... }: import (oldNixpkgsSrc + "/nixos") {
inherit system;
configuration = { imports = modules; };
};
system = oldNixosSystem {
system = "x86_64-linux";
modules = [
(oldNixpkgsSrc + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
({ pkgs, ...}: {
boot.initrd.kernelModules = [ "fbcon" ];
services.openssh.enable = true;
users.users.root.password = "changeme";
services.xserver.enable = false;
#services.displayManager.enable = false;
})
];
};
in system.config.system.build.isoImage;
obs = let
pkgs = import inputs.nixpkgs-unstable { inherit system; };
in pkgs.wrapOBS {
plugins = with pkgs.obs-studio-plugins; [
obs-ndi
];
};
zephyr = inputs.zephyr-nix.packages.${system}; zephyr = inputs.zephyr-nix.packages.${system};
@@ -178,7 +230,7 @@ in rec {
}); });
run-vm = specialArgs.pkgs.writeScriptBin "run-vm" '' run-vm = specialArgs.pkgs.writeScriptBin "run-vm" ''
${self.nixosConfigurations.hpm.config.system.build.vm}/bin/run-hpm-vm -m 4G -cpu host -smp 4 ${self.nixosConfigurations.main.config.system.build.vm}/bin/run-main-vm -m 4G -cpu host -smp 4
''; '';
hec-img = nixos-generators.nixosGenerate { hec-img = nixos-generators.nixosGenerate {

79
scripts/batteryscript.sh Executable file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/env bash
# Settings
battery_percent_MODULUS=5 # How many percent difference are required for another update
INTERVAL=5 # The interval at which to check the battery percentage
ALERT_SCRIPT="sudo /home/mia/Scripts/keyboard_alert.sh"
# Battery Levels
BAT_RECOMMENDED_UPPER_LIMIT=80
BAT_RECOMMENDED_LOWER_LIMIT=40
BAT_SLIGHTLY_LOW=30
BAT_LOW=20
BAT_VERY_LOW=10
BAT_HIB=5
force_notification=0
last_battery_percent=0
get_percentage()
{
echo $(cat /sys/bus/acpi/drivers/battery/*/power_supply/BAT?/capacity)
}
countdown()
{
for i in $(seq 1 10);
do
if [[ $(cat /sys/bus/acpi/drivers/battery/*/power_supply/BAT?/status) = "Charging" ]]; then
return
fi
sleep 1
notify-send $((10-$i)) -u critical
done
systemctl hibernate
}
while true;
do
sleep $INTERVAL
battery_percent=$(get_percentage)
if [[ $battery_percent -eq $last_battery_percent ]]; then
continue
fi
if [[ $(( battery_percent % $battery_percent_MODULUS )) -ne 0 && $force_notification -ne 1 ]]; then
continue
fi
# Is battery charging?
if [[ $(cat /sys/bus/acpi/drivers/battery/*/power_supply/BAT?/status) = "Charging" ]]; then
if [[ $battery_percent -ge $BAT_RECOMMENDED_UPPER_LIMIT ]]; then
notify-send "Im full!" -u low
$ALERT_SCRIPT
fi
# Is battery discharging?
else
if [[ $battery_percent -le $BAT_HIB ]]; then
notify-send "Self destructing in T Minus 10 Seconds..." -u critical &&
countdown
elif [[ $battery_percent -le $BAT_VERY_LOW ]]; then
notify-send "I beg you, I'm about to die!" -u critical &&
$ALERT_SCRIPT 5
elif [[ $battery_percent -le $BAT_LOW ]]; then
notify-send "Can you please plug me in aleady? I'm dying!" -u normal &&
$ALERT_SCRIPT 2
elif [[ $battery_percent -le $BAT_SLIGHTLY_LOW ]]; then
notify-send "I'd need a recharge about now pwp" -u normal &&
$ALERT_SCRIPT 1
elif [[ $battery_percent -le $BAT_RECOMMENDED_LOWER_LIMIT ]]; then
notify-send "Please plug me in pwp" -u low
fi
fi
last_battery_percent=$battery_percent
done

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
export XDG_RUNTIME_DIR="/run/user/$(id -u $SENDER_USER)"
export WAYLAND_DISPLAY="wayland-0"
ALERT_SCRIPT="sudo ./keyboard_alert.sh 2"
status=$1
if [[ $status -eq 0 ]]; then
dunstctl close-all
notify-send "No mommy put it back pwp" -u low
$ALERT_SCRIPT
else
dunstctl close-all
notify-send "Thank you for plugging me mommy ~" -u low
$ALERT_SCRIPT
fi

16
scripts/colorscript.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
while true; do
sudo ectool led battery red
sleep 0.2
sudo ectool led battery green
sleep 0.2
sudo ectool led battery blue
sleep 0.2
sudo ectool led battery yellow
sleep 0.2
sudo ectool led battery white
sleep 0.2
sudo ectool led battery amber
sleep 0.2
done

5
scripts/get_power_usage.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
power=$(cat /sys/class/power_supply/BAT1/current_now /sys/class/power_supply/BAT1/voltage_now | xargs | awk '{ printf "%.1f\n", $1 * $2 / 1e12 }')
echo $power

12
scripts/idlescript Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
swayidle -w -d \
timeout 15 'bash -c "~/.config/nixos/scripts/keyboard_fade_brightness.sh 4 0 0.05"' \
resume 'bash -c "brightnessctl -d framework_laptop::kbd_backlight set 4"' \
timeout 170 'bash -c "brightnessctl g > /tmp/current_brightness && brightnessctl -e s 30%-"' \
resume 'bash -c "if [ -f /tmp/current_brightness ]; then brightnessctl set $(cat /tmp/current_brightness); fi"' \
timeout 180 '/home/mia/Scripts/lockscript' \
timeout 200 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
after-resume 'swaymsg "output * dpms on"' \
before-sleep '/home/mia/Scripts/lockscript'

31
scripts/keyboard_alert.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
CURRENT_LIGHT=$(sudo ectool pwmgetkblight | cut -d' ' -f 5)
echo $CURRENT_LIGHT >> /home/mia/Scripts/output.txt
if [[ $CURRENT_LIGHT -eq "" ]]
then
CURRENT_LIGHT=0
fi
if [[ $CURRENT_LIGHT -eq 0 ]];
then
FIRST_LIGHT_VALUE=100
SECOND_LIGHT_VALUE=0
else
FIRST_LIGHT_VALUE=$CURRENT_LIGHT
SECOND_LIGHT_VALUE=0
fi
count=0
while [[ $count -lt $1 ]];
do
sudo ectool pwmsetkblight $FIRST_LIGHT_VALUE
sleep 0.13
sudo ectool pwmsetkblight $SECOND_LIGHT_VALUE
sleep 0.13
((count=count+1))
done
sudo ectool pwmsetkblight $CURRENT_LIGHT

8
scripts/lockscript Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
path="/home/mia/Pictures/Screenshots/screen.png"
grim "$path" &&
corrupter -add 0 -bheight 20 -stdabber 10 -boffset 50 "$path" "$path" &&
swaylock -c /home/mia/.config/swaylock/config &&
swaymsg "output * dpms on"

1
scripts/screenshot.sh Executable file
View File

@@ -0,0 +1 @@
flameshot gui -r | wl-copy

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Get the PID of the focused window
PID=$(swaymsg -t get_tree | jq -r '.. | select(.focused? == true).pid')
FOCUSED_WIN_ID=$(swaymsg -t get_tree | jq -r '.. | select(.focused? == true).id')
# Check if the process is frozen
STATE=$(ps -o state= -p $PID)
if [[ "$STATE" == *T* ]]; then
# If the process is frozen, unfreeze it and reset border color
kill -CONT $PID
swaymsg [con_id=$FOCUSED_WIN_ID] border pixel 2
else
# If the process is running, freeze it and change border color
kill -STOP $PID
swaymsg [con_id=$FOCUSED_WIN_ID] border pixel 10
fi

103
scripts/waybar-timer.sh Executable file
View File

@@ -0,0 +1,103 @@
#!/usr/bin/env bash
### AUTHOR: Johann Birnick (github: jbirnick)
### PROJECT REPO: https://github.com/jbirnick/waybar-timer
## FUNCTIONS
now () { date --utc +%s; }
killTimer () { rm -rf /tmp/waybar-timer ; }
timerSet () { [ -e /tmp/waybar-timer/ ] ; }
timerPaused () { [ -f /tmp/waybar-timer/paused ] ; }
timerExpiry () { cat /tmp/waybar-timer/expiry ; }
timerAction () { cat /tmp/waybar-timer/action ; }
secondsLeftWhenPaused () { cat /tmp/waybar-timer/paused ; }
minutesLeftWhenPaused () { echo $(( ( $(secondsLeftWhenPaused) + 59 ) / 60 )) ; }
secondsLeft () { echo $(( $(timerExpiry) - $(now) )) ; }
minutesLeft () { echo $(( ( $(secondsLeft) + 59 ) / 60 )) ; }
printExpiryTime () { notify-send -u low -r 12345 "Timer expires at $( date -d "$(secondsLeft) sec" +%H:%M)" ;}
printPaused () { notify-send -u low -r 12345 "Timer paused" ; }
removePrinting () { notify-send -C 12345 ; }
updateTail () {
# check whether timer is expired
if timerSet
then
if { timerPaused && [ $(minutesLeftWhenPaused) -le 0 ] ; } || { ! timerPaused && [ $(minutesLeft) -le 0 ] ; }
then
eval $(timerAction)
killTimer
removePrinting
fi
fi
# update output
if timerSet
then
if timerPaused
then
echo "{\"text\": \"$(minutesLeftWhenPaused)\", \"alt\": \"paused\", \"tooltip\": \"Timer paused\", \"class\": \"timer\" }"
else
echo "{\"text\": \"$(minutesLeft)\", \"alt\": \"running\", \"tooltip\": \"Timer expires at $( date -d "$(secondsLeft) sec" +%H:%M)\", \"class\": \"timer\" }"
fi
else
echo "{\"text\": \"0\", \"alt\": \"standby\", \"tooltip\": \"No timer set\", \"class\": \"timer\" }"
fi
}
## MAIN CODE
case $1 in
updateandprint)
updateTail
;;
new)
killTimer
mkdir /tmp/waybar-timer
echo "$(( $(now) + 60*${2} ))" > /tmp/waybar-timer/expiry
echo "${3}" > /tmp/waybar-timer/action
printExpiryTime
;;
increase)
if timerSet
then
if timerPaused
then
echo "$(( $(secondsLeftWhenPaused) + ${2} ))" > /tmp/waybar-timer/paused
else
echo "$(( $(timerExpiry) + ${2} ))" > /tmp/waybar-timer/expiry
printExpiryTime
fi
else
exit 1
fi
;;
cancel)
killTimer
removePrinting
;;
togglepause)
if timerSet
then
if timerPaused
then
echo "$(( $(now) + $(secondsLeftWhenPaused) ))" > /tmp/waybar-timer/expiry
rm -f /tmp/waybar-timer/paused
printExpiryTime
else
secondsLeft > /tmp/waybar-timer/paused
rm -f /tmp/waybar-timer/expiry
printPaused
fi
else
exit 1
fi
;;
*)
echo "Please read the manual at https://github.com/jbirnick/waybar-timer ."
;;
esac