From 64eee2b9030f9d794fd211d4b352ae0f290a4ce4 Mon Sep 17 00:00:00 2001 From: Tyler Starr Date: Thu, 25 May 2023 22:01:36 -0700 Subject: [PATCH] nixos :( --- home/dot_config/mimeapps.list | 1 + home/dot_config/sway/config | 6 +-- ...le_status.sh => executable_status.sh.tmpl} | 19 +++++-- .../sway/scripts/executable_tabfocus.sh | 14 ++++- provision/nixos/flake.lock | 54 +++++++++++++++++++ provision/nixos/flake.nix | 6 ++- .../nixos/hosts/kestrel/configuration.nix | 9 ++-- provision/nixos/modules/desktop/sway.nix | 1 + provision/nixos/modules/devel/default.nix | 2 +- provision/nixos/modules/devel/engineering.nix | 2 +- provision/nixos/modules/devel/python.nix | 2 + provision/nixos/modules/devel/tooling.nix | 1 + provision/nixos/modules/gaming/steam.nix | 5 +- 13 files changed, 107 insertions(+), 15 deletions(-) rename home/dot_config/sway/scripts/{executable_status.sh => executable_status.sh.tmpl} (57%) diff --git a/home/dot_config/mimeapps.list b/home/dot_config/mimeapps.list index 90daa80a..e52d8001 100644 --- a/home/dot_config/mimeapps.list +++ b/home/dot_config/mimeapps.list @@ -1,4 +1,5 @@ [Default Applications] +inode/directory=pcmanfm.desktop; text/html=firefox.desktop; x-scheme-handler/http=firefox.desktop; x-scheme-handler/https=firefox.desktop; diff --git a/home/dot_config/sway/config b/home/dot_config/sway/config index e4c20abb..ebf857de 100644 --- a/home/dot_config/sway/config +++ b/home/dot_config/sway/config @@ -122,8 +122,8 @@ for_window [class="discord"] move container to workspace $tag8 # [p]ower commands bindsym $mod+p mode $mode_power mode $mode_power { - bindsym s exec loginctl poweroff - bindsym r exec loginctl reboot + bindsym s exec shutdown now + bindsym r exec reboot bindsym Escape mode default } @@ -205,7 +205,7 @@ bindsym $mod+o mode open mode open { bindsym b exec firefox, $e bindsym s exec steam, $e - bindsym d exec flatpak run com.discordapp.Discord, $e + bindsym d exec discord, $e bindsym Escape mode default } diff --git a/home/dot_config/sway/scripts/executable_status.sh b/home/dot_config/sway/scripts/executable_status.sh.tmpl similarity index 57% rename from home/dot_config/sway/scripts/executable_status.sh rename to home/dot_config/sway/scripts/executable_status.sh.tmpl index ec3d86b0..baae8a24 100644 --- a/home/dot_config/sway/scripts/executable_status.sh +++ b/home/dot_config/sway/scripts/executable_status.sh.tmpl @@ -2,7 +2,7 @@ # You should see changes to the status bar after saving this script. # Uptime -uptime_formatted=$(uptime | cut -d ',' -f1 | cut -d ' ' -f7) +uptime_formatted=$(uptime | cut -d ',' -f1 | rev | cut -d ' ' -f1 | rev) # Date date_formatted=$(date "+%a %F %H:%M") @@ -30,7 +30,20 @@ else fi #bluetooth=$(bluetoothctl devices | cut -f2 -d' ' | while read uuid; do bluetoothctl info $uuid; done | grep -e "Name\|Connected: yes" | grep -B1 "yes" | head -n 1 | cut -d\ -f2-) -bluetooth="a" +bluetooth="🫐" + +# Network usage +r1=`cat /sys/class/net/{{ .network_interface }}/statistics/rx_bytes` +t1=`cat /sys/class/net/{{ .network_interface }}/statistics/tx_bytes` +sleep 1 +r2=`cat /sys/class/net/{{ .network_interface }}/statistics/rx_bytes` +t2=`cat /sys/class/net/{{ .network_interface }}/statistics/tx_bytes` +tx=`expr $t2 - $t1` +rx=`expr $r2 - $r1` +txmb=$(echo "scale = 1; $tx / 128000" | bc | awk '{printf "%05.1f\n", $0}') +rxmb=$(echo "scale = 1; $rx / 128000" | bc | awk '{printf "%05.1f\n", $0}') + #lel -echo -e "🫐 $bluetooth | ⬆️ $uptime_formatted | 🔉$volume% | $gamemode | 🐧 $linux_version | $date_formatted " +echo -e "👍 $txmb 👎 $rxmb | ⬆️ $uptime_formatted | 🔉$volume% | $gamemode | 🐧 $linux_version | $date_formatted " + diff --git a/home/dot_config/sway/scripts/executable_tabfocus.sh b/home/dot_config/sway/scripts/executable_tabfocus.sh index ab341fbd..e131a1ef 100644 --- a/home/dot_config/sway/scripts/executable_tabfocus.sh +++ b/home/dot_config/sway/scripts/executable_tabfocus.sh @@ -13,15 +13,27 @@ move_tabbed = {"h": "focus parent; focus left", "k": "focus left", "l": "focus parent; focus right"} +move_tabbed_single = {"h": "focus left", + "j": "focus right", + "k": "focus left", + "l": "focus right"} + i3 = i3ipc.Connection() # Get the focused container focused = i3.get_tree().find_focused() +# Get number of splits (v or h) +focused_workspace = focused.workspace() +num_splits = sum(1 for con in focused_workspace.descendants() if con.layout == 'splitv' or con.layout == 'splith') + # Get the layout of the parent container layout = focused.parent.layout if layout == "tabbed": - i3.command(move_tabbed[sys.argv[1]]) + if num_splits > 0: + i3.command(move_tabbed[sys.argv[1]]) + else: + i3.command(move_tabbed_single[sys.argv[1]]) else: i3.command(move_normal[sys.argv[1]]) diff --git a/provision/nixos/flake.lock b/provision/nixos/flake.lock index 4d0bbc30..6e14827a 100644 --- a/provision/nixos/flake.lock +++ b/provision/nixos/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -20,6 +35,28 @@ "type": "github" } }, + "mach-nix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "pypi-deps-db": "pypi-deps-db" + }, + "locked": { + "lastModified": 1681814846, + "narHash": "sha256-IMQ1Twf/ozE53CwrunXNlYD3D31xqgz/mZyZG38Ov/Y=", + "owner": "DavHau", + "repo": "mach-nix", + "rev": "8d903072c7b5426d90bc42a008242c76590af916", + "type": "github" + }, + "original": { + "owner": "DavHau", + "repo": "mach-nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1683408522, @@ -36,9 +73,26 @@ "type": "github" } }, + "pypi-deps-db": { + "flake": false, + "locked": { + "lastModified": 1678051695, + "narHash": "sha256-kFFP8TN8pEKARtjK9loGdH+TU23ZbHdVLCUdNcufKPs=", + "owner": "DavHau", + "repo": "pypi-deps-db", + "rev": "e00b22ead9d3534ba1c448e1af3076af6b234acf", + "type": "github" + }, + "original": { + "owner": "DavHau", + "repo": "pypi-deps-db", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", + "mach-nix": "mach-nix", "nixpkgs": "nixpkgs" } } diff --git a/provision/nixos/flake.nix b/provision/nixos/flake.nix index 84670c33..72f3dd0a 100644 --- a/provision/nixos/flake.nix +++ b/provision/nixos/flake.nix @@ -7,9 +7,13 @@ url = github:nix-community/home-manager; inputs.nixpkgs.follows = "nixpkgs"; }; + mach-nix= { + url = "github:DavHau/mach-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs @ { self, nixpkgs, home-manager, ... }: + outputs = inputs @ { self, nixpkgs, home-manager, mach-nix, ... }: let system = "x86_64-linux"; pkgs = import nixpkgs { diff --git a/provision/nixos/hosts/kestrel/configuration.nix b/provision/nixos/hosts/kestrel/configuration.nix index 89dce01e..64cf97bd 100644 --- a/provision/nixos/hosts/kestrel/configuration.nix +++ b/provision/nixos/hosts/kestrel/configuration.nix @@ -69,6 +69,8 @@ nerdfonts ]; + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; programs.zsh.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.${user} = { @@ -90,6 +92,8 @@ mpv pinentry-curses trash-cli + bc + unzip ]; # Enable user services @@ -107,10 +111,7 @@ configDir = "/home/tstarr/.config/syncthing"; }; }; - virtualisation.docker.rootless = { - enable = true; - setSocketVariable = true; - }; + # Enable the OpenSSH daemon. services.openssh.enable = true; services.pcscd.enable = true; diff --git a/provision/nixos/modules/desktop/sway.nix b/provision/nixos/modules/desktop/sway.nix index 63aa9e55..6353c9f5 100644 --- a/provision/nixos/modules/desktop/sway.nix +++ b/provision/nixos/modules/desktop/sway.nix @@ -41,6 +41,7 @@ in { grim # screenshot functionality wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout mako # notification system developed by swaywm maintainer + #dunst wdisplays # tool to configure displays rofi imagemagick diff --git a/provision/nixos/modules/devel/default.nix b/provision/nixos/modules/devel/default.nix index 4ef52ea3..ebe66dbb 100644 --- a/provision/nixos/modules/devel/default.nix +++ b/provision/nixos/modules/devel/default.nix @@ -1,5 +1,5 @@ { ... }: { - imports = [ ./python.nix ./engineering.nix ]; + imports = [ ./tooling.nix ./python.nix ./engineering.nix ]; } diff --git a/provision/nixos/modules/devel/engineering.nix b/provision/nixos/modules/devel/engineering.nix index e794e151..2926450c 100644 --- a/provision/nixos/modules/devel/engineering.nix +++ b/provision/nixos/modules/devel/engineering.nix @@ -9,6 +9,6 @@ in { config = lib.mkIf cfg.enable { # Install packages - environment.systemPackages = with pkgs; [ super-slicer-latest freecad blender ]; + environment.systemPackages = with pkgs; [ super-slicer freecad blender ]; }; } diff --git a/provision/nixos/modules/devel/python.nix b/provision/nixos/modules/devel/python.nix index 214b99b2..f4e9fc4b 100644 --- a/provision/nixos/modules/devel/python.nix +++ b/provision/nixos/modules/devel/python.nix @@ -7,6 +7,8 @@ let my-python-packages = ps: with ps; [ virtualenv i3ipc + ipython + pip ]; in { diff --git a/provision/nixos/modules/devel/tooling.nix b/provision/nixos/modules/devel/tooling.nix index 9a1e9853..2468e886 100644 --- a/provision/nixos/modules/devel/tooling.nix +++ b/provision/nixos/modules/devel/tooling.nix @@ -12,6 +12,7 @@ in { environment.systemPackages = with pkgs; [ neovim ripgrep + tmux tmuxinator ]; }; diff --git a/provision/nixos/modules/gaming/steam.nix b/provision/nixos/modules/gaming/steam.nix index 409355f1..4cd34062 100644 --- a/provision/nixos/modules/gaming/steam.nix +++ b/provision/nixos/modules/gaming/steam.nix @@ -14,7 +14,10 @@ in { hardware.steam-hardware.enable = true; - environment.systemPackages = [ pkgs.steam ]; + environment.systemPackages = [ + pkgs.steam + pkgs.ryujinx + ]; }; }