From 0c8d438bf391432c0ffcbbb77df70756a937d6da Mon Sep 17 00:00:00 2001 From: 4o1x5 <4o1x5@4o1x5.dev> Date: Sat, 11 Jan 2025 12:03:31 +0100 Subject: [PATCH] polybar and whatevernot --- flake.lock | 30 ++-- flake.nix | 6 +- hosts/strix/apps/syncthing.nix | 3 +- hosts/strix/configuration.nix | 3 +- hosts/thinkpad/apps/graphics.nix | 10 +- hosts/thinkpad/apps/music.nix | 6 +- hosts/thinkpad/apps/office.nix | 4 - hosts/thinkpad/apps/syncthing.nix | 9 +- hosts/thinkpad/configs/firefox.nix | 13 +- hosts/thinkpad/configs/polybar/bottom.nix | 17 +- hosts/thinkpad/configs/polybar/top.nix | 11 +- hosts/thinkpad/configs/rofi.nix | 188 ++++++++++---------- hosts/thinkpad/configuration.nix | 32 ++-- hosts/thinkpad/desktop.nix | 2 + hosts/thinkpad/hardware-configuration.nix | 23 +-- hosts/thinkpad/opt/poly.ini | 206 ++++++++++++++++++++++ 16 files changed, 381 insertions(+), 182 deletions(-) create mode 100644 hosts/thinkpad/opt/poly.ini diff --git a/flake.lock b/flake.lock index e4a957e..e95d13e 100755 --- a/flake.lock +++ b/flake.lock @@ -208,11 +208,11 @@ ] }, "locked": { - "lastModified": 1734366194, - "narHash": "sha256-vykpJ1xsdkv0j8WOVXrRFHUAdp9NXHpxdnn1F4pYgSw=", + "lastModified": 1736373539, + "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", "owner": "nix-community", "repo": "home-manager", - "rev": "80b0fdf483c5d1cb75aaad909bd390d48673857f", + "rev": "bd65bc3cde04c16755955630b344bc9e35272c56", "type": "github" }, "original": { @@ -333,11 +333,11 @@ }, "nixpkgs-last": { "locked": { - "lastModified": 1734529975, - "narHash": "sha256-ze3IJksru9dN0keqUxY0WNf8xrwfs8Ty/z9v/keyBbg=", + "lastModified": 1735563628, + "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "72d11d40b9878a67c38f003c240c2d2e1811e72a", + "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", "type": "github" }, "original": { @@ -360,11 +360,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1734424634, - "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", + "lastModified": 1736344531, + "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", + "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", "type": "github" }, "original": { @@ -407,11 +407,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1734600368, - "narHash": "sha256-nbG9TijTMcfr+au7ZVbKpAhMJzzE2nQBYmRvSdXUD8g=", + "lastModified": 1736200483, + "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b47fd6fa00c6afca88b8ee46cfdb00e104f50bca", + "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", "type": "github" }, "original": { @@ -495,11 +495,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1733940028, - "narHash": "sha256-WI4YDWvk3s3gUnt0cyt0USoTpUTEeEYm+EyQCCvrLvQ=", + "lastModified": 1734937677, + "narHash": "sha256-5qKdUBN1cq/LHa6ASIjGcDEYKDnAiaKgNtZCRbBrWEs=", "owner": "icewind1991", "repo": "nvidia-patch-nixos", - "rev": "91dd42b7a201b0e2b6c588faf70ffc09cd7b4a16", + "rev": "ec2e76e3cd53208c6bcbbddcc043516a24ca71b2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 40211eb..cd439ff 100755 --- a/flake.nix +++ b/flake.nix @@ -63,16 +63,16 @@ } ) - ./hosts/strix/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; } + ./hosts/strix/configuration.nix ]; }; - nixosConfigurations.thinkpad = nixpkgs.lib.nixosSystem { + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inputs = inputs; @@ -89,12 +89,12 @@ } ) - ./hosts/thinkpad/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; } + ./hosts/thinkpad/configuration.nix ]; }; diff --git a/hosts/strix/apps/syncthing.nix b/hosts/strix/apps/syncthing.nix index 5250b59..506e7ef 100755 --- a/hosts/strix/apps/syncthing.nix +++ b/hosts/strix/apps/syncthing.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ services.syncthing = { enable = true; user = "grape"; diff --git a/hosts/strix/configuration.nix b/hosts/strix/configuration.nix index 241f916..7d86d1c 100755 --- a/hosts/strix/configuration.nix +++ b/hosts/strix/configuration.nix @@ -91,12 +91,11 @@ "flakes" ]; - home-manager.users.grape = + home-manager.users."${user}" = { ... }: { home.stateVersion = "24.11"; }; - nixpkgs.config.permittedInsecurePackages = [ "electron-27.3.11" ]; diff --git a/hosts/thinkpad/apps/graphics.nix b/hosts/thinkpad/apps/graphics.nix index 82d25e4..f4fa7a7 100644 --- a/hosts/thinkpad/apps/graphics.nix +++ b/hosts/thinkpad/apps/graphics.nix @@ -1,12 +1,6 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ - #krita - #gimp - #figma-linux - #kdenlive - - # video cutting easy - losslesscut-bin ]; } diff --git a/hosts/thinkpad/apps/music.nix b/hosts/thinkpad/apps/music.nix index 1679b35..9b423c0 100755 --- a/hosts/thinkpad/apps/music.nix +++ b/hosts/thinkpad/apps/music.nix @@ -1,12 +1,10 @@ -{ pkgs, config, ... }: { +{ pkgs, config, ... }: +{ environment.systemPackages = with pkgs; [ playerctl jamesdsp yt-dlp feishin - #mpv-unwrapped - qpwgraph ]; } - diff --git a/hosts/thinkpad/apps/office.nix b/hosts/thinkpad/apps/office.nix index 15064e7..98073a4 100755 --- a/hosts/thinkpad/apps/office.nix +++ b/hosts/thinkpad/apps/office.nix @@ -1,9 +1,5 @@ { pkgs, config, ... }: { environment.systemPackages = with pkgs; [ - libreoffice - onlyoffice-bin ]; } - - diff --git a/hosts/thinkpad/apps/syncthing.nix b/hosts/thinkpad/apps/syncthing.nix index 5250b59..3e51862 100755 --- a/hosts/thinkpad/apps/syncthing.nix +++ b/hosts/thinkpad/apps/syncthing.nix @@ -1,8 +1,9 @@ -{ pkgs, ... }: { +{ pkgs, user, ... }: +{ services.syncthing = { enable = true; - user = "grape"; - dataDir = "/home/grape/Documents"; - configDir = "/home/grape/.syncthing"; + user = "${user}"; + dataDir = "/home/peach/Documents"; + configDir = "/home/peach/.syncthing"; }; } diff --git a/hosts/thinkpad/configs/firefox.nix b/hosts/thinkpad/configs/firefox.nix index ae35fa6..219a8af 100644 --- a/hosts/thinkpad/configs/firefox.nix +++ b/hosts/thinkpad/configs/firefox.nix @@ -1,4 +1,9 @@ -{ pkgs, user, ... }: +{ + pkgs, + user, + dotfilepath, + ... +}: { home-manager.users.${user} = { programs.firefox = { @@ -9,9 +14,9 @@ id = 0; # TODO fix impurity - extraConfig = builtins.readFile "/home/grape/dotfiles/nix/opt/firefox/user.js"; # custom userjs config - userChrome = builtins.readFile "/home/grape/dotfiles/nix/opt/firefox/userChrome.css"; # browser styles - userContent = builtins.readFile "/home/grape/dotfiles/nix/opt/firefox/userContent.css"; # browser styles + extraConfig = builtins.readFile "${dotfilepath}/hosts/thinkpad/opt/firefox/user.js"; # custom userjs config + userChrome = builtins.readFile "${dotfilepath}/hosts/thinkpad/opt/firefox/userChrome.css"; # browser styles + userContent = builtins.readFile "${dotfilepath}/hosts/thinkpad/opt/firefox/userContent.css"; # browser styles extensions = with pkgs; [ nur.repos.rycee.firefox-addons.ublock-origin diff --git a/hosts/thinkpad/configs/polybar/bottom.nix b/hosts/thinkpad/configs/polybar/bottom.nix index fcdd5fc..0bec92e 100644 --- a/hosts/thinkpad/configs/polybar/bottom.nix +++ b/hosts/thinkpad/configs/polybar/bottom.nix @@ -1,4 +1,9 @@ -{ pkgs, ... }: +{ + pkgs, + dotfilepath, + user, + ... +}: let # todo add this to flake.nix colors = { @@ -14,11 +19,11 @@ let seperatorColor = "#FAD000"; }; - script = "~/dotfiles/scripts"; + script = "~${dotfilepath}/scripts"; in { - home-manager.users.grape.services.polybar = { + home-manager.users.${user}.services.polybar = { config = { @@ -59,8 +64,6 @@ in click-right = "pavucontrol"; }; - - "module/replay" = { type = "custom/script"; exec = "~/.config/scripts/status.sh"; @@ -80,7 +83,6 @@ in label-background = "#191830"; label-connected = "%{F${colors.seperatorColor}}%{F-} %downspeed% %{F${colors.seperatorColor}}%{F-} %upspeed%"; - label-connected-background = "${colors.bg}"; label-disconnected-background = "${colors.bg}"; @@ -99,7 +101,6 @@ in label-disconnected-background = "${colors.bg}"; }; - "bar/bottom" = { background = "#00191830"; border-color = "#00400080"; @@ -121,5 +122,3 @@ in }; } - - diff --git a/hosts/thinkpad/configs/polybar/top.nix b/hosts/thinkpad/configs/polybar/top.nix index 4faf12d..db04662 100644 --- a/hosts/thinkpad/configs/polybar/top.nix +++ b/hosts/thinkpad/configs/polybar/top.nix @@ -1,3 +1,4 @@ +{ dotfilepath, user, ... }: let colors = { fg = "#FFFFFF"; @@ -11,11 +12,12 @@ let currentWorkspace = "#FAD000"; seperatorColor = "#FAD000"; }; - script = "~/.config/scripts"; + + script = "~${dotfilepath}/scripts"; in { - home-manager.users.grape.services.polybar = { + home-manager.users.${user}.services.polybar = { config = { "module/date" = { @@ -40,7 +42,7 @@ in "module/fs-label-data" = { type = "custom/text"; label = "DAT "; - label-foreground = "${ colors. seperatorColor}"; + label-foreground = "${colors.seperatorColor}"; }; "module/ewmh" = { @@ -98,7 +100,6 @@ in label-warn-foreground = "${colors.warn}"; }; - "fs-base" = { type = "internal/fs"; label-unmounted = "?"; @@ -106,7 +107,6 @@ in warn-precentage = "80%"; }; - "module/fs-system" = { "inherit" = "fs-base"; mount-0 = "/"; @@ -164,4 +164,3 @@ in }; } - diff --git a/hosts/thinkpad/configs/rofi.nix b/hosts/thinkpad/configs/rofi.nix index 46f2251..e9b52d2 100755 --- a/hosts/thinkpad/configs/rofi.nix +++ b/hosts/thinkpad/configs/rofi.nix @@ -6,121 +6,123 @@ }: { - home-manager.users.grape.programs.rofi = { - enable = true; - font = "Jetbrains Mono"; - theme = "/home/${user}/.config/rofi/theme.rasi"; - plugins = with pkgs; [ - rofi-calc - rofi-emoji - ]; - }; + home-manager.users.${user} = { + programs.rofi = { + enable = true; + font = "Jetbrains Mono"; + theme = "/home/${user}/.config/rofi/theme.rasi"; + plugins = with pkgs; [ + rofi-calc + rofi-emoji + ]; + }; - home-manager.users.grape.home.file.".config/rofi/theme.rasi" = { - enable = true; - text = '' - /******************************************************************************* - * MACOS SPOTLIGHT LIKE DARK THEME FOR ROFI - * User : LR-Tech - * Theme Repo : https://github.com/lr-tech/rofi-themes-collection - *******************************************************************************/ + home.file.".config/rofi/theme.rasi" = { + enable = true; + text = '' + /******************************************************************************* + * MACOS SPOTLIGHT LIKE DARK THEME FOR ROFI + * User : LR-Tech + * Theme Repo : https://github.com/lr-tech/rofi-themes-collection + *******************************************************************************/ - * { - font: "JetBrains Mono Nerd 12"; + * { + font: "JetBrains Mono Nerd 12"; - bg0: #191830; - bg1: #7E7E7E80; - bg2: #FAD000; + bg0: #191830; + bg1: #7E7E7E80; + bg2: #FAD000; - fg0: #DEDEDE; - fg1: #FFFFFF; - fg2: #DEDEDE80; + fg0: #DEDEDE; + fg1: #FFFFFF; + fg2: #DEDEDE80; - background-color: transparent; - text-color: @fg0; + background-color: transparent; + text-color: @fg0; - margin: 0; - padding: 0; - spacing: 0; - } + margin: 0; + padding: 0; + spacing: 0; + } - window { - background-color: @bg0; + window { + background-color: @bg0; - location: center; - width: 640; - border-radius: 8; - } + location: center; + width: 640; + border-radius: 8; + } - inputbar { - font: "Montserrat 20"; - padding: 12px; - spacing: 12px; - children: [ icon-search, entry ]; - } + inputbar { + font: "Montserrat 20"; + padding: 12px; + spacing: 12px; + children: [ icon-search, entry ]; + } - icon-search { - expand: false; - filename: "search"; - size: 28px; - } + icon-search { + expand: false; + filename: "search"; + size: 28px; + } - icon-search, entry, element-icon, element-text { - vertical-align: 0.5; - } + icon-search, entry, element-icon, element-text { + vertical-align: 0.5; + } - entry { - font: inherit; + entry { + font: inherit; - placeholder : "Search"; - placeholder-color : @fg2; - } + placeholder : "Search"; + placeholder-color : @fg2; + } - message { - border: 2px 0 0; - border-color: @bg1; - background-color: @bg1; - } + message { + border: 2px 0 0; + border-color: @bg1; + background-color: @bg1; + } - textbox { - padding: 8px 24px; - } + textbox { + padding: 8px 24px; + } - listview { - lines: 10; - columns: 1; + listview { + lines: 10; + columns: 1; - fixed-height: false; - border: 1px 0 0; - border-color: @bg1; - } + fixed-height: false; + border: 1px 0 0; + border-color: @bg1; + } - element { - padding: 8px 16px; - spacing: 16px; - background-color: transparent; - } + element { + padding: 8px 16px; + spacing: 16px; + background-color: transparent; + } - element normal active { - text-color: @bg2; - } + element normal active { + text-color: @bg2; + } - element alternate active { - text-color: @bg2; - } + element alternate active { + text-color: @bg2; + } - element selected normal, element selected active { - background-color: @bg2; - text-color: @fg1; - } + element selected normal, element selected active { + background-color: @bg2; + text-color: @fg1; + } - element-icon { - size: 1em; - } + element-icon { + size: 1em; + } - element-text { - text-color: inherit; - } - ''; + element-text { + text-color: inherit; + } + ''; + }; }; } diff --git a/hosts/thinkpad/configuration.nix b/hosts/thinkpad/configuration.nix index d1a490e..535f129 100755 --- a/hosts/thinkpad/configuration.nix +++ b/hosts/thinkpad/configuration.nix @@ -83,28 +83,36 @@ "flakes" ]; + nixpkgs.config.permittedInsecurePackages = [ + "electron-27.3.11" + ]; + home-manager.users."${user}" = { ... }: { home.stateVersion = "24.11"; }; - nixpkgs.config.permittedInsecurePackages = [ - "electron-27.3.11" - ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + boot.loader.grub.useOSProber = true; - # kernel - #boot.kernelPackages = pkgs.linuxPackages_xanmod; # Gaming + boot.initrd.luks.devices."luks-66da6971-2a98-4277-b74c-a8cecb5e3bd3".device = + "/dev/disk/by-uuid/66da6971-2a98-4277-b74c-a8cecb5e3bd3"; + # Setup keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; - #boot.initrd.luks.devices."luks-f7e86dde-55a5-4306-a7c2-cf2d93c9ee0b".device = "/dev/disk/by-uuid/f7e86dde-55a5-4306-a7c2-cf2d93c9ee0b"; # old dead ssd rip 24.07.28 - boot.initrd.luks.devices."luks-da1b2f8c-877a-4c39-8965-a4af625718c".device = - "/dev/disk/by-uuid/da1b2f8c-877a-4c39-8965-a4af6a25718c"; + boot.loader.grub.enableCryptodisk = true; - networking.hostName = "strix"; + boot.initrd.luks.devices."luks-bd115bee-c7d6-4c9e-8e3b-e32c39edb80f".keyFile = + "/crypto_keyfile.bin"; + boot.initrd.luks.devices."luks-66da6971-2a98-4277-b74c-a8cecb5e3bd3".keyFile = + "/crypto_keyfile.bin"; + + networking.hostName = "nixos"; # Define your hostname. # Enable networking networking.networkmanager.enable = true; diff --git a/hosts/thinkpad/desktop.nix b/hosts/thinkpad/desktop.nix index bb622c2..fff3186 100755 --- a/hosts/thinkpad/desktop.nix +++ b/hosts/thinkpad/desktop.nix @@ -18,6 +18,8 @@ feh mpv + ungoogled-chromium + ]; fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) diff --git a/hosts/thinkpad/hardware-configuration.nix b/hosts/thinkpad/hardware-configuration.nix index f6fbc03..289cec6 100644 --- a/hosts/thinkpad/hardware-configuration.nix +++ b/hosts/thinkpad/hardware-configuration.nix @@ -8,31 +8,20 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" ]; + boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/c5e13eac-4cdf-490b-85f4-c14038313ada"; + { device = "/dev/disk/by-uuid/6d0032be-b81f-4db6-a6f1-078ae85939db"; fsType = "ext4"; }; - boot.initrd.luks.devices."luks-53201bbc-c763-4d15-8bf8-a173550fab91".device = "/dev/disk/by-uuid/53201bbc-c763-4d15-8bf8-a173550fab91"; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/9DDA-7820"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - fileSystems."/media/terra" = - { device = "/dev/disk/by-uuid/f2b24250-0cf5-43d4-806f-7f024922781a"; - fsType = "ext4"; - }; + boot.initrd.luks.devices."luks-bd115bee-c7d6-4c9e-8e3b-e32c39edb80f".device = "/dev/disk/by-uuid/bd115bee-c7d6-4c9e-8e3b-e32c39edb80f"; swapDevices = - [ { device = "/dev/disk/by-uuid/b719003b-1ae0-4377-97f1-4447b4514de8"; } + [ { device = "/dev/disk/by-uuid/ddc26af8-f38f-4f2f-8c9d-44053794eda7"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking @@ -40,8 +29,8 @@ # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eno2.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + # networking.interfaces.eno0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/hosts/thinkpad/opt/poly.ini b/hosts/thinkpad/opt/poly.ini new file mode 100644 index 0000000..1dc7ed7 --- /dev/null +++ b/hosts/thinkpad/opt/poly.ini @@ -0,0 +1,206 @@ + +[bar/bottom] +background=#00191830 +border-color=#00400080 +border-size=10px +bottom=true +font-0=Jetbrains Mono Nerd font:size=11;3 +font-1=Jetbrains Mono Nerd font:size=22;5 +foreground=#FFFFFF +height=34 +modules-center=cava +modules-left=audio-capsule a music-capsule +modules-right=" wired-network a wireless-network a replay" +padding-left=5 +padding-right=5 +radius=20 +width=100% + +[bar/default] +background=#00191830 +border-color=#00400080 +border-size=10px +bottom=false +font-0=Jetbrains Mono Nerd font:size=11;3 +font-1=Jetbrains Mono Nerd font:size=22;5 +foreground=#FFFFFF +height=34 +modules-center=ewmh +modules-left=date s keyboard battery +modules-right="fs-data s fs-system s memory s cpu-temp cpu-usage" +padding-left=2 +padding-right=2 +radius=15 +width=100% + +[fs-base] +format-prefix-foreground=#FFFFFF +label-unmounted=? +type=internal/fs +warn-precentage=80% + +[global/wm] +override-redirect=false + +[module/a] +label=" " +label-foreground=#FAD000 +type=custom/text + +[module/audio-capsule] +click-right=pavucontrol +format-muted=%{T2}%{F#191830}%{F-}%{T-}%{T2}%{F#191830}%{F-}%{T-} +format-volume=%{T2}%{F#191830}%{F-}%{T-}%{T2}%{F#191830}%{F-}%{T-} +label-muted=muted +label-muted-background=#191830 +label-muted-foreground=#FF0 +label-volume=%percentage%% +label-volume-background=#191830 +type=internal/alsa +use-ui-max=true + +[module/battery] +adapter=AC0 +battery=BAT0 +full-at=95 +low-at=20 +poll-interval=4 +type=internal/battery + +[module/cava] +exec=~/home/peach/dotfiles/scripts/cava.sh +format=%{T2}%{F#191830}%{F-}%{T-}