├── Templates
├── bash-script.sh
├── python-script.py
├── word-document.docx
├── excel-spreadsheet.xlsx
└── powerpoint-presentation.pptx
├── .config
├── nixos
│ ├── features
│ │ ├── gpu-default.nix
│ │ ├── virtualization.nix
│ │ ├── networking.nix
│ │ ├── nixsur-plymouth-theme
│ │ │ ├── nixsur.tar.gz
│ │ │ └── default.nix
│ │ ├── display-default.nix
│ │ ├── users.nix
│ │ ├── printer.nix
│ │ ├── gpu-amd.nix
│ │ ├── locale.nix
│ │ ├── boot.nix
│ │ ├── display-desktop.nix
│ │ └── hyprland.nix
│ ├── default-configuration.nix
│ ├── desktop-configuration.nix
│ ├── laptop-configuration.nix
│ ├── flake.lock
│ └── flake.nix
└── home-manager
│ ├── files
│ ├── assets
│ │ ├── me.jpg
│ │ ├── wallpaper-list
│ │ ├── nixos-icon.svg
│ │ └── hitbox.py
│ ├── wallpapers
│ │ └── default.png
│ └── wlogout-icons
│ │ ├── lock.png
│ │ ├── reboot.png
│ │ └── shutdown.png
│ ├── features
│ ├── gammastep.nix
│ ├── gtklock.nix
│ ├── mpd.nix
│ ├── chromium.nix
│ ├── hitbox.nix
│ ├── editor.nix
│ ├── firefox.nix
│ ├── mako.nix
│ ├── screenshot.nix
│ ├── environment.nix
│ ├── extra-desktop-files.nix
│ ├── terminal.nix
│ ├── google-drive.nix
│ ├── fuzzel.nix
│ ├── wlogout.nix
│ ├── hyprpaper.nix
│ ├── packages.nix
│ ├── shell.nix
│ ├── theme.nix
│ ├── rofi.nix
│ ├── default-applications.nix
│ ├── hyprland.nix
│ ├── vscode.nix
│ ├── waybar.nix
│ └── ranger.nix
│ ├── home.nix
│ ├── packages
│ ├── hyprevents.nix
│ └── hyprprop.nix
│ ├── flake.lock
│ └── flake.nix
├── .gitignore
├── LICENSE
└── README.md
/Templates/bash-script.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 |
--------------------------------------------------------------------------------
/.config/nixos/features/gpu-default.nix:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/Templates/python-script.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
--------------------------------------------------------------------------------
/.config/nixos/features/virtualization.nix:
--------------------------------------------------------------------------------
1 | {
2 | virtualisation.libvirtd.enable = true;
3 | }
4 |
--------------------------------------------------------------------------------
/Templates/word-document.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/Templates/word-document.docx
--------------------------------------------------------------------------------
/Templates/excel-spreadsheet.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/Templates/excel-spreadsheet.xlsx
--------------------------------------------------------------------------------
/.config/nixos/features/networking.nix:
--------------------------------------------------------------------------------
1 | {
2 | networking.hostName = "nixos";
3 | networking.networkmanager.enable = true;
4 | }
5 |
--------------------------------------------------------------------------------
/Templates/powerpoint-presentation.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/Templates/powerpoint-presentation.pptx
--------------------------------------------------------------------------------
/.config/home-manager/files/assets/me.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/.config/home-manager/files/assets/me.jpg
--------------------------------------------------------------------------------
/.config/home-manager/files/assets/wallpaper-list:
--------------------------------------------------------------------------------
1 | beach-gate.jpg https://tinyurl.com/2p9dfrb2
2 | garden.png https://tinyurl.com/26ey564k
3 |
--------------------------------------------------------------------------------
/.config/home-manager/files/wallpapers/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/.config/home-manager/files/wallpapers/default.png
--------------------------------------------------------------------------------
/.config/home-manager/files/wlogout-icons/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/.config/home-manager/files/wlogout-icons/lock.png
--------------------------------------------------------------------------------
/.config/home-manager/files/wlogout-icons/reboot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/.config/home-manager/files/wlogout-icons/reboot.png
--------------------------------------------------------------------------------
/.config/home-manager/files/wlogout-icons/shutdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/.config/home-manager/files/wlogout-icons/shutdown.png
--------------------------------------------------------------------------------
/.config/nixos/features/nixsur-plymouth-theme/nixsur.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChristianWSmith/nix-config/HEAD/.config/nixos/features/nixsur-plymouth-theme/nixsur.tar.gz
--------------------------------------------------------------------------------
/.config/nixos/features/display-default.nix:
--------------------------------------------------------------------------------
1 | {
2 | environment.etc = {
3 | "display.conf" = {
4 | text = ''
5 | monitor=,preferred,auto,auto
6 | '';
7 | };
8 | };
9 | }
10 |
--------------------------------------------------------------------------------
/.config/home-manager/features/gammastep.nix:
--------------------------------------------------------------------------------
1 | {
2 | services.gammastep = {
3 | enable = true;
4 | provider = "geoclue2";
5 | tray = true;
6 | temperature = {
7 | day = 5500;
8 | night = 3700;
9 | };
10 | };
11 | }
12 |
--------------------------------------------------------------------------------
/.config/home-manager/features/gtklock.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ...}:
2 | {
3 | home.packages = [ pkgs.gtklock ];
4 | home.file = {
5 | ".config/gtklock/style.css".text = ''
6 | window {
7 | background-image: url("../../.active-wallpaper");
8 | background-size: 100% 100%;
9 | }
10 | '';
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/.config/home-manager/features/mpd.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, ... }:
2 | {
3 | home.packages = with pkgs; [ mpc-cli mpdevil ];
4 | programs.ncmpcpp = {
5 | enable = true;
6 | mpdMusicDir = "${user.home}/Music";
7 | };
8 | services.mpd = {
9 | enable = true;
10 | musicDirectory = "${user.home}/Music";
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/.config/nixos/features/users.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ... }:
2 | {
3 | users.users.christian = {
4 | isNormalUser = true;
5 | description = "Christian Smith";
6 | extraGroups = [ "networkmanager" "wheel" "scanner" "lp" ];
7 | packages = with pkgs; [];
8 | shell = pkgs.fish;
9 | };
10 | programs.fish.enable = true;
11 | }
12 |
--------------------------------------------------------------------------------
/.config/nixos/features/printer.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ... }:
2 | {
3 | services = {
4 | avahi = {
5 | enable = true;
6 | nssmdns = true;
7 | openFirewall = true;
8 | };
9 | printing = {
10 | enable = true;
11 | drivers = [ pkgs.epson-escpr2 ];
12 | };
13 | };
14 | hardware.sane.enable = true;
15 | }
16 |
--------------------------------------------------------------------------------
/.config/home-manager/features/chromium.nix:
--------------------------------------------------------------------------------
1 | {
2 | programs.chromium = {
3 | enable = true;
4 | extensions = [
5 | { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin
6 | { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # dark reader
7 | { id = "dbepggeogbaibhgnhhndojpepiihcmeb"; } # vimium
8 | ];
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/.config/nixos/features/gpu-amd.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ... }:
2 | {
3 | boot.initrd.kernelModules = [ "amdgpu" ];
4 | hardware.opengl = {
5 | extraPackages = with pkgs; [ rocm-opencl-icd rocm-opencl-runtime amdvlk ];
6 | extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ];
7 | driSupport = true;
8 | driSupport32Bit = true;
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore by default
2 | *
3 |
4 | # GitHub
5 | !LICENSE
6 | !README.md
7 |
8 | # System + Home Manager
9 | !.config
10 | !.config/home-manager
11 | !.config/home-manager/**
12 | !.config/nixos
13 | !.config/nixos/**
14 | .config/nixos/hardware.nix
15 |
16 | # Hyprland Extra
17 | !.config/hypr/extra.conf
18 |
19 | # Templates
20 | !Templates
21 | !Templates/**
22 |
--------------------------------------------------------------------------------
/.config/nixos/default-configuration.nix:
--------------------------------------------------------------------------------
1 | { config, pkgs, lib, ... }:
2 | {
3 | nix.settings.experimental-features = [ "nix-command" "flakes" ];
4 |
5 | imports = [
6 | ./hardware.nix
7 | ./features/display-default.nix
8 | ./features/gpu-default.nix
9 | ./features/boot.nix
10 | ./features/locale.nix
11 | ./features/networking.nix
12 | ./features/users.nix
13 | ./features/hyprland.nix
14 | ./features/virtualization.nix
15 | ];
16 |
17 | nixpkgs.config.allowUnfree = true;
18 | system.stateVersion = "23.05";
19 | }
20 |
--------------------------------------------------------------------------------
/.config/nixos/desktop-configuration.nix:
--------------------------------------------------------------------------------
1 | { config, pkgs, lib, ... }:
2 | {
3 | nix.settings.experimental-features = [ "nix-command" "flakes" ];
4 |
5 | imports = [
6 | ./hardware.nix
7 | ./features/display-desktop.nix
8 | ./features/gpu-amd.nix
9 | ./features/boot.nix
10 | ./features/locale.nix
11 | ./features/networking.nix
12 | ./features/users.nix
13 | ./features/printer.nix
14 | ./features/hyprland.nix
15 | ./features/virtualization.nix
16 | ];
17 |
18 | nixpkgs.config.allowUnfree = true;
19 | system.stateVersion = "23.05";
20 | }
21 |
--------------------------------------------------------------------------------
/.config/nixos/laptop-configuration.nix:
--------------------------------------------------------------------------------
1 | { config, pkgs, lib, ... }:
2 | {
3 | nix.settings.experimental-features = [ "nix-command" "flakes" ];
4 |
5 | imports = [
6 | ./hardware.nix
7 | ./features/display-default.nix
8 | ./features/gpu-amd.nix
9 | ./features/boot.nix
10 | ./features/locale.nix
11 | ./features/networking.nix
12 | ./features/users.nix
13 | ./features/printer.nix
14 | ./features/hyprland.nix
15 | ./features/virtualization.nix
16 | ];
17 |
18 | nixpkgs.config.allowUnfree = true;
19 | system.stateVersion = "23.05";
20 | }
21 |
--------------------------------------------------------------------------------
/.config/home-manager/features/hitbox.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, ... }:
2 | let
3 | hitbox = pkgs.writeShellScriptBin "hitbox" ''
4 | ${user.home}/.assets/hitbox.py ${pkgs.xboxdrv}/bin/xboxdrv
5 | '';
6 | in
7 | {
8 | home.packages = with pkgs; [
9 | hitbox
10 | xboxdrv
11 | ];
12 | systemd.user.services.hitbox = {
13 | Unit = {
14 | Description = "DragonRise PCB Hitbox Daemon";
15 | };
16 | Service = {
17 | Type = "simple";
18 | ExecStart = "${user.home}/.nix-profile/bin/hitbox";
19 | Restart = "on-failure";
20 | RestartSec = 1;
21 | };
22 | };
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/.config/home-manager/features/editor.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ... }:
2 | let
3 | editor = pkgs.writeShellScriptBin "editor" ''
4 | neovim $@
5 | '';
6 | in
7 | {
8 | home.packages = [ editor ];
9 | programs.neovim = {
10 | enable = true;
11 | viAlias = true;
12 | vimAlias = true;
13 | defaultEditor = true;
14 | extraConfig = ''
15 | :set number relativenumber
16 | :set tabstop=2
17 | :set shiftwidth=2
18 | :set expandtab
19 | :set autoindent
20 | :syntax on
21 | '';
22 | plugins = [ pkgs.vimPlugins.yuck-vim pkgs.vimPlugins.scss-syntax-vim ];
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/.config/nixos/features/locale.nix:
--------------------------------------------------------------------------------
1 | {
2 | time.timeZone = "America/New_York";
3 | services.xserver = {
4 | layout = "us";
5 | xkbVariant = "";
6 | };
7 | i18n = {
8 | defaultLocale = "en_US.UTF-8";
9 | extraLocaleSettings = {
10 | LC_ADDRESS = "en_US.UTF-8";
11 | LC_IDENTIFICATION = "en_US.UTF-8";
12 | LC_MEASUREMENT = "en_US.UTF-8";
13 | LC_MONETARY = "en_US.UTF-8";
14 | LC_NAME = "en_US.UTF-8";
15 | LC_NUMERIC = "en_US.UTF-8";
16 | LC_PAPER = "en_US.UTF-8";
17 | LC_TELEPHONE = "en_US.UTF-8";
18 | LC_TIME = "en_US.UTF-8";
19 | };
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/.config/nixos/flake.lock:
--------------------------------------------------------------------------------
1 | {
2 | "nodes": {
3 | "nixpkgs": {
4 | "locked": {
5 | "lastModified": 1699099776,
6 | "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=",
7 | "owner": "nixos",
8 | "repo": "nixpkgs",
9 | "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb",
10 | "type": "github"
11 | },
12 | "original": {
13 | "owner": "nixos",
14 | "ref": "nixos-unstable",
15 | "repo": "nixpkgs",
16 | "type": "github"
17 | }
18 | },
19 | "root": {
20 | "inputs": {
21 | "nixpkgs": "nixpkgs"
22 | }
23 | }
24 | },
25 | "root": "root",
26 | "version": 7
27 | }
28 |
--------------------------------------------------------------------------------
/.config/nixos/features/boot.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ... }:
2 | {
3 | boot = {
4 | consoleLogLevel = 0;
5 | initrd = {
6 | verbose = false;
7 | systemd.dbus.enable = true;
8 | };
9 | plymouth = {
10 | enable = true;
11 | themePackages = [ (pkgs.callPackage ./nixsur-plymouth-theme/default.nix {}) ];
12 | theme = "nixsur";
13 | };
14 | kernelParams = [ "nowatchdog" "audit=0" "modprobe.blacklist=sp5100_tco" "loglevel=3" "reboot=bios" "quiet" "splash" "rd.systemd.show_status=false" "rd.udev.log_level=3" "udev.log_priority=3" "boot.shell_on_fail" "vt.global_cursor_default=0" ];
15 | loader =
16 | {
17 | timeout = 0;
18 | efi.canTouchEfiVariables = true;
19 | systemd-boot.enable = true;
20 | };
21 | };
22 | }
23 |
--------------------------------------------------------------------------------
/.config/nixos/features/display-desktop.nix:
--------------------------------------------------------------------------------
1 | {
2 | environment.etc = {
3 | "display.conf" = {
4 | text = ''
5 | monitor=DP-2, 1920x1080, 0x0, 1
6 | monitor=DP-1, 1920x1080@240, 1920x0, 1
7 | monitor=DP-3, 1920x1080, 3840x0, 1
8 |
9 | workspace=11,monitor:DP-2
10 | workspace=12,monitor:DP-3
11 | workspace=1,monitor:DP-1
12 | workspace=2,monitor:DP-1
13 | workspace=3,monitor:DP-1
14 | workspace=4,monitor:DP-1
15 | workspace=5,monitor:DP-1
16 | workspace=6,monitor:DP-1
17 | workspace=7,monitor:DP-1
18 | workspace=8,monitor:DP-1
19 | workspace=9,monitor:DP-1
20 | workspace=10,monitor:DP-1
21 |
22 | exec-once=xrandr --output DP-1 --primary
23 | '';
24 | };
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/.config/home-manager/features/firefox.nix:
--------------------------------------------------------------------------------
1 | { inputs, user, ... }:
2 | {
3 | programs.firefox = {
4 | enable = true;
5 | profiles."${user.name}" = {
6 | extensions = [
7 | inputs.firefox-addons.packages."x86_64-linux".ublock-origin
8 | inputs.firefox-addons.packages."x86_64-linux".darkreader
9 | inputs.firefox-addons.packages."x86_64-linux".vimium
10 | inputs.firefox-addons.packages."x86_64-linux".new-tab-override
11 | ];
12 | settings = {
13 | "browser.tabs.inTitlebar" = 0;
14 | "browser.toolbars.bookmarks.visibility" = "always";
15 | "browser.bookmarks.addedImportButton" = false;
16 | "browser.startup.firstrunSkipsHomepage" = false;
17 | "browser.startup.homepage" = "www.google.com";
18 | };
19 | };
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/.config/home-manager/files/assets/nixos-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.config/nixos/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | description = "NixOS Flake";
3 | inputs = {
4 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
5 | };
6 | outputs = { self, nixpkgs }:
7 | let
8 | system = "x86_64-linux";
9 | pkgs = import nixpkgs {
10 | inherit system;
11 | config = {
12 | allowUnfree = true;
13 | };
14 | };
15 | in
16 | {
17 | nixosConfigurations = {
18 | default = nixpkgs.lib.nixosSystem {
19 | specialArgs = { inherit system; };
20 | modules = [
21 | ./default-configuration.nix
22 | ];
23 | };
24 | desktop = nixpkgs.lib.nixosSystem {
25 | specialArgs = { inherit system; };
26 | modules = [
27 | ./desktop-configuration.nix
28 | ];
29 | };
30 | laptop = nixpkgs.lib.nixosSystem {
31 | specialArgs = { inherit system; };
32 | modules = [
33 | ./laptop-configuration.nix
34 | ];
35 | };
36 | };
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/.config/home-manager/features/mako.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, theme, lib, ... }:
2 | let
3 | notifyClipboard = pkgs.writeShellScriptBin "notify-clipboard" ''
4 | paste=$(wl-paste)
5 |
6 | if [ "$paste" ]
7 | then
8 | notify-send "Clipboard: $paste"
9 | fi
10 | '';
11 | in
12 | {
13 | home.packages = [ notifyClipboard ];
14 | services.mako = {
15 | enable = true;
16 | anchor = "top-center";
17 | backgroundColor = "#${theme.colorScheme.background1Hex}${theme.colorScheme.transparencyBackgroundHex}";
18 | borderColor = "#${theme.colorScheme.accentHex}${theme.colorScheme.transparencyForegroundHex}";
19 | textColor = "#${theme.colorScheme.foreground1Hex}";
20 | progressColor = "#${theme.colorScheme.accentHex}";
21 | borderSize = theme.borderWidth;
22 | borderRadius = theme.borderRadius;
23 | defaultTimeout = 3000;
24 | font = "${theme.fontName} ${builtins.toString theme.fontSize}";
25 | iconPath = "${user.home}/.nix-profile/share/icons/${theme.iconThemeName}";
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/.config/home-manager/features/screenshot.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, ... }:
2 | let
3 | recordScreen = pkgs.writeShellScriptBin "wayland-record-screen" ''
4 | PIDFILE="/tmp/record-screen.pid"
5 | if ps -p $(cat $PIDFILE);
6 | then
7 | kill -SIGINT $(pgrep wf-recorder)
8 | notify-send "Screen recording ended."
9 | else
10 | echo "$$" > $PIDFILE
11 | sleep 1
12 | dimensions=$(slurp -d)
13 | if [ "$dimensions" ]
14 | then
15 | filename="recording-$(date +%s).mp4"
16 | notify-send "Screen recording started: ~/Videos/$filename"
17 | wf-recorder -g "$dimensions" -f ${user.home}/Videos/$filename
18 | else
19 | notify-send "Screen recording cancelled."
20 | fi
21 | fi
22 | '';
23 | screenshot = pkgs.writeShellScriptBin "wayland-screenshot" ''
24 | sleep 1
25 | dimensions=$(slurp -d)
26 | if [ "$dimensions" ]
27 | then
28 | grim -g "$dimensions" - | swappy -f -
29 | fi
30 | '';
31 | in
32 | {
33 | home.packages = [ pkgs.wf-recorder pkgs.slurp pkgs.grim pkgs.swappy screenshot recordScreen ];
34 | }
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Christian Smith
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.config/home-manager/home.nix:
--------------------------------------------------------------------------------
1 | { inputs, config, pkgs, user, ... }:
2 | {
3 | home.username = user.name;
4 | home.homeDirectory = user.home;
5 |
6 | home.stateVersion = "22.11";
7 |
8 | imports = [
9 | ./features/packages.nix
10 | ./features/environment.nix
11 | ./features/shell.nix
12 | ./features/editor.nix
13 | ./features/terminal.nix
14 | ./features/hyprland.nix
15 | ./features/default-applications.nix
16 | ./features/theme.nix
17 | ./features/mako.nix
18 | ./features/gammastep.nix
19 | ./features/firefox.nix
20 | ./features/chromium.nix
21 | ./features/hitbox.nix
22 | ./features/fuzzel.nix
23 | ./features/wlogout.nix
24 | ./features/waybar.nix
25 | ./features/gtklock.nix
26 | ./features/hyprpaper.nix
27 | ./features/vscode.nix
28 | ./features/ranger.nix
29 | ./features/mpd.nix
30 | ./features/screenshot.nix
31 | ./features/extra-desktop-files.nix
32 | ./features/google-drive.nix
33 | ./features/rofi.nix
34 | ];
35 |
36 | home.file = {
37 | ".assets".source = files/assets;
38 | ".hushlogin".text = "";
39 | };
40 |
41 | programs.home-manager.enable = true;
42 | }
43 |
--------------------------------------------------------------------------------
/.config/nixos/features/nixsur-plymouth-theme/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | stdenv,
3 | lib,
4 | zip
5 | }: let
6 | version = "2023-09-07";
7 | in
8 | stdenv.mkDerivation {
9 | pname = "nixsur-plymouth-theme";
10 | inherit version;
11 |
12 | nativeBuildInputs = [
13 | zip
14 | ];
15 |
16 | sourceRoot = ".";
17 |
18 | src = [
19 | ./nixsur.tar.gz
20 | ];
21 |
22 | unpackPhase = ''
23 | for srcFile in $src; do
24 | local tgt=$(echo $srcFile | cut --delimiter=- --fields=2-)
25 | cp -r $srcFile $tgt
26 | done
27 | '';
28 |
29 | installPhase = ''
30 | mkdir -p $out/share/plymouth/themes
31 | tar xzf ./nixsur.tar.gz
32 | cp -r ./nixsur $out/share/plymouth/themes/
33 | chmod +w $out/share/plymouth/themes/nixsur/nixsur.plymouth
34 | echo "ImageDir=$out/share/plymouth/themes/nixsur" >> $out/share/plymouth/themes/nixsur/nixsur.plymouth
35 | echo "ScriptFile=$out/share/plymouth/themes/nixsur/nixsur.script" >> $out/share/plymouth/themes/nixsur/nixsur.plymouth
36 | chmod -w $out/share/plymouth/themes/nixsur/nixsur.plymouth
37 | '';
38 |
39 | meta = with lib; {
40 | description = "NixSur plymouth theme";
41 | platforms = platforms.linux;
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/.config/home-manager/packages/hyprevents.nix:
--------------------------------------------------------------------------------
1 | {
2 | stdenv,
3 | lib,
4 | pkgs
5 | }: let
6 | version = "git";
7 | in
8 | stdenv.mkDerivation {
9 | pname = "hyprevents";
10 | inherit version;
11 |
12 | nativeBuildInputs = with pkgs; [
13 | socat
14 | ];
15 |
16 | src = pkgs.fetchFromGitHub {
17 | owner = "vilari-mickopf";
18 | repo = "hyprevents";
19 | rev = "95426ae4dac70c6e6ed67918dbf3bdedfdf28f37";
20 | sha256 = "sha256-SLt2ukCJbfkvnGLgy9x7/3BoI2OqC4VIdgM5z768EXc=";
21 | };
22 |
23 | unpackPhase = ''
24 | mkdir -p $out
25 | cp -r $src/* $out
26 | '';
27 |
28 | patchPhase = ''
29 | sed -i "s@/usr@$out@g" $out/Makefile
30 | sed -i "s@/usr/share@$out/share@g" $out/hyprevents
31 | sed -i "s@/usr/share@$out/share@g" $out/event_loader
32 | '';
33 |
34 | installPhase = ''
35 | cd $out
36 | make
37 | chmod +x $out/bin/*
38 | chmod +x $out/share/hyprevents/*
39 | rm $out/event_loader
40 | rm $out/Makefile
41 | rm $out/event_handler
42 | rm $out/hyprevents
43 | rm $out/README.md
44 | '';
45 |
46 | meta = with lib; {
47 | description = "Invoke shell functions in response to Hyprland socket2 events";
48 | platforms = platforms.linux;
49 | };
50 | }
51 |
--------------------------------------------------------------------------------
/.config/home-manager/features/environment.nix:
--------------------------------------------------------------------------------
1 | { pkgs, theme, ... }:
2 | {
3 | home.sessionVariables = {
4 | SHELL = "${pkgs.fish}/bin/fish";
5 | TERMINAL = "kitty";
6 | BROWSER = "firefox";
7 | NIXPKGS_ALLOW_UNFREE = "1";
8 | NEWT_COLORS = ''
9 | root=${theme.colorScheme.newtAccent},${theme.colorScheme.newtBackground}
10 | border=${theme.colorScheme.newtAccent},${theme.colorScheme.newtBackground}
11 | title=${theme.colorScheme.newtAccent},${theme.colorScheme.newtBackground}
12 | roottext=${theme.colorScheme.newtForeground},${theme.colorScheme.newtBackground}
13 | window=${theme.colorScheme.newtAccent},${theme.colorScheme.newtBackground}
14 | textbox=${theme.colorScheme.newtForeground},${theme.colorScheme.newtBackground}
15 | button=${theme.colorScheme.newtBackground},${theme.colorScheme.newtAccent}
16 | compactbutton=${theme.colorScheme.newtForeground},${theme.colorScheme.newtBackground}
17 | listbox=${theme.colorScheme.newtForeground},${theme.colorScheme.newtBackground}
18 | actlistbox=${theme.colorScheme.newtBackground},${theme.colorScheme.newtForeground}
19 | actsellistbox=${theme.colorScheme.newtBackground},${theme.colorScheme.newtAccent}
20 | checkbox=${theme.colorScheme.newtAccent},${theme.colorScheme.newtBackground}
21 | actcheckbox=${theme.colorScheme.newtBackground},${theme.colorScheme.newtAccent}
22 | '';
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/.config/home-manager/features/extra-desktop-files.nix:
--------------------------------------------------------------------------------
1 | { pkgs, ... }:
2 | {
3 | home.file = {
4 | ".local/share/applications/messenger-web.desktop".text = ''
5 | [Desktop Entry]
6 | Name=Messenger
7 | StartupWMClass=messenger
8 | Comment=Facebook messenger.
9 | Exec=chromium --new-window --enable-extensions --enable-features=WebRTCPipeWireCapturer --app="https://www.messenger.com/login/"
10 | GenericName=Messenger
11 | Icon=fbmessenger
12 | Type=Application
13 | Categories=Network;InstantMessaging;
14 | Path=${pkgs.chromium}/bin
15 | '';
16 | ".local/share/applications/discord-web.desktop".text = ''
17 | [Desktop Entry]
18 | Name=Discord (web)
19 | StartupWMClass=discord
20 | Comment=Discord
21 | Exec=chromium --new-window --enable-extensions --enable-features=WebRTCPipeWireCapturer --app="https://www.discord.com/login/"
22 | GenericName=Discord
23 | Icon=discord
24 | Type=Application
25 | Categories=Network;InstantMessaging;
26 | Path=${pkgs.chromium}/bin
27 | '';
28 | ".local/share/applications/yed.desktop".text = ''
29 | [Desktop Entry]
30 | Name=yEd
31 | StartupWMClass=yEd
32 | Comment=yEd
33 | Exec=${pkgs.yed}/bin/yed
34 | GenericName=yEd
35 | Icon=${pkgs.yed}/yed/icons/yed128.png
36 | Type=Application
37 | Categories=Office;
38 | Path=${pkgs.yed}/bin
39 | '';
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/.config/home-manager/packages/hyprprop.nix:
--------------------------------------------------------------------------------
1 | {
2 | stdenv,
3 | lib,
4 | pkgs
5 | }: let
6 | version = "git";
7 | hyprevents = (pkgs.callPackage ./hyprevents.nix {});
8 | in
9 | stdenv.mkDerivation {
10 | pname = "hyprprop";
11 | inherit version;
12 |
13 | nativeBuildInputs = with pkgs; [
14 | jq
15 | socat
16 | slurp
17 | ];
18 |
19 | propogatedBuildInputs = [
20 | hyprevents
21 | ];
22 |
23 | src = pkgs.fetchFromGitHub {
24 | owner = "vilari-mickopf";
25 | repo = "hyprprop";
26 | rev = "77e154aaaaee911f66187689d878a41f97fabc51";
27 | sha256 = "sha256-5CijOK0gW8w9MY0xmLj5tZ7c/3UfrshXAABv8Ui0Hds=";
28 | };
29 |
30 | unpackPhase = ''
31 | mkdir -p $out
32 | cp -r $src/* $out
33 | '';
34 |
35 | patchPhase = ''
36 | sed -i "s@/usr@$out@g" $out/Makefile
37 | sed -i "s@/usr/share@$out/share@g" $out/hyprprop
38 | sed -i "s@hyprevents@${hyprevents}/bin/hyprevents@g" $out/hyprprop
39 | sed -i 's@\[ -n "$error" \] \&\& prop@\[ -n "$error" \] \&\& cleanup \&\& exit@g' $out/hyprprop
40 | '';
41 |
42 | installPhase = ''
43 | cd $out
44 | make
45 | chmod +x $out/bin/*
46 | chmod +x $out/share/hyprprop/*
47 | rm $out/hyprprop
48 | rm $out/README.md
49 | rm $out/event_handler
50 | rm $out/Makefile
51 | '';
52 |
53 | meta = with lib; {
54 | description = "xprop for Hyprland";
55 | platforms = platforms.linux;
56 | };
57 | }
58 |
--------------------------------------------------------------------------------
/.config/home-manager/features/terminal.nix:
--------------------------------------------------------------------------------
1 | { pkgs, theme, lib, ... }:
2 | let
3 | launcher = pkgs.writeShellScriptBin "terminal" ''
4 | if [ "$1" == "" ]
5 | then
6 | footclient
7 | else
8 | footclient -E $(which $1) ''${@:2}
9 | fi
10 | '';
11 | in
12 | {
13 | home.packages = [ launcher ];
14 | programs.foot = {
15 | enable = true;
16 | settings = {
17 | main = {
18 | shell = "${pkgs.fish}/bin/fish";
19 | font = "${theme.monoFontName}:pixelsize=${builtins.toString theme.fontSizeUI}";
20 | };
21 | colors = {
22 | alpha = theme.colorScheme.transparencyBackgroundRGB;
23 | background = theme.colorScheme.background1Hex;
24 | regular0 = theme.colorScheme.background1Hex;
25 | regular1 = theme.colorScheme.redHex;
26 | regular2 = theme.colorScheme.greenHex;
27 | regular3 = theme.colorScheme.yellowHex;
28 | regular4 = theme.colorScheme.blueHex;
29 | regular5 = theme.colorScheme.magentaHex;
30 | regular6 = theme.colorScheme.cyanHex;
31 | regular7 = theme.colorScheme.foreground4Hex;
32 | bright0 = theme.colorScheme.background4Hex;
33 | bright1 = theme.colorScheme.redHex;
34 | bright2 = theme.colorScheme.greenHex;
35 | bright3 = theme.colorScheme.yellowHex;
36 | bright4 = theme.colorScheme.blueHex;
37 | bright5 = theme.colorScheme.magentaHex;
38 | bright6 = theme.colorScheme.cyanHex;
39 | bright7 = theme.colorScheme.foreground1Hex;
40 | };
41 | };
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # nix-config
2 | Nix config files.
3 |
4 | ## Installation
5 | My install notes are found [here](https://docs.google.com/document/d/1AH0DahjBLnj5EFFwaiUMHzl7CS2ftOybahPNlOBMhlM/edit?usp=sharing).
6 |
7 | ## Default Keybindings
8 | IMPORTANT: My config uses keyd to swap ALT for META and vice versa. This means that if you want a program to read ALT, you press META. My main modifier in Hyprland is set to SUPER (meta), which means that you will press ALT on the physical keyboard. Henceforth, key names will refer to the PHYSICAL keys on the keyboard:
9 |
10 | ### Movement
11 | - ALT+1, ALT+2, ..., ALT+N : Go to workspace N
12 | - ALT+SHIFT+1, ALT+SHIFT+2, ..., ALT+SHIFT+N : Move current window to workspace N and follow it
13 | - ALT+I/J/K/L: Focus window up/left/down/right
14 | - ALT+SHIFT+I/J/K/L: Move focused window up/left/down/right
15 |
16 | ### Essentials
17 | - ALT+D: fuzzel (run launcher)
18 | - ALT+Enter: footclient (terminal)
19 | - ALT+SHIFT+E: wlogout (power menu)
20 |
21 | ### Extras
22 | - ALT+Z: zen mode toggle (kill waybar, set all gaps to zero, turn off rounding)
23 | - ALT+SHIFT+Q: close focused window
24 | - ALT+E: ranger (text-based file browser)
25 | - ALT+W: firefox (web browser)
26 | - ALT+C: clipboard history
27 | - ALT+O: emoji picker
28 | - ALT+A: pulsemixer (text-based audio control)
29 | - ALT+SHIFT+C: clear clipboard history
30 | - ALT+F: toggle fullscreen focused window
31 | - ALT+P: hyprpicker (color picker)
32 | - ALT+S: screenshot
33 | - ALT+B: btop (task manager)
34 | - ALT+SHIFT+B: cycle wallpaper (background)
35 |
36 | ## TODO (for me):
37 | - Figure out how to manage hitbox as a package.
38 |
--------------------------------------------------------------------------------
/.config/home-manager/features/google-drive.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, ... }:
2 | let
3 | mountGoogleDrive = pkgs.writeShellScriptBin "mount-google-drive" ''
4 | mkdir -p ${user.home}/GoogleDrive
5 | if ! rclone listremotes | grep GoogleDrive &> /dev/null; then
6 | echo "Attempting to create GoogleDrive rclone config..."
7 | rclone config create GoogleDrive drive
8 | else
9 | echo "GoogleDrive rclone config already exists."
10 | fi
11 | if rclone listremotes | grep GoogleDrive &> /dev/null; then
12 | if ! mount | grep GoogleDrive &> /dev/null; then
13 | echo "Mounting GoogleDrive with rclone..."
14 | rclone mount --vfs-cache-mode minimal GoogleDrive: ${user.home}/GoogleDrive & disown
15 | else
16 | echo "GoogleDrive already mounted."
17 | fi
18 | else
19 | echo "GoogleDrive rclone config does not exist even after attempting to create it."
20 | fi
21 | '';
22 | unmountGoogleDrive = pkgs.writeShellScriptBin "unmount-google-drive" ''
23 | if rclone listremotes | grep GoogleDrive &> /dev/null; then
24 | if mount | grep GoogleDrive &> /dev/null; then
25 | echo "Unmounting GoogleDrive..."
26 | fusermount -u ${user.home}/GoogleDrive
27 | else
28 | echo "GoogleDrive already not mounted."
29 | fi
30 | else
31 | echo "GoogleDrive rclone config does not exist."
32 | fi
33 | '';
34 | backupSteamShaderCache = pkgs.writeShellScriptBin "backup-steam-shader-cache" ''
35 | mkdir -p ${user.home}/GoogleDrive/shadercache
36 | rsync --info=progress2 --info=name0 -a ${user.home}/.steam/steam/steamapps/shadercache/ ${user.home}/GoogleDrive/shadercache
37 | '';
38 | restoreSteamShaderCache = pkgs.writeShellScriptBin "restore-steam-shader-cache" ''
39 | mkdir -p ${user.home}/GoogleDrive/shadercache
40 | rsync --info=progress2 --info=name0 -a ${user.home}/GoogleDrive/shadercache/ ${user.home}/.steam/steam/steamapps/shadercache
41 | '';
42 | in
43 | {
44 | home.packages = [
45 | pkgs.rclone
46 | mountGoogleDrive
47 | unmountGoogleDrive
48 | backupSteamShaderCache
49 | restoreSteamShaderCache
50 | ];
51 | }
52 |
--------------------------------------------------------------------------------
/.config/home-manager/features/fuzzel.nix:
--------------------------------------------------------------------------------
1 | { pkgs, theme, ... }:
2 | let
3 | appLauncher = pkgs.writeShellScriptBin "app-launcher" ''
4 | pkill fuzzel
5 | fuzzel
6 | '';
7 | dmenu = pkgs.writeShellScriptBin "dmenu" ''
8 | pkill fuzzel
9 | fuzzel -d $@
10 | '';
11 | emoji = pkgs.writeShellScriptBin "emoji" ''
12 | pkill fuzzel
13 | rofimoji --selector fuzzel --action $1
14 | if [ "$action" = "copy" ]; then
15 | notify-clipboard
16 | fi
17 | '';
18 | clipboard = pkgs.writeShellScriptBin "clipboard-picker" ''
19 | pkill fuzzel
20 | cliphist list | dmenu | cliphist decode | wl-copy
21 | notify-clipboard
22 | '';
23 | clipboardWipe = pkgs.writeShellScriptBin "clipboard-wipe" ''
24 | if zenity --question --title="Clear Clipboard History?" --ok-label=Yes --cancel-label=No; then
25 | cliphist wipe
26 | notify-send "Clipboard history wiped."
27 | fi
28 | '';
29 | in
30 | {
31 | home.packages = [ appLauncher dmenu emoji clipboard clipboardWipe pkgs.gnome.zenity ];
32 | programs.fuzzel = {
33 | enable = true;
34 | settings = {
35 | main = {
36 | font = "${theme.monoFontName}:style=Bold:pixelsize=${builtins.toString theme.fontSizeUI}";
37 | prompt = "> ";
38 | icon-theme = theme.iconThemeName;
39 | exit-on-keyboard-focus-loss = "no";
40 | };
41 | colors = {
42 | background = "${theme.colorScheme.background1Hex}${theme.colorScheme.transparencyBackgroundHex}";
43 | text = "${theme.colorScheme.foreground1Hex}ff";
44 | match = "${theme.colorScheme.dangerHex}${theme.colorScheme.transparencyForegroundHex}";
45 | selection = "${theme.colorScheme.accentHex}${theme.colorScheme.transparencyForegroundHex}";
46 | selection-text = "${theme.colorScheme.background1Hex}ff";
47 | selection-match = "${theme.colorScheme.dangerHex}ff";
48 | border = "${theme.colorScheme.accentHex}${theme.colorScheme.transparencyForegroundHex}";
49 | };
50 | border = {
51 | width = builtins.toString theme.borderWidth;
52 | radius = builtins.toString theme.borderRadius;
53 | };
54 | };
55 | };
56 | }
57 |
--------------------------------------------------------------------------------
/.config/home-manager/features/wlogout.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, theme, ... }:
2 | let
3 | powerMenu = pkgs.writeShellScriptBin "power-menu" ''
4 | wlogout --layout ${user.home}/.config/wlogout/layout --css ${user.home}/.config/wlogout/style.css
5 | '';
6 | in
7 | {
8 | home.file = {
9 | ".config/wlogout/icons".source = ../files/wlogout-icons;
10 | };
11 | home.packages = [ powerMenu ];
12 | programs.wlogout = {
13 | enable = true;
14 | layout = [
15 | {
16 | "label" = "lock";
17 | "action" = "gtklock";
18 | "keybind" = "l";
19 | }
20 | {
21 | "label" = "reboot";
22 | "action" = "reboot";
23 | "keybind" = "r";
24 | }
25 | {
26 | "label" = "shutdown";
27 | "action" = "poweroff";
28 | "keybind" = "s";
29 | }
30 | ];
31 | style = ''
32 | * {
33 | background-image: none;
34 | }
35 | window {
36 | background-color: rgba(${theme.colorScheme.background1RGB}, ${theme.colorScheme.transparencyBackgroundRGB});
37 | }
38 | button {
39 | margin: 9px;
40 | color: rgba(${theme.colorScheme.foreground1RGB}, 1);
41 | background-color: rgba(${theme.colorScheme.background1RGB}, ${theme.colorScheme.transparencyBackgroundRGB});
42 | border: 1px solid rgba(${theme.colorScheme.background4RGB}, ${theme.colorScheme.transparencyBackgroundRGB});
43 | background-repeat: no-repeat;
44 | background-position: center;
45 | background-size: 25%;
46 | border-radius: 5px;
47 | }
48 |
49 | button:hover {
50 | border: 1px solid rgba(${theme.colorScheme.accentRGB}, ${theme.colorScheme.transparencyForegroundRGB});
51 | outline-style: none;
52 | }
53 |
54 | #lock {
55 | background-image: image(url("${user.home}/.config/wlogout/icons/lock.png"));
56 | }
57 |
58 | #shutdown {
59 | background-image: image(url("${user.home}/.config/wlogout/icons/shutdown.png"));
60 | }
61 |
62 | #reboot {
63 | background-image: image(url("${user.home}/.config/wlogout/icons/reboot.png"));
64 | }
65 | '';
66 | };
67 | }
68 |
--------------------------------------------------------------------------------
/.config/home-manager/features/hyprpaper.nix:
--------------------------------------------------------------------------------
1 | { user, pkgs, ... }:
2 | let
3 | setWallpaper = pkgs.writeShellScriptBin "set-wallpaper" ''
4 | ln -sf $(readlink -f $1) ${user.home}/.active-wallpaper
5 | pkill hyprpaper
6 | hyprpaper
7 | '';
8 | randomWallpaper = pkgs.writeShellScriptBin "random-wallpaper" ''
9 | current_wallpaper=$(basename $(readlink ${user.home}/.active-wallpaper))
10 |
11 | if [ "$current_wallpaper" = "" ]; then
12 | new_wallpaper=$(ls ${user.home}/.wallpapers | sort -R | tail -1)
13 | else
14 | new_wallpaper=$(ls ${user.home}/.wallpapers | grep -v $current_wallpaper | sort -R | tail -1)
15 | fi
16 |
17 | if [ "$new_wallpaper" = "" ]; then
18 | new_wallpaper="${user.home}/.wallpapers/default.png"
19 | else
20 | new_wallpaper="${user.home}/.wallpapers/$new_wallpaper"
21 | fi
22 |
23 | ln -sf $new_wallpaper ${user.home}/.active-wallpaper
24 | pkill hyprpaper
25 | hyprpaper
26 | '';
27 | getWallpapers = pkgs.writeShellScriptBin "get-wallpapers" ''
28 | wallpaper_dir=${user.home}/.wallpapers
29 | got_wallpapers=${user.home}/.got-wallpapers
30 |
31 | CURRENT_SHA="$(sha256sum $(readlink -f $0) | cut -d' ' -f1)$(sha256sum ${user.home}/.assets/wallpaper-list | cut -d' ' -f1)"
32 | LAST_SHA=$(cat $got_wallpapers)
33 |
34 | if [ "$CURRENT_SHA" != "$LAST_SHA" ]; then
35 | echo "Updating wallpapers..."
36 | else
37 | echo "Wallpapers up to date."
38 | exit
39 | fi
40 |
41 | download() {
42 | wget -nc -O $wallpaper_dir/$1 $2
43 | }
44 |
45 | while IFS="" read -r line || [ -n "$line" ]; do
46 | name=$(echo $line | cut -d' ' -f1)
47 | url=$(echo $line | cut -d' ' -f2)
48 | download $name $url
49 | done < ${user.home}/.assets/wallpaper-list
50 |
51 | echo "$CURRENT_SHA" > $HOME/.got-wallpapers
52 | '';
53 | in
54 | {
55 | home.packages = [ pkgs.hyprpaper setWallpaper randomWallpaper getWallpapers ];
56 | home.file = {
57 | ".config/hypr/hyprpaper.conf".text = ''
58 | preload = ~/.active-wallpaper
59 |
60 | wallpaper = eDP-1,~/.active-wallpaper
61 | wallpaper = DP-1,~/.active-wallpaper
62 | wallpaper = DP-2,~/.active-wallpaper
63 | wallpaper = DP-3,~/.active-wallpaper
64 | '';
65 | };
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/.config/home-manager/features/packages.nix:
--------------------------------------------------------------------------------
1 | { inputs, pkgs, user, theme, ... }:
2 | let
3 | pythonPackages = ps: with ps; [
4 | matplotlib
5 | pyinotify
6 | ];
7 |
8 | pythonPackage = pkgs.python3.withPackages pythonPackages;
9 | in
10 | {
11 | programs.git = {
12 | enable = true;
13 | userEmail = user.email;
14 | userName = user.fullName;
15 | };
16 |
17 | programs.btop = {
18 | enable = true;
19 | settings = {
20 | color_theme = "Default";
21 | theme_background = false;
22 | };
23 | };
24 |
25 | programs.imv = {
26 | enable = true;
27 | settings = {
28 | options.overlay = true;
29 | };
30 | };
31 | programs.thunderbird = {
32 | enable = true;
33 | profiles."${user.email}".isDefault = true;
34 | };
35 |
36 | home.packages = with pkgs; [
37 | # Fonts
38 | noto-fonts-emoji
39 | noto-fonts-cjk-sans
40 | noto-fonts-cjk-serif
41 |
42 | # Command Line Tools
43 | gvfs
44 | glib
45 | gdb
46 | lsof
47 | pulseaudio
48 | alsa-utils
49 | wget
50 | yafetch
51 | starfetch
52 | lolcat
53 | figlet
54 | rar
55 | zip
56 | unzip
57 | p7zip
58 | imagemagick
59 | ghostscript
60 | jq
61 | socat
62 | pythonPackage
63 |
64 | # TUI Tools
65 | pulsemixer
66 | networkmanager
67 | # khal
68 |
69 | # GUI Tools
70 | xorg.xrandr
71 | rofimoji
72 | wf-recorder
73 | wl-clipboard
74 | cliphist
75 | hyprpicker
76 | inotify-tools
77 | libnotify
78 | pavucontrol
79 | networkmanagerapplet
80 | gamescope
81 | ffmpegthumbnailer
82 | obs-studio
83 | blueberry
84 |
85 | # Files
86 | mpv
87 | zathura
88 | vlc
89 | gst_all_1.gst-plugins-base
90 | gst_all_1.gst-plugins-good
91 | gst_all_1.gst-plugins-bad
92 | gst_all_1.gst-plugins-ugly
93 | cinnamon.nemo-with-extensions
94 | cinnamon.nemo-emblems
95 | cinnamon.nemo-fileroller
96 | transmission-gtk
97 |
98 | # Editors
99 | gimp
100 | inkscape
101 | audacity
102 | handbrake
103 | onlyoffice-bin
104 | meld
105 | galculator
106 | libsForQt5.kdenlive
107 | obsidian
108 |
109 | # Internet
110 | discord
111 |
112 | # GNOME Apps
113 | gnome.simple-scan
114 | gnome.cheese
115 | gnome.gnome-font-viewer
116 | evince
117 | gnome.gnome-boxes
118 |
119 | yed
120 | (callPackage ../packages/hyprprop.nix {})
121 | ];
122 | }
123 |
--------------------------------------------------------------------------------
/.config/home-manager/files/assets/hitbox.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import subprocess, os, signal, pyinotify, sys
4 | from threading import Thread
5 | from queue import Queue
6 |
7 |
8 | PATHNAME = "/dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick"
9 | COMMAND = sys.argv[1] + ' --evdev /dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick --evdev-keymap "BTN_TRIGGER=A,BTN_THUMB2=X,BTN_TOP=Y,BTN_THUMB=B,BTN_PINKIE=LB,BTN_TOP2=RB,BTN_BASE2=LT,BTN_BASE=RT,BTN_BASE5=TL,BTN_BASE6=TR,BTN_BASE3=Back,BTN_BASE4=Start" --evdev-absmap "ABS_X=x1,ABS_Y=y1" --axismap "-y1=y1" --mimic-xpad --silent'
10 | CONNECT = 1
11 | DISCONNECT = 0
12 |
13 | run_xboxdrv = False
14 | xboxdrv_pid = None
15 | xboxdrv_thread = None
16 | action_queue = Queue()
17 |
18 |
19 | def start_xboxdrv():
20 | global run_xboxdrv
21 | global xboxdrv_pid
22 | while run_xboxdrv:
23 | xboxdrv = subprocess.Popen(COMMAND, shell=True)
24 | xboxdrv_pid = xboxdrv.pid
25 | xboxdrv.communicate()
26 |
27 |
28 | def kill_until_dead():
29 | could_kill = True
30 | while could_kill:
31 | try:
32 | os.kill(xboxdrv_pid, signal.SIGKILL)
33 | except:
34 | could_kill = False
35 |
36 |
37 | def connect():
38 | global run_xboxdrv
39 | global xboxdrv_thread
40 | if xboxdrv_thread is None:
41 | run_xboxdrv = True
42 | xboxdrv_thread = Thread(target=start_xboxdrv)
43 | xboxdrv_thread.start()
44 |
45 |
46 | def disconnect():
47 | global run_xboxdrv
48 | global xboxdrv_thread
49 | if xboxdrv_thread is not None:
50 | run_xboxdrv = False
51 | kill_until_dead()
52 | xboxdrv_thread.join()
53 | xboxdrv_thread = None
54 |
55 |
56 | def connection_broker():
57 | while True:
58 | action = action_queue.get()
59 | if action == CONNECT:
60 | connect()
61 | elif action == DISCONNECT:
62 | disconnect()
63 |
64 |
65 | def main():
66 | class MyEventHandler(pyinotify.ProcessEvent):
67 | def process_IN_MOVED_FROM(self, event):
68 | if event.pathname == PATHNAME:
69 | action_queue.put(CONNECT)
70 | def process_IN_MOVED_TO(self, event):
71 | if event.pathname == PATHNAME:
72 | action_queue.put(CONNECT)
73 | def process_IN_CREATE(self, event):
74 | if event.pathname == PATHNAME:
75 | action_queue.put(CONNECT)
76 | def process_IN_DELETE(self, event):
77 | if event.pathname == PATHNAME:
78 | action_queue.put(DISCONNECT)
79 | wm = pyinotify.WatchManager()
80 | handler = MyEventHandler()
81 | notifier = pyinotify.Notifier(wm, handler)
82 | wm.add_watch('/dev/input/by-id', pyinotify.ALL_EVENTS)
83 | Thread(target=connection_broker).start()
84 | if os.path.islink(PATHNAME):
85 | action_queue.put(CONNECT)
86 | notifier.loop()
87 |
88 |
89 | if __name__ == "__main__":
90 | main()
91 |
92 |
--------------------------------------------------------------------------------
/.config/nixos/features/hyprland.nix:
--------------------------------------------------------------------------------
1 | { pkgs, lib, ... }:
2 | let
3 | portalPackages = [ pkgs.xdg-desktop-portal pkgs.xdg-desktop-portal-hyprland ];
4 | joinedPortals = pkgs.buildEnv {
5 | name = "xdg-portals";
6 | paths = portalPackages;
7 | pathsToLink = [ "/share/xdg-desktop-portal/portals" "/share/applications" ];
8 | };
9 | in
10 | {
11 | programs = {
12 | gnome-disks.enable = true;
13 | dconf.enable = true;
14 | hyprland.enable = true;
15 | steam = {
16 | enable = true;
17 | remotePlay.openFirewall = true;
18 | dedicatedServer.openFirewall = true;
19 | };
20 | };
21 | xdg.portal = {
22 | enable = lib.mkForce false;
23 | extraPortals = lib.mkForce [ ];
24 | };
25 | hardware = {
26 | opengl.enable = true;
27 | bluetooth.enable = true;
28 | };
29 | security = {
30 | rtkit.enable = true;
31 | polkit.enable = true;
32 | pam.services = {
33 | gtklock.text = lib.readFile "${pkgs.gtklock}/etc/pam.d/gtklock";
34 | "christian".enableGnomeKeyring = true;
35 | };
36 | };
37 | services = {
38 | gnome.gnome-keyring.enable = true;
39 | udisks2.enable = true;
40 | pipewire = {
41 | enable = true;
42 | alsa.enable = true;
43 | alsa.support32Bit = true;
44 | pulse.enable = true;
45 | jack.enable = true;
46 | wireplumber.enable = true;
47 | };
48 | keyd = {
49 | enable = true;
50 | keyboards.default = {
51 | ids = [ "*" ];
52 | settings.main = {
53 | alt = "layer(meta)";
54 | meta = "layer(alt)";
55 | };
56 | };
57 | };
58 | getty = {
59 | autologinUser = "christian";
60 | helpLine = lib.mkForce "";
61 | greetingLine = "";
62 | extraArgs = [ "--skip-login" ];
63 | };
64 | geoclue2.enable = true;
65 | power-profiles-daemon.enable = true;
66 | dbus.packages = portalPackages;
67 | };
68 | environment = {
69 | systemPackages = [ joinedPortals ];
70 | pathsToLink = [ "/share/applications" ];
71 | sessionVariables = {
72 | XDG_DESKTOP_PORTAL_DIR = "${joinedPortals}/share/xdg-desktop-portal/portals";
73 | };
74 | };
75 | systemd = {
76 | packages = portalPackages;
77 | user.services.xdg-desktop-portal = {
78 | description = "Portal service";
79 | partOf = lib.mkForce [];
80 | serviceConfig = {
81 | Type = "dbus";
82 | BusName = "org.freedesktop.portal.Desktop";
83 | ExecStart = "${pkgs.xdg-desktop-portal}/libexec/xdg-desktop-portal";
84 | Slice = "session.slice";
85 | };
86 | };
87 | user.services.xdg-desktop-portal-hyprland = {
88 | description = "Portal service (Hyprland implementation)";
89 | partOf = lib.mkForce [];
90 | after = lib.mkForce [];
91 | serviceConfig = {
92 | Type = "dbus";
93 | BusName = "org.freedesktop.impl.portal.desktop.hyprland";
94 | ExecStart = "${pkgs.xdg-desktop-portal-hyprland}/libexec/xdg-desktop-portal-hyprland";
95 | Restart = "on-failure";
96 | Slice = "session.slice";
97 | };
98 | };
99 | user.services.polkit-gnome-authentication-agent-1 = {
100 | description = "polkit-gnome-authentication-agent-1";
101 | wantedBy = [ "graphical-session.target" ];
102 | wants = [ "graphical-session.target" ];
103 | after = [ "graphical-session.target" ];
104 | serviceConfig = {
105 | Type = "simple";
106 | ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
107 | Restart = "on-failure";
108 | RestartSec = 1;
109 | TimeoutStopSec = 10;
110 | };
111 | };
112 | };
113 | }
114 |
--------------------------------------------------------------------------------
/.config/home-manager/flake.lock:
--------------------------------------------------------------------------------
1 | {
2 | "nodes": {
3 | "base16-schemes": {
4 | "flake": false,
5 | "locked": {
6 | "lastModified": 1689473676,
7 | "narHash": "sha256-L0RhUr9+W5EPWBpLcmkKpUeCEWRs/kLzVMF3Vao2ZU0=",
8 | "owner": "tinted-theming",
9 | "repo": "base16-schemes",
10 | "rev": "d95123ca6377cd849cfdce92c0a24406b0c6a789",
11 | "type": "github"
12 | },
13 | "original": {
14 | "owner": "tinted-theming",
15 | "repo": "base16-schemes",
16 | "type": "github"
17 | }
18 | },
19 | "firefox-addons": {
20 | "inputs": {
21 | "flake-utils": "flake-utils",
22 | "nixpkgs": [
23 | "nixpkgs"
24 | ]
25 | },
26 | "locked": {
27 | "dir": "pkgs/firefox-addons",
28 | "lastModified": 1699783991,
29 | "narHash": "sha256-c3/20so+NZJOIR1HyKDf8/FhXrEMX2/4kcGg1Yg+vxI=",
30 | "owner": "rycee",
31 | "repo": "nur-expressions",
32 | "rev": "16cffde1cc5f21cd6a48a1a7eba477d2f0c2b593",
33 | "type": "gitlab"
34 | },
35 | "original": {
36 | "dir": "pkgs/firefox-addons",
37 | "owner": "rycee",
38 | "repo": "nur-expressions",
39 | "type": "gitlab"
40 | }
41 | },
42 | "flake-utils": {
43 | "locked": {
44 | "lastModified": 1629284811,
45 | "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
46 | "owner": "numtide",
47 | "repo": "flake-utils",
48 | "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c",
49 | "type": "github"
50 | },
51 | "original": {
52 | "owner": "numtide",
53 | "repo": "flake-utils",
54 | "type": "github"
55 | }
56 | },
57 | "home-manager": {
58 | "inputs": {
59 | "nixpkgs": [
60 | "nixpkgs"
61 | ]
62 | },
63 | "locked": {
64 | "lastModified": 1699783872,
65 | "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=",
66 | "owner": "nix-community",
67 | "repo": "home-manager",
68 | "rev": "280721186ab75a76537713ec310306f0eba3e407",
69 | "type": "github"
70 | },
71 | "original": {
72 | "owner": "nix-community",
73 | "repo": "home-manager",
74 | "type": "github"
75 | }
76 | },
77 | "nix-colors": {
78 | "inputs": {
79 | "base16-schemes": "base16-schemes",
80 | "nixpkgs-lib": "nixpkgs-lib"
81 | },
82 | "locked": {
83 | "lastModified": 1695388192,
84 | "narHash": "sha256-2jelpE7xK+4M7jZNyWL7QYOYegQLYBDQS5bvdo8XRUQ=",
85 | "owner": "misterio77",
86 | "repo": "nix-colors",
87 | "rev": "37227f274b34a3b51649166deb94ce7fec2c6a4c",
88 | "type": "github"
89 | },
90 | "original": {
91 | "owner": "misterio77",
92 | "repo": "nix-colors",
93 | "type": "github"
94 | }
95 | },
96 | "nixpkgs": {
97 | "locked": {
98 | "lastModified": 1699099776,
99 | "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=",
100 | "owner": "nixos",
101 | "repo": "nixpkgs",
102 | "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb",
103 | "type": "github"
104 | },
105 | "original": {
106 | "owner": "nixos",
107 | "ref": "nixos-unstable",
108 | "repo": "nixpkgs",
109 | "type": "github"
110 | }
111 | },
112 | "nixpkgs-lib": {
113 | "locked": {
114 | "lastModified": 1694911725,
115 | "narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=",
116 | "owner": "nix-community",
117 | "repo": "nixpkgs.lib",
118 | "rev": "819180647f428a3826bfc917a54449da1e532ce0",
119 | "type": "github"
120 | },
121 | "original": {
122 | "owner": "nix-community",
123 | "repo": "nixpkgs.lib",
124 | "type": "github"
125 | }
126 | },
127 | "root": {
128 | "inputs": {
129 | "firefox-addons": "firefox-addons",
130 | "home-manager": "home-manager",
131 | "nix-colors": "nix-colors",
132 | "nixpkgs": "nixpkgs"
133 | }
134 | }
135 | },
136 | "root": "root",
137 | "version": 7
138 | }
139 |
--------------------------------------------------------------------------------
/.config/home-manager/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | description = "Home Manager configuration of christian";
3 |
4 | inputs = {
5 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 | home-manager = {
7 | url = "github:nix-community/home-manager";
8 | inputs.nixpkgs.follows = "nixpkgs";
9 | };
10 | firefox-addons = {
11 | url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
12 | inputs.nixpkgs.follows = "nixpkgs";
13 | };
14 | nix-colors.url = "github:misterio77/nix-colors";
15 | };
16 |
17 | outputs = { nixpkgs, home-manager, ... }@inputs:
18 | let
19 | system = "x86_64-linux";
20 |
21 | user = {
22 | name = "christian";
23 | home = "/home/christian";
24 | fullName = "Christian Smith";
25 | email = "smith.christian.william@gmail.com";
26 | };
27 |
28 | palette = inputs.nix-colors.colorSchemes.material-darker.colors;
29 |
30 | theme = {
31 | colorScheme = {
32 | transparencyBackgroundHex = "CC";
33 | transparencyForegroundHex = "EE";
34 | transparencyHeavyShadeHex = "5C";
35 | transparencyLightShadeHex = "14";
36 |
37 | transparencyBackgroundRGB = "0.8";
38 | transparencyForegroundRGB = "0.93";
39 | transparencyHeavyShadeRGB = "0.36";
40 | transparencyLightShadeRGB = "0.08";
41 |
42 | background1Hex = palette.base00;
43 | background2Hex = palette.base01;
44 | background3Hex = palette.base02;
45 | background4Hex = palette.base03;
46 | foreground4Hex = palette.base04;
47 | foreground3Hex = palette.base05;
48 | foreground2Hex = palette.base06;
49 | foreground1Hex = palette.base07;
50 |
51 | background1RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base00;
52 | background2RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base01;
53 | background3RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base02;
54 | background4RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base03;
55 | foreground4RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base04;
56 | foreground3RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base05;
57 | foreground2RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base06;
58 | foreground1RGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base07;
59 |
60 | redHex = palette.base08;
61 | orangeHex = palette.base09;
62 | yellowHex = palette.base0A;
63 | greenHex = palette.base0B;
64 | cyanHex = palette.base0C;
65 | blueHex = palette.base0D;
66 | magentaHex = palette.base0E;
67 | brownHex = palette.base0F;
68 |
69 | redRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base08;
70 | orangeRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base09;
71 | yellowRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base0A;
72 | greenRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base0B;
73 | cyanRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base0C;
74 | blueRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base0D;
75 | magentaRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base0E;
76 | brownRGB = inputs.nix-colors.lib.conversions.hexToRGBString "," palette.base0F;
77 |
78 | accentHex = theme.colorScheme.cyanHex;
79 | secondaryAccentHex = theme.colorScheme.greenHex;
80 | dangerHex = theme.colorScheme.redHex;
81 | warningHex = theme.colorScheme.yellowHex;
82 | infoHex = theme.colorScheme.blueHex;
83 | successHex = theme.colorScheme.greenHex;
84 | specialHex = theme.colorScheme.magentaHex;
85 |
86 | accentRGB = theme.colorScheme.cyanRGB;
87 | secondaryAccentRGB = theme.colorScheme.greenRGB;
88 | dangerRGB = theme.colorScheme.redRGB;
89 | warningRGB = theme.colorScheme.yellowRGB;
90 | infoRGB = theme.colorScheme.blueRGB;
91 | successRGB = theme.colorScheme.greenRGB;
92 | specialRGB = theme.colorScheme.magentaRGB;
93 |
94 | newtForeground = "white";
95 | newtBackground = "black";
96 | newtAccent = "cyan";
97 | };
98 | borderWidth = 1;
99 | borderRadius = 5;
100 | gapsIn = 3;
101 | gapsOut = 5;
102 |
103 | fontPackage = pkgs.noto-fonts;
104 | fontName = "Noto Sans";
105 | fontSize = 11;
106 | fontSizeUI = 16;
107 | monoFontPackage = pkgs.noto-fonts;
108 | monoFontName = "Noto Sans Mono";
109 | monoFontSize = 10;
110 |
111 | cursorThemePackage = pkgs.gnome.adwaita-icon-theme;
112 | cursorThemeName = "Adwaita";
113 | cursorSize = 40;
114 |
115 | iconThemePackage = pkgs.flat-remix-icon-theme;
116 | iconThemeName = "Flat-Remix-Cyan-Dark";
117 |
118 | themePackage = pkgs.adw-gtk3;
119 | themeName = "adw-gtk3-dark";
120 | qtPlatformTheme = "gtk";
121 | qtStyleName = "adwaita-dark";
122 | };
123 |
124 | pkgs = import nixpkgs {
125 | inherit system;
126 | config.allowUnfree = true;
127 | };
128 | in {
129 | homeConfigurations."${user.name}" = home-manager.lib.homeManagerConfiguration {
130 | inherit pkgs;
131 | extraSpecialArgs = { inherit inputs user theme pkgs; };
132 | modules = [
133 | inputs.nix-colors.homeManagerModules.default
134 | ./home.nix
135 | ];
136 | };
137 | };
138 | }
139 |
--------------------------------------------------------------------------------
/.config/home-manager/features/shell.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, theme, ... }:
2 | {
3 | home.packages = with pkgs; [ eza ];
4 | programs.fish = {
5 | enable = true;
6 | interactiveShellInit = ''
7 | set fish_greeting
8 |
9 | if test (tty) = /dev/tty1;
10 | while test -f ~/.tty1-gui-only;
11 | hyprland-launcher;
12 | end;
13 | end;
14 |
15 | set fish_color_autosuggestion ${theme.colorScheme.background4Hex}
16 | set fish_color_cancel \x2d\x2dreverse
17 | set fish_color_command ${theme.colorScheme.successHex}
18 | set fish_color_comment ${theme.colorScheme.warningHex}
19 | set fish_color_end ${theme.colorScheme.specialHex}
20 | set fish_color_error ${theme.colorScheme.dangerHex}
21 | set fish_color_escape ${theme.colorScheme.accentHex}
22 | set fish_color_host_remote \x1d
23 | set fish_color_keyword \x1d
24 | set fish_color_match ${theme.colorScheme.infoHex}
25 | set fish_color_operator ${theme.colorScheme.infoHex}
26 | set fish_color_option \x1d
27 | set fish_color_param ${theme.colorScheme.foreground3Hex}
28 | set fish_color_quote ${theme.colorScheme.warningHex}
29 | set fish_color_redirection ${theme.colorScheme.foreground3Hex}
30 | set fish_pager_color_background \x1d
31 | set fish_pager_color_description ${theme.colorScheme.warningHex}
32 | set fish_pager_color_secondary_background \x1d
33 | set fish_pager_color_secondary_completion \x1d
34 | set fish_pager_color_secondary_description \x1d
35 | set fish_pager_color_secondary_prefix \x1d
36 | set fish_pager_color_selected_background \x2d\x2dbackground\x3dbrblack
37 | set fish_pager_color_selected_completion \x1d
38 | set fish_pager_color_selected_description \x1d
39 | set fish_pager_color_selected_prefix \x1d
40 |
41 | alias ls "eza --icons"
42 | alias nix-gc "nix-collect-garbage -d"
43 | alias full-gc "nixos-gc && nix-gc"
44 | alias ga "git add"
45 | alias gr "git restore"
46 | alias gc "git commit -m"
47 | alias gp "git push"
48 | alias gs "git status"
49 | alias gd "git diff"
50 | alias nt "terminal & disown"
51 | alias chx "chmod +x"
52 | alias chw "chmod +w"
53 | alias poweroff "systemctl poweroff --no-wall"
54 | alias reboot "systemctl reboot -i --no-wall"
55 | '';
56 |
57 | functions = {
58 | fish_prompt = ''
59 | set -l last_pipestatus $pipestatus
60 | set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
61 |
62 | if not set -q __fish_git_prompt_show_informative_status
63 | set -g __fish_git_prompt_show_informative_status 1
64 | end
65 | if not set -q __fish_git_prompt_hide_untrackedfiles
66 | set -g __fish_git_prompt_hide_untrackedfiles 1
67 | end
68 | if not set -q __fish_git_prompt_color_branch
69 | set -g __fish_git_prompt_color_branch ${theme.colorScheme.specialHex} --bold
70 | end
71 | if not set -q __fish_git_prompt_showupstream
72 | set -g __fish_git_prompt_showupstream informative
73 | end
74 | if not set -q __fish_git_prompt_color_dirtystate
75 | set -g __fish_git_prompt_color_dirtystate ${theme.colorScheme.infoHex}
76 | end
77 | if not set -q __fish_git_prompt_color_stagedstate
78 | set -g __fish_git_prompt_color_stagedstate ${theme.colorScheme.warningHex}
79 | end
80 | if not set -q __fish_git_prompt_color_invalidstate
81 | set -g __fish_git_prompt_color_invalidstate ${theme.colorScheme.dangerHex}
82 | end
83 | if not set -q __fish_git_prompt_color_untrackedfiles
84 | set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
85 | end
86 | if not set -q __fish_git_prompt_color_cleanstate
87 | set -g __fish_git_prompt_color_cleanstate ${theme.colorScheme.successHex} --bold
88 | end
89 |
90 | set -l color_cwd
91 | set -l suffix
92 | if functions -q fish_is_root_user; and fish_is_root_user
93 | if set -q fish_color_cwd_root
94 | set color_cwd $fish_color_cwd_root
95 | else
96 | set color_cwd $fish_color_cwd
97 | end
98 | set suffix '#'
99 | else
100 | set color_cwd $fish_color_cwd
101 | set suffix '$'
102 | end
103 |
104 | # PWD
105 | set_color $color_cwd
106 | echo -n (prompt_pwd)
107 | set_color normal
108 |
109 | printf '%s ' (fish_vcs_prompt)
110 |
111 | set -l status_color (set_color $fish_color_status)
112 | set -l statusb_color (set_color --bold $fish_color_status)
113 | set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
114 | echo -n $prompt_status
115 | set_color normal
116 |
117 | echo -n "$suffix "
118 | '';
119 | nixos-up = ''
120 | if ! test "$argv"
121 | echo "Usage: nixos-up (flake)"
122 | return
123 | end
124 | sudo nix-channel --update
125 | cp -r ${user.home}/.config/nixos /tmp
126 | if test "$argv[2]" = "flake"
127 | echo "updating flake.lock..."
128 | nix flake update /tmp/nixos/
129 | end
130 | sudo nixos-rebuild switch --flake /tmp/nixos/#$argv[1]
131 | if test "$argv[2]" = "flake"
132 | cp /tmp/nixos/flake.lock ${user.home}/.config/nixos/flake.lock
133 | end
134 | rm -rf /tmp/nixos
135 | '';
136 | nix-up = ''
137 | if test "$argv[1]" = "flake"
138 | echo "updating flake.lock..."
139 | nix flake update ${user.home}/.config/home-manager/
140 | end
141 | pushd $(pwd)
142 | nix-channel --update
143 | home-manager switch -b backup
144 | popd
145 | '';
146 | nixos-gc = ''
147 | sudo nix-collect-garbage
148 | sudo nix-collect-garbage -d
149 | sudo /run/current-system/bin/switch-to-configuration boot
150 | '';
151 | nix-goto = "cd $(dirname $(readlink -f $(which $argv)))";
152 | };
153 | };
154 | }
155 |
--------------------------------------------------------------------------------
/.config/home-manager/features/theme.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, theme, ... }:
2 | let
3 | gtkCss = ''
4 | @define-color accent_color #${theme.colorScheme.blueHex};
5 | @define-color accent_bg_color #${theme.colorScheme.blueHex};
6 | @define-color accent_fg_color #${theme.colorScheme.foreground1Hex};
7 | @define-color destructive_color #${theme.colorScheme.redHex};
8 | @define-color destructive_bg_color #${theme.colorScheme.redHex};
9 | @define-color destructive_fg_color #${theme.colorScheme.foreground1Hex};
10 | @define-color success_color #${theme.colorScheme.greenHex};
11 | @define-color success_bg_color #${theme.colorScheme.greenHex};
12 | @define-color success_fg_color #${theme.colorScheme.foreground1Hex};
13 | @define-color warning_color #${theme.colorScheme.yellowHex};
14 | @define-color warning_bg_color #${theme.colorScheme.yellowHex};
15 | @define-color warning_fg_color rgba(${theme.colorScheme.background1RGB},${theme.colorScheme.transparencyBackgroundRGB});
16 | @define-color error_color #${theme.colorScheme.redHex};
17 | @define-color error_bg_color #${theme.colorScheme.redHex};
18 | @define-color error_fg_color #${theme.colorScheme.foreground1Hex};
19 | @define-color window_bg_color #${theme.colorScheme.background2Hex};
20 | @define-color window_fg_color #${theme.colorScheme.foreground1Hex};
21 | @define-color view_bg_color #${theme.colorScheme.background1Hex};
22 | @define-color view_fg_color #${theme.colorScheme.foreground1Hex};
23 | @define-color headerbar_bg_color #${theme.colorScheme.background2Hex};
24 | @define-color headerbar_fg_color #${theme.colorScheme.foreground1Hex};
25 | @define-color headerbar_border_color #${theme.colorScheme.foreground1Hex};
26 | @define-color headerbar_backdrop_color #${theme.colorScheme.background2Hex};
27 | @define-color headerbar_shade_color rgba(${theme.colorScheme.background1RGB},${theme.colorScheme.transparencyHeavyShadeRGB});
28 | @define-color card_bg_color rgba(${theme.colorScheme.foreground1RGB},${theme.colorScheme.transparencyLightShadeRGB});
29 | @define-color card_fg_color #${theme.colorScheme.foreground1Hex};
30 | @define-color card_shade_color rgba(${theme.colorScheme.background1RGB},${theme.colorScheme.transparencyHeavyShadeRGB});
31 | @define-color dialog_bg_color #${theme.colorScheme.background3Hex};
32 | @define-color dialog_fg_color #${theme.colorScheme.foreground1Hex};
33 | @define-color popover_bg_color #${theme.colorScheme.background3Hex};
34 | @define-color popover_fg_color #${theme.colorScheme.foreground1Hex};
35 | @define-color shade_color rgba(${theme.colorScheme.background1RGB},${theme.colorScheme.transparencyHeavyShadeRGB});
36 | @define-color scrollbar_outline_color rgba(${theme.colorScheme.background1RGB},${theme.colorScheme.transparencyHeavyShadeRGB});
37 | @define-color blue_1 #${theme.colorScheme.blueHex};
38 | @define-color blue_2 #${theme.colorScheme.blueHex};
39 | @define-color blue_3 #${theme.colorScheme.blueHex};
40 | @define-color blue_4 #${theme.colorScheme.blueHex};
41 | @define-color blue_5 #${theme.colorScheme.blueHex};
42 | @define-color green_1 #${theme.colorScheme.greenHex};
43 | @define-color green_2 #${theme.colorScheme.greenHex};
44 | @define-color green_3 #${theme.colorScheme.greenHex};
45 | @define-color green_4 #${theme.colorScheme.greenHex};
46 | @define-color green_5 #${theme.colorScheme.greenHex};
47 | @define-color yellow_1 #${theme.colorScheme.yellowHex};
48 | @define-color yellow_2 #${theme.colorScheme.yellowHex};
49 | @define-color yellow_3 #${theme.colorScheme.yellowHex};
50 | @define-color yellow_4 #${theme.colorScheme.yellowHex};
51 | @define-color yellow_5 #${theme.colorScheme.yellowHex};
52 | @define-color orange_1 #${theme.colorScheme.orangeHex};
53 | @define-color orange_2 #${theme.colorScheme.orangeHex};
54 | @define-color orange_3 #${theme.colorScheme.orangeHex};
55 | @define-color orange_4 #${theme.colorScheme.orangeHex};
56 | @define-color orange_5 #${theme.colorScheme.orangeHex};
57 | @define-color red_1 #${theme.colorScheme.redHex};
58 | @define-color red_2 #${theme.colorScheme.redHex};
59 | @define-color red_3 #${theme.colorScheme.redHex};
60 | @define-color red_4 #${theme.colorScheme.redHex};
61 | @define-color red_5 #${theme.colorScheme.redHex};
62 | @define-color purple_1 #${theme.colorScheme.magentaHex};
63 | @define-color purple_2 #${theme.colorScheme.magentaHex};
64 | @define-color purple_3 #${theme.colorScheme.magentaHex};
65 | @define-color purple_4 #${theme.colorScheme.magentaHex};
66 | @define-color purple_5 #${theme.colorScheme.magentaHex};
67 | @define-color brown_1 #${theme.colorScheme.brownHex};
68 | @define-color brown_2 #${theme.colorScheme.brownHex};
69 | @define-color brown_3 #${theme.colorScheme.brownHex};
70 | @define-color brown_4 #${theme.colorScheme.brownHex};
71 | @define-color brown_5 #${theme.colorScheme.brownHex};
72 | @define-color light_1 #${theme.colorScheme.foreground1Hex};
73 | @define-color light_2 #${theme.colorScheme.foreground1Hex};
74 | @define-color light_3 #${theme.colorScheme.foreground2Hex};
75 | @define-color light_4 #${theme.colorScheme.foreground3Hex};
76 | @define-color light_5 #${theme.colorScheme.foreground4Hex};
77 | @define-color dark_1 #${theme.colorScheme.background4Hex};
78 | @define-color dark_2 #${theme.colorScheme.background3Hex};
79 | @define-color dark_3 #${theme.colorScheme.background2Hex};
80 | @define-color dark_4 #${theme.colorScheme.background1Hex};
81 | @define-color dark_5 #${theme.colorScheme.background1Hex};
82 | '';
83 | in
84 | {
85 | home.file = {
86 | ".config/gtk-3.0/gtk.css".text = gtkCss;
87 | ".config/gtk-4.0/gtk.css".text = gtkCss;
88 | };
89 | home.pointerCursor = {
90 | package = theme.cursorThemePackage;
91 | name = theme.cursorThemeName;
92 | size = theme.cursorSize;
93 | gtk.enable = true;
94 | x11 = {
95 | enable = true;
96 | defaultCursor = "left_ptr";
97 | };
98 | };
99 |
100 | fonts.fontconfig.enable = true;
101 |
102 | gtk = {
103 | enable = true;
104 | font = {
105 | package = theme.fontPackage;
106 | name = theme.fontName;
107 | size = theme.fontSize;
108 | };
109 | theme.package = theme.themePackage;
110 | theme.name = theme.themeName;
111 | iconTheme.package = theme.iconThemePackage;
112 | iconTheme.name = theme.iconThemeName;
113 | gtk3.bookmarks = [
114 | "file://${user.home}/Documents Documents"
115 | "file://${user.home}/Downloads Downloads"
116 | "file://${user.home}/Music Music"
117 | "file://${user.home}/Pictures Pictures"
118 | "file://${user.home}/Templates Templates"
119 | "file://${user.home}/Videos Videos"
120 | ];
121 | };
122 |
123 | qt = {
124 | enable = true;
125 | platformTheme = theme.qtPlatformTheme;
126 | style.name = theme.qtStyleName;
127 | };
128 | }
129 |
--------------------------------------------------------------------------------
/.config/home-manager/features/rofi.nix:
--------------------------------------------------------------------------------
1 | { pkgs, config, theme, ... }:
2 | let
3 | guiAppLauncher = pkgs.writeShellScriptBin "gui-app-launcher" ''
4 | rofi -show drun
5 | '';
6 | in
7 | {
8 | home.packages = [guiAppLauncher];
9 |
10 | programs.rofi.enable = true;
11 | programs.rofi.theme =
12 | let
13 | inherit (config.lib.formats.rasi) mkLiteral;
14 | in {
15 | "configuration" = {
16 | modi = "drun";
17 | show-icons = true;
18 | display-drun = ">";
19 | drun-display-format = "{name}";
20 | hover-select = true;
21 | me-select-entry = "";
22 | me-accept-entry = map mkLiteral [ "MousePrimary" "MouseSecondary" "MouseDPrimary" ];
23 | };
24 |
25 | "*" = {
26 | background = mkLiteral "#${theme.colorScheme.background1Hex}FF";
27 | background-alt = mkLiteral "#${theme.colorScheme.background2Hex}FF";
28 | foreground = mkLiteral "#${theme.colorScheme.foreground1Hex}FF";
29 | selected = mkLiteral "#${theme.colorScheme.accentHex}FF";
30 | active = mkLiteral "#${theme.colorScheme.successHex}FF";
31 | urgent = mkLiteral "#${theme.colorScheme.dangerHex}FF";
32 | font = "${theme.fontName} ${builtins.toString theme.fontSize}";
33 | };
34 |
35 | "window" = {
36 | transparency = "real";
37 | location = mkLiteral "center";
38 | anchor = mkLiteral "center";
39 | fullscreen = mkLiteral "true";
40 | width = mkLiteral "100%";
41 | height = mkLiteral "100%";
42 | x-offset = mkLiteral "0px";
43 | y-offset = mkLiteral "0px";
44 |
45 | enabled = mkLiteral "true";
46 | margin = mkLiteral "0px";
47 | padding = mkLiteral "0px";
48 | border = mkLiteral "0px solid";
49 | border-radius = mkLiteral "0px";
50 | border-color = mkLiteral "@selected";
51 | background-color = mkLiteral "black / 10%";
52 | cursor = "default";
53 | };
54 |
55 | "mainbox" = {
56 | enabled = mkLiteral "true";
57 | spacing = mkLiteral "100px";
58 | margin = mkLiteral "0px";
59 | padding = mkLiteral "100px 225px";
60 | border = mkLiteral "0px solid";
61 | border-radius = mkLiteral "0px 0px 0px 0px";
62 | border-color = mkLiteral "@selected";
63 | background-color = mkLiteral "transparent";
64 | children = map mkLiteral [ "inputbar" "listview" ];
65 | };
66 |
67 | "inputbar" = {
68 | enabled = mkLiteral "true";
69 | spacing = mkLiteral "10px";
70 | margin = mkLiteral "0% 28%";
71 | padding = mkLiteral "10px";
72 | border = mkLiteral "${builtins.toString theme.borderWidth}px solid";
73 | border-radius = mkLiteral "${builtins.toString theme.borderRadius}px";
74 | border-color = mkLiteral "#${theme.colorScheme.foreground1Hex}${theme.colorScheme.transparencyHeavyShadeHex}";
75 | background-color = mkLiteral "#${theme.colorScheme.foreground1Hex}${theme.colorScheme.transparencyLightShadeHex}";
76 | text-color = mkLiteral "@foreground";
77 | children = map mkLiteral [ "prompt" "entry" ];
78 | };
79 |
80 | "prompt" = {
81 | enabled = mkLiteral "true";
82 | background-color = mkLiteral "transparent";
83 | text-color = mkLiteral "inherit";
84 | };
85 | "textbox-prompt-colon" = {
86 | enabled = mkLiteral "true";
87 | expand = mkLiteral "false";
88 | str = "::";
89 | background-color = mkLiteral "transparent";
90 | text-color = mkLiteral "inherit";
91 | };
92 | "entry" = {
93 | enabled = mkLiteral "true";
94 | background-color = mkLiteral "transparent";
95 | text-color = mkLiteral "inherit";
96 | cursor = mkLiteral "text";
97 | placeholder = "Search";
98 | placeholder-color = mkLiteral "inherit";
99 | };
100 |
101 | "listview" = {
102 | enabled = mkLiteral "true";
103 | columns = mkLiteral "7";
104 | lines = mkLiteral "4";
105 | cycle = mkLiteral "true";
106 | dynamic = mkLiteral "true";
107 | scrollbar = mkLiteral "false";
108 | layout = mkLiteral "vertical";
109 | reverse = mkLiteral "false";
110 | fixed-height = mkLiteral "true";
111 | fixed-columns = mkLiteral "true";
112 |
113 | spacing = mkLiteral "0px";
114 | margin = mkLiteral "0px";
115 | padding = mkLiteral "0px";
116 | border = mkLiteral "0px solid";
117 | border-radius = mkLiteral "0px";
118 | border-color = mkLiteral "@selected";
119 | background-color = mkLiteral "transparent";
120 | text-color = mkLiteral "@foreground";
121 | cursor = "default";
122 | };
123 | "scrollbar" = {
124 | handle-width = mkLiteral "5px";
125 | handle-color = mkLiteral "@selected";
126 | border-radius = mkLiteral "0px";
127 | background-color = mkLiteral "@background-alt";
128 | };
129 |
130 | "element" = {
131 | enabled = mkLiteral "true";
132 | spacing = mkLiteral "15px";
133 | margin = mkLiteral "0px";
134 | padding = mkLiteral "35px 10px";
135 | border = mkLiteral "0px solid";
136 | border-radius = mkLiteral "15px";
137 | border-color = mkLiteral "@selected";
138 | background-color = mkLiteral "transparent";
139 | text-color = mkLiteral "@foreground";
140 | orientation = mkLiteral "vertical";
141 | cursor = mkLiteral "pointer";
142 | };
143 | "element normal.normal" = {
144 | background-color = mkLiteral "transparent";
145 | text-color = mkLiteral "@foreground";
146 | };
147 | "element selected.normal" = {
148 | background-color = mkLiteral "#${theme.colorScheme.foreground1Hex}${theme.colorScheme.transparencyLightShadeHex}";
149 | text-color = mkLiteral "@foreground";
150 | };
151 | "element-icon" = {
152 | background-color = mkLiteral "transparent";
153 | text-color = mkLiteral "inherit";
154 | size = mkLiteral "72px";
155 | cursor = mkLiteral "inherit";
156 | };
157 | "element-text" = {
158 | background-color = mkLiteral "transparent";
159 | text-color = mkLiteral "inherit";
160 | highlight = mkLiteral "inherit";
161 | cursor = mkLiteral "inherit";
162 | vertical-align = mkLiteral "0.5";
163 | horizontal-align = mkLiteral "0.5";
164 | };
165 |
166 | "error-message" = {
167 | padding = mkLiteral "100px";
168 | border = mkLiteral "0px solid";
169 | border-radius = mkLiteral "0px";
170 | border-color = mkLiteral "@selected";
171 | background-color = mkLiteral "#${theme.colorScheme.background1Hex}${theme.colorScheme.transparencyLightShadeHex}";
172 | text-color = mkLiteral "@foreground";
173 | };
174 | "textbox" = {
175 | background-color = mkLiteral "transparent";
176 | text-color = mkLiteral "@foreground";
177 | vertical-align = mkLiteral "0.5";
178 | horizontal-align = mkLiteral "0.0";
179 | highlight = mkLiteral "none";
180 | };
181 | };
182 | }
--------------------------------------------------------------------------------
/.config/home-manager/features/default-applications.nix:
--------------------------------------------------------------------------------
1 | let
2 | audioDefaults = [ "mpv.desktop" ];
3 | videoDefaults = [ "mpv.desktop" ];
4 | imageDefaults = [ "imv.desktop" ];
5 | textDefaults = [ "codium.desktop" ];
6 | fontDefaults = [ "org.gnome.font-viewer.desktop" ];
7 | in
8 | {
9 | xdg = {
10 | enable = true;
11 | mime.enable = true;
12 | mimeApps = {
13 | enable = true;
14 | defaultApplications = {
15 | "audio/3gpp" = audioDefaults;
16 | "audio/3gpp2" = audioDefaults;
17 | "audio/aac" = audioDefaults;
18 | "audio/adpcm" = audioDefaults;
19 | "audio/aiff" = audioDefaults;
20 | "audio/basic" = audioDefaults;
21 | "audio/flac" = audioDefaults;
22 | "audio/midi" = audioDefaults;
23 | "audio/mp4" = audioDefaults;
24 | "audio/mpeg" = audioDefaults;
25 | "audio/ogg" = audioDefaults;
26 | "audio/opus" = audioDefaults;
27 | "audio/vnd.digital-winds" = audioDefaults;
28 | "audio/vnd.dts" = audioDefaults;
29 | "audio/vnd.dts.hd" = audioDefaults;
30 | "audio/vnd.lucent.voice" = audioDefaults;
31 | "audio/vnd.ms-playready.media.pya" = audioDefaults;
32 | "audio/vnd.nuera.ecelp4800" = audioDefaults;
33 | "audio/vnd.nuera.ecelp7470" = audioDefaults;
34 | "audio/vnd.nuera.ecelp9600" = audioDefaults;
35 | "audio/wav" = audioDefaults;
36 | "audio/webm" = audioDefaults;
37 | "audio/x-aiff" = audioDefaults;
38 | "audio/x-matroska" = audioDefaults;
39 | "audio/x-mpegurl" = audioDefaults;
40 | "audio/x-ms-wax" = audioDefaults;
41 | "audio/x-ms-wma" = audioDefaults;
42 | "audio/x-pn-realaudio" = audioDefaults;
43 | "audio/x-pn-realaudio-plugin" = audioDefaults;
44 |
45 | "font/otf" = fontDefaults;
46 | "font/woff" = fontDefaults;
47 | "font/woff2" = fontDefaults;
48 |
49 | "image/avif" = imageDefaults;
50 | "image/bmp" = imageDefaults;
51 | "image/cgm" = imageDefaults;
52 | "image/g3fax" = imageDefaults;
53 | "image/gif" = imageDefaults;
54 | "image/heic" = imageDefaults;
55 | "image/ief" = imageDefaults;
56 | "image/jpeg" = imageDefaults;
57 | "image/pjpeg" = imageDefaults;
58 | "image/png" = imageDefaults;
59 | "image/prs.btif" = imageDefaults;
60 | "image/svg+xml" = imageDefaults;
61 | "image/tiff" = imageDefaults;
62 | "image/vnd.adobe.photoshop" = imageDefaults;
63 | "image/vnd.djvu" = imageDefaults;
64 | "image/vnd.dwg" = imageDefaults;
65 | "image/vnd.dxf" = imageDefaults;
66 | "image/vnd.fastbidsheet" = imageDefaults;
67 | "image/vnd.fpx" = imageDefaults;
68 | "image/vnd.fst" = imageDefaults;
69 | "image/vnd.fujixerox.edmics-mmr" = imageDefaults;
70 | "image/vnd.fujixerox.edmics-rlc" = imageDefaults;
71 | "image/vnd.ms-modi" = imageDefaults;
72 | "image/vnd.net-fpx" = imageDefaults;
73 | "image/vnd.wap.wbmp" = imageDefaults;
74 | "image/vnd.xiff" = imageDefaults;
75 | "image/webp" = imageDefaults;
76 | "image/x-adobe-dng" = imageDefaults;
77 | "image/x-canon-cr2" = imageDefaults;
78 | "image/x-canon-crw" = imageDefaults;
79 | "image/x-cmu-raster" = imageDefaults;
80 | "image/x-cmx" = imageDefaults;
81 | "image/x-epson-erf" = imageDefaults;
82 | "image/x-freehand" = imageDefaults;
83 | "image/x-fuji-raf" = imageDefaults;
84 | "image/x-icns" = imageDefaults;
85 | "image/x-icon" = imageDefaults;
86 | "image/x-kodak-dcr" = imageDefaults;
87 | "image/x-kodak-k25" = imageDefaults;
88 | "image/x-kodak-kdc" = imageDefaults;
89 | "image/x-minolta-mrw" = imageDefaults;
90 | "image/x-nikon-nef" = imageDefaults;
91 | "image/x-olympus-orf" = imageDefaults;
92 | "image/x-panasonic-raw" = imageDefaults;
93 | "image/x-pcx" = imageDefaults;
94 | "image/x-pentax-pef" = imageDefaults;
95 | "image/x-pict" = imageDefaults;
96 | "image/x-portable-anymap" = imageDefaults;
97 | "image/x-portable-bitmap" = imageDefaults;
98 | "image/x-portable-graymap" = imageDefaults;
99 | "image/x-portable-pixmap" = imageDefaults;
100 | "image/x-rgb" = imageDefaults;
101 | "image/x-sigma-x3f" = imageDefaults;
102 | "image/x-sony-arw" = imageDefaults;
103 | "image/x-sony-sr2" = imageDefaults;
104 | "image/x-sony-srf" = imageDefaults;
105 | "image/x-xbitmap" = imageDefaults;
106 | "image/x-xpixmap" = imageDefaults;
107 | "image/x-xwindowdump" = imageDefaults;
108 |
109 | "text/calendar" = textDefaults;
110 | "text/css" = textDefaults;
111 | "text/csv" = textDefaults;
112 | "text/html" = textDefaults;
113 | "text/javascript" = textDefaults;
114 | "text/markdown" = textDefaults;
115 | "text/mathml" = textDefaults;
116 | "text/plain" = textDefaults;
117 | "text/prs.lines.tag" = textDefaults;
118 | "text/richtext" = textDefaults;
119 | "text/sgml" = textDefaults;
120 | "text/tab-separated-values" = textDefaults;
121 | "text/troff" = textDefaults;
122 | "text/uri-list" = textDefaults;
123 | "text/vnd.curl" = textDefaults;
124 | "text/vnd.curl.dcurl" = textDefaults;
125 | "text/vnd.curl.mcurl" = textDefaults;
126 | "text/vnd.curl.scurl" = textDefaults;
127 | "text/vnd.fly" = textDefaults;
128 | "text/vnd.fmi.flexstor" = textDefaults;
129 | "text/vnd.graphviz" = textDefaults;
130 | "text/vnd.in3d.3dml" = textDefaults;
131 | "text/vnd.in3d.spot" = textDefaults;
132 | "text/vnd.sun.j2me.app-descriptor" = textDefaults;
133 | "text/vnd.wap.si" = textDefaults;
134 | "text/vnd.wap.sl" = textDefaults;
135 | "text/vnd.wap.wml" = textDefaults;
136 | "text/vnd.wap.wmlscript" = textDefaults;
137 | "text/x-asm" = textDefaults;
138 | "text/x-c" = textDefaults;
139 | "text/x-fortran" = textDefaults;
140 | "text/x-java-source" = textDefaults;
141 | "text/x-pascal" = textDefaults;
142 | "text/x-python" = textDefaults;
143 | "text/x-setext" = textDefaults;
144 | "text/x-uuencode" = textDefaults;
145 | "text/x-vcalendar" = textDefaults;
146 | "text/x-vcard" = textDefaults;
147 |
148 | "video/3gpp" = videoDefaults;
149 | "video/3gpp2" = videoDefaults;
150 | "video/h261" = videoDefaults;
151 | "video/h263" = videoDefaults;
152 | "video/h264" = videoDefaults;
153 | "video/jpeg" = videoDefaults;
154 | "video/jpm" = videoDefaults;
155 | "video/mj2" = videoDefaults;
156 | "video/mp2t" = videoDefaults;
157 | "video/mp4" = videoDefaults;
158 | "video/mpeg" = videoDefaults;
159 | "video/ogg" = videoDefaults;
160 | "video/quicktime" = videoDefaults;
161 | "video/vnd.fvt" = videoDefaults;
162 | "video/vnd.mpegurl" = videoDefaults;
163 | "video/vnd.ms-playready.media.pyv" = videoDefaults;
164 | "video/vnd.vivo" = videoDefaults;
165 | "video/webm" = videoDefaults;
166 | "video/x-f4v" = videoDefaults;
167 | "video/x-fli" = videoDefaults;
168 | "video/x-flv" = videoDefaults;
169 | "video/x-m4v" = videoDefaults;
170 | "video/x-matroska" = videoDefaults;
171 | "video/x-ms-asf" = videoDefaults;
172 | "video/x-ms-wm" = videoDefaults;
173 | "video/x-ms-wmv" = videoDefaults;
174 | "video/x-ms-wmx" = videoDefaults;
175 | "video/x-ms-wvx" = videoDefaults;
176 | "video/x-msvideo" = videoDefaults;
177 | "video/x-sgi-movie" = videoDefaults;
178 |
179 | };
180 | };
181 | };
182 | }
--------------------------------------------------------------------------------
/.config/home-manager/features/hyprland.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, theme, ... }:
2 | let
3 | extraConfig = pkgs.writeShellScriptBin "hyprland-extra-config" ''
4 | if ! [ -f ${user.home}/.config/hypr/extra.conf ]; then
5 | touch ${user.home}/.config/hypr/extra.conf
6 | hyprctl reload
7 | fi
8 | '';
9 | launcher = pkgs.writeShellScriptBin "hyprland-launcher" ''
10 | . "${user.home}/.nix-profile/etc/profile.d/hm-session-vars.sh"
11 | dbus-run-session ${pkgs.hyprland}/bin/Hyprland &> /dev/null
12 | '';
13 | startPortals = pkgs.writeShellScriptBin "start-portals" ''
14 | systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
15 | dbus-update-activation-environment
16 | dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
17 | systemctl --user start xdg-desktop-portal
18 | systemctl --user start xdg-desktop-portal-hyprland
19 | '';
20 | colorPicker = pkgs.writeShellScriptBin "wayland-colorpicker" ''
21 | hyprpicker | tr -d '\n' | wl-copy
22 | notify-clipboard
23 | '';
24 | in
25 | {
26 | home.file = {
27 | ".tty1-gui-only".text = "";
28 | ".wallpapers/default.png".source = ../files/wallpapers/default.png;
29 | ".config/hypr/autoexec.conf".text = ''
30 | exec-once = hyprland-extra-config
31 | exec-once = foot --server
32 | exec-once = get-wallpapers
33 | exec-once = random-wallpaper
34 | exec-once = waybar
35 | exec-once = start-portals
36 | exec-once = wl-paste --watch cliphist store
37 | exec-once = mount-google-drive
38 | exec-once = mkdir -p ${user.home}/Pictures ${user.home}/Documents ${user.home}/Videos ${user.home}/Music ${user.home}/Downloads ${user.home}/Templates ${user.home}/Desktop ${user.home}/Public ${user.home}/GitHub
39 | '';
40 | ".config/hypr/binds.conf".text = ''
41 | $mainMod = SUPER
42 | bind = $mainMod, RETURN, exec, terminal
43 | bind = $mainMod, W, exec, $BROWSER
44 | bind = $mainMod, E, exec, terminal ranger
45 | bind = $mainMod, S, exec, wayland-screenshot
46 | bind = $mainMod, P, exec, wayland-colorpicker
47 | bind = $mainMod, A, exec, terminal pulsemixer
48 | bind = $mainMod, D, exec, app-launcher
49 | bind = $mainMod, T, exec, system-tray
50 | bind = $mainMod, B, exec, terminal btop
51 | bind = $mainMod, Z, exec, zen-toggle
52 | bind = $mainMod, O, exec, emoji type
53 | bind = $mainMod SHIFT, B, exec, random-wallpaper
54 | bind = $mainMod, C, exec, clipboard-picker
55 | bind = $mainMod SHIFT, C, exec, clipboard-wipe
56 | bind = $mainMod, M, exec, terminal ncmpcpp
57 |
58 | bind = $mainMod SHIFT, Q, killactive,
59 | bind = $mainMod SHIFT, E, exec, power-menu
60 | bind = $mainMod, SPACE, togglefloating,
61 | bind = $mainMod, F, fullscreen,
62 |
63 | bind = $mainMod, J, movefocus, l
64 | bind = $mainMod, L, movefocus, r
65 | bind = $mainMod, I, movefocus, u
66 | bind = $mainMod, K, movefocus, d
67 |
68 | bind = $mainMod SHIFT, J, movewindow, l
69 | bind = $mainMod SHIFT, L, movewindow, r
70 | bind = $mainMod SHIFT, I, movewindow, u
71 | bind = $mainMod SHIFT, K, movewindow, d
72 |
73 | bindm = $mainMod, mouse:272, movewindow
74 | bindm = $mainMod, mouse:273, resizewindow
75 |
76 | bind = $mainMod, 1, workspace, 1
77 | bind = $mainMod, 2, workspace, 2
78 | bind = $mainMod, 3, workspace, 3
79 | bind = $mainMod, 4, workspace, 4
80 | bind = $mainMod, 5, workspace, 5
81 | bind = $mainMod, 6, workspace, 6
82 | bind = $mainMod, 7, workspace, 7
83 | bind = $mainMod, 8, workspace, 8
84 | bind = $mainMod, 9, workspace, 9
85 | bind = $mainMod, 0, workspace, 10
86 |
87 | bind = $mainMod SHIFT, 1, movetoworkspace, 1
88 | bind = $mainMod SHIFT, 2, movetoworkspace, 2
89 | bind = $mainMod SHIFT, 3, movetoworkspace, 3
90 | bind = $mainMod SHIFT, 4, movetoworkspace, 4
91 | bind = $mainMod SHIFT, 5, movetoworkspace, 5
92 | bind = $mainMod SHIFT, 6, movetoworkspace, 6
93 | bind = $mainMod SHIFT, 7, movetoworkspace, 7
94 | bind = $mainMod SHIFT, 8, movetoworkspace, 8
95 | bind = $mainMod SHIFT, 9, movetoworkspace, 9
96 | bind = $mainMod SHIFT, 0, movetoworkspace, 10
97 |
98 | bind = , xf86audioraisevolume, exec, wpctl set-volume @DEFAULT_SINK@ 10%+
99 | bind = , xf86audiolowervolume, exec, wpctl set-volume @DEFAULT_SINK@ 10%-
100 | bind = , xf86audiomicmute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle
101 | bind = , xf86audiomute, exec, wpctl set-mute @DEFAULT_SINK@ toggle
102 | # TODO: lets fill this out
103 | # bind = , xf86rfkill, exec, airplane mode
104 | # bind = , xf86brightnessup, exec, brightnessup
105 | # bind = , xf86brightnessdown, exec, brightnessdown
106 | # bind = , xf86webcam, exec, webcam
107 | '';
108 | ".config/hypr/environment.conf".text = '''';
109 | ".config/hypr/input.conf".text = ''
110 | input {
111 | kb_layout = us
112 | kb_variant =
113 | kb_model =
114 | kb_options =
115 | kb_rules =
116 | follow_mouse = 1
117 | touchpad {
118 | natural_scroll = true
119 | }
120 | sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
121 | }
122 | gestures {
123 | workspace_swipe = false
124 | }
125 | device:epic-mouse-v1 {
126 | sensitivity = -0.5
127 | }
128 | '';
129 | ".config/hypr/windowrules.conf".text = ''
130 | windowrulev2 = tile,class:(Chromium-browser),title:(www.messenger.com_/login)
131 | windowrulev2 = tile,class:(Chromium-browser),title:(www.discord.com_/login)
132 | windowrulev2 = float,class:(wlogout),title:(wlogout)
133 | windowrulev2 = noanim,class:(wlogout),title:(wlogout)
134 | windowrulev2 = noanim,class:(Rofi),title:(rofi)
135 | '';
136 | ".config/hypr/appearance.conf".text = ''
137 | blurls=waybar
138 | layerrule=ignorezero, waybar
139 | general {
140 | gaps_in = 3
141 | gaps_out = 5
142 | border_size = 1
143 | col.active_border = rgba(${theme.colorScheme.accentHex}${theme.colorScheme.transparencyForegroundHex}) rgba(${theme.colorScheme.secondaryAccentHex}${theme.colorScheme.transparencyForegroundHex}) 45deg
144 | col.inactive_border = rgba(${theme.colorScheme.background4Hex}${theme.colorScheme.transparencyBackgroundHex})
145 |
146 | layout = dwindle
147 | }
148 | decoration {
149 | rounding = ${builtins.toString theme.borderRadius}
150 | blur {
151 | enabled = true
152 | size = 3
153 | passes = 1
154 | }
155 | drop_shadow = true
156 | shadow_range = 4
157 | shadow_render_power = 3
158 | col.shadow = rgba(${theme.colorScheme.background1Hex}${theme.colorScheme.transparencyBackgroundHex})
159 | }
160 | animations {
161 | enabled = true
162 | bezier = myBezier, 0.05, 0.9, 0.1, 1.05
163 | animation = windows, 1, 7, myBezier
164 | animation = windowsOut, 1, 7, default, popin 80%
165 | animation = border, 1, 10, default
166 | animation = borderangle, 1, 8, default
167 | animation = fade, 1, 7, default
168 | animation = workspaces, 1, 6, myBezier, slide
169 | }
170 | dwindle {
171 | pseudotile = true
172 | preserve_split = true
173 | }
174 | master {
175 | new_is_master = false
176 | }
177 | gestures {
178 | workspace_swipe = false
179 | }
180 | misc {
181 | disable_hyprland_logo = true
182 | disable_splash_rendering = true
183 | force_hypr_chan = false
184 | }
185 | '';
186 | };
187 | home.packages = [ launcher extraConfig startPortals colorPicker ];
188 | wayland.windowManager.hyprland = {
189 | enable = true;
190 | xwayland.enable = true;
191 | extraConfig = ''
192 | source=${user.home}/.config/hypr/autoexec.conf
193 | source=${user.home}/.config/hypr/appearance.conf
194 | source=${user.home}/.config/hypr/input.conf
195 | source=${user.home}/.config/hypr/binds.conf
196 | source=${user.home}/.config/hypr/windowrules.conf
197 | source=${user.home}/.config/hypr/environment.conf
198 | source=${user.home}/.config/hypr/extra.conf
199 | source=/etc/display.conf
200 | '';
201 | };
202 | }
203 |
--------------------------------------------------------------------------------
/.config/home-manager/features/vscode.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, theme, ... }:
2 | {
3 | programs.vscode = {
4 | enable = true;
5 | package = pkgs.vscodium;
6 | extensions = [
7 | pkgs.vscode-extensions.kamikillerto.vscode-colorize
8 | pkgs.vscode-extensions.bbenoist.nix
9 | ];
10 | userSettings = {
11 | "editor.fontFamily" = "'${theme.monoFontName}', 'monospace', monospace";
12 | "editor.fontLigatures" = false;
13 | "editor.fontSize" = builtins.floor theme.monoFontSize * 16 / 12;
14 | "git.openRepositoryInParentFolders" = "never";
15 | "colorize.include" = [ "*" ];
16 | "explorer.confirmDelete" = false;
17 | "security.workspace.trust.untrustedFiles" = "open";
18 | "terminal.integrated.enableImages" = true;
19 | "workbench.colorCustomizations" = {
20 | "activityBar.activeBorder" = "#${theme.colorScheme.blueHex}";
21 | "activityBar.background" = "#${theme.colorScheme.background1Hex}";
22 | "activityBar.border" = "#${theme.colorScheme.background2Hex}";
23 | "activityBar.foreground" = "#${theme.colorScheme.foreground3Hex}";
24 | "activityBar.inactiveForeground" = "#${theme.colorScheme.foreground4Hex}";
25 | "activityBarBadge.background" = "#${theme.colorScheme.blueHex}";
26 | "activityBarBadge.foreground" = "#${theme.colorScheme.foreground1Hex}";
27 | "badge.background" = "#${theme.colorScheme.background4Hex}";
28 | "badge.foreground" = "#${theme.colorScheme.foreground1Hex}";
29 | "button.background" = "#${theme.colorScheme.blueHex}";
30 | "button.border" = "#${theme.colorScheme.foreground1Hex}${theme.colorScheme.transparencyLightShadeHex}";
31 | "button.foreground" = "#${theme.colorScheme.foreground1Hex}";
32 | "button.hoverBackground" = "#${theme.colorScheme.blueHex}";
33 | "button.secondaryBackground" = "#${theme.colorScheme.background2Hex}";
34 | "button.secondaryForeground" = "#${theme.colorScheme.foreground3Hex}";
35 | "button.secondaryHoverBackground" = "#${theme.colorScheme.background3Hex}";
36 | "chat.slashCommandBackground" = "#${theme.colorScheme.background3Hex}";
37 | "chat.slashCommandForeground" = "#${theme.colorScheme.cyanHex}";
38 | "checkbox.background" = "#${theme.colorScheme.background2Hex}";
39 | "checkbox.border" = "#${theme.colorScheme.background3Hex}";
40 | "debugToolBar.background" = "#${theme.colorScheme.background1Hex}";
41 | "descriptionForeground" = "#${theme.colorScheme.foreground4Hex}";
42 | "dropdown.background" = "#${theme.colorScheme.background2Hex}";
43 | "dropdown.border" = "#${theme.colorScheme.background3Hex}";
44 | "dropdown.foreground" = "#${theme.colorScheme.foreground3Hex}";
45 | "dropdown.listBackground" = "#${theme.colorScheme.background1Hex}";
46 | "editor.background" = "#${theme.colorScheme.background1Hex}";
47 | "editor.findMatchBackground" = "#${theme.colorScheme.brownHex}";
48 | "editor.foreground" = "#${theme.colorScheme.foreground3Hex}";
49 | "editorGroup.border" = "#${theme.colorScheme.foreground1Hex}${theme.colorScheme.transparencyLightShadeHex}";
50 | "editorGroupHeader.tabsBackground" = "#${theme.colorScheme.background1Hex}";
51 | "editorGroupHeader.tabsBorder" = "#${theme.colorScheme.background2Hex}";
52 | "editorGutter.addedBackground" = "#${theme.colorScheme.greenHex}";
53 | "editorGutter.deletedBackground" = "#${theme.colorScheme.redHex}";
54 | "editorGutter.modifiedBackground" = "#${theme.colorScheme.blueHex}";
55 | "editorLineNumber.activeForeground" = "#${theme.colorScheme.foreground3Hex}";
56 | "editorLineNumber.foreground" = "#${theme.colorScheme.foreground4Hex}";
57 | "editorOverviewRuler.border" = "#${theme.colorScheme.background1Hex}";
58 | "editorWidget.background" = "#${theme.colorScheme.background1Hex}";
59 | "errorForeground" = "#${theme.colorScheme.redHex}";
60 | "focusBorder" = "#${theme.colorScheme.blueHex}";
61 | "foreground" = "#${theme.colorScheme.foreground3Hex}";
62 | "icon.foreground" = "#${theme.colorScheme.foreground3Hex}";
63 | "input.background" = "#${theme.colorScheme.background2Hex}";
64 | "input.border" = "#${theme.colorScheme.background3Hex}";
65 | "input.foreground" = "#${theme.colorScheme.foreground3Hex}";
66 | "input.placeholderForeground" = "#${theme.colorScheme.foreground4Hex}";
67 | "inputOption.activeBackground" = "#${theme.colorScheme.blueHex}${theme.colorScheme.transparencyBackgroundHex}";
68 | "inputOption.activeBorder" = "#${theme.colorScheme.blueHex}";
69 | "keybindingLabel.foreground" = "#${theme.colorScheme.foreground3Hex}";
70 | "menu.background" = "#${theme.colorScheme.background1Hex}";
71 | "notificationCenterHeader.background" = "#${theme.colorScheme.background1Hex}";
72 | "notificationCenterHeader.foreground" = "#${theme.colorScheme.foreground3Hex}";
73 | "notifications.background" = "#${theme.colorScheme.background1Hex}";
74 | "notifications.border" = "#${theme.colorScheme.background2Hex}";
75 | "notifications.foreground" = "#${theme.colorScheme.foreground3Hex}";
76 | "panel.background" = "#${theme.colorScheme.background1Hex}";
77 | "panel.border" = "#${theme.colorScheme.background2Hex}";
78 | "panelInput.border" = "#${theme.colorScheme.background2Hex}";
79 | "panelTitle.activeBorder" = "#${theme.colorScheme.blueHex}";
80 | "panelTitle.activeForeground" = "#${theme.colorScheme.foreground3Hex}";
81 | "panelTitle.inactiveForeground" = "#${theme.colorScheme.foreground4Hex}";
82 | "peekViewEditor.background" = "#${theme.colorScheme.background1Hex}";
83 | "peekViewEditor.matchHighlightBackground" = "#${theme.colorScheme.yellowHex}${theme.colorScheme.transparencyHeavyShadeHex}";
84 | "peekViewResult.background" = "#${theme.colorScheme.background1Hex}";
85 | "peekViewResult.matchHighlightBackground" = "#${theme.colorScheme.yellowHex}${theme.colorScheme.transparencyHeavyShadeHex}";
86 | "pickerGroup.border" = "#${theme.colorScheme.background3Hex}";
87 | "progressBar.background" = "#${theme.colorScheme.blueHex}";
88 | "quickInput.background" = "#${theme.colorScheme.background1Hex}";
89 | "quickInput.foreground" = "#${theme.colorScheme.foreground3Hex}";
90 | "settings.dropdownBackground" = "#${theme.colorScheme.background2Hex}";
91 | "settings.dropdownBorder" = "#${theme.colorScheme.background3Hex}";
92 | "settings.headerForeground" = "#${theme.colorScheme.foreground1Hex}";
93 | "settings.modifiedItemIndicator" = "#${theme.colorScheme.yellowHex}${theme.colorScheme.transparencyHeavyShadeHex}";
94 | "sideBar.background" = "#${theme.colorScheme.background1Hex}";
95 | "sideBar.border" = "#${theme.colorScheme.background2Hex}";
96 | "sideBar.foreground" = "#${theme.colorScheme.foreground3Hex}";
97 | "sideBarSectionHeader.background" = "#${theme.colorScheme.background1Hex}";
98 | "sideBarSectionHeader.border" = "#${theme.colorScheme.background2Hex}";
99 | "sideBarSectionHeader.foreground" = "#${theme.colorScheme.foreground3Hex}";
100 | "sideBarTitle.foreground" = "#${theme.colorScheme.foreground3Hex}";
101 | "statusBar.background" = "#${theme.colorScheme.background1Hex}";
102 | "statusBar.border" = "#${theme.colorScheme.background2Hex}";
103 | "statusBar.debuggingBackground" = "#${theme.colorScheme.blueHex}";
104 | "statusBar.debuggingForeground" = "#${theme.colorScheme.foreground1Hex}";
105 | "statusBar.focusBorder" = "#${theme.colorScheme.blueHex}";
106 | "statusBar.foreground" = "#${theme.colorScheme.foreground3Hex}";
107 | "statusBar.noFolderBackground" = "#${theme.colorScheme.background1Hex}";
108 | "statusBarItem.focusBorder" = "#${theme.colorScheme.blueHex}";
109 | "statusBarItem.prominentBackground" = "#${theme.colorScheme.background4Hex}";
110 | "statusBarItem.remoteBackground" = "#${theme.colorScheme.blueHex}";
111 | "statusBarItem.remoteForeground" = "#${theme.colorScheme.foreground1Hex}";
112 | "tab.activeBackground" = "#${theme.colorScheme.background1Hex}";
113 | "tab.activeBorder" = "#${theme.colorScheme.background1Hex}";
114 | "tab.activeBorderTop" = "#${theme.colorScheme.blueHex}";
115 | "tab.activeForeground" = "#${theme.colorScheme.foreground1Hex}";
116 | "tab.border" = "#${theme.colorScheme.background2Hex}";
117 | "tab.hoverBackground" = "#${theme.colorScheme.background1Hex}";
118 | "tab.inactiveBackground" = "#${theme.colorScheme.background1Hex}";
119 | "tab.inactiveForeground" = "#${theme.colorScheme.foreground4Hex}";
120 | "tab.unfocusedActiveBorder" = "#${theme.colorScheme.background1Hex}";
121 | "tab.unfocusedActiveBorderTop" = "#${theme.colorScheme.background2Hex}";
122 | "tab.unfocusedHoverBackground" = "#${theme.colorScheme.background1Hex}";
123 | "terminal.foreground" = "#${theme.colorScheme.foreground3Hex}";
124 | "terminal.tab.activeBorder" = "#${theme.colorScheme.blueHex}";
125 | "textBlockQuote.background" = "#${theme.colorScheme.background2Hex}";
126 | "textBlockQuote.border" = "#${theme.colorScheme.background4Hex}";
127 | "textCodeBlock.background" = "#${theme.colorScheme.background2Hex}";
128 | "textLink.activeForeground" = "#${theme.colorScheme.cyanHex}";
129 | "textLink.foreground" = "#${theme.colorScheme.cyanHex}";
130 | "textSeparator.foreground" = "#${theme.colorScheme.background2Hex}";
131 | "titleBar.activeBackground" = "#${theme.colorScheme.background1Hex}";
132 | "titleBar.activeForeground" = "#${theme.colorScheme.foreground3Hex}";
133 | "titleBar.border" = "#${theme.colorScheme.background2Hex}";
134 | "titleBar.inactiveBackground" = "#${theme.colorScheme.background1Hex}";
135 | "titleBar.inactiveForeground" = "#${theme.colorScheme.foreground4Hex}";
136 | "welcomePage.tileBackground" = "#${theme.colorScheme.background2Hex}";
137 | "welcomePage.progress.foreground" = "#${theme.colorScheme.blueHex}";
138 | "widget.border" = "#${theme.colorScheme.background2Hex}";
139 | };
140 | };
141 | };
142 | }
--------------------------------------------------------------------------------
/.config/home-manager/features/waybar.nix:
--------------------------------------------------------------------------------
1 | { pkgs, theme, ... }:
2 | let
3 | zenToggle = pkgs.writeShellScriptBin "zen-toggle" ''
4 | if pgrep waybar; then
5 | pkill waybar
6 | hyprctl keyword general:gaps_in 0
7 | hyprctl keyword general:gaps_out 0
8 | hyprctl keyword general:border_size 0
9 | hyprctl keyword decoration:rounding 0
10 | else
11 | waybar & disown
12 | hyprctl keyword general:gaps_in ${builtins.toString theme.gapsIn}
13 | hyprctl keyword general:gaps_out ${builtins.toString theme.gapsOut}
14 | hyprctl keyword general:border_size ${builtins.toString theme.borderWidth}
15 | hyprctl keyword decoration:rounding ${builtins.toString theme.borderRadius}
16 | fi
17 | '';
18 | in
19 | {
20 | programs.waybar = {
21 | enable = true;
22 | settings = {
23 | mainBar = {
24 | layer = "top";
25 | position = "top";
26 | height = 30;
27 | margin = "${builtins.toString theme.gapsOut}px ${builtins.toString theme.gapsOut}px 0px ${builtins.toString theme.gapsOut}px";
28 | spacing = 0;
29 | modules-left = ["custom/applauncher" "custom/files" "mpd" "hyprland/workspaces"];
30 | modules-center = ["wlr/taskbar"];
31 | modules-right = ["tray" "pulseaudio" "network" "battery" "clock" "custom/closewindow" "custom/powermenu"];
32 | "custom/applauncher" = {
33 | return-type = "json";
34 | format = "{}";
35 | exec = "echo {\\\"text\\\": \\\"\\\", \\\"tooltip\\\": \\\"Application Launcher\\\"}";
36 | on-click = "gui-app-launcher";
37 | on-click-right = "app-launcher";
38 | };
39 | "custom/files" = {
40 | return-type = "json";
41 | format = "{}";
42 | exec = "echo {\\\"text\\\": \\\"\\\", \\\"tooltip\\\": \\\"Files\\\"}";
43 | on-click = "nemo";
44 | on-click-right = "terminal ranger";
45 | };
46 | "custom/closewindow" = {
47 | return-type = "json";
48 | format = "{}";
49 | exec = "echo {\\\"text\\\": \\\"\\\", \\\"tooltip\\\": \\\"Close Window\\\"}";
50 | on-click = "kill -9 $(hyprprop | jq -r '.pid')";
51 | };
52 | "custom/powermenu" = {
53 | return-type = "json";
54 | format = "{}";
55 | exec = "echo {\\\"text\\\": \\\"\\\", \\\"tooltip\\\": \\\"Power Menu\\\"}";
56 | on-click = "power-menu";
57 | };
58 | "hyprland/workspaces" = {
59 | disable-scroll = true;
60 | all-outputs = false;
61 | warp-on-scroll = false;
62 | format = "{icon}";
63 | format-icons = {
64 | "1" = "1";
65 | "2" = "2";
66 | "3" = "3";
67 | "4" = "4";
68 | "5" = "5";
69 | "6" = "6";
70 | "7" = "7";
71 | "8" = "8";
72 | "9" = "9";
73 | "10" = "10";
74 | "11" = "L";
75 | "12" = "R";
76 | };
77 | };
78 | "wlr/taskbar" = {
79 | icon-size = 26;
80 | sort-by-app-id = true;
81 | all-outputs = true;
82 | on-click = "activate";
83 | ignore-list = [ "wlogout" ];
84 | };
85 | mpd = {
86 | on-click = "mpdevil";
87 | on-click-right = "terminal ncmpcpp";
88 | on-click-middle = "mpc toggle";
89 | format = "{stateIcon} {consumeIcon} {randomIcon} {repeatIcon} {singleIcon}";
90 | format-disconnected = "Disconnected";
91 | format-stopped = " {consumeIcon} {randomIcon} {repeatIcon} {singleIcon}";
92 | unknown-tag = "N/A";
93 | interval = 2;
94 | consume-icons = {
95 | off = "";
96 | on = "";
97 | };
98 | random-icons = {
99 | off = "";
100 | on = "";
101 | };
102 | repeat-icons = {
103 | off = "";
104 | on = "";
105 | };
106 | single-icons = {
107 | off = "";
108 | on = "";
109 | };
110 | state-icons = {
111 | paused = "";
112 | playing = "";
113 | };
114 | tooltip-format = "{artist} - {album} - {title}";
115 | tooltip-format-disconnected = "MPD (disconnected)";
116 | };
117 | tray = {
118 | spacing = 0;
119 | icon-size = 20;
120 | };
121 | clock = {
122 | format = "{:%I:%M %p}";
123 | tooltip-format = "{:%Y %B}\n{calendar}";
124 | format-alt = "{:%a %m/%d/%Y}";
125 | };
126 | battery = {
127 | states = {
128 | warning = 30;
129 | critical = 15;
130 | };
131 | format = "{icon}";
132 | format-charging = "";
133 | format-plugged = "";
134 | format-icons = [
135 | ""
136 | ""
137 | ""
138 | ""
139 | ""
140 | ""
141 | ""
142 | ""
143 | ""
144 | ""
145 | ""
146 | ];
147 | };
148 | network = {
149 | format-wifi = "{icon}";
150 | format-ethernet = "";
151 | tooltip-format = "{ifname} via {gwaddr}";
152 | format-linked = "";
153 | format-disconnected = "";
154 | on-click = "terminal nmtui";
155 | format-icons = [
156 | ""
157 | ""
158 | ""
159 | ""
160 | ""
161 | ];
162 | };
163 | pulseaudio = {
164 | format = "{icon} {format_source}";
165 | format-bluetooth = "{icon} {format_source}";
166 | format-bluetooth-muted = "{icon} {format_source}";
167 | format-muted = " {format_source}";
168 | format-source = "";
169 | format-source-muted = "";
170 | format-icons = {
171 | headphone = "";
172 | hands-free = "";
173 | headset = "";
174 | phone = "";
175 | portable = "";
176 | car = "";
177 | default = [
178 | ""
179 | ""
180 | ""
181 | ];
182 | };
183 | on-click = "pavucontrol";
184 | on-click-right = "terminal pulsemixer";
185 | };
186 | };
187 | };
188 | style = ''
189 | * {
190 | font-family: ${theme.fontName};
191 | font-size: ${builtins.toString theme.fontSizeUI}px;
192 | font-weight: bold;
193 | margin: 0px;
194 | padding: 0px;
195 | transition: all .2s ease-in-out;
196 | }
197 |
198 | .modules-left,
199 | .modules-right,
200 | window#waybar,
201 | tooltip {
202 | border-radius: ${builtins.toString theme.borderRadius}px;
203 | color: #${theme.colorScheme.foreground1Hex};
204 | transition-property: background-color;
205 | transition-duration: .5s;
206 | }
207 |
208 | window#waybar {
209 | background-color: rgba(0,0,0,0);
210 | }
211 |
212 | .modules-left,
213 | .modules-right,
214 | tooltip {
215 | background-color: rgba(${theme.colorScheme.background1RGB}, ${theme.colorScheme.transparencyBackgroundRGB});
216 | }
217 |
218 | window#waybar.hidden {
219 | opacity: 0.2;
220 | }
221 |
222 | #clock,
223 | #battery,
224 | #network,
225 | #pulseaudio,
226 | #tray,
227 | #custom-applauncher,
228 | #custom-files,
229 | #custom-closewindow,
230 | #custom-powermenu,
231 | #mpd,
232 | #workspaces button {
233 | box-shadow: inset 0 -3px transparent;
234 | border: none;
235 | border-radius: ${builtins.toString theme.borderRadius}px;
236 | margin: 2px 1px 2px 1px;
237 | background-color: transparent;
238 | color: #${theme.colorScheme.foreground1Hex};
239 | }
240 |
241 | #clock,
242 | #battery,
243 | #network,
244 | #pulseaudio,
245 | #tray,
246 | #custom-applauncher,
247 | #custom-files,
248 | #custom-closewindow,
249 | #custom-powermenu,
250 | #mpd,
251 | #workspaces button:hover,
252 | #workspaces button.active,
253 | #workspaces button.focused {
254 | background: rgba(${theme.colorScheme.background4RGB}, ${theme.colorScheme.transparencyBackgroundRGB});
255 | }
256 |
257 | #workspaces button.urgent {
258 | background-color: #${theme.colorScheme.dangerHex};
259 | }
260 |
261 | #taskbar button {
262 | margin: 0px 1px 0px 1px;
263 | }
264 |
265 | #taskbar button:hover,
266 | #taskbar button.active,
267 | #taskbar button.focused {
268 | background: rgba(${theme.colorScheme.foreground1RGB}, ${theme.colorScheme.transparencyLightShadeRGB});
269 | }
270 |
271 | #custom-applauncher,
272 | #custom-files {
273 | padding: 0px 11px 0px 6px;
274 | }
275 |
276 |
277 | #custom-closewindow,
278 | #custom-powermenu {
279 | padding: 0px 9px 0px 8px;
280 | }
281 |
282 | #network {
283 | padding: 0px 12px 0px 7px;
284 | }
285 |
286 | #tray {
287 | padding: 0px 5px 0px 5px;
288 | }
289 |
290 | #mpd {
291 | padding: 0px 10px 0px 6px;
292 | }
293 |
294 | #pulseaudio,
295 | #clock,
296 | #battery {
297 | padding: 0px 7px 0px 7px;
298 | }
299 |
300 | #workspaces button {
301 | padding: 0px 5px;
302 | }
303 |
304 | #workspaces button.active,
305 | #workspaces button.focused {
306 | padding: 0px 15px;
307 | }
308 |
309 | .modules-left {
310 | padding: 0px 1px 0px 1px;
311 | }
312 |
313 | .modules-right {
314 | padding: 0px 1px 0px 1px;
315 | }
316 | '';
317 | };
318 | home.packages = with pkgs; [
319 | nerdfonts
320 | zenToggle
321 | ];
322 | }
323 |
--------------------------------------------------------------------------------
/.config/home-manager/features/ranger.nix:
--------------------------------------------------------------------------------
1 | { pkgs, user, ... }:
2 | let
3 | scope = pkgs.writeShellApplication {
4 | name = "ranger-scope";
5 |
6 | runtimeInputs = with pkgs; [
7 | poppler_utils
8 | ffmpeg
9 | fontforge-gtk
10 | catdoc
11 | catdocx
12 | atool
13 | libarchive
14 | xlsx2csv
15 | ];
16 |
17 | text = ''
18 | set -o noclobber -o noglob -o nounset -o pipefail
19 | IFS=$'\n'
20 |
21 | ## If the option `use_preview_script` is set to `true`,
22 | ## then this script will be called and its output will be displayed in ranger.
23 | ## ANSI color codes are supported.
24 | ## STDIN is disabled, so interactive scripts won't work properly
25 |
26 | ## This script is considered a configuration file and must be updated manually.
27 | ## It will be left untouched if you upgrade ranger.
28 |
29 | ## Because of some automated testing we do on the script #'s for comments need
30 | ## to be doubled up. Code that is commented out, because it's an alternative for
31 | ## example, gets only one #.
32 |
33 | ## Meanings of exit codes:
34 | ## code | meaning | action of ranger
35 | ## -----+------------+-------------------------------------------
36 | ## 0 | success | Display stdout as preview
37 | ## 1 | no preview | Display no preview at all
38 | ## 2 | plain text | Display the plain content of the file
39 | ## 3 | fix width | Don't reload when width changes
40 | ## 4 | fix height | Don't reload when height changes
41 | ## 5 | fix both | Don't ever reload
42 | ## 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
43 | ## 7 | image | Display the file directly as an image
44 |
45 | ## Script arguments
46 | FILE_PATH="$1" # Full path of the highlighted file
47 | PV_WIDTH="$2" # Width of the preview pane (number of fitting characters)
48 | ## shellcheck disable=SC2034 # PV_HEIGHT is provided for convenience and unused
49 | # PV_HEIGHT="$3" # Height of the preview pane (number of fitting characters)
50 | IMAGE_CACHE_PATH="$4" # Full path that should be used to cache image preview
51 | PV_IMAGE_ENABLED="$5" # 'True' if image previews are enabled, 'False' otherwise.
52 |
53 | FILE_EXTENSION="''${FILE_PATH##*.}"
54 | FILE_EXTENSION_LOWER="$(printf "%s" "$FILE_EXTENSION" | tr '[:upper:]' '[:lower:]')"
55 |
56 | ## Settings
57 | HIGHLIGHT_SIZE_MAX=262143 # 256KiB
58 | HIGHLIGHT_TABWIDTH="''${HIGHLIGHT_TABWIDTH:-8}"
59 | HIGHLIGHT_STYLE="''${HIGHLIGHT_STYLE:-pablo}"
60 | HIGHLIGHT_OPTIONS="--replace-tabs=$HIGHLIGHT_TABWIDTH --style=$HIGHLIGHT_STYLE ''${HIGHLIGHT_OPTIONS:-}"
61 | PYGMENTIZE_STYLE="''${PYGMENTIZE_STYLE:-autumn}"
62 | BAT_STYLE="''${BAT_STYLE:-plain}"
63 | SQLITE_TABLE_LIMIT=20 # Display only the top tables in database, set to 0 for no exhaustive preview (only the sqlite_master table is displayed).
64 | SQLITE_ROW_LIMIT=5 # Display only the first and the last ( - 1) records in each table, set to 0 for no limits.
65 |
66 | handle_extension() {
67 | case "$FILE_EXTENSION_LOWER" in
68 | ## Archive
69 | a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
70 | rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
71 | atool --list -- "$FILE_PATH" && exit 5
72 | bsdtar --list --file "$FILE_PATH" && exit 5
73 | exit 1;;
74 | rar)
75 | ## Avoid password prompt by providing empty password
76 | unrar lt -p- -- "$FILE_PATH" && exit 5
77 | exit 1;;
78 | 7z)
79 | ## Avoid password prompt by providing empty password
80 | 7z l -p -- "$FILE_PATH" && exit 5
81 | exit 1;;
82 |
83 | ## PDF
84 | pdf)
85 | ## Preview as text conversion
86 | pdftotext -l 10 -nopgbrk -q -- "$FILE_PATH" - | \
87 | fmt -w "$PV_WIDTH" && exit 5
88 | mutool draw -F txt -i -- "$FILE_PATH" 1-10 | \
89 | fmt -w "$PV_WIDTH" && exit 5
90 | exiftool "$FILE_PATH" && exit 5
91 | exit 1;;
92 |
93 | ## BitTorrent
94 | torrent)
95 | transmission-show -- "$FILE_PATH" && exit 5
96 | exit 1;;
97 |
98 | ## OpenDocument
99 | odt|sxw)
100 | ## Preview as text conversion
101 | odt2txt "$FILE_PATH" && exit 5
102 | ## Preview as markdown conversion
103 | pandoc -s -t markdown -- "$FILE_PATH" && exit 5
104 | exit 1;;
105 | ods|odp)
106 | ## Preview as text conversion (unsupported by pandoc for markdown)
107 | odt2txt "$FILE_PATH" && exit 5
108 | exit 1;;
109 |
110 | ## XLSX
111 | xlsx)
112 | ## Preview as csv conversion
113 | ## Uses: https://github.com/dilshod/xlsx2csv
114 | xlsx2csv -- "$FILE_PATH" && exit 5
115 | exit 1;;
116 |
117 | ## DOCX
118 | docx)
119 | catdocx -- "$FILE_PATH" && exit 5
120 | exit 1;;
121 |
122 | ## HTML
123 | htm|html|xhtml)
124 | ## Preview as text conversion
125 | w3m -dump "$FILE_PATH" && exit 5
126 | lynx -dump -- "$FILE_PATH" && exit 5
127 | elinks -dump "$FILE_PATH" && exit 5
128 | pandoc -s -t markdown -- "$FILE_PATH" && exit 5
129 | ;;
130 |
131 | ## JSON
132 | json)
133 | jq --color-output . "$FILE_PATH" && exit 5
134 | python -m json.tool -- "$FILE_PATH" && exit 5
135 | ;;
136 |
137 | ## Jupyter Notebooks
138 | ipynb)
139 | jupyter nbconvert --to markdown "$FILE_PATH" --stdout | env COLORTERM=8bit bat --color=always --style=plain --language=markdown && exit 5
140 | jupyter nbconvert --to markdown "$FILE_PATH" --stdout && exit 5
141 | jq --color-output . "$FILE_PATH" && exit 5
142 | python -m json.tool -- "$FILE_PATH" && exit 5
143 | ;;
144 |
145 | ## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
146 | ## by file(1).
147 | dff|dsf|wv|wvc)
148 | mediainfo "$FILE_PATH" && exit 5
149 | exiftool "$FILE_PATH" && exit 5
150 | ;; # Continue with next handler on failure
151 | esac
152 | }
153 |
154 | handle_image() {
155 | ## Size of the preview if there are multiple options or it has to be
156 | ## rendered from vector graphics. If the conversion program allows
157 | ## specifying only one dimension while keeping the aspect ratio, the width
158 | ## will be used.
159 | local DEFAULT_SIZE="1920x1080"
160 |
161 | local mimetype="$1"
162 | case "$mimetype" in
163 | ## SVG
164 | image/svg+xml|image/svg)
165 | rsvg-convert --keep-aspect-ratio --width "''${DEFAULT_SIZE%x*}" "$FILE_PATH" -o "$IMAGE_CACHE_PATH.png" \
166 | && mv "$IMAGE_CACHE_PATH.png" "$IMAGE_CACHE_PATH" \
167 | && exit 6
168 | exit 1;;
169 |
170 | ## DjVu
171 | image/vnd.djvu)
172 | ddjvu -format=tiff -quality=90 -page=1 -size="$DEFAULT_SIZE" \
173 | - "$IMAGE_CACHE_PATH" < "$FILE_PATH" \
174 | && exit 6 || exit 1;;
175 |
176 | ## Image
177 | image/*)
178 | local orientation
179 | orientation="$( identify -format '%[EXIF:Orientation]\n' -- "$FILE_PATH" )"
180 | ## If orientation data is present and the image actually
181 | ## needs rotating ("1" means no rotation)...
182 | if [[ -n "$orientation" && "$orientation" != 1 ]]; then
183 | ## ...auto-rotate the image according to the EXIF data.
184 | convert -- "$FILE_PATH" -auto-orient "$IMAGE_CACHE_PATH" && exit 6
185 | fi
186 |
187 | ## `w3mimgdisplay` will be called for all images (unless overridden
188 | ## as above), but might fail for unsupported types.
189 | exit 7;;
190 |
191 | ## Video
192 | video/*)
193 | # Get embedded thumbnail
194 | ffmpeg -i "$FILE_PATH" -map 0:v -map -0:V -c copy "$IMAGE_CACHE_PATH" && exit 6
195 | # Get frame 10% into video
196 | ffmpegthumbnailer -i "$FILE_PATH" -o "$IMAGE_CACHE_PATH" -s 0 && exit 6
197 | exit 1;;
198 |
199 | ## Audio
200 | audio/*)
201 | # Get embedded thumbnail
202 | ffmpeg -i "$FILE_PATH" -map 0:v -map -0:V -c copy \
203 | "$IMAGE_CACHE_PATH" && exit 6;;
204 |
205 | ## PDF
206 | application/pdf)
207 | pdftoppm -f 1 -l 1 \
208 | -scale-to-x "''${DEFAULT_SIZE%x*}" \
209 | -scale-to-y -1 \
210 | -singlefile \
211 | -jpeg -tiffcompression jpeg \
212 | -- "$FILE_PATH" "''${IMAGE_CACHE_PATH%.*}" \
213 | && exit 6 || exit 1;;
214 |
215 |
216 | ## ePub, MOBI, FB2 (using Calibre)
217 | # application/epub+zip|application/x-mobipocket-ebook|\
218 | # application/x-fictionbook+xml)
219 | # # ePub (using https://github.com/marianosimone/epub-thumbnailer)
220 | # epub-thumbnailer "$FILE_PATH" "$IMAGE_CACHE_PATH" \
221 | # "''${DEFAULT_SIZE%x*}" && exit 6
222 | # ebook-meta --get-cover="$IMAGE_CACHE_PATH" -- "$FILE_PATH" \
223 | # >/dev/null && exit 6
224 | # exit 1;;
225 |
226 | ## Font
227 | application/font*|application/*opentype)
228 | preview_png="/tmp/$(basename "''${IMAGE_CACHE_PATH%.*}").png"
229 | if fontimage -o "$preview_png" \
230 | --pixelsize "120" \
231 | --fontname \
232 | --pixelsize "80" \
233 | --text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \
234 | --text " abcdefghijklmnopqrstuvwxyz " \
235 | --text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \
236 | --text " The quick brown fox jumps over the lazy dog. " \
237 | "$FILE_PATH";
238 | then
239 | convert -- "$preview_png" "$IMAGE_CACHE_PATH" \
240 | && rm "$preview_png" \
241 | && exit 6
242 | else
243 | exit 1
244 | fi
245 | ;;
246 | esac
247 |
248 | case "$FILE_EXTENSION_LOWER" in
249 | ## 3D models
250 | ## OpenSCAD only supports png image output, and $IMAGE_CACHE_PATH
251 | ## is hardcoded as jpeg. So we make a tempfile.png and just
252 | ## move/rename it to jpg. This works because image libraries are
253 | ## smart enough to handle it.
254 | # csg|scad)
255 | # openscad_image "$FILE_PATH" && exit 6
256 | # ;;
257 | # 3mf|amf|dxf|off|stl)
258 | # openscad_image <(echo "import(\"$FILE_PATH\");") && exit 6
259 | # ;;
260 | drawio)
261 | draw.io -x "$FILE_PATH" -o "$IMAGE_CACHE_PATH" \
262 | --width "''${DEFAULT_SIZE%x*}" && exit 6
263 | exit 1;;
264 | esac
265 | }
266 |
267 | handle_mime() {
268 | local mimetype="$1"
269 | case "$mimetype" in
270 | ## RTF and DOC
271 | text/rtf|*msword)
272 | ## Preview as text conversion
273 | ## note: catdoc does not always work for .doc files
274 | ## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
275 | catdoc -- "$FILE_PATH" && exit 5
276 | exit 1;;
277 |
278 | ## DOCX, ePub, FB2 (using markdown)
279 | ## You might want to remove "|epub" and/or "|fb2" below if you have
280 | ## uncommented other methods to preview those formats
281 | *wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
282 | ## Preview as markdown conversion
283 | pandoc -s -t markdown -- "$FILE_PATH" && exit 5
284 | exit 1;;
285 |
286 | ## E-mails
287 | message/rfc822)
288 | ## Parsing performed by mu: https://github.com/djcb/mu
289 | mu view -- "$FILE_PATH" && exit 5
290 | exit 1;;
291 |
292 | ## XLS
293 | *ms-excel)
294 | ## Preview as csv conversion
295 | ## xls2csv comes with catdoc:
296 | ## http://www.wagner.pp.ru/~vitus/software/catdoc/
297 | xls2csv -- "$FILE_PATH" && exit 5
298 | exit 1;;
299 |
300 | ## SQLite
301 | *sqlite3)
302 | ## Preview as text conversion
303 | sqlite_tables="$( sqlite3 "file:$FILE_PATH?mode=ro" '.tables' )" \
304 | || exit 1
305 | [ -z "$sqlite_tables" ] &&
306 | { echo "Empty SQLite database." && exit 5; }
307 | sqlite_show_query() {
308 | sqlite-utils query "$FILE_PATH" "$1" --table --fmt fancy_grid \
309 | || sqlite3 "file:$FILE_PATH?mode=ro" "$1" -header -column
310 | }
311 | ## Display basic table information
312 | sqlite_rowcount_query="$(
313 | sqlite3 "file:$FILE_PATH?mode=ro" -noheader \
314 | 'SELECT group_concat(
315 | "SELECT """ || name || """ AS tblname,
316 | count(*) AS rowcount
317 | FROM " || name,
318 | " UNION ALL "
319 | )
320 | FROM sqlite_master
321 | WHERE type="table" AND name NOT LIKE "sqlite_%";'
322 | )"
323 | sqlite_show_query \
324 | "SELECT tblname AS 'table', rowcount AS 'count',
325 | (
326 | SELECT '(' || group_concat(name, ', ') || ')'
327 | FROM pragma_table_info(tblname)
328 | ) AS 'columns',
329 | (
330 | SELECT '(' || group_concat(
331 | upper(type) || (
332 | CASE WHEN pk > 0 THEN ' PRIMARY KEY' ELSE '' + "''" + '' END
333 | ),
334 | ', '
335 | ) || ')'
336 | FROM pragma_table_info(tblname)
337 | ) AS 'types'
338 | FROM ($sqlite_rowcount_query);"
339 | if [ "$SQLITE_TABLE_LIMIT" -gt 0 ] &&
340 | [ "$SQLITE_ROW_LIMIT" -ge 0 ]; then
341 | ## Do exhaustive preview
342 | echo && printf '>%.0s' $( seq "$PV_WIDTH" ) && echo
343 | sqlite3 "file:$FILE_PATH?mode=ro" -noheader \
344 | "SELECT name FROM sqlite_master
345 | WHERE type='table' AND name NOT LIKE 'sqlite_%'
346 | LIMIT $SQLITE_TABLE_LIMIT;" |
347 | while read -r sqlite_table; do
348 | sqlite_rowcount="$(
349 | sqlite3 "file:$FILE_PATH?mode=ro" -noheader \
350 | "SELECT count(*) FROM $sqlite_table"
351 | )"
352 | echo
353 | if [ "$SQLITE_ROW_LIMIT" -gt 0 ] &&
354 | [ "$SQLITE_ROW_LIMIT" \
355 | -lt "$sqlite_rowcount" ]; then
356 | echo "$sqlite_table [$SQLITE_ROW_LIMIT of $sqlite_rowcount]:"
357 | sqlite_ellipsis_query="$(
358 | sqlite3 "file:$FILE_PATH?mode=ro" -noheader \
359 | "SELECT 'SELECT ' || group_concat(
360 | '''...''', ', '
361 | )
362 | FROM pragma_table_info(
363 | '$sqlite_table'
364 | );"
365 | )"
366 | sqlite_show_query \
367 | "SELECT * FROM (
368 | SELECT * FROM $sqlite_table LIMIT 1
369 | )
370 | UNION ALL $sqlite_ellipsis_query UNION ALL
371 | SELECT * FROM (
372 | SELECT * FROM $sqlite_table
373 | LIMIT ($SQLITE_ROW_LIMIT - 1)
374 | OFFSET (
375 | $sqlite_rowcount
376 | - ($SQLITE_ROW_LIMIT - 1)
377 | )
378 | );"
379 | else
380 | echo "$sqlite_table [$sqlite_rowcount]:"
381 | sqlite_show_query "SELECT * FROM $sqlite_table;"
382 | fi
383 | done
384 | fi
385 | exit 5;;
386 |
387 | ## Text
388 | text/* | */xml)
389 | ## Syntax highlight
390 | if [[ "$( stat --printf='%s' -- "$FILE_PATH" )" -gt "$HIGHLIGHT_SIZE_MAX" ]]; then
391 | exit 2
392 | fi
393 | if [[ "$( tput colors )" -ge 256 ]]; then
394 | local pygmentize_format='terminal256'
395 | local highlight_format='xterm256'
396 | else
397 | local pygmentize_format='terminal'
398 | local highlight_format='ansi'
399 | fi
400 | env HIGHLIGHT_OPTIONS="$HIGHLIGHT_OPTIONS" highlight \
401 | --out-format="$highlight_format" \
402 | --force -- "$FILE_PATH" && exit 5
403 | env COLORTERM=8bit bat --color=always --style="$BAT_STYLE" \
404 | -- "$FILE_PATH" && exit 5
405 | pygmentize -f "$pygmentize_format" -O "style=$PYGMENTIZE_STYLE"\
406 | -- "$FILE_PATH" && exit 5
407 | exit 2;;
408 |
409 | ## DjVu
410 | image/vnd.djvu)
411 | ## Preview as text conversion (requires djvulibre)
412 | djvutxt "$FILE_PATH" | fmt -w "$PV_WIDTH" && exit 5
413 | exiftool "$FILE_PATH" && exit 5
414 | exit 1;;
415 |
416 | ## Image
417 | image/*)
418 | ## Preview as text conversion
419 | # img2txt --gamma=0.6 --width="$PV_WIDTH" -- "$FILE_PATH" && exit 4
420 | exiftool "$FILE_PATH" && exit 5
421 | exit 1;;
422 |
423 | ## Video and audio
424 | video/* | audio/*)
425 | mediainfo "$FILE_PATH" && exit 5
426 | exiftool "$FILE_PATH" && exit 5
427 | exit 1;;
428 |
429 | ## ELF files (executables and shared objects)
430 | application/x-executable | application/x-pie-executable | application/x-sharedlib)
431 | readelf -WCa "$FILE_PATH" && exit 5
432 | exit 1;;
433 | esac
434 | }
435 |
436 | handle_fallback() {
437 | echo '----- File Type Classification -----' && file --dereference --brief -- "$FILE_PATH" && exit 5
438 | }
439 |
440 |
441 | MIMETYPE="$( file --dereference --brief --mime-type -- "$FILE_PATH" )"
442 | if [[ "$PV_IMAGE_ENABLED" == 'True' ]]; then
443 | handle_image "$MIMETYPE"
444 | fi
445 | handle_extension
446 | handle_mime "$MIMETYPE"
447 | handle_fallback
448 |
449 | exit 1
450 | '';
451 | };
452 |
453 | # TODO: update this when ranger 1.9.4 releases
454 | ranger = (pkgs.ranger.overrideAttrs (old: {
455 | version = "git";
456 | src = pkgs.fetchFromGitHub {
457 | owner = "ranger";
458 | repo = "ranger";
459 | rev = "136416c7e2ecc27315fe2354ecadfe09202df7dd";
460 | sha256= "sha256-nW4KlatugmPRPXl+XvV0/mo+DE5o8FLRrsJuiKbFGyY=";
461 | };
462 | buildInputs = with pkgs.python3Packages; [
463 | astroid
464 | pylint
465 | ];
466 | }));
467 | in
468 | {
469 | home.file = {
470 | ".config/ranger/rc.conf".text = ''
471 | set preview_images true
472 | set preview_images_method sixel
473 | set preview_files true
474 | set use_preview_script true
475 | set preview_script ${scope}/bin/ranger-scope
476 | copymap i
477 | copymap k
478 | copymap j
479 | copymap l
480 | '';
481 | };
482 | home.packages = [
483 | scope
484 | ranger
485 | ];
486 | }
487 |
--------------------------------------------------------------------------------