├── .gitignore ├── nixos ├── features │ ├── home-manager.nix │ ├── docker.nix │ ├── bluetooth.nix │ ├── hidpi.nix │ ├── steam.nix │ ├── nix-ld-vscode.nix │ ├── kde.nix │ ├── podman.nix │ ├── tailscale.nix │ ├── sunshine.nix │ ├── i3.nix │ ├── key-mapping │ │ ├── caps-to-ctrl-esc.nix │ │ ├── right-alt-to-ctrl-b.nix │ │ └── swap-left-alt-and-super.nix │ ├── README.md │ ├── kvm-host.nix │ ├── music-production.nix │ ├── sound.nix │ ├── plex-server.nix │ ├── sway.nix │ ├── kindle │ │ ├── default.nix │ │ └── kindle-verisign-cert.crt │ ├── plausible.nix │ └── fonts.nix ├── hosts │ ├── colon │ │ ├── nginx.nix │ │ ├── kavita.nix │ │ ├── default.nix │ │ ├── nextcloud.nix │ │ ├── hardware-configuration.nix │ │ ├── wireguard.nix │ │ └── photoprism.nix │ ├── clacks │ │ ├── default.nix │ │ └── hardware-configuration.nix │ ├── nobby │ │ ├── storage.nix │ │ ├── restic.nix │ │ ├── samba.nix │ │ ├── stashapp.nix │ │ ├── hardware-configuration.nix │ │ └── default.nix │ ├── detritus │ │ ├── default.nix │ │ └── hardware-configuration.nix │ ├── nasty │ │ ├── samba-conf.nix │ │ ├── hardware-configuration.nix │ │ └── default.nix │ ├── asahi │ │ ├── hardware-configuration.nix │ │ └── default.nix │ ├── magrat │ │ ├── hardware-configuration.nix │ │ └── default.nix │ ├── buddy │ │ ├── hardware-configuration.nix │ │ └── default.nix │ └── hex-wsl │ │ └── default.nix ├── common.nix ├── minimal.nix └── users.nix ├── home-manager └── yusef │ ├── features │ ├── cli │ │ ├── nixpkgs-config.nix │ │ ├── syncthing.nix │ │ ├── emacs.nix │ │ ├── nushell │ │ │ ├── default.nix │ │ │ └── env.nu │ │ ├── npm.nix │ │ ├── ssh.nix │ │ ├── zellij.nix │ │ ├── helix.nix │ │ ├── default.nix │ │ ├── git.nix │ │ ├── fish.nix │ │ ├── tmux.nix │ │ └── nvim │ │ │ └── default.nix │ └── desktop │ │ ├── sway │ │ ├── default.nix │ │ ├── no-hardware-cursors.nix │ │ ├── nvidia.nix │ │ ├── natural-scrolling.nix │ │ ├── monitors.nix │ │ ├── swayidle.nix │ │ └── sway.nix │ │ ├── common │ │ ├── davinci-resolve.nix │ │ ├── vscode.nix │ │ ├── qt.nix │ │ ├── obs.nix │ │ ├── asahi-wrapper.nix │ │ ├── vscode-insiders.nix │ │ ├── fonts.nix │ │ ├── default.nix │ │ ├── alacritty.nix │ │ ├── firefox.nix │ │ └── wezterm.nix │ │ ├── backgrounds │ │ └── jwst-carina.jpg │ │ ├── i3 │ │ ├── default.nix │ │ ├── rofi │ │ │ ├── default.nix │ │ │ └── theme.nix │ │ ├── picom.nix │ │ ├── i3.nix │ │ └── polybar.nix │ │ ├── hyprland │ │ ├── nvidia.nix │ │ └── default.nix │ │ └── wayland │ │ ├── mako.nix │ │ ├── default.nix │ │ ├── waybar │ │ ├── colors-gtk-css.nix │ │ ├── style.css │ │ └── default.nix │ │ ├── swaylock.nix │ │ └── electron-hacks.nix │ ├── hosts │ ├── clacks.nix │ ├── colon.nix │ ├── nasty.nix │ ├── old-work-macbook-darwin.nix │ ├── macbook-darwin.nix │ ├── hex-wsl.nix │ ├── buddy.nix │ ├── magrat.nix │ ├── asahi.nix │ ├── detritus.nix │ ├── nobby.nix │ └── work-macbook-darwin.nix │ └── global │ ├── colors.nix │ └── default.nix ├── secrets ├── kavita-token.age ├── colon-nextcloud.age ├── photoprism-admin.age ├── restic │ ├── nobby-env.age │ ├── nobby-repo.age │ └── nobby-password.age ├── tailscaleOAuthEnvFile.age ├── wireguard-privkey-colon.age ├── plausible-admin-password.age ├── plausible-maxmind-license.age ├── plausible-secret-keybase.age └── secrets.nix ├── pkgs ├── fonts │ ├── feather-icons │ │ ├── feathericon.ttf │ │ └── default.nix │ ├── material-icons │ │ ├── MaterialIcons-Regular.ttf │ │ ├── MaterialIconsRound-Regular.otf │ │ ├── MaterialIconsSharp-Regular.otf │ │ ├── MaterialIconsOutlined-Regular.otf │ │ ├── MaterialIconsTwoTone-Regular.otf │ │ └── default.nix │ ├── monaspace │ │ └── default.nix │ ├── sf-pro │ │ └── default.nix │ └── default.nix ├── default.nix ├── trim-screencast.nix ├── wineApps │ └── kindle.nix └── wrapWine.nix ├── darwin ├── features │ ├── brew.nix │ ├── yabai-scripting-additions.nix │ └── yabai.nix ├── hosts │ ├── macbook.nix │ ├── old-work-macbook.nix │ ├── work-macbook.nix │ └── common.nix └── fonts.nix ├── modules ├── home-manager │ ├── wallpaper.nix │ ├── default.nix │ └── monitors.nix └── nixos │ ├── default.nix │ ├── vscode-server-nix-ld.nix │ ├── speakersafetyd.nix │ ├── v4l2-loopback.nix │ ├── dual-function-keys.nix │ └── ts-serve.nix ├── nixpkgs.nix ├── shell.nix ├── overlays └── default.nix ├── README.md ├── justfile └── flake.nix /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | -------------------------------------------------------------------------------- /nixos/features/home-manager.nix: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/nixpkgs-config.nix: -------------------------------------------------------------------------------- 1 | { 2 | allowUnfree = true; 3 | } -------------------------------------------------------------------------------- /home-manager/yusef/hosts/clacks.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | imports = [ ../global ]; 4 | } 5 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/colon.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | imports = [ ../global ]; 4 | } 5 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/nasty.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | imports = [ ../global ]; 4 | } 5 | -------------------------------------------------------------------------------- /nixos/features/docker.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | virtualisation.docker.enable = true; 4 | } 5 | -------------------------------------------------------------------------------- /secrets/kavita-token.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/kavita-token.age -------------------------------------------------------------------------------- /secrets/colon-nextcloud.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/colon-nextcloud.age -------------------------------------------------------------------------------- /secrets/photoprism-admin.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/photoprism-admin.age -------------------------------------------------------------------------------- /secrets/restic/nobby-env.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/restic/nobby-env.age -------------------------------------------------------------------------------- /secrets/restic/nobby-repo.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/restic/nobby-repo.age -------------------------------------------------------------------------------- /secrets/restic/nobby-password.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/restic/nobby-password.age -------------------------------------------------------------------------------- /secrets/tailscaleOAuthEnvFile.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/tailscaleOAuthEnvFile.age -------------------------------------------------------------------------------- /secrets/wireguard-privkey-colon.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/wireguard-privkey-colon.age -------------------------------------------------------------------------------- /secrets/plausible-admin-password.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/plausible-admin-password.age -------------------------------------------------------------------------------- /secrets/plausible-maxmind-license.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/plausible-maxmind-license.age -------------------------------------------------------------------------------- /secrets/plausible-secret-keybase.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/secrets/plausible-secret-keybase.age -------------------------------------------------------------------------------- /pkgs/fonts/feather-icons/feathericon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/pkgs/fonts/feather-icons/feathericon.ttf -------------------------------------------------------------------------------- /nixos/features/bluetooth.nix: -------------------------------------------------------------------------------- 1 | # import to enable bluetooth 2 | { 3 | hardware.bluetooth.enable = true; 4 | services.blueman.enable = true; 5 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/default.nix: -------------------------------------------------------------------------------- 1 | {config, ... }: 2 | { 3 | imports = [ 4 | ./sway.nix 5 | ./swayidle.nix 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /nixos/features/hidpi.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ...}: 2 | { 3 | console.font = "${pkgs.powerline-fonts}/share/consolefonts/ter-powerline-v32n.psf.gz"; 4 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/davinci-resolve.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | home.packages = [ 4 | pkgs.davinci-resolve 5 | ]; 6 | } 7 | -------------------------------------------------------------------------------- /pkgs/fonts/material-icons/MaterialIcons-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/pkgs/fonts/material-icons/MaterialIcons-Regular.ttf -------------------------------------------------------------------------------- /pkgs/fonts/material-icons/MaterialIconsRound-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/pkgs/fonts/material-icons/MaterialIconsRound-Regular.otf -------------------------------------------------------------------------------- /pkgs/fonts/material-icons/MaterialIconsSharp-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/pkgs/fonts/material-icons/MaterialIconsSharp-Regular.otf -------------------------------------------------------------------------------- /pkgs/fonts/material-icons/MaterialIconsOutlined-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/pkgs/fonts/material-icons/MaterialIconsOutlined-Regular.otf -------------------------------------------------------------------------------- /pkgs/fonts/material-icons/MaterialIconsTwoTone-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/pkgs/fonts/material-icons/MaterialIconsTwoTone-Regular.otf -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/backgrounds/jwst-carina.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yusefnapora/nix-config/HEAD/home-manager/yusef/features/desktop/backgrounds/jwst-carina.jpg -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/vscode.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | { 3 | programs.vscode = { 4 | enable = true; 5 | package = lib.mkDefault pkgs.vscode-fhs; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/i3/default.nix: -------------------------------------------------------------------------------- 1 | { lib, config, pkgs, ... }: 2 | { 3 | imports = [ 4 | ./i3.nix 5 | ./picom.nix 6 | ./polybar.nix 7 | # ./rofi 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/old-work-macbook-darwin.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common/wezterm.nix 6 | ]; 7 | 8 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/syncthing.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | { 3 | 4 | services.syncthing = { 5 | enable = true; 6 | 7 | # TODO: look into extraOptions 8 | }; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/no-hardware-cursors.nix: -------------------------------------------------------------------------------- 1 | # fix for invisible cursor when running in vmware or nvida gpus 2 | { config, ... }: 3 | { 4 | home.sessionVariables = { 5 | WLR_NO_HARDWARE_CURSORS = "1"; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /nixos/features/steam.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | { 3 | programs.steam = { 4 | enable = true; 5 | 6 | extraCompatPackages = lib.optionals (pkgs.system == "x86_64-linux") [ 7 | pkgs.proton-ge-bin 8 | ]; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /nixos/features/nix-ld-vscode.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, outputs, ... }: 2 | { 3 | imports = [ 4 | outputs.nixosModules.vscode-server-nix-ld 5 | ]; 6 | 7 | vscode-server-nix-ld = { 8 | enable = true; 9 | users = [ "yusef" ]; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /darwin/features/brew.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | { 3 | homebrew = { 4 | enable = true; 5 | 6 | taps = [ 7 | "d12frosted/emacs-plus" 8 | ]; 9 | brews = [ 10 | "d12frosted/emacs-plus/emacs-plus@29" 11 | ]; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /modules/home-manager/wallpaper.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | let inherit (lib) types mkOption; 3 | in 4 | { 5 | options.wallpaper = mkOption { 6 | type = types.path; 7 | default = ""; 8 | description = '' 9 | Wallpaper path 10 | ''; 11 | }; 12 | } -------------------------------------------------------------------------------- /nixos/features/kde.nix: -------------------------------------------------------------------------------- 1 | # Enables KDE plasma 2 | { pkgs, lib, ... }: 3 | { 4 | services.xserver.enable = true; 5 | services.displayManager.sddm.wayland.enable = true; 6 | services.desktopManager.plasma6.enable = true; 7 | 8 | programs.dconf.enable = true; 9 | } 10 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/emacs.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | # emacs config managed separately in github.com/yusefnapora/emacs.d 4 | 5 | # only install on linux, since we use a mac-hacked emacs via homebrew on darwin 6 | programs.emacs.enable = pkgs.stdenv.isLinux; 7 | } 8 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/qt.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | let 3 | style = if config.colorScheme.variant == "dark" then "adwaita-dark" else "adwaita"; 4 | in 5 | { 6 | qt.enable = true; 7 | qt.style.name = style; 8 | qt.platformTheme.name = "adwaita"; 9 | } 10 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/macbook-darwin.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common/wezterm.nix 6 | ../features/cli/syncthing.nix 7 | ]; 8 | 9 | home.sessionPath = [ "/opt/homebrew/bin/" ]; 10 | } 11 | -------------------------------------------------------------------------------- /pkgs/fonts/feather-icons/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pkgs 3 | ,... }: 4 | pkgs.stdenvNoCC.mkDerivation { 5 | name = "feather-icons-font"; 6 | dontConfigure = true; 7 | src = ./.; 8 | 9 | installPhase = '' 10 | mkdir -p $out/share/fonts/truetype 11 | cp $src/feathericon.ttf $out/share/fonts/truetype/ 12 | ''; 13 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/hyprland/nvidia.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | 4 | wayland.windowManager.hyprland.settings.env = [ 5 | "LIBVA_DRIVER_NAME,nvidia" 6 | "XDG_SESSION_TYPE,wayland" 7 | "GBM_BACKEND,nvidia-drm" 8 | "__GLX_VENDOR_LIBRARY_NAME,nvidia" 9 | "WLR_NO_HARDWARE_CURSORS,1" 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /modules/home-manager/default.nix: -------------------------------------------------------------------------------- 1 | # Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). 2 | # These should be stuff you would like to share with others, not your personal configurations. 3 | 4 | { 5 | monitors = import ./monitors.nix; 6 | wallpaper = import ./wallpaper.nix; 7 | } 8 | -------------------------------------------------------------------------------- /nixos/features/podman.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | { 3 | virtualisation.podman = { 4 | enable = true; 5 | dockerCompat = true; 6 | defaultNetwork.settings.dns_enabled = true; 7 | }; 8 | virtualisation.oci-containers.backend = "podman"; 9 | environment.systemPackages = [ pkgs.podman-compose pkgs.distrobox ]; 10 | } 11 | -------------------------------------------------------------------------------- /nixos/features/tailscale.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ...}: 2 | { 3 | environment.systemPackages = [ pkgs.tailscale ]; 4 | 5 | services.tailscale.enable = true; 6 | 7 | networking.firewall = { 8 | enable = true; 9 | trustedInterfaces = [ "tailscale0" ]; 10 | allowedUDPPorts = [ config.services.tailscale.port ]; 11 | }; 12 | } -------------------------------------------------------------------------------- /home-manager/yusef/hosts/hex-wsl.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | 6 | (import ../features/desktop/common/fonts.nix { 7 | inherit lib pkgs config; 8 | }) 9 | 10 | ../features/desktop/common/vscode.nix 11 | ../features/desktop/common/wezterm.nix 12 | ]; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /nixos/features/sunshine.nix: -------------------------------------------------------------------------------- 1 | # adapted from https://github.com/bphenriques/dotfiles/blob/master/nixos/modules/services/sunshine.nix 2 | { config, lib, pkgs, ... }: 3 | { 4 | 5 | services.sunshine = { 6 | enable = true; 7 | package = pkgs.sunshine.override { cudaSupport = true; }; 8 | capSysAdmin = true; 9 | openFirewall = true; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/buddy.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common 6 | 7 | ../features/desktop/sway 8 | ]; 9 | 10 | monitors = [ 11 | { 12 | name = "Screen 0"; 13 | width = 1920; 14 | height = 1080; 15 | scale = 1.0; 16 | } 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /pkgs/fonts/material-icons/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pkgs 3 | ,... }: 4 | pkgs.stdenvNoCC.mkDerivation { 5 | name = "material-icons-font"; 6 | dontConfigure = true; 7 | src = ./.; 8 | 9 | installPhase = '' 10 | mkdir -p $out/share/fonts/{opentype,truetype} 11 | cp $src/*.otf $out/share/fonts/opentype/ 12 | cp $src/*.ttf $out/share/fonts/truetype/ 13 | ''; 14 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/nvidia.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: 2 | { 3 | home.sessionVariables = { 4 | SWAY_CLI_FLAGS = "--unsupported-gpu"; 5 | GBM_BACKEND = "nvidia-drm"; 6 | __GLX_VENDOR_LIBRARY_NAME = "nvidia"; 7 | __GL_GSYNC_ALLOWED = "0"; 8 | __GL_VRR_ALLOWED = "0"; 9 | WLR_DRM_NO_ATOMIC = "1"; 10 | }; 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /nixos/features/i3.nix: -------------------------------------------------------------------------------- 1 | # enables i3 tiling X11 window manager 2 | # see home-manager config for all the interesting config bits 3 | { lib, pkgs, ...}: 4 | { 5 | services.xserver = { 6 | enable = true; 7 | 8 | windowManager.i3.enable = true; 9 | }; 10 | 11 | 12 | services.displayManager.defaultSession = "none+i3"; 13 | services.libinput.enable = true; 14 | } 15 | -------------------------------------------------------------------------------- /nixos/hosts/colon/nginx.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | security.acme = { 4 | acceptTerms = true; 5 | defaults.email = "yusef@napora.org"; 6 | }; 7 | 8 | services.nginx = { 9 | enable = true; 10 | recommendedTlsSettings = true; 11 | recommendedOptimisation = true; 12 | recommendedGzipSettings = true; 13 | recommendedProxySettings = true; 14 | }; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/natural-scrolling.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | { 3 | wayland.windowManager.sway.config.input = { 4 | "type:pointer" = { 5 | natural_scroll = "enabled"; 6 | }; 7 | 8 | "type:touchpad" = { 9 | natural_scroll = "enabled"; 10 | }; 11 | 12 | "type:mouse" = { 13 | natural_scroll = "enabled"; 14 | }; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /nixpkgs.nix: -------------------------------------------------------------------------------- 1 | # A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file 2 | # This is useful to avoid using channels when using legacy nix commands 3 | let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; 4 | in 5 | import (fetchTarball { 6 | url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; 7 | sha256 = lock.narHash; 8 | }) 9 | -------------------------------------------------------------------------------- /darwin/hosts/macbook.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, inputs, ... }: 2 | let 3 | inherit (inputs) nixpkgs; 4 | in 5 | { 6 | imports = [ 7 | ./common.nix 8 | ../features/yabai.nix 9 | ../features/yabai-scripting-additions.nix 10 | ../features/brew.nix 11 | ]; 12 | 13 | home-manager.users.yusef = import ../../home-manager/yusef/hosts/macbook-darwin.nix; 14 | 15 | ids.gids.nixbld = 350; 16 | system.stateVersion = 4; 17 | } 18 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/magrat.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common 6 | 7 | ../features/desktop/sway 8 | ../features/desktop/sway/natural-scrolling.nix 9 | ]; 10 | 11 | 12 | monitors = [ 13 | { 14 | name = "Virtual-1"; 15 | width = 3840; 16 | height = 2160; 17 | scale = 2.0; 18 | } 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | # Shell for bootstrapping flake-enabled nix and home-manager 2 | # You can enter it through 'nix develop' or (legacy) 'nix-shell' 3 | 4 | { pkgs ? (import ./nixpkgs.nix) { } }: { 5 | default = pkgs.mkShell { 6 | # Enable experimental features without having to specify the argument 7 | NIX_CONFIG = "experimental-features = nix-command flakes"; 8 | nativeBuildInputs = with pkgs; [ nix home-manager git just ]; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/mako.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | let colors = config.colorScheme.palette; 3 | in { 4 | services.mako = { 5 | enable = true; 6 | icons = true; 7 | anchor = "bottom-right"; 8 | margin = "30"; 9 | padding = "20"; 10 | borderRadius = 5; 11 | backgroundColor = "#${colors.base01}"; 12 | textColor = "#${colors.base05}"; 13 | borderColor = "#${colors.base04}"; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/asahi.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common 6 | ../features/desktop/common/vscode-insiders.nix 7 | 8 | #../features/desktop/sway 9 | #../features/desktop/sway/natural-scrolling.nix 10 | ]; 11 | 12 | monitors = [ 13 | { 14 | name = "DP-1"; 15 | width = 3024; 16 | height = 1890; 17 | scale = 2.0; 18 | } 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /darwin/hosts/old-work-macbook.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, inputs, ... }: 2 | let 3 | inherit (inputs) nixpkgs; 4 | in 5 | { 6 | imports = [ 7 | ./common.nix 8 | ../features/yabai.nix 9 | ../features/yabai-scripting-additions.nix 10 | ../features/brew.nix 11 | ]; 12 | 13 | home-manager.users.yusef = import ../../home-manager/yusef/hosts/old-work-macbook-darwin.nix; 14 | 15 | environment.systemPackages = [ 16 | pkgs.lima 17 | ]; 18 | 19 | system.stateVersion = 4; 20 | } 21 | -------------------------------------------------------------------------------- /darwin/hosts/work-macbook.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, inputs, ... }: 2 | let 3 | inherit (inputs) nixpkgs; 4 | in 5 | { 6 | imports = [ 7 | ./common.nix 8 | ../features/yabai.nix 9 | ../features/brew.nix 10 | ]; 11 | 12 | users.users = { 13 | ynapora = { 14 | name = "ynapora"; 15 | home = "/Users/ynapora"; 16 | }; 17 | }; 18 | 19 | home-manager.users.ynapora = import ../../home-manager/yusef/hosts/work-macbook-darwin.nix; 20 | 21 | system.stateVersion = 4; 22 | } 23 | -------------------------------------------------------------------------------- /pkgs/default.nix: -------------------------------------------------------------------------------- 1 | # Custom packages, that can be defined similarly to ones from nixpkgs 2 | # You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' 3 | 4 | { pkgs ? (import ../nixpkgs.nix) { } }: rec { 5 | custom-fonts = pkgs.callPackage ./fonts { }; 6 | trim-screencast = pkgs.callPackage ./trim-screencast.nix { }; 7 | wrapWine = pkgs.callPackage ./wrapWine.nix { }; 8 | kindle_1_17 = pkgs.callPackage ./wineApps/kindle.nix { 9 | inherit wrapWine; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /nixos/features/key-mapping/caps-to-ctrl-esc.nix: -------------------------------------------------------------------------------- 1 | # depends on the key-remapping module. add this to your host config: 2 | # imports = [ 3 | # outputs.nixosModules.dual-function-keys 4 | # # whatever other imports you want 5 | # ]; 6 | # 7 | {...}: 8 | { 9 | key-remapping.dual-function-keys = { 10 | enable = true; 11 | mappings."Capslock to Esc when tapped, Ctrl when held" = { 12 | key = "KEY_CAPSLOCK"; 13 | tap = "KEY_ESC"; 14 | hold = "KEY_LEFTCTRL"; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /darwin/fonts.nix: -------------------------------------------------------------------------------- 1 | { pkgs, outputs, ... }: 2 | let 3 | inherit (pkgs.stdenv) system; 4 | 5 | nerdFonts = with pkgs.nerd-fonts; [ 6 | fira-code 7 | droid-sans-mono 8 | jetbrains-mono 9 | fantasque-sans-mono 10 | iosevka 11 | ]; 12 | in { 13 | fonts = { 14 | packages = nerdFonts ++ builtins.attrValues { 15 | inherit (pkgs) 16 | fira-code 17 | open-fonts 18 | powerline-fonts 19 | liberation_ttf 20 | iosevka 21 | monaspace 22 | ; 23 | }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /modules/nixos/default.nix: -------------------------------------------------------------------------------- 1 | # Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). 2 | # These should be stuff you would like to share with others, not your personal configurations. 3 | 4 | { 5 | # List your module files here 6 | vscode-server-nix-ld = import ./vscode-server-nix-ld.nix; 7 | dual-function-keys = import ./dual-function-keys.nix; 8 | v4l2-loopback = import ./v4l2-loopback.nix; 9 | speakersafetyd = import ./speakersafetyd.nix; 10 | ts-serve = import ./ts-serve.nix; 11 | } 12 | -------------------------------------------------------------------------------- /nixos/common.nix: -------------------------------------------------------------------------------- 1 | # Extends minimal config to include features we almost always want (fonts, etc.) 2 | { inputs, outputs, lib, config, pkgs, ... }: { 3 | imports = [ 4 | ./minimal.nix 5 | 6 | ./features/fonts.nix 7 | #./features/podman.nix 8 | ./features/nix-ld-vscode.nix 9 | ]; 10 | 11 | # enable mounting external media without root privs 12 | services.udisks2.enable = true; 13 | 14 | # The rest of the configuration is set by each host config, which will 15 | # import this file and extend to suit each host. 16 | } 17 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/nushell/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: 2 | { 3 | programs.nushell = { 4 | enable = true; 5 | 6 | envFile.source = ./env.nu; 7 | configFile.source = ./config.nu; 8 | 9 | extraConfig = lib.optionalString pkgs.stdenv.isDarwin '' 10 | # add alias for macos `open` command 11 | alias macopen = /usr/bin/open 12 | ''; 13 | }; 14 | 15 | home.packages = builtins.attrValues { 16 | inherit (pkgs) 17 | starship 18 | any-nix-shell 19 | ; 20 | }; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /nixos/features/key-mapping/right-alt-to-ctrl-b.nix: -------------------------------------------------------------------------------- 1 | # depends on the key-remapping module. add this to your host config: 2 | # imports = [ 3 | # outputs.nixosModules.dual-function-keys 4 | # # whatever other imports you want 5 | # ]; 6 | # 7 | {...}: 8 | { 9 | key-remapping.dual-function-keys = { 10 | enable = true; 11 | mappings."Right Alt to Ctrl+B" = { 12 | key = "KEY_RIGHTALT"; 13 | tap = ["KEY_LEFTCTRL" "KEY_B"]; 14 | hold = ["KEY_LEFTCTRL" "KEY_B"]; 15 | hold-start = "BEFORE_CONSUME"; 16 | }; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /pkgs/fonts/monaspace/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | pkgs.stdenvNoCC.mkDerivation rec { 3 | name = "monaspace"; 4 | version = "1.000"; 5 | src = pkgs.fetchFromGitHub { 6 | owner = "githubnext"; 7 | repo = "monaspace"; 8 | rev = "v${version}"; 9 | sha256 = "sha256-Zo56r0QoLwxwGQtcWP5cDlasx000G9BFeGINvvwEpQs="; 10 | }; 11 | 12 | installPhase = '' 13 | mkdir -p $out/share/fonts/{opentype,truetype} 14 | cp $src/fonts/otf/*.otf $out/share/fonts/opentype 15 | cp $src/fonts/variable/*.ttf $out/share/fonts/truetype 16 | ''; 17 | } 18 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/npm.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ...}: 2 | { 3 | # configure npm to install global packages to ~/.npm-packages 4 | # based on this blog post: https://matthewrhone.dev/nixos-npm-globally 5 | 6 | home.activation.npm-packages = '' 7 | mkdir -p $HOME/.npm-packages/lib 8 | ''; 9 | 10 | home.file.".npmrc".text = '' 11 | prefix = ''${HOME}/.npm-packages 12 | ''; 13 | 14 | programs.fish.shellInit = '' 15 | set -x PATH $PATH $HOME/.npm-packages/bin 16 | set -x NODE_PATH $HOME/.npm-packages/lib/node_modules 17 | ''; 18 | } 19 | -------------------------------------------------------------------------------- /nixos/hosts/clacks/default.nix: -------------------------------------------------------------------------------- 1 | { lib, config, pkgs, ... }: 2 | { 3 | imports = 4 | [ # Include the results of the hardware scan. 5 | ./hardware-configuration.nix 6 | 7 | ../../minimal.nix 8 | ]; 9 | 10 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/clacks.nix; 11 | 12 | # Use the systemd-boot EFI boot loader. 13 | boot.loader.systemd-boot.enable = true; 14 | boot.loader.efi.canTouchEfiVariables = false; 15 | 16 | networking.hostName = "clacks"; # Define your hostname. 17 | system.stateVersion = "23.05"; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /pkgs/fonts/sf-pro/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: 2 | pkgs.stdenvNoCC.mkDerivation { 3 | name = "sf-pro"; 4 | 5 | src = pkgs.fetchFromGitHub { 6 | owner = "sahibjotsaggu"; 7 | repo = "San-Francisco-Pro-Fonts"; 8 | rev = "8bfea09aa6f1139479f80358b2e1e5c6dc991a58"; 9 | sha256 = "sha256-mAXExj8n8gFHq19HfGy4UOJYKVGPYgarGd/04kUIqX4="; 10 | }; 11 | 12 | dontConfigure = true; 13 | 14 | installPhase = '' 15 | mkdir -p $out/share/fonts/{opentype,truetype} 16 | cp $src/*.otf $out/share/fonts/opentype/ 17 | cp $src/*.ttf $out/share/fonts/truetype/ 18 | ''; 19 | } 20 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/obs.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | let 3 | inherit (lib) mkIf; 4 | inherit (pkgs.stdenv) isAarch64 isLinux; 5 | 6 | mkAsahiWrapper = (import ./asahi-wrapper.nix { inherit lib pkgs; }); 7 | obs-package = mkAsahiWrapper { name = "obs"; package = pkgs.obs-studio; }; 8 | in { 9 | config = mkIf isLinux { 10 | 11 | programs.obs-studio = { 12 | enable = true; 13 | package = obs-package; 14 | }; 15 | 16 | home.packages = [ 17 | # also install shotcut video editor for simple edits 18 | pkgs.shotcut 19 | ]; 20 | 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/monitors.nix: -------------------------------------------------------------------------------- 1 | # Convert config.monitors into sway's format 2 | { lib, monitors }: 3 | let 4 | enabledMonitors = lib.filter (m: m.enabled) monitors; 5 | outputList = lib.forEach enabledMonitors (m: let 6 | w = builtins.toString m.width; 7 | h = builtins.toString m.height; 8 | hz = builtins.toString m.refreshRate; 9 | scale = builtins.toString m.scale; 10 | in { 11 | name = m.name; 12 | value = { 13 | mode = "${w}x${h}@${hz}Hz"; 14 | scale = scale; 15 | }; 16 | }); 17 | in 18 | builtins.listToAttrs outputList 19 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/i3/rofi/default.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: 2 | let 3 | inherit (lib) mkIf; 4 | 5 | dpi-scale = 1.0; # TODO: read from monitor config 6 | scaled = size: (lib.strings.floatToString (size * dpi-scale)); 7 | in 8 | { 9 | programs.rofi = { 10 | enable = true; 11 | 12 | plugins = builtins.attrValues { 13 | inherit (pkgs) rofi-emoji rofi-calc; 14 | }; 15 | 16 | terminal = "$TERMINAL"; 17 | 18 | theme = (import ./theme.nix { inherit scaled; inherit config; }); 19 | 20 | extraConfig = { 21 | modi = "drun,run,emoji,calc,ssh,combi,window"; 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/detritus.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common 6 | 7 | # not using default sway config, since I don't want swayidle to lock the session 8 | # in the VM when I page away to the host for a while. 9 | ../features/desktop/sway/sway.nix 10 | ../features/desktop/sway/no-hardware-cursors.nix 11 | ]; 12 | 13 | colorScheme = inputs.nix-colors.colorSchemes.snazzy; 14 | 15 | monitors = [ 16 | { 17 | name = "Virtual-1"; 18 | width = 3072; 19 | height = 1920; 20 | scale = 2.0; 21 | } 22 | ]; 23 | } 24 | -------------------------------------------------------------------------------- /nixos/features/README.md: -------------------------------------------------------------------------------- 1 | # features 2 | 3 | This directory contains "features" that can be added to a host configuration's `imports` list to enable certain functionality and configure things as I like them. In other words, my personal config, not something that's necesarily usable by other people. 4 | 5 | Enable a feature by adding it to your host config's `imports` list: 6 | 7 | ```nix 8 | { 9 | imports = [ 10 | ../features/bluetooth.nix 11 | ]; 12 | } 13 | ``` 14 | 15 | Note that you may need to tweak the import path depending on where you're importing from. TODO: I wonder if there's a way to write import paths relative to the repo root? Seems like something flakes might support. 16 | -------------------------------------------------------------------------------- /pkgs/fonts/default.nix: -------------------------------------------------------------------------------- 1 | { lib, callPackage }: 2 | let 3 | inherit (builtins) readDir attrNames listToAttrs; 4 | inherit (lib.attrsets) filterAttrs nameValuePair; 5 | inherit (lib.lists) forEach; 6 | 7 | p = path: (callPackage path {}); 8 | 9 | # get a list of all subdirectories of this dir 10 | dirs = 11 | attrNames 12 | (filterAttrs 13 | (name: type: type == "directory") 14 | (readDir ./.)); 15 | 16 | # make an attrset where the keys are the directory name, 17 | # and the values are the result of (callPackage ./${dir-name} {}) 18 | packages = 19 | listToAttrs 20 | (forEach 21 | dirs 22 | (dir: (nameValuePair dir (p ./${dir})))); 23 | in 24 | packages 25 | -------------------------------------------------------------------------------- /nixos/features/key-mapping/swap-left-alt-and-super.nix: -------------------------------------------------------------------------------- 1 | # depends on the key-remapping module. add this to your host config: 2 | # imports = [ 3 | # outputs.nixosModules.dual-function-keys 4 | # # whatever other imports you want 5 | # ]; 6 | # 7 | { ...}: 8 | { 9 | key-remapping.dual-function-keys = { 10 | enable = true; 11 | mappings."Left Alt to Left Super" = { 12 | key = "KEY_LEFTALT"; 13 | tap = "KEY_LEFTMETA"; 14 | hold = "KEY_LEFTMETA"; 15 | hold-start = "BEFORE_CONSUME"; 16 | }; 17 | mappings."Left Super to Left Alt" = { 18 | key = "KEY_LEFTMETA"; 19 | tap = "KEY_LEFTALT"; 20 | hold = "KEY_LEFTALT"; 21 | hold-start = "BEFORE_CONSUME"; 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /pkgs/trim-screencast.nix: -------------------------------------------------------------------------------- 1 | { writeScript 2 | , makeWrapper 3 | , symlinkJoin 4 | , ffmpeg 5 | , bash 6 | , coreutils 7 | }: 8 | let 9 | script = writeScript "trim-screencast" 10 | '' 11 | #!${bash}/bin/bash 12 | input_file=$1 13 | filename=$(basename -- "$input_file") 14 | extension="''${filename##*.}" 15 | output_file="$filename-trimmed.$extension" 16 | 17 | ffmpeg -i "$input_file" -vf mpdecimate -vsync vfr -acodec copy "$output_file" 18 | ''; 19 | in 20 | symlinkJoin { 21 | name = "trim-screencast"; 22 | paths = [ bash ffmpeg coreutils ]; 23 | buildInputs = [ makeWrapper ]; 24 | postBuild = '' 25 | cp ${script} $out/bin/trim-screencast 26 | wrapProgram $out/bin/trim-screencast --set PATH $out/bin 27 | ''; 28 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/asahi-wrapper.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | let 3 | inherit (pkgs.stdenv) isLinux isAarch64; 4 | isAsahi = (isLinux && isAarch64); 5 | in 6 | { package 7 | , name 8 | , paths ? [] 9 | , gl-version ? "3.3" 10 | , gles-version ? "3.0" 11 | , glsl-version ? "330" 12 | }: if (! isAsahi) then package else pkgs.symlinkJoin { 13 | inherit name; 14 | paths = [ package ] ++ paths; 15 | buildInputs = [ pkgs.makeWrapper ]; 16 | postBuild = '' 17 | wrapProgram "$out/bin/${name}" \ 18 | --set "MESA_GL_VERSION_OVERRIDE" "${gl-version}" \ 19 | --set "MESA_GLES_VERSION_OVERRIDE" "${gles-version}" \ 20 | --set "MESA_GLSL_VERSION_OVERRIDE" "${glsl-version}" 21 | ''; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/ssh.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | { 3 | programs.ssh = { 4 | enable = true; 5 | extraConfig = '' 6 | AddKeysToAgent=yes 7 | ''; 8 | 9 | matchBlocks = lib.mkDefault { 10 | sb = { 11 | hostname = "proton.usbx.me"; 12 | user = "yusef"; 13 | }; 14 | 15 | # WSL on hex via proxy jump config 16 | # see https://kleinfelter.com/3-ways-to-ssh-to-a-pc-running-windows-and-wsl2 17 | hex-wsl = { 18 | hostname = "127.0.0.1"; 19 | port = 2022; 20 | proxyJump = "hex-win"; 21 | user = "yusef"; 22 | }; 23 | 24 | # Hex (windows host). LAN only 25 | hex-win = { 26 | hostname = "hex.lan"; 27 | user = "yusef"; 28 | }; 29 | }; 30 | }; 31 | } -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/swayidle.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | let 3 | inherit (lib.attrsets) attrByPath; 4 | 5 | lock-cmd = "${pkgs.swaylock-effects}/bin/swaylock -S --daemonize"; 6 | 7 | lock-timeout = (attrByPath ["SWAY_LOCK_TIMEOUT"] "600" config.home.sessionVariables); 8 | suspend-timeout = (attrByPath ["SWAY_SUSPEND_TIMEOUT"] "1200" config.home.sessionVariables); 9 | 10 | swayidle-cmd = '' 11 | ${pkgs.swayidle}/bin/swayidle -w \ 12 | timeout ${lock-timeout} '${lock-cmd}' \ 13 | timeout ${suspend-timeout} 'sudo systemctl suspend' \ 14 | before-sleep '${lock-cmd}' \ 15 | lock '${lock-cmd}' 16 | ''; 17 | in { 18 | wayland.windowManager.sway.config.startup = [ 19 | { command = swayidle-cmd; } 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /darwin/features/yabai-scripting-additions.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | { 3 | services.yabai = { 4 | enableScriptingAddition = true; 5 | extraConfig = '' 6 | yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" 7 | sudo yabai --load-sa 8 | ''; 9 | }; 10 | 11 | environment.etc = { 12 | "sudoers.d/10-yabai".text = '' 13 | %admin ALL=(root) NOPASSWD: ${pkgs.yabai}/bin/yabai --load-sa 14 | ''; 15 | }; 16 | 17 | services.skhd.skhdConfig = 18 | let 19 | hyper = "cmd + ctrl + alt"; 20 | yabai = "${pkgs.yabai}/bin/yabai"; 21 | in '' 22 | ${hyper} - left : ${yabai} -m window --space prev 23 | ${hyper} - right : ${yabai} -m window --space next 24 | ${hyper} - up : ${yabai} -m window --display recent 25 | ''; 26 | } 27 | -------------------------------------------------------------------------------- /nixos/features/kvm-host.nix: -------------------------------------------------------------------------------- 1 | # enable VM hosting using kvm/qemu via libvirt. 2 | # Installs virt-manager, so more suited to workstation than headless vm host. 3 | { pkgs, lib, config, ...}: 4 | { 5 | environment.systemPackages = [ pkgs.virt-manager pkgs.spice-gtk ]; 6 | 7 | virtualisation = { 8 | spiceUSBRedirection.enable = true; 9 | libvirtd.enable = true; 10 | libvirtd.qemu = { 11 | package = pkgs.qemu_kvm; 12 | runAsRoot = true; 13 | 14 | # enable TPM support (for win11) 15 | swtpm.enable = true; 16 | ovmf = { 17 | enable = true; 18 | packages = [ 19 | (pkgs.OVMFFull.override { 20 | secureBoot = true; 21 | tpmSupport = true; 22 | }).fd 23 | ]; 24 | }; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | 4 | imports = [ 5 | ./waybar 6 | ./mako.nix 7 | ./swaylock.nix 8 | ./electron-hacks.nix 9 | ]; 10 | 11 | xdg.mimeApps.enable = true; 12 | home.packages = with pkgs; [ 13 | grim 14 | gtk3 # For gtk-launch 15 | slurp 16 | waypipe 17 | wf-recorder 18 | wl-clipboard 19 | wl-mirror 20 | ydotool 21 | ]; 22 | 23 | # add pbcopy & pbpaste aliases for clipboard 24 | programs.fish.shellAliases = { 25 | pbcopy = "${pkgs.wl-clipboard}/bin/wl-copy"; 26 | pbpaste = "${pkgs.wl-clipboard}/bin/wl-paste"; 27 | }; 28 | 29 | home.sessionVariables = { 30 | MOZ_ENABLE_WAYLAND = 1; 31 | QT_QPA_PLATFORM = "wayland"; 32 | LIBSEAT_BACKEND = "logind"; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /nixos/hosts/colon/kavita.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | let 3 | port = 5000; 4 | in { 5 | 6 | age.secrets.kavita-token = { 7 | file = ../../../secrets/kavita-token.age; 8 | owner = "kavita"; 9 | group = "kavita"; 10 | mode = "770"; 11 | }; 12 | 13 | services.kavita = { 14 | enable = true; 15 | dataDir = "/data/kavita"; 16 | tokenKeyFile = config.age.secrets.kavita-token.path; 17 | 18 | settings = { 19 | Port = port; 20 | IpAddresses = "127.0.0.1"; 21 | }; 22 | }; 23 | 24 | services.nginx.virtualHosts = { 25 | "library.napora.org" = { 26 | forceSSL = true; 27 | enableACME = true; 28 | http2 = true; 29 | locations."/" = { 30 | proxyPass = "http://127.0.0.1:${(builtins.toString port)}"; 31 | proxyWebsockets = true; 32 | }; 33 | }; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/zellij.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | let 3 | colors = config.colorScheme.palette; 4 | base16-theme = { 5 | fg = "#${colors.base05}"; 6 | bg = "#${colors.base02}"; 7 | black = "#${colors.base00}"; 8 | red = "#${colors.base08}"; 9 | green = "#${colors.base0B}"; 10 | yellow = "#${colors.base0A}"; 11 | blue = "#${colors.base0D}"; 12 | magenta = "#${colors.base0E}"; 13 | cyan = "#${colors.base0C}"; 14 | white = "#${colors.base05}"; 15 | orange = "#${colors.base09}"; 16 | }; 17 | in 18 | { 19 | 20 | programs.zellij = { 21 | enable = true; 22 | 23 | settings = { 24 | theme = "base16"; 25 | themes.base16 = base16-theme; 26 | 27 | ui.pane_frames = { 28 | rounded_corners = true; 29 | hide_session_name = true; 30 | }; 31 | }; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /nixos/features/music-production.nix: -------------------------------------------------------------------------------- 1 | { pkgs, inputs, ... }: 2 | let 3 | inherit (pkgs.lib.lists) optionals; 4 | in { 5 | imports = [ 6 | inputs.musnix.nixosModules.musnix 7 | ]; 8 | 9 | musnix = { 10 | enable = true; 11 | alsaSeq.enable = true; 12 | kernel.realtime = true; 13 | das_watchdog.enable = true; 14 | }; 15 | environment.systemPackages = builtins.attrValues { 16 | inherit (pkgs) 17 | reaper 18 | odin2 19 | tunefish 20 | yabridge 21 | yabridgectl 22 | libjack2 23 | jack2 24 | jack2Full 25 | jack_capture 26 | qjackctl 27 | a2jmidid 28 | pavucontrol 29 | guitarix 30 | gxplugins-lv2 31 | rakarrack 32 | rkrlv2 33 | distrho 34 | kapitonov-plugins-pack 35 | carla 36 | lsp-plugins 37 | ; 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /nixos/features/sound.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | # disable default sound module. see https://nixos.wiki/wiki/PipeWire 4 | services.pulseaudio.enable = false; 5 | 6 | security.rtkit.enable = true; 7 | services.pipewire = { 8 | enable = true; 9 | alsa.enable = true; 10 | alsa.support32Bit = true; 11 | pulse.enable = true; 12 | wireplumber.enable = true; 13 | }; 14 | 15 | #environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' 16 | # bluez_monitor.properties = { 17 | # ["bluez5.enable-sbc-xq"] = true, 18 | # ["bluez5.enable-msbc"] = true, 19 | # ["bluez5.enable-hw-volume"] = true, 20 | # ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" 21 | # } 22 | #''; 23 | 24 | environment.systemPackages = builtins.attrValues { inherit (pkgs) pavucontrol alsa-utils; }; 25 | } 26 | -------------------------------------------------------------------------------- /nixos/hosts/nobby/storage.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | 4 | fileSystems."/mnt/rustbucket" = 5 | { device = "/dev/disk/by-uuid/B26A85D86A859A2D"; 6 | fsType = "ntfs3"; 7 | noCheck = true; 8 | options = [ "rw" "uid=1000" "nofail" ]; 9 | }; 10 | 11 | 12 | fileSystems."/mnt/disks/storage-1" = { 13 | device = "/dev/disk/by-label/storage-1-20tb"; 14 | fsType = "btrfs"; 15 | options = [ "compress=zstd" "nofail"]; 16 | }; 17 | 18 | fileSystems."/mnt/parity/parity-1" = { 19 | device = "/dev/disk/by-label/parity-1-20tb"; 20 | fsType = "ext4"; 21 | options = ["nofail"]; 22 | }; 23 | 24 | # TODO: setup mergerfs once we have more disks onliine 25 | # environment.systemPackages = [ pkgs.mergerfs ]; 26 | 27 | # fileSystems."/storage" = { 28 | # fsType = "fuse.mergerfs"; 29 | # device = "/mnt/disks/*"; 30 | # }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/waybar/colors-gtk-css.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | let 3 | colors = config.colorScheme.palette; 4 | in '' 5 | @define-color base00 #${colors.base00}; 6 | @define-color base01 #${colors.base01}; 7 | @define-color base02 #${colors.base02}; 8 | @define-color base03 #${colors.base03}; 9 | @define-color base04 #${colors.base04}; 10 | @define-color base05 #${colors.base05}; 11 | @define-color base06 #${colors.base06}; 12 | @define-color base07 #${colors.base07}; 13 | @define-color base08 #${colors.base08}; 14 | @define-color base09 #${colors.base09}; 15 | @define-color base0A #${colors.base0A}; 16 | @define-color base0B #${colors.base0B}; 17 | @define-color base0C #${colors.base0C}; 18 | @define-color base0D #${colors.base0D}; 19 | @define-color base0E #${colors.base0E}; 20 | @define-color base0F #${colors.base0F}; 21 | '' 22 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/nobby.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common 6 | 7 | ../features/cli/syncthing.nix 8 | #../features/desktop/common/davinci-resolve.nix 9 | 10 | #../features/desktop/sway 11 | #../features/desktop/sway/natural-scrolling.nix 12 | #../features/desktop/sway/nvidia.nix 13 | #../features/desktop/sway/no-hardware-cursors.nix 14 | #../features/desktop/i3 15 | #../features/desktop/hyprland 16 | #../features/desktop/hyprland/nvidia.nix 17 | ]; 18 | 19 | # TODO: switch back to wezterm if we get it working with nvida + wayland 20 | # home.sessionVariables.TERMINAL = "alacritty"; 21 | 22 | monitors = [ 23 | { 24 | name = "DP-1"; 25 | width = 3840; 26 | height = 2160; 27 | scale = 1.0; 28 | } 29 | ]; 30 | } 31 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/helix.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | let 3 | 4 | themes-repo = pkgs.fetchFromGitHub { 5 | owner = "CptPotato"; 6 | repo = "helix-themes"; 7 | rev = "0ebf77d9e1dc3ee71fbb2a2956810cfc131d0008"; 8 | sha256 = "sha256-Cr4NEEFq3XOmOvbsYpRUGkOY1Mq7wIFJzxVhf8e9T0c="; 9 | }; 10 | 11 | 12 | scheme-edge = (builtins.readFile "${themes-repo}/schemes/edge"); 13 | palette-neon = (builtins.readFile "${themes-repo}/palettes/edge/neon"); 14 | theme-edge-neon = lib.strings.concatStringsSep "\n" [scheme-edge palette-neon]; 15 | in 16 | { 17 | home.packages = [ pkgs.helix ]; 18 | 19 | home.file."helix-config" = { 20 | target = ".config/helix/config.toml"; 21 | text = '' 22 | theme = "edge-neon" 23 | ''; 24 | }; 25 | 26 | home.file."helix-theme-edge-neon" = { 27 | target = ".config/helix/themes/edge-neon.toml"; 28 | text = theme-edge-neon; 29 | }; 30 | } -------------------------------------------------------------------------------- /nixos/hosts/colon/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | { 3 | imports = [ 4 | ./hardware-configuration.nix 5 | 6 | ../../minimal.nix 7 | ../../features/tailscale.nix 8 | ../../features/plausible.nix 9 | 10 | ./wireguard.nix 11 | ./nginx.nix 12 | ./photoprism.nix 13 | ./nextcloud.nix 14 | ./kavita.nix 15 | ]; 16 | 17 | time.timeZone = lib.mkForce "UTC"; 18 | 19 | virtualisation.docker.enable = true; 20 | 21 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/colon.nix; 22 | 23 | networking.hostName = "colon"; 24 | networking.useDHCP = true; 25 | 26 | networking.firewall = { 27 | enable = true; 28 | allowedTCPPorts = [ 80 443 ]; 29 | }; 30 | 31 | networking.nameservers = ["1.1.1.1" "8.8.8.8"]; 32 | 33 | boot.loader.systemd-boot.enable = true; 34 | boot.loader.efi.canTouchEfiVariables = true; 35 | 36 | system.stateVersion = "23.11"; 37 | } 38 | -------------------------------------------------------------------------------- /nixos/hosts/colon/nextcloud.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | { 3 | 4 | age.secrets.nextcloud-admin-pass = { 5 | file = ../../../secrets/colon-nextcloud.age; 6 | mode = "770"; 7 | owner = "nextcloud"; 8 | group = "nextcloud"; 9 | }; 10 | 11 | security.acme = { 12 | acceptTerms = true; 13 | defaults.email = "yusef@napora.org"; 14 | }; 15 | 16 | services.nextcloud = { 17 | enable = true; 18 | package = pkgs.nextcloud29; 19 | datadir = "/data/nextcloud"; 20 | hostName = "cloud.napora.org"; 21 | maxUploadSize = "50G"; 22 | https = true; 23 | config = { 24 | adminuser = "root"; 25 | adminpassFile = config.age.secrets.nextcloud-admin-pass.path; 26 | }; 27 | settings = { 28 | overwriteprotocol = "https"; 29 | }; 30 | }; 31 | 32 | 33 | services.nginx.virtualHosts.${config.services.nextcloud.hostName} = { 34 | forceSSL = true; 35 | enableACME = true; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /nixos/hosts/detritus/default.nix: -------------------------------------------------------------------------------- 1 | # Host config for work vm on 16" intel macbook (vmware) 2 | 3 | { config, pkgs, lib, inputs, outputs, ... }: 4 | { 5 | imports = 6 | [ # Include the results of the hardware scan. 7 | ./hardware-configuration.nix 8 | 9 | ../../common.nix 10 | 11 | # enable various features 12 | ../../features/sound.nix 13 | ../../features/tailscale.nix 14 | ../../features/sway.nix 15 | 16 | # font config 17 | ../../features/hidpi.nix 18 | ]; 19 | 20 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/detritus.nix; 21 | 22 | virtualisation.docker.enable = true; 23 | virtualisation.vmware.guest.enable = true; 24 | 25 | # Use the systemd-boot EFI boot loader. 26 | boot.loader.systemd-boot.enable = true; 27 | boot.loader.efi.canTouchEfiVariables = false; 28 | 29 | networking.hostName = "detritus"; # Define your hostname. 30 | 31 | system.stateVersion = "23.05"; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/vscode-insiders.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | let 3 | inherit (pkgs.stdenv) system; 4 | 5 | sources = { 6 | x86_64-linux = { 7 | os = "linux-x64"; 8 | sha256 = ""; 9 | }; 10 | aarch64-linux = { 11 | os = "linux-arm64"; 12 | sha256 = "1723n1dd7y8lp0495g8x9n3ipbwlhly0xwv2bv4klhgd8vfd8fzf"; 13 | }; 14 | }; 15 | 16 | os = sources.${system}.os; 17 | sha256 = sources.${system}.sha256; 18 | 19 | src = builtins.fetchTarball { 20 | url = "https://code.visualstudio.com/sha/download?build=insider&os=${os}"; 21 | sha256 = sha256; 22 | }; 23 | 24 | vscode-insiders = (pkgs.vscode.override { isInsiders = true; }).overrideAttrs ( 25 | oldAttrs: rec { 26 | inherit src; 27 | version = "latest"; 28 | buildInputs = oldAttrs.buildInputs ++ [ pkgs.krb5 ]; 29 | }); 30 | in { 31 | programs.vscode = { 32 | enable = true; 33 | package = vscode-insiders.fhs; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /overlays/default.nix: -------------------------------------------------------------------------------- 1 | # This file defines overlays 2 | { inputs, ... }: 3 | { 4 | # This one brings our custom packages from the 'pkgs' directory 5 | additions = final: _prev: { 6 | # nest everything under a namespace that's not likely to collide 7 | # with anything in nixpkgs 8 | local-pkgs = import ../pkgs { pkgs = final; }; 9 | }; 10 | 11 | # This one contains whatever you want to overlay 12 | # You can change versions, add patches, set compilation flags, anything really. 13 | # https://nixos.wiki/wiki/Overlays 14 | modifications = final: prev: { 15 | # example = prev.example.overrideAttrs (oldAttrs: rec { 16 | # ... 17 | # }); 18 | }; 19 | 20 | # When applied, the unstable nixpkgs set (declared in the flake inputs) will 21 | # be accessible through 'pkgs.unstable' 22 | unstable-packages = final: _prev: { 23 | unstable = import inputs.nixpkgs-unstable { 24 | system = final.system; 25 | config.allowUnfree = true; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /nixos/features/plex-server.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | { 3 | # enable Plex server 4 | services.plex = let 5 | plexpass = pkgs.plex.override { 6 | plexRaw = pkgs.plexRaw.overrideAttrs (old: rec { 7 | version = "1.31.0.6654-02189b09f"; 8 | src = pkgs.fetchurl { 9 | url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb"; 10 | sha256 = "sha256-TTEcyIBFiuJTNHeJ9wu+4o2ol72oCvM9FdDPC83J3Mc="; 11 | }; 12 | }); 13 | }; 14 | 15 | audnexus-plugin = pkgs.fetchFromGitHub { 16 | owner = "djdembeck"; 17 | repo = "Audnexus.bundle"; 18 | rev = "v1.1.0"; 19 | sha256 = "sha256-eylY/fOfMRiDBFaFN1DUyISm/8FO9tRTGE6J/Owkqds="; 20 | }; 21 | in { 22 | enable = true; 23 | openFirewall = true; 24 | #package = plexpass; 25 | #extraPlugins = [ 26 | # (builtins.path { 27 | # name = "Audnexus.bundle"; 28 | # path = audnexus-plugin; 29 | # }) 30 | #]; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /nixos/hosts/nasty/samba-conf.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | 4 | # Samba config 5 | services.samba = { 6 | enable = true; 7 | securityType = "user"; 8 | openFirewall = true; 9 | extraConfig = '' 10 | workgroup = WORKGROUP 11 | server string = nasty 12 | netbios name = nasty 13 | security = user 14 | hosts allow = 192.168.86. 127.0.0.1 localhost 15 | hosts deny = 0.0.0.0/0 16 | guest account = nobody 17 | map to guest = bad user 18 | ''; 19 | shares = let 20 | common_attrs = { 21 | browseable = "yes"; 22 | "read only" = "no"; 23 | "guest ok" = "no"; 24 | "create mask" = "0644"; 25 | "directory mask" = "0755"; 26 | "force user" = "yusef"; 27 | "force group" = "users"; 28 | }; 29 | in { 30 | media = { 31 | path = "/ocean/media"; 32 | } // common_attrs; 33 | documents = { 34 | path = "/ocean/documents"; 35 | } // common_attrs; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/fonts.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | let 3 | mkFontOption = kind: { 4 | family = lib.mkOption { 5 | type = lib.types.str; 6 | default = null; 7 | description = "Family name for ${kind} font profile"; 8 | example = "Fira Code"; 9 | }; 10 | package = lib.mkOption { 11 | type = lib.types.package; 12 | default = null; 13 | description = "Package for ${kind} font profile"; 14 | example = "pkgs.fira-code"; 15 | }; 16 | }; 17 | cfg = config.fontProfiles; 18 | in { 19 | 20 | options.fontProfiles = { 21 | monospace = mkFontOption "monospace"; 22 | regular = mkFontOption "regular"; 23 | }; 24 | 25 | 26 | config = { 27 | fontProfiles = { 28 | monospace = { 29 | family = "FiraCode Nerd Font"; 30 | package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }; 31 | }; 32 | regular = { 33 | family = "Fira Sans"; 34 | package = pkgs.fira; 35 | }; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /nixos/hosts/nobby/restic.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, self, ... }: 2 | let 3 | secrets = config.age.secrets; 4 | home-dir = config.users.users.yusef.home; 5 | media-dir = "/mnt/rustbucket/Media"; 6 | in { 7 | 8 | age.secrets = { 9 | "restic/nobby-password".file = "${self}/secrets/restic/nobby-password.age"; 10 | "restic/nobby-env".file = "${self}/secrets/restic/nobby-env.age"; 11 | "restic/nobby-repo".file = "${self}/secrets/restic/nobby-repo.age"; 12 | }; 13 | 14 | services.restic.backups = { 15 | daily = { 16 | initialize = true; 17 | 18 | environmentFile = secrets."restic/nobby-env".path; 19 | repositoryFile = secrets."restic/nobby-repo".path; 20 | passwordFile = secrets."restic/nobby-password".path; 21 | 22 | paths = [ 23 | "${home-dir}/projects" 24 | "${home-dir}/Documents" 25 | 26 | "${media-dir}/Music recording" 27 | "${media-dir}/Home movies" 28 | ]; 29 | 30 | pruneOpts = [ 31 | "--keep-daily 7" 32 | "--keep-weekly 5" 33 | "--keep-monthly 12" 34 | ]; 35 | }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /nixos/hosts/nobby/samba.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | { 3 | 4 | # Samba config 5 | services.samba = { 6 | enable = true; 7 | openFirewall = true; 8 | settings = let 9 | common_attrs = { 10 | browseable = "yes"; 11 | "read only" = "no"; 12 | "guest ok" = "no"; 13 | "create mask" = "0644"; 14 | "directory mask" = "0755"; 15 | "force user" = "yusef"; 16 | "force group" = "users"; 17 | }; 18 | in { 19 | global = { 20 | workgroup = "WORKGROUP"; 21 | "server string" = config.networking.hostName; 22 | "netbios name" = config.networking.hostName; 23 | security = "user"; 24 | "hosts allow" = "192.168.86. 127.0.0.1 localhost"; 25 | "hosts deny" = "0.0.0.0/0"; 26 | "guest account" = "nobody"; 27 | "map to guest" = "bad user"; 28 | }; 29 | rustbucket = { 30 | path = "/mnt/rustbucket"; 31 | } // common_attrs; 32 | 33 | storage1 = { 34 | path = "/mnt/disks/storage-1"; 35 | } // common_attrs; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /nixos/features/sway.nix: -------------------------------------------------------------------------------- 1 | # enables sway (wayland window manager). 2 | # see home-manager config for all the interesting config bits 3 | { lib, pkgs, ...}: 4 | { 5 | environment.systemPackages = [ 6 | pkgs.wdisplays 7 | pkgs.xorg.xcursorthemes 8 | pkgs.vanilla-dmz 9 | pkgs.xfce.thunar 10 | pkgs.lxqt.lxqt-policykit # provides a default authentification client for policykit 11 | pkgs.qt6.qtwayland 12 | ]; 13 | programs.sway.enable = true; 14 | 15 | qt.enable = true; 16 | qt.style = "adwaita"; 17 | qt.platformTheme = "gnome"; 18 | 19 | # enable browsing smb shares in thunar, etc 20 | # see: https://nixos.wiki/wiki/Samba#Browsing_samba_shares_with_GVFS 21 | services.gvfs.enable = true; 22 | 23 | # enable gnome keyring so vscode, etc. can store credentials 24 | services.gnome = { 25 | gnome-keyring.enable = true; 26 | }; 27 | 28 | # Enable XDG portal for screen capture 29 | xdg.portal = { 30 | enable = true; 31 | extraPortals = with pkgs; [ 32 | xdg-desktop-portal-wlr 33 | kdePackages.xdg-desktop-portal-kde 34 | xdg-desktop-portal-gtk 35 | ]; 36 | wlr = { 37 | enable = true; 38 | }; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /home-manager/yusef/hosts/work-macbook-darwin.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, pkgs, config, ... }: 2 | { 3 | imports = [ 4 | ../global 5 | ../features/desktop/common/wezterm.nix 6 | ]; 7 | 8 | home.username = lib.mkForce "ynapora"; 9 | home.homeDirectory = lib.mkForce "/Users/ynapora"; 10 | 11 | programs.ssh.matchBlocks = { 12 | "code.citrite.net" = { 13 | identityFile = "/Users/ynapora/.ssh/pdm-git-rsa__code-citrite-net"; 14 | user = "git"; 15 | }; 16 | "ssh.code.sharefile-coretools.com" = { 17 | identityFile = "/Users/ynapora/.ssh/pdm-git-rsa__ssh-code-sharefile-coretools-com"; 18 | user = "git"; 19 | }; 20 | "github.com" = { 21 | identityFile = "/Users/ynapora/.ssh/id_ed25519-sharefile-github"; 22 | user = "git"; 23 | }; 24 | }; 25 | 26 | programs.fish.plugins = [ 27 | { 28 | name = "nvm"; 29 | src = pkgs.fetchFromGitHub { 30 | owner = "jorgebucaran"; 31 | repo = "nvm.fish"; 32 | rev = "a0892d0bb2304162d5faff561f030bb418cac34d"; 33 | sha256 = "sha256-GTEkCm+OtxMS3zJI5gnFvvObkrpepq1349/LcEPQRDo="; 34 | }; 35 | } 36 | ]; 37 | 38 | home.sessionVariables.nvm_default_version = "20"; 39 | } 40 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | { 3 | imports = [ 4 | ./fish.nix 5 | ./nushell 6 | ./git.nix 7 | ./helix.nix 8 | ./npm.nix 9 | ./nvim 10 | ./ssh.nix 11 | ./tmux.nix 12 | ./zellij.nix 13 | ./emacs.nix 14 | ]; 15 | 16 | home.packages = [ pkgs.nixVersions.stable ] ++ builtins.attrValues { 17 | inherit (pkgs) 18 | jq 19 | tealdeer 20 | unzip 21 | htop 22 | killall 23 | tree 24 | lnav 25 | duf 26 | ripgrep 27 | fd 28 | atool 29 | bat 30 | gron 31 | xh 32 | just 33 | nil 34 | ; 35 | }; 36 | 37 | programs = { 38 | direnv.enable = true; 39 | direnv.nix-direnv.enable = true; 40 | 41 | nix-index = { 42 | enable = true; 43 | enableFishIntegration = true; 44 | enableBashIntegration = true; 45 | }; 46 | 47 | fzf = { 48 | enable = true; 49 | enableFishIntegration = true; 50 | }; 51 | }; 52 | 53 | nixpkgs.config = import ./nixpkgs-config.nix; 54 | home.file."nixpkgs-config" = { 55 | target = ".config/nixpkgs/config.nix"; 56 | source = ./nixpkgs-config.nix; 57 | }; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /home-manager/yusef/global/colors.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, lib, config, ...}: 2 | { 3 | imports = [ 4 | inputs.nix-colors.homeManagerModule 5 | 6 | ]; 7 | 8 | colorScheme = lib.mkDefault inputs.nix-colors.colorSchemes.harmonic16-dark; 9 | 10 | # write the color scheme to a CSS file for future reference 11 | home.file.".config/colors/colorscheme.css".text = let 12 | colors = config.colorScheme.palette; 13 | in '' 14 | /* 15 | color scheme: ${config.colorScheme.name} (${config.colorScheme.variant}) 16 | */ 17 | :root { 18 | --color-base00: #${colors.base00}; 19 | --color-base01: #${colors.base01}; 20 | --color-base02: #${colors.base02}; 21 | --color-base03: #${colors.base03}; 22 | --color-base04: #${colors.base04}; 23 | --color-base05: #${colors.base05}; 24 | --color-base06: #${colors.base06}; 25 | --color-base07: #${colors.base07}; 26 | --color-base08: #${colors.base08}; 27 | --color-base09: #${colors.base09}; 28 | --color-base0A: #${colors.base0A}; 29 | --color-base0B: #${colors.base0B}; 30 | --color-base0C: #${colors.base0C}; 31 | --color-base0D: #${colors.base0D}; 32 | --color-base0E: #${colors.base0E}; 33 | --color-base0F: #${colors.base0F}; 34 | } 35 | ''; 36 | } 37 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | let 3 | inherit (lib) mkIf; 4 | inherit (builtins) attrValues; 5 | inherit (lib.lists) optionals; 6 | 7 | inherit (pkgs.stdenv) isLinux isx86_64; 8 | 9 | mkAsahiWrapper = (import ./asahi-wrapper.nix { inherit lib pkgs; }); 10 | kitty = mkAsahiWrapper { name = "kitty"; package = pkgs.kitty; }; 11 | 12 | common-packages = [ kitty pkgs.xfce.thunar ] 13 | ++ attrValues { 14 | inherit (pkgs) 15 | dmenu 16 | chromium 17 | zeal 18 | tigervnc 19 | obsidian 20 | _1password-gui 21 | vlc 22 | mpv 23 | bookworm 24 | ; 25 | }; 26 | 27 | x86-linux-packages = attrValues { 28 | inherit (pkgs) 29 | # calibre 30 | #zoom-us 31 | #slack 32 | simplescreenrecorder 33 | ; 34 | }; 35 | in { 36 | imports = [ 37 | ./fonts.nix 38 | ./alacritty.nix 39 | ./firefox.nix 40 | ./obs.nix 41 | ./wezterm.nix 42 | ./qt.nix 43 | ./vscode.nix 44 | ]; 45 | 46 | #programs.emacs.package = pkgs.emacs29-pgtk; 47 | 48 | home.packages = 49 | common-packages 50 | ++ optionals (isLinux && isx86_64) x86-linux-packages; 51 | 52 | wallpaper = lib.mkDefault ../backgrounds/jwst-carina.jpg; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /modules/nixos/vscode-server-nix-ld.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, ... }: 2 | let 3 | inherit (lib) types mkEnableOption mkOption mkIf lists; 4 | 5 | cfg = config.vscode-server-nix-ld; 6 | 7 | NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [ 8 | pkgs.stdenv.cc.cc 9 | ]; 10 | 11 | env-setup = '' 12 | export NIX_LD_LIBRARY_PATH=${NIX_LD_LIBRARY_PATH} 13 | export NIX_LD=$(cat ${pkgs.stdenv.cc}/nix-support/dynamic-linker | ${pkgs.findutils}/bin/xargs echo -n) 14 | ''; 15 | 16 | user-config-list = lists.forEach cfg.users (user: { 17 | name = user; 18 | value = { 19 | home.file.".vscode-server/server-env-setup".text = env-setup; 20 | }; 21 | }); 22 | 23 | user-configs = builtins.listToAttrs user-config-list; 24 | in { 25 | 26 | options.vscode-server-nix-ld = with types; { 27 | enable = mkEnableOption "Enable nix-ld based support for vscode server. The home-manager nixos module must be installed for this to work correctly."; 28 | users = mkOption { 29 | type = types.listOf types.str; 30 | description = "Users to enable vscode-server support for."; 31 | example = "[ \"yusef\" ]"; 32 | default = []; 33 | }; 34 | }; 35 | 36 | config = mkIf cfg.enable { 37 | programs.nix-ld.enable = true; 38 | environment.systemPackages = [ pkgs.wget ]; 39 | home-manager.users = user-configs; 40 | }; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /home-manager/yusef/global/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, outputs, lib, config, pkgs, ... }: 2 | let 3 | inherit (pkgs.stdenv) isDarwin; 4 | homeDirectory = if isDarwin then "/Users/yusef" else "/home/yusef"; 5 | in 6 | { 7 | imports = [ 8 | ./colors.nix 9 | ../features/cli 10 | ] ++ (builtins.attrValues outputs.homeManagerModules); 11 | 12 | nixpkgs = { 13 | overlays = [ 14 | outputs.overlays.additions 15 | outputs.overlays.modifications 16 | outputs.overlays.unstable-packages 17 | inputs.nur.overlays.default 18 | ]; 19 | config = { 20 | allowUnfree = true; 21 | # Workaround for https://github.com/nix-community/home-manager/issues/2942 22 | allowUnfreePredicate = (_: true); 23 | permittedInsecurePackages = [ 24 | "electron-27.3.11" 25 | ]; 26 | }; 27 | }; 28 | 29 | home = { 30 | username = lib.mkDefault "yusef"; 31 | homeDirectory = lib.mkDefault homeDirectory; 32 | sessionVariables = { 33 | EDITOR = "nvim"; 34 | TERMINAL = lib.mkDefault "wezterm"; 35 | COLORTERM = lib.mkDefault "truecolor"; 36 | BROWSER = lib.mkDefault "firefox"; 37 | }; 38 | }; 39 | 40 | programs.home-manager.enable = true; 41 | 42 | # systemd.user.startServices = "sd-switch"; 43 | 44 | # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion 45 | home.stateVersion = "23.05"; 46 | } 47 | -------------------------------------------------------------------------------- /nixos/hosts/detritus/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = [ ]; 8 | 9 | boot.initrd.availableKernelModules = [ "ata_piix" "mptspi" "uhci_hcd" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; 10 | boot.initrd.kernelModules = [ ]; 11 | boot.kernelModules = [ ]; 12 | boot.extraModulePackages = [ ]; 13 | 14 | fileSystems."/" = 15 | { device = "/dev/disk/by-uuid/28421eff-097e-49f1-84e6-14d8167905c9"; 16 | fsType = "ext4"; 17 | }; 18 | 19 | fileSystems."/boot" = 20 | { device = "/dev/disk/by-uuid/9E34-EE8D"; 21 | fsType = "vfat"; 22 | }; 23 | 24 | swapDevices = [ ]; 25 | 26 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 27 | # (the default) this is the recommended approach. When using systemd-networkd it's 28 | # still possible to use this option, but it's recommended to use it in conjunction 29 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 30 | networking.useDHCP = lib.mkDefault true; 31 | # networking.interfaces.ens33.useDHCP = lib.mkDefault true; 32 | 33 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 34 | } 35 | -------------------------------------------------------------------------------- /modules/home-manager/monitors.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | 3 | let 4 | inherit (lib) mkOption types; 5 | cfg = config.monitors; 6 | in 7 | { 8 | options.monitors = mkOption { 9 | type = types.listOf (types.submodule { 10 | options = { 11 | name = mkOption { 12 | type = types.str; 13 | example = "DP-1"; 14 | }; 15 | noBar = mkOption { 16 | type = types.bool; 17 | default = false; 18 | }; 19 | width = mkOption { 20 | type = types.int; 21 | example = 1920; 22 | }; 23 | height = mkOption { 24 | type = types.int; 25 | example = 1080; 26 | }; 27 | refreshRate = mkOption { 28 | type = types.int; 29 | default = 60; 30 | }; 31 | scale = mkOption { 32 | type = types.float; 33 | default = 1.0; 34 | }; 35 | x = mkOption { 36 | type = types.int; 37 | default = 0; 38 | }; 39 | y = mkOption { 40 | type = types.int; 41 | default = 0; 42 | }; 43 | enabled = mkOption { 44 | type = types.bool; 45 | default = true; 46 | }; 47 | workspace = mkOption { 48 | type = types.nullOr types.str; 49 | default = null; 50 | }; 51 | }; 52 | }); 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /modules/nixos/speakersafetyd.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: 2 | let 3 | cfg = config.services.speakersafetyd; 4 | speakersafetyd = pkgs.local-pkgs.speakersafetyd; 5 | in { 6 | options.services.speakersafetyd = { 7 | enable = lib.mkEnableOption "Enable speaker safety daemon for asahi linux"; 8 | }; 9 | 10 | config = lib.mkIf cfg.enable { 11 | 12 | services.udev.extraRules = '' 13 | SUBSYSTEM=="sound", DRIVERS=="snd-soc-macaudio", GOTO="speakersafetyd_macaudio" 14 | GOTO="speakersafetyd_end" 15 | 16 | LABEL="speakersafetyd_macaudio" 17 | KERNEL=="pcmC*D2c", ATTRS{id}=="J314", TAG+="systemd", ENV{ACP_IGNORE}="1", ENV{SYSTEMD_WANTS}="speakersafetyd.service" 18 | KERNEL=="pcmC*D2c", ATTRS{id}=="J413", TAG+="systemd", ENV{ACP_IGNORE}="1", ENV{SYSTEMD_WANTS}="speakersafetyd.service" 19 | 20 | LABEL="speakersafetyd_end" 21 | ''; 22 | 23 | systemd.services.speakersafetyd = { 24 | description = "Speaker safety daemon"; 25 | wantedBy = [ "multi-user.target" ]; 26 | startLimitIntervalSec = 60; 27 | startLimitBurst = 10; 28 | 29 | serviceConfig = { 30 | Type = "simple"; 31 | ExecStart = "${speakersafetyd}/bin/speakersafetyd -c ${speakersafetyd}/share/speakersafetyd"; 32 | UMask = "0066"; 33 | Restart = "on-failure"; 34 | RestartSec = 1; 35 | }; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /nixos/hosts/asahi/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/installer/scan/not-detected.nix") 9 | ]; 10 | 11 | boot.initrd.availableKernelModules = [ "usb_storage" "sdhci_pci" ]; 12 | boot.initrd.kernelModules = [ ]; 13 | boot.kernelModules = [ ]; 14 | boot.extraModulePackages = [ ]; 15 | 16 | fileSystems."/" = 17 | { device = "/dev/disk/by-uuid/98c1e408-8720-4d4c-9393-03aedb579389"; 18 | fsType = "ext4"; 19 | }; 20 | 21 | fileSystems."/boot" = 22 | { device = "/dev/disk/by-uuid/7EC9-130D"; 23 | fsType = "vfat"; 24 | }; 25 | 26 | swapDevices = [ ]; 27 | 28 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 29 | # (the default) this is the recommended approach. When using systemd-networkd it's 30 | # still possible to use this option, but it's recommended to use it in conjunction 31 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 32 | networking.useDHCP = lib.mkDefault true; 33 | # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; 34 | 35 | nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; 36 | } 37 | -------------------------------------------------------------------------------- /nixos/features/kindle/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | let 3 | # Script to extract the decryption key from Kindle for PC using the script 4 | # from the DeDRM calibre plugin (must be installed manually). 5 | # To use it with calibre, go to Preferences > Plugins > File Type > DeDRM 6 | # and hit "Configure plugin", then "Kindle for Mac/PC". On the dialog, import 7 | # the keyfile. 8 | # Note that the key is specific to each Kindle app install, so if you reinstall 9 | # the app, you'll need to extract the new key. 10 | kindle-key-script = (pkgs.writeScriptBin "kindle-key" '' 11 | SCRIPT_PATH="$HOME/.config/calibre/plugins/DeDRM/libraryfiles/kindlekey.py" 12 | if [ ! -f "$SCRIPT_PATH" ]; then 13 | echo "Calibre DeDRM plugin not found. Install and try again." 14 | exit 1 15 | fi 16 | 17 | if [ "$WINEPREFIX" = "" ]; then 18 | export WINEPREFIX="$HOME/.wine-nix/kindle" 19 | fi 20 | 21 | ${pkgs.wine}/bin/wine py -3 $SCRIPT_PATH ./kindlekey.k4i 22 | ''); 23 | in { 24 | environment.systemPackages = [ 25 | kindle-key-script 26 | 27 | pkgs.local-pkgs.kindle_1_17 28 | 29 | pkgs.wine # needed for calibre DeDRM plugin to find the key 30 | ]; 31 | 32 | # Kindle 1.17 needs a special certificate file to access the network. 33 | # see: https://askubuntu.com/a/1352999 34 | security.pki.certificateFiles = [ 35 | ./kindle-verisign-cert.crt 36 | ]; 37 | } 38 | -------------------------------------------------------------------------------- /nixos/features/plausible.nix: -------------------------------------------------------------------------------- 1 | { self, pkgs, lib, config, ... }: 2 | let 3 | domain = "plausible.napora.org"; 4 | in { 5 | age.secrets = { 6 | plausible-admin-password.file = "${self}/secrets/plausible-admin-password.age"; 7 | plausible-secret-keybase.file = "${self}/secrets/plausible-secret-keybase.age"; 8 | plausible-maxmind-license.file = "${self}/secrets/plausible-maxmind-license.age"; 9 | }; 10 | 11 | security.acme = { 12 | acceptTerms = true; 13 | defaults.email = "yusef@napora.org"; 14 | }; 15 | 16 | systemd.services.plausible = { 17 | environment.MAXMIND_EDITION = "GeoLite2-City"; 18 | serviceConfig.LoadCredential = [ 19 | "MAXMIND_LICENSE_KEY:${config.age.secrets.plausible-maxmind-license.path}" 20 | ]; 21 | }; 22 | 23 | services = { 24 | nginx.enable = true; 25 | 26 | nginx.virtualHosts.${domain} = { 27 | forceSSL = true; 28 | enableACME = true; 29 | locations."/".proxyPass = "http://127.0.0.1:${toString config.services.plausible.server.port}"; 30 | }; 31 | 32 | plausible = { 33 | enable = true; 34 | 35 | adminUser = { 36 | activate = true; 37 | email = "yusef@napora.org"; 38 | passwordFile = config.age.secrets.plausible-admin-password.path; 39 | }; 40 | 41 | server = { 42 | baseUrl = "https://${domain}"; 43 | secretKeybaseFile = config.age.secrets.plausible-secret-keybase.path; 44 | }; 45 | }; 46 | 47 | }; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/swaylock.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | let 3 | colors = config.colorScheme.palette; 4 | in { 5 | programs.swaylock = { 6 | enable = true; 7 | package = pkgs.swaylock-effects; 8 | settings = { 9 | effect-blur = "20x3"; 10 | fade-in = 0.1; 11 | 12 | font = config.fontProfiles.regular.family; 13 | font-size = 32; 14 | 15 | line-uses-inside = true; 16 | disable-caps-lock-text = true; 17 | indicator-caps-lock = true; 18 | indicator-radius = 100; 19 | indicator-idle-visible = true; 20 | 21 | ring-color = "#${colors.base02}"; 22 | inside-wrong-color = "#${colors.base08}"; 23 | ring-wrong-color = "#${colors.base08}"; 24 | key-hl-color = "#${colors.base0B}"; 25 | bs-hl-color = "#${colors.base08}"; 26 | ring-ver-color = "#${colors.base09}"; 27 | inside-ver-color = "#${colors.base09}"; 28 | inside-color = "#${colors.base01}"; 29 | text-color = "#${colors.base07}"; 30 | text-clear-color = "#${colors.base01}"; 31 | text-ver-color = "#${colors.base01}"; 32 | text-wrong-color = "#${colors.base01}"; 33 | text-caps-lock-color = "#${colors.base07}"; 34 | inside-clear-color = "#${colors.base0C}"; 35 | ring-clear-color = "#${colors.base0C}"; 36 | inside-caps-lock-color = "#${colors.base09}"; 37 | ring-caps-lock-color = "#${colors.base02}"; 38 | separator-color = "#${colors.base02}"; 39 | }; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /nixos/hosts/nobby/stashapp.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, outputs, ... }: 2 | let 3 | hostName = "nobby"; 4 | tailnetName = "chimera-tone"; 5 | data-path = "/mnt/disks/storage-1/media/smut"; 6 | state-path = "/mnt/disks/storage-1/docker/stash"; 7 | in { 8 | 9 | imports = [ outputs.nixosModules.ts-serve ]; 10 | 11 | virtualisation.oci-containers = { 12 | backend = "docker"; 13 | containers = { 14 | stashapp = { 15 | image = "stashapp/stash:latest"; 16 | # ports = ["9999:9999"]; 17 | extraOptions = [ 18 | "--network=container:TSstash" 19 | ]; 20 | dependsOn = [ "TSstash" ]; 21 | environment = { 22 | STASH_STASH = "/data/"; 23 | STASH_GENERATED = "/generated/"; 24 | STASH_METADATA = "/metadata/"; 25 | STASH_CACHE = "/cache"; 26 | STASH_BLOBS = "/blobs"; 27 | }; 28 | volumes = [ 29 | "/etc/zoneinfo/America/New_York:/etc/localtime:ro" 30 | "${data-path}:/data" 31 | "${state-path}/config:/root/.stash" 32 | "${state-path}/metadata:/metadata" 33 | "${state-path}/cache:/cache" 34 | "${state-path}/blobs:/blobs" 35 | "${state-path}/generated:/generated" 36 | ]; 37 | }; 38 | }; 39 | }; 40 | 41 | yomaq.pods.tailscaled."TSstash" = { 42 | TSserve = { 43 | "/" = "http://127.0.0.1:9999"; 44 | }; 45 | TShostname = "stash"; 46 | tags = [ "tag:container" ]; 47 | }; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/git.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | { 3 | home.file.".config/git/config-sharefile.inc".text = '' 4 | [user] 5 | email = "yusef.napora@cloud.com" 6 | ''; 7 | 8 | programs.jujutsu = { 9 | enable = true; 10 | }; 11 | 12 | programs.git = { 13 | enable = true; 14 | userName = "Yusef Napora"; 15 | userEmail = "yusef@napora.org"; 16 | aliases = { 17 | upstream-name = "!git remote | egrep -o '(upstream|origin)' | tail -1"; 18 | head-branch = "!basename $(git symbolic-ref refs/remotes/$(git upstream-name)/HEAD)"; 19 | cm = "!git checkout $(git head-branch)"; 20 | co = "checkout"; 21 | cob = "checkout -b"; 22 | cprev = "checkout @{-1}"; 23 | repo-root = "rev-parse --show-toplevel"; 24 | rr = "rev-parse --show-toplevel"; 25 | }; 26 | 27 | includes = [ 28 | { path = "~/.config/git/config-sharefile.inc"; 29 | condition = "gitdir:~/work/"; 30 | } 31 | ]; 32 | 33 | ignores = [ 34 | ".env" 35 | ".envrc" 36 | ".direnv/" 37 | "*.swp" 38 | ".idea/" 39 | ]; 40 | 41 | extraConfig = { 42 | init.defaultBranch = "main"; 43 | }; 44 | 45 | difftastic = { 46 | enable = true; 47 | background = "${config.colorScheme.variant}"; 48 | }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /nixos/hosts/colon/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/profiles/qemu-guest.nix") 9 | ]; 10 | 11 | boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "virtio_scsi" "usbhid" ]; 12 | boot.initrd.kernelModules = [ ]; 13 | boot.kernelModules = [ ]; 14 | boot.extraModulePackages = [ ]; 15 | 16 | fileSystems."/" = 17 | { device = "/dev/disk/by-uuid/59a06f37-4850-4166-aed7-82f307521dba"; 18 | fsType = "ext4"; 19 | }; 20 | 21 | fileSystems."/boot" = 22 | { device = "/dev/disk/by-uuid/F75E-63D7"; 23 | fsType = "vfat"; 24 | }; 25 | 26 | fileSystems."/data" = { 27 | device = "/dev/disk/by-label/data"; 28 | fsType = "ext4"; 29 | }; 30 | 31 | swapDevices = [ ]; 32 | 33 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 34 | # (the default) this is the recommended approach. When using systemd-networkd it's 35 | # still possible to use this option, but it's recommended to use it in conjunction 36 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 37 | networking.useDHCP = lib.mkDefault true; 38 | # networking.interfaces.eth0.useDHCP = lib.mkDefault true; 39 | 40 | nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; 41 | } 42 | -------------------------------------------------------------------------------- /modules/nixos/v4l2-loopback.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | inherit (lib) mkOption mkEnableOption mkIf types; 4 | 5 | device-submodule = types.submodule { 6 | options = { 7 | number = mkOption { 8 | description = "Device number to assign. will create e.g. /dev/video{number}"; 9 | type = types.ints.unsigned; 10 | }; 11 | label = mkOption { 12 | description = "Device label (shown in e.g. Zoom ui to select camera)"; 13 | type = types.str; 14 | }; 15 | }; 16 | }; 17 | 18 | device-number-strs = lib.forEach cfg.devices (c: builtins.toString c.number); 19 | device-labels = lib.forEach cfg.devices (c: c.label); 20 | video-nr = lib.concatStringsSep "," device-number-strs; 21 | label-str = lib.concatStringsSep "," device-labels; 22 | modprobe-config = '' 23 | options v4l2loopback exclusive_caps=1 video_nr=${video-nr} device_label=${label-str} 24 | ''; 25 | 26 | cfg = config.v4l2-loopback; 27 | in { 28 | options.v4l2-loopback = { 29 | enable = mkEnableOption "Enable video loopback devices with v4l2-loopback"; 30 | devices = mkOption { 31 | description = "Loopback video devices to create"; 32 | type = types.listOf device-submodule; 33 | }; 34 | }; 35 | 36 | config = mkIf cfg.enable { 37 | boot.extraModulePackages = with config.boot.kernelPackages; [ 38 | v4l2loopback.out 39 | ]; 40 | 41 | boot.kernelModules = [ 42 | "v4l2loopback" 43 | ]; 44 | 45 | boot.extraModprobeConfig = modprobe-config; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /nixos/hosts/colon/wireguard.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | let 3 | externalInterface = "enp0s6"; 4 | listenPort = 51820; 5 | 6 | peers = [ 7 | { 8 | name = "pixel-5"; 9 | publicKey = "V/0d3OUX3/XPjFQE72mMat2dmLOIK58I7Zo8tzh/7SQ="; 10 | allowedIPs = [ "10.100.0.2/32" ]; 11 | } 12 | ]; 13 | in { 14 | 15 | age.secrets.wireguard-privkey-colon = { 16 | file = ../../../secrets/wireguard-privkey-colon.age; 17 | mode = "600"; 18 | owner = "root"; 19 | group = "root"; 20 | }; 21 | 22 | networking = { 23 | nat = { 24 | enable = true; 25 | inherit externalInterface; 26 | internalInterfaces = [ "wg0" ]; 27 | }; 28 | 29 | firewall.allowedUDPPorts = [ listenPort ]; 30 | 31 | wireguard.interfaces.wg0 = { 32 | privateKeyFile = config.age.secrets.wireguard-privkey-colon.path; 33 | ips = [ "10.100.0.1/24" ]; 34 | 35 | inherit listenPort peers; 36 | 37 | # This allows the wireguard server to route your traffic to the internet and hence be like a VPN 38 | # For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients 39 | postSetup = '' 40 | ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ${externalInterface} -j MASQUERADE 41 | ''; 42 | 43 | # This undoes the above command 44 | postShutdown = '' 45 | ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ${externalInterface} -j MASQUERADE 46 | ''; 47 | 48 | }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /nixos/hosts/magrat/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/installer/scan/not-detected.nix") 9 | ]; 10 | 11 | boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; 12 | boot.initrd.kernelModules = [ ]; 13 | boot.kernelModules = [ "kvm-intel" ]; 14 | boot.extraModulePackages = [ ]; 15 | 16 | fileSystems."/" = 17 | { device = "/dev/disk/by-uuid/09d563c3-f5ca-47d3-8a44-187f7f007f06"; 18 | fsType = "ext4"; 19 | }; 20 | 21 | fileSystems."/boot" = 22 | { device = "/dev/disk/by-uuid/B2BC-E752"; 23 | fsType = "vfat"; 24 | options = [ "fmask=0022" "dmask=0022" ]; 25 | }; 26 | 27 | swapDevices = [ ]; 28 | 29 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 30 | # (the default) this is the recommended approach. When using systemd-networkd it's 31 | # still possible to use this option, but it's recommended to use it in conjunction 32 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 33 | networking.useDHCP = lib.mkDefault true; 34 | # networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true; 35 | 36 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 37 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 38 | } 39 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/i3/picom.nix: -------------------------------------------------------------------------------- 1 | # enable picom compositor, so we can have transparency in polybar & other cool stuff 2 | { pkgs, lib, config, ... }: 3 | { 4 | services.picom = { 5 | enable = true; 6 | fade = true; 7 | fadeDelta = 5; 8 | 9 | shadow = true; 10 | shadowOffsets = [ (-7) (-7) ]; 11 | shadowOpacity = 0.7; 12 | shadowExclude = [ 13 | "window_type *= 'normal' && ! name ~= ''" 14 | "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" # don't draw multiple shadows for tabbed windows 15 | "class_g = 'firefox' && argb" # fix odd shadows for some firefox windows 16 | "class_i = 'rofi'" # disable shadows for rofi to fix odd corner rendering 17 | ]; 18 | 19 | activeOpacity = 1.0; 20 | 21 | # set terminal windows to 80% opacity when unfocused. 22 | # using this instead of inactiveOpacity, since the latter is 23 | # too distracting when e.g. coding with a web-browser in split screen 24 | opacityRules = [ 25 | "80: class_i = 'kitty' && focused != 1" 26 | "80: class_i = 'Alacritty' && focused != 1" 27 | "80: class_i = 'wezterm' && focused != 1" 28 | 29 | # don't render hidden windows (prevents semi-transparent tabbed windows) 30 | "0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'" 31 | "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'" 32 | "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'" 33 | "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'" 34 | "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'" 35 | ]; 36 | 37 | backend = "xrender"; 38 | vSync = true; 39 | 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /nixos/hosts/nasty/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/installer/scan/not-detected.nix") 9 | ]; 10 | 11 | boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; 12 | boot.initrd.kernelModules = [ ]; 13 | boot.kernelModules = [ "kvm-intel" ]; 14 | boot.extraModulePackages = [ ]; 15 | 16 | fileSystems."/" = 17 | { device = "/dev/disk/by-uuid/84b11a5f-4a72-4b30-8ca0-b04d099c0ff0"; 18 | fsType = "ext4"; 19 | }; 20 | 21 | fileSystems."/boot" = 22 | { device = "/dev/disk/by-uuid/4AB0-F031"; 23 | fsType = "vfat"; 24 | }; 25 | 26 | swapDevices = [ ]; 27 | 28 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 29 | # (the default) this is the recommended approach. When using systemd-networkd it's 30 | # still possible to use this option, but it's recommended to use it in conjunction 31 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 32 | networking.useDHCP = lib.mkDefault true; 33 | # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; 34 | # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; 35 | 36 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 37 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 38 | } 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My nix configurations 2 | 3 | This repo has my personal configuration for [NixOS](https://nixos.org) and [nix-darwin](https://github.com/LnL7/nix-darwin), including a cross-platform [home-manager](https://nix-community.github.io/home-manager/) configuration used by both. 4 | 5 | Refactored from my [old config](https://github.com/yusefnapora/nixos-system-flake) using [Misterio77's awesome starter template](https://github.com/Misterio77/nix-starter-configs) as a starting point, since my old config was becoming a bit of a rats nest, and Gabriel's configs are really nicely organized and have some great defaults for things like configuring nixpkgs. 6 | 7 | ## Structure 8 | 9 | - `flake.nix`: flake entrypoint 10 | - `darwin`: nix-darwin host configurations 11 | - `home-manager`: home-manager configurations & features 12 | - `modules`: nixos and home-manager modules that could potentially be upstreamed 13 | - `nixos`: NixOS host configurations & features 14 | - `overlays`: nixpkgs overlays, including local packages & nixpkgs-unstable 15 | - `pkgs`: local packages that could potentially be upstreamed to nixpkgs 16 | 17 | ## Usage 18 | 19 | The `justfile` defines a few recipies using the [just](https://github.com/casey/just) command runner. Run `just --list` to list all recipies. The most important are `just switch`, which builds the config (for the current hostname by default) and switches to it, `just build` which builds but doesn't switch, and `just trace`, which prints the stacktrace when things fail to build. 20 | 21 | If you don't have `just` installed but do have nix, run `nix develop` to open a bootstrap shell environment. 22 | 23 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/alacritty.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: 2 | let 3 | colors = config.colorScheme.palette; 4 | in { 5 | programs.alacritty = { 6 | enable = true; 7 | settings = { 8 | font.size = 14; 9 | font.normal.family = "FiraCode Nerd Font Mono"; 10 | font.bold.family = "FiraCode Nerd Font Mono"; 11 | 12 | colors = { 13 | primary = { 14 | foreground = "#${colors.base05}"; 15 | background = "#${colors.base00}"; 16 | }; 17 | 18 | # Colors the cursor will use if `custom_cursor_colors` is true 19 | cursor = { 20 | text = "#${colors.base00}"; 21 | cursor = "#${colors.base05}"; 22 | }; 23 | 24 | # Normal colors 25 | normal = { 26 | black = "#${colors.base00}"; 27 | red = "#${colors.base08}"; 28 | green = "#${colors.base0B}"; 29 | yellow = "#${colors.base0A}"; 30 | blue = "#${colors.base0D}"; 31 | magenta = "#${colors.base0E}"; 32 | cyan = "#${colors.base0C}"; 33 | white = "#${colors.base05}"; 34 | }; 35 | # Bright colors 36 | bright = { 37 | black = "#${colors.base03}"; 38 | red = "#${colors.base09}"; 39 | green = "#${colors.base01}"; 40 | yellow = "#${colors.base02}"; 41 | blue = "#${colors.base04}"; 42 | magenta = "#${colors.base06}"; 43 | cyan = "#${colors.base0F}"; 44 | white = "#${colors.base07}"; 45 | }; 46 | draw_bold_text_with_bright_colors = false; 47 | }; 48 | }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /nixos/hosts/nasty/default.nix: -------------------------------------------------------------------------------- 1 | # Host config for home NAS box / plex server 2 | 3 | { lib, config, pkgs, outputs, ... }: 4 | { 5 | imports = 6 | [ # Include the results of the hardware scan. 7 | ./hardware-configuration.nix 8 | 9 | # base config 10 | ../../common.nix 11 | 12 | # samba share config 13 | ./samba-conf.nix 14 | 15 | # optional features 16 | ../../features/tailscale.nix 17 | ../../features/plex-server.nix 18 | 19 | # key mappings 20 | outputs.nixosModules.dual-function-keys 21 | ../../features/key-mapping/caps-to-ctrl-esc.nix 22 | ../../features/key-mapping/right-alt-to-ctrl-b.nix 23 | ]; 24 | 25 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/nasty.nix; 26 | 27 | 28 | # enable ZFS 29 | # see: https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/index.html 30 | boot.supportedFilesystems = [ "zfs" ]; 31 | # set hostId to first 8 chars of /etc/machine-id 32 | networking.hostId = "f94f2c6c"; 33 | # import pools on boot 34 | boot.zfs.extraPools = [ "ocean" ]; 35 | 36 | 37 | systemd.targets.hibernate.enable = false; 38 | 39 | environment.systemPackages = builtins.attrValues { 40 | inherit (pkgs) audible-cli ffmpeg; 41 | }; 42 | 43 | # Use the systemd-boot EFI boot loader. 44 | boot.loader.systemd-boot.enable = true; 45 | boot.loader.efi.canTouchEfiVariables = true; 46 | 47 | networking.hostName = "nasty"; # Define your hostname. 48 | 49 | networking.useDHCP = false; 50 | networking.interfaces.enp2s0.useDHCP = true; 51 | networking.interfaces.enp3s0.useDHCP = true; 52 | 53 | system.stateVersion = "22.11"; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /nixos/hosts/buddy/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/installer/scan/not-detected.nix") 9 | ]; 10 | 11 | boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; 12 | boot.initrd.kernelModules = [ ]; 13 | boot.kernelModules = [ "kvm-intel" ]; 14 | boot.extraModulePackages = [ ]; 15 | 16 | fileSystems."/" = 17 | { device = "/dev/disk/by-uuid/c62bd9e7-26b6-4d9c-8a48-701f10303591"; 18 | fsType = "ext4"; 19 | }; 20 | 21 | fileSystems."/boot" = 22 | { device = "/dev/disk/by-uuid/90D0-6292"; 23 | fsType = "vfat"; 24 | }; 25 | 26 | swapDevices = [ ]; 27 | 28 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 29 | # (the default) this is the recommended approach. When using systemd-networkd it's 30 | # still possible to use this option, but it's recommended to use it in conjunction 31 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 32 | networking.useDHCP = lib.mkDefault true; 33 | # networking.interfaces.enp88s0.useDHCP = lib.mkDefault true; 34 | # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; 35 | 36 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 37 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 38 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 39 | } 40 | -------------------------------------------------------------------------------- /nixos/hosts/nobby/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/installer/scan/not-detected.nix") 9 | ./storage.nix 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; 13 | boot.initrd.kernelModules = [ ]; 14 | boot.kernelModules = [ "kvm-intel" ]; 15 | boot.extraModulePackages = [ ]; 16 | boot.supportedFilesystems = [ "ntfs3" "zfs" "btrfs" ]; 17 | 18 | fileSystems."/" = 19 | { device = "/dev/disk/by-uuid/a5ef9c80-7b8e-4217-a06c-eac798b05c7f"; 20 | fsType = "ext4"; 21 | }; 22 | 23 | fileSystems."/boot" = 24 | { device = "/dev/disk/by-uuid/DFD9-154B"; 25 | fsType = "vfat"; 26 | }; 27 | 28 | swapDevices = [ ]; 29 | 30 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 31 | # (the default) this is the recommended approach. When using systemd-networkd it's 32 | # still possible to use this option, but it's recommended to use it in conjunction 33 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 34 | networking.useDHCP = lib.mkDefault true; 35 | # networking.interfaces.eno1.useDHCP = lib.mkDefault true; 36 | 37 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 38 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 39 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 40 | } 41 | -------------------------------------------------------------------------------- /nixos/features/fonts.nix: -------------------------------------------------------------------------------- 1 | { pkgs 2 | , lib 3 | , ...}: 4 | let 5 | nerdFonts = with pkgs.nerd-fonts; [ 6 | fira-code 7 | droid-sans-mono 8 | jetbrains-mono 9 | fantasque-sans-mono 10 | iosevka 11 | ]; 12 | in { 13 | # set the console font 14 | i18n.defaultLocale = "en_US.UTF-8"; 15 | console = { 16 | earlySetup = true; 17 | font = lib.mkDefault "${pkgs.powerline-fonts}/share/consolefonts/ter-powerline-v16n.psf.gz"; 18 | packages = [ pkgs.powerline-fonts ]; 19 | keyMap = "us"; 20 | }; 21 | 22 | # accept the license for the Joypixels font 23 | nixpkgs.config.joypixels.acceptLicense = true; 24 | 25 | fonts.fontconfig = { 26 | enable = lib.mkForce true; 27 | 28 | defaultFonts = { 29 | serif = [ "Liberation Serif" "Joypixels" ]; 30 | sansSerif = [ "SF Pro Display" "Joypixels" ]; 31 | monospace = [ "FiraCode Nerd Font Mono" ]; 32 | emoji = [ "Joypixels" ]; 33 | }; 34 | 35 | # fix pixelation 36 | antialias = true; 37 | 38 | # fix antialiasing blur 39 | hinting = { 40 | enable = true; 41 | style = "full"; 42 | autohint = true; 43 | }; 44 | 45 | subpixel = { 46 | rgba = "rgb"; 47 | lcdfilter = "default"; 48 | }; 49 | }; 50 | 51 | fonts.packages = nerdFonts ++ builtins.attrValues { 52 | inherit (pkgs) 53 | fira-code 54 | noto-fonts 55 | open-fonts 56 | powerline-fonts 57 | # helvetica-neue-lt-std 58 | liberation_ttf 59 | iosevka 60 | joypixels 61 | monaspace 62 | ; 63 | 64 | # custom fonts from this repo (see pkgs/fonts) 65 | inherit (pkgs.local-pkgs.custom-fonts) material-icons feather-icons sf-pro; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /nixos/hosts/magrat/default.nix: -------------------------------------------------------------------------------- 1 | # Host config for 2018 dell xps 13 2 | 3 | { config, pkgs, lib, inputs, outputs, ... }: 4 | { 5 | imports = 6 | [ # Include the results of the hardware scan. 7 | ./hardware-configuration.nix 8 | 9 | ../../common.nix 10 | 11 | # enable various features 12 | ../../features/sound.nix 13 | ../../features/tailscale.nix 14 | ../../features/sway.nix 15 | 16 | outputs.nixosModules.dual-function-keys 17 | ../../features/key-mapping/caps-to-ctrl-esc.nix 18 | ../../features/key-mapping/swap-left-alt-and-super.nix 19 | 20 | # font config 21 | ../../features/hidpi.nix 22 | ]; 23 | 24 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/magrat.nix; 25 | 26 | virtualisation.docker.enable = true; 27 | services.hardware.bolt.enable = true; 28 | services.fwupd.enable = true; 29 | 30 | environment.systemPackages = [ pkgs.fprintd ]; 31 | services.fprintd = { 32 | enable = true; 33 | #tod = { 34 | # enable = true; 35 | # driver = pkgs.libfprint-2-tod1-vfs0090; 36 | #}; 37 | }; 38 | security.pam.services.swaylock = { 39 | text = '' 40 | auth sufficient pam_unix.so try_first_pass likeauth nullok 41 | auth sufficient pam_fprintd.so 42 | auth include login 43 | ''; 44 | }; 45 | 46 | 47 | # Use the systemd-boot EFI boot loader. 48 | boot.loader.systemd-boot.enable = true; 49 | boot.loader.efi.canTouchEfiVariables = false; 50 | 51 | networking.hostName = "magrat"; # Define your hostname. 52 | networking.networkmanager.enable = true; 53 | systemd.services.NetworkManager-wait-online.enable = false; 54 | 55 | system.stateVersion = "24.05"; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /nixos/hosts/clacks/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ (modulesPath + "/installer/scan/not-detected.nix") 9 | ]; 10 | 11 | boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ohci_pci" "ehci_pci" "usbhid" "usb_storage" "sd_mod" ]; 12 | boot.initrd.kernelModules = [ ]; 13 | boot.kernelModules = [ "kvm-amd" ]; 14 | boot.extraModulePackages = [ ]; 15 | 16 | fileSystems."/" = 17 | { device = "/dev/disk/by-uuid/32dbab7e-a5d9-4055-8313-2b8899313f5e"; 18 | fsType = "ext4"; 19 | }; 20 | 21 | fileSystems."/boot" = 22 | { device = "/dev/disk/by-uuid/EEE0-1173"; 23 | fsType = "vfat"; 24 | }; 25 | 26 | swapDevices = [ ]; 27 | 28 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 29 | # (the default) this is the recommended approach. When using systemd-networkd it's 30 | # still possible to use this option, but it's recommended to use it in conjunction 31 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 32 | networking.useDHCP = lib.mkDefault true; 33 | # networking.interfaces.enp3s0f0.useDHCP = lib.mkDefault true; 34 | # networking.interfaces.enp3s0f1.useDHCP = lib.mkDefault true; 35 | # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; 36 | 37 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 38 | powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; 39 | hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 40 | } 41 | -------------------------------------------------------------------------------- /nixos/hosts/colon/photoprism.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | { 3 | age.secrets.photoprism-admin = { 4 | file = ../../../secrets/photoprism-admin.age; 5 | owner = "photoprism"; 6 | group = "photoprism"; 7 | mode = "770"; 8 | }; 9 | 10 | # bind mount the photoprism data dir to /data/photoprism 11 | fileSystems."/var/lib/private/photoprism" = 12 | { device = "/data/photoprism"; 13 | options = [ "bind" ]; 14 | }; 15 | 16 | services.photoprism = { 17 | enable = true; 18 | port = 2342; 19 | passwordFile = config.age.secrets.photoprism-admin.path; 20 | 21 | originalsPath = "/var/lib/private/photoprism/originals"; 22 | address = "127.0.0.1"; 23 | settings = { 24 | PHOTOPRISM_ADMIN_USER = "admin"; 25 | PHOTOPRISM_DEFAULT_LOCALE = "en"; 26 | PHOTOPRISM_DATABASE_DRIVER = "mysql"; 27 | PHOTOPRISM_DATABASE_NAME = "photoprism"; 28 | PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock"; 29 | PHOTOPRISM_DATABASE_USER = "photoprism"; 30 | PHOTOPRISM_SITE_URL = "https://pics.napora.org"; 31 | PHOTOPRISM_SITE_TITLE = "Our Pics"; 32 | }; 33 | }; 34 | 35 | services.mysql = { 36 | enable = true; 37 | package = pkgs.mariadb; 38 | ensureDatabases = [ "photoprism" ]; 39 | ensureUsers = [ { 40 | name = "photoprism"; 41 | ensurePermissions = { 42 | "photoprism.*" = "ALL PRIVILEGES"; 43 | }; 44 | } ]; 45 | }; 46 | 47 | services.nginx = { 48 | virtualHosts = { 49 | "pics.napora.org" = { 50 | forceSSL = true; 51 | enableACME = true; 52 | http2 = true; 53 | locations."/" = { 54 | proxyPass = "http://127.0.0.1:2342"; 55 | proxyWebsockets = true; 56 | }; 57 | }; 58 | }; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /nixos/features/kindle/kindle-verisign-cert.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB 3 | yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL 4 | ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp 5 | U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW 6 | ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 7 | aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL 8 | MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW 9 | ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln 10 | biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp 11 | U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y 12 | aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1 13 | nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex 14 | t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz 15 | SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG 16 | BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+ 17 | rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/ 18 | NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E 19 | BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH 20 | BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy 21 | aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv 22 | MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE 23 | p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y 24 | 5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK 25 | WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ 26 | 4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N 27 | hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq 28 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /darwin/features/yabai.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ...}: 2 | let 3 | inherit (lib) lists strings; 4 | 5 | floating-apps = [ 6 | "System Settings" 7 | # "Zoom" 8 | # "zoom.us" 9 | ]; 10 | 11 | floating-rules = lists.forEach floating-apps (name: 12 | "yabai -m rule --add app='${name}' manage=off" 13 | ); 14 | floating-rules-str = strings.concatStringsSep "\n" floating-rules; 15 | 16 | in 17 | { 18 | services.yabai = { 19 | enable = true; 20 | 21 | config = { 22 | window_placement = "second_child"; 23 | window_topmost = "on"; 24 | window_shadow = "float"; 25 | mouse_modifier = "ctrl"; 26 | }; 27 | 28 | extraConfig = floating-rules-str + "\n" 29 | + '' 30 | yabai -m config layout bsp 31 | ''; 32 | }; 33 | 34 | services.skhd = let 35 | hyper = "cmd + ctrl + alt"; 36 | yabai = "${pkgs.yabai}/bin/yabai"; 37 | wezterm = "/Applications/WezTerm.app/Contents/MacOS/wezterm"; 38 | in { 39 | enable = true; 40 | 41 | skhdConfig = '' 42 | # sleep when "F13" key is pressed (mapped to scroll lock via karabiner) 43 | f13 : pmset displaysleepnow 44 | 45 | 46 | ${hyper} - return : ${wezterm} start 47 | ${hyper} - h : ${yabai} -m window --swap west 48 | ${hyper} - j : ${yabai} -m window --swap south 49 | ${hyper} - k : ${yabai} -m window --swap north 50 | ${hyper} - l : ${yabai} -m window --swap east 51 | 52 | ${hyper} - space : ${yabai} -m window --toggle float 53 | ${hyper} - b : ${yabai} -m space --balance 54 | 55 | # increase size of the left-child (decrease size of right-child) of the containing node 56 | ${hyper} + shift - l : ${yabai} -m window --ratio rel:0.1 57 | 58 | # increase size of the right-child (decrease size of left-child) of the containing node 59 | ${hyper} + shift - h : ${yabai} -m window --ratio rel:-0.1 60 | ''; 61 | }; 62 | 63 | environment.systemPackages = [ pkgs.skhd ]; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/nushell/env.nu: -------------------------------------------------------------------------------- 1 | # Nushell Environment Config File 2 | # 3 | # version = 0.82.0 4 | 5 | $env.STARSHIP_SHELL = "nu" 6 | 7 | def create_left_prompt [] { 8 | starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)' 9 | } 10 | 11 | # Use nushell functions to define your right and left prompt 12 | $env.PROMPT_COMMAND = {|| create_left_prompt } 13 | $env.PROMPT_COMMAND_RIGHT = "" 14 | 15 | # The prompt indicators are environmental variables that represent 16 | # the state of the prompt 17 | $env.PROMPT_INDICATOR = "" 18 | $env.PROMPT_INDICATOR_VI_INSERT = ": " 19 | $env.PROMPT_INDICATOR_VI_NORMAL = "> " 20 | $env.PROMPT_MULTILINE_INDICATOR = "::: " 21 | 22 | # Specifies how environment variables are: 23 | # - converted from a string to a value on Nushell startup (from_string) 24 | # - converted from a value back to a string when running external commands (to_string) 25 | # Note: The conversions happen *after* config.nu is loaded 26 | $env.ENV_CONVERSIONS = { 27 | "PATH": { 28 | from_string: { |s| $s | split row (char esep) | path expand --no-symlink } 29 | to_string: { |v| $v | path expand --no-symlink | str join (char esep) } 30 | } 31 | "Path": { 32 | from_string: { |s| $s | split row (char esep) | path expand --no-symlink } 33 | to_string: { |v| $v | path expand --no-symlink | str join (char esep) } 34 | } 35 | } 36 | 37 | # Directories to search for scripts when calling source or use 38 | # 39 | # By default, /scripts is added 40 | $env.NU_LIB_DIRS = [ 41 | ($nu.default-config-dir | path join 'scripts') 42 | ] 43 | 44 | # Directories to search for plugin binaries when calling register 45 | # 46 | # By default, /plugins is added 47 | $env.NU_PLUGIN_DIRS = [ 48 | ($nu.default-config-dir | path join 'plugins') 49 | ] 50 | 51 | # To add entries to PATH (on Windows you might use Path), you can use the following pattern: 52 | # $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') 53 | -------------------------------------------------------------------------------- /nixos/minimal.nix: -------------------------------------------------------------------------------- 1 | # Baseline "minimal" config, suitable for headless boxes (router, raspberry pi, etc) 2 | # Most hosts extend from ./common.nix instead, which includes quality of life stuff 3 | # like fonts, podman, etc. 4 | 5 | { inputs, outputs, lib, config, pkgs, ... }: { 6 | # You can import other NixOS modules here 7 | imports = [ 8 | inputs.home-manager.nixosModules.home-manager 9 | inputs.agenix.nixosModules.default 10 | ./users.nix 11 | ]; 12 | 13 | time.timeZone = lib.mkDefault "America/NewYork"; 14 | 15 | home-manager.extraSpecialArgs = { inherit inputs outputs; }; 16 | 17 | programs.fish.enable = true; 18 | 19 | services.openssh.enable = true; 20 | 21 | environment.systemPackages = [ 22 | inputs.agenix.packages.${pkgs.stdenv.system}.default 23 | ]; 24 | 25 | nixpkgs = { 26 | overlays = [ 27 | outputs.overlays.additions 28 | outputs.overlays.modifications 29 | outputs.overlays.unstable-packages 30 | ]; 31 | config = { 32 | allowUnfree = true; 33 | }; 34 | }; 35 | 36 | nix = { 37 | # This will add each flake input as a registry 38 | # To make nix3 commands consistent with your flake 39 | registry = lib.mapAttrs (_: value: { flake = value; }) inputs; 40 | 41 | # This will additionally add your inputs to the system's legacy channels 42 | # Making legacy nix commands consistent as well, awesome! 43 | nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; 44 | 45 | settings = { 46 | # Enable flakes and new 'nix' command 47 | experimental-features = "nix-command flakes"; 48 | # Deduplicate and optimize nix store 49 | auto-optimise-store = true; 50 | 51 | # binary caches 52 | substituters = []; 53 | trusted-public-keys = []; 54 | }; 55 | }; 56 | 57 | # services.automatic-timezoned.enable = lib.mkDefault true; 58 | # The rest of the configuration is set by each host config, which will 59 | # import this file and extend to suit each host. 60 | } 61 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | # Build the system config and switch to it when running `just` with no args 2 | default: switch 3 | 4 | hostname := `hostname | cut -d "." -f 1` 5 | 6 | # Build the nix-darwin system configuration without switching to it 7 | [macos] 8 | build target_host=hostname flags="": 9 | @echo "Building nix-darwin config..." 10 | nix --extra-experimental-features 'nix-command flakes' build ".#darwinConfigurations.{{target_host}}.system" {{flags}} 11 | 12 | # Build the nix-darwin config with the --show-trace flag set 13 | [macos] 14 | trace target_host=hostname: (build target_host "--show-trace") 15 | 16 | # Build the nix-darwin configuration and switch to it 17 | [macos] 18 | switch target_host=hostname: (build target_host) 19 | @echo "switching to new config for {{target_host}}" 20 | ./result/sw/bin/darwin-rebuild switch --flake ".#{{target_host}}" 21 | 22 | # Reload the skhd (hotkey daemon) service to apply new config. Workaround for config changes not being auto-detected. 23 | [macos] 24 | reload-skhd: 25 | launchctl stop org.nixos.skhd && launchctl start org.nixos.skhd && sleep 1 && skhd -r 26 | 27 | # on asahi linux, we need to pass the --impure flag to read in firmware files 28 | rebuild_flags := `if [ -d /boot/asahi ]; then echo "--impure"; else echo ""; fi` 29 | 30 | 31 | # Build the NixOS configuration without switching to it 32 | [linux] 33 | build target_host=hostname flags="": 34 | nixos-rebuild build --flake .#{{target_host}} {{rebuild_flags}} {{flags}} 35 | 36 | # Build the NixOS config with the --show-trace flag set 37 | [linux] 38 | trace target_host=hostname: (build target_host "--show-trace") 39 | 40 | # Build the NixOS configuration and switch to it. 41 | [linux] 42 | switch target_host=hostname: 43 | sudo nixos-rebuild switch --flake .#{{target_host}} {{rebuild_flags}} 44 | 45 | # Update flake inputs to their latest revisions 46 | update: 47 | nix flake update 48 | 49 | 50 | # Garbage collect old OS generations and remove stale packages from the nix store 51 | gc generations="5d": 52 | sudo nix-env --delete-generations {{generations}} 53 | sudo nix-store --gc 54 | -------------------------------------------------------------------------------- /nixos/hosts/buddy/default.nix: -------------------------------------------------------------------------------- 1 | # Host config for intel nuc used for music production & recording 2 | 3 | { config, pkgs, lib, inputs, outputs, ... }: 4 | { 5 | imports = 6 | [ # Include the results of the hardware scan. 7 | ./hardware-configuration.nix 8 | 9 | # import module for musnix (music production kernel tuning, etc) 10 | # inputs.musnix.nixosModules.musnix 11 | 12 | ../../common.nix 13 | 14 | # enable various features 15 | ../../features/sound.nix 16 | ../../features/tailscale.nix 17 | ../../features/sway.nix 18 | ../../features/plex-server.nix 19 | #../../features/music-production.nix 20 | 21 | 22 | # key remapping 23 | outputs.nixosModules.dual-function-keys 24 | ../../features/key-mapping/caps-to-ctrl-esc.nix 25 | 26 | # font config 27 | ../../features/hidpi.nix 28 | ]; 29 | 30 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/buddy.nix; 31 | 32 | # thunderbolt support 33 | services.hardware.bolt.enable = true; 34 | 35 | # doesn't seem to want to wake from hibernate... 36 | systemd.targets.hibernate.enable = false; 37 | 38 | services.logind.extraConfig = '' 39 | # set power button to suspend instead of poweroff 40 | HandlePowerKey=suspend 41 | # suspend when idle timer kicks in 42 | IdleAction=suspend 43 | IdleActionSec=45m 44 | ''; 45 | 46 | # enable hw-accelerated video playback for intel GPU 47 | environment.variables = { 48 | LIBVA_DRIVER_NAME = "iHD"; 49 | VDPAU_DRIVER = "va_gl"; 50 | }; 51 | 52 | hardware.graphics = lib.mkForce { 53 | enable = true; 54 | extraPackages = with pkgs; [ 55 | intel-media-driver 56 | vaapiIntel 57 | vaapiVdpau 58 | libvdpau-va-gl 59 | ]; 60 | }; 61 | 62 | 63 | environment.sessionVariables = { 64 | QT_AUTO_SCREEN_SCALE_FACTOR = "1"; 65 | QT_ENABLE_HIGHDPI_SCALING = "1"; 66 | GDK_SCALE = "2"; 67 | }; 68 | 69 | 70 | # Use the systemd-boot EFI boot loader. 71 | boot.loader.systemd-boot.enable = true; 72 | boot.loader.efi.canTouchEfiVariables = false; 73 | 74 | networking.hostName = "buddy"; # Define your hostname. 75 | 76 | system.stateVersion = "23.05"; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/electron-hacks.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | { 3 | # start electron apps in native wayland mode 4 | 5 | programs.fish.shellAliases = { 6 | # vscode as of 1.85 doesn't work with wayland anymore, but the insiders build does, 7 | # so we only apply the hacks to code-insiders. 8 | # TODO: go back to non-insiders build when it works again 9 | code = "NIXOS_OZONE_WL=1 code-insiders"; 10 | obsidian = "OBSIDIAN_USE_WAYLAND=1 obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; 11 | chromium = "chromium --ozone-platform=wayland"; 12 | 13 | # leave 1password in Xwayland mode, since the clipboard is broken in wayland: 14 | # https://1password.community/discussion/121681/copy-passwords-under-pure-wayland 15 | # "1password" = "1password -enable-features=UseOzonePlatform -ozone-platform=wayland"; 16 | }; 17 | 18 | # apply wayland mode hacks to desktop entries for electron apps 19 | xdg.desktopEntries = { 20 | code = { 21 | name = "Visual Studio Code"; 22 | terminal = false; 23 | icon = "${config.programs.vscode.package}/lib/vscode/resources/app/resources/linux/code.png"; 24 | exec = "env NIXOS_OZONE_WL=1 code-insiders"; 25 | }; 26 | obsidian = { 27 | name = "Obsidian"; 28 | terminal = false; 29 | icon = "${pkgs.obsidian}/share/icons/hicolor/256x256/apps/obsidian.png"; 30 | exec = "env OBSIDIAN_USE_WAYLAND=1 obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; 31 | }; 32 | 33 | chromium-browser = { 34 | name = "Chromium"; 35 | terminal = false; 36 | icon = "${pkgs.chromium}/share/icons/hicolor/256x256/apps/chromium.png"; 37 | exec = "chromium --ozone-platform=wayland"; 38 | }; 39 | 40 | # use xwayland until clipboard bug is fixed: 41 | # https://1password.community/discussion/121681/copy-passwords-under-pure-wayland 42 | # "1password" = { 43 | # name = "1Password"; 44 | # terminal = false; 45 | # icon = "${pkgs._1password-gui}/share/1password/resources/icons/hicolor/256x256/apps/1password.png"; 46 | # exec = "1password -enable-features=UseOzonePlatform -ozone-platform=wayland"; 47 | # }; 48 | }; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/waybar/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | border: none; 3 | border-radius: 0; 4 | font-family: FiraCode Nerd Font; 5 | } 6 | 7 | window#waybar { 8 | background: @base00; 9 | color: @base06; 10 | } 11 | 12 | tooltip { 13 | background: @base03; 14 | border: 1px solid @base02; 15 | border-radius: 10px; 16 | } 17 | tooltip label { 18 | color: white; 19 | } 20 | 21 | 22 | #workspaces button { 23 | padding: 0 5px; 24 | background: transparent; 25 | color: @base06; 26 | border-bottom: 2px solid transparent; 27 | } 28 | 29 | #workspaces button.focused { 30 | background: @base0B; 31 | color: @base01; 32 | border-bottom: 2px solid @base06; 33 | } 34 | 35 | #clock, #custom-clock, #battery, #pulseaudio, #tray { 36 | padding: 0 15px; 37 | margin: 0 0; 38 | } 39 | 40 | #tray { 41 | border-bottom: 2px solid @base0C; 42 | } 43 | 44 | #clock, #custom-clock { 45 | border-bottom: 2px solid @base0D; 46 | } 47 | 48 | #pulseaudio { 49 | border-bottom: 2px solid @base0D; 50 | } 51 | 52 | #battery { 53 | border-bottom: 2px solid @base0F; 54 | } 55 | 56 | #battery.charging { 57 | border-bottom: 2px solid @base0B; 58 | } 59 | 60 | #battery.warning { 61 | border-bottom: 2px solid @base0A; 62 | } 63 | 64 | #battery.critical { 65 | border-bottom: 2px solid @base09; 66 | } 67 | 68 | @keyframes blinkWarning { 69 | to { 70 | border-bottom: 2px solid @base08; 71 | } 72 | } 73 | 74 | @keyframes blinkCritical { 75 | to { 76 | color: @base08; 77 | border-bottom: 2px solid @base08; 78 | } 79 | } 80 | 81 | #battery.warning:not(.charging) { 82 | animation-name: blinkWarning; 83 | animation-duration: 1.5s; 84 | animation-timing-function: linear; 85 | animation-iteration-count: infinite; 86 | animation-direction: alternate; 87 | } 88 | 89 | #battery.critical:not(.charging) { 90 | animation-name: blinkCritical; 91 | animation-duration: 1.0s; 92 | animation-timing-function: linear; 93 | animation-iteration-count: infinite; 94 | animation-direction: alternate; 95 | } 96 | 97 | #mode { 98 | padding: 0 15px; 99 | background: @base04; 100 | border-bottom: 2px solid white; 101 | } 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/firefox.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, inputs, ... }: 2 | let 3 | inherit (lib) mkIf; 4 | inherit (pkgs.stdenv) isLinux; 5 | addons = pkgs.nur.repos.rycee.firefox-addons; 6 | in { 7 | config = mkIf isLinux { 8 | home.sessionVariables.BROWSER = "firefox"; 9 | 10 | programs.firefox = { 11 | enable = true; 12 | profiles.yusef = { 13 | extensions.packages = with addons; [ 14 | ublock-origin 15 | onepassword-password-manager 16 | # kagi-search 17 | ]; 18 | settings = { 19 | "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; 20 | "browser.disableResetPrompt" = true; 21 | "browser.download.panel.shown" = true; 22 | "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; 23 | "browser.shell.checkDefaultBrowser" = false; 24 | "browser.shell.defaultBrowserCheckCount" = 1; 25 | "browser.startup.homepage" = "https://kagi.com"; 26 | "privacy.trackingprotection.enabled" = true; 27 | "browser.uiCustomization.state" = ''{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["ublock0_raymondhill_net-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","customizableui-special-spring1","urlbar-container","customizableui-special-spring2","downloads-button","fxa-toolbar-menu-button","_d634138d-c276-4fc8-924b-40a0ea21d284_-browser-action"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["firefox-view-button","tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["import-button","personal-bookmarks"]},"seen":["save-to-pocket-button","developer-button","_d634138d-c276-4fc8-924b-40a0ea21d284_-browser-action","ublock0_raymondhill_net-browser-action"],"dirtyAreaCache":["nav-bar","PersonalToolbar","toolbar-menubar","TabsToolbar","unified-extensions-area"],"currentVersion":18,"newElementCount":2}''; 28 | }; 29 | }; 30 | }; 31 | 32 | xdg = { 33 | mime.enable = true; 34 | mimeApps.enable = true; 35 | mimeApps.defaultApplications = { 36 | "text/html" = [ "firefox.desktop" ]; 37 | "text/xml" = [ "firefox.desktop" ]; 38 | "x-scheme-handler/http" = [ "firefox.desktop" ]; 39 | "x-scheme-handler/https" = [ "firefox.desktop" ]; 40 | }; 41 | }; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /pkgs/wineApps/kindle.nix: -------------------------------------------------------------------------------- 1 | # Package for Kindle v1.17, the last version before KFX downloads were added. 2 | # Note that the system trust store needs to have a specific verisign root certificate 3 | # installed. See nixos/features/kindle/default.nix in this repo for that bit, plus 4 | # a script to extract the decryption key from the installed app. 5 | 6 | { pkgs 7 | , fetchurl 8 | , makeDesktopItem 9 | , symlinkJoin 10 | , wrapWine 11 | , ... }: 12 | let 13 | source = fetchurl { 14 | url = "https://ia600909.us.archive.org/6/items/kindle-for-pc-1-17-44170/kindle-for-pc-1-17-44170.exe"; 15 | sha256 = "001j2r2024icfr8nk6z9pxzp0krlf30jv2a6qk3w0xhj7w2z1q0l"; 16 | }; 17 | 18 | python-win-installer = fetchurl { 19 | url = "https://www.python.org/ftp/python/3.9.6/python-3.9.6.exe"; 20 | sha256 = "506f8d88063191e9c579a4d6b4274b16e941d004ce33f99ab34ef4c5be23e45b"; 21 | }; 22 | 23 | name = "kindle"; 24 | 25 | bin = wrapWine { 26 | inherit name; 27 | 28 | firstrunScript = '' 29 | echo "installing Kindle for PC" 30 | wine ${source} /S 31 | 32 | # create the default content folder 33 | mkdir -p "$WINE_NIX_PROFILES/${name}/Documents/My Kindle Content" 34 | 35 | # set the windows version reported by wine to 8.1, so we can install python 3 36 | winecfg /v win81 37 | 38 | # install python3 in our wine prefix 39 | echo "installing python" 40 | wine ${python-win-installer} /quiet 41 | 42 | # install cryptodome python module 43 | wine py -m pip install pycryptodome 44 | 45 | # reset windows version back to win7 to make the Kindle app happy 46 | winecfg /v win7 47 | ''; 48 | 49 | setupScript = '' 50 | # disable auto update 51 | APP_DIR="$WINE_NIX_PROFILES/${name}/AppData/Local/Amazon/Kindle" 52 | mkdir -p "$APP_DIR" 53 | rm -rf "$APP_DIR/updates" 54 | echo "no thanks" > "$APP_DIR/updates" 55 | ''; 56 | 57 | executable = "$WINEPREFIX/drive_c/Program Files/Amazon/Kindle/Kindle.exe"; 58 | }; 59 | 60 | desktop = makeDesktopItem { 61 | name = "Kindle"; 62 | desktopName = "Kindle"; 63 | type = "Application"; 64 | exec = "${bin}/bin/kindle"; 65 | icon = fetchurl { 66 | url = "https://m.media-amazon.com/images/I/51NEb1QMCHL.png"; 67 | sha256 = "0jk028paxfgxb3hwkn8igbzx7a7a3aqywz5v2spx920mqdc11bg1"; 68 | }; 69 | }; 70 | in symlinkJoin { 71 | name = "kindle"; 72 | paths = [bin desktop]; 73 | } 74 | -------------------------------------------------------------------------------- /secrets/secrets.nix: -------------------------------------------------------------------------------- 1 | let 2 | yusef-keys = [ 3 | "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCcNEoHJz21abNd7p2go7+nXAOMc9onYQ75MhHUpm1Y5rb1Yrw3ZBOgVgGNriDDa4j3TUgpONid87p1gpUXGpGk+bH9vPLC9rP2icQRDYcpNogJODI5LKnzjZ3ZzVhwc+oel340h4sFUrEkB7NH0A61Yq3wLf4rpnqmj0oREVVNPWUD28nlIokLyNxDByfhZ2xY79lB+FMZkTLoKBgrazFqGH8heZ6mUuKWn97rsTULoNlRtWnEHgh9AjKszRq6tv8s4LzB9i4qB4FROxDjrAWy7UdMK9F6rPuPHjBwin9xYH49sdXN5sDLfWk72iRxFfKd0vVt6H5Uo1OUWzdVrgJd" 4 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII280YRFMNNpVO7qxroCmuodMY5Hzo4UwTPoXuukU4tW" 5 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAtGHkPPabyi3Ea1X5qKpOVyzAmkDTf7zHXs7PzIRQjq" 6 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE8JtJB3EC/jldJUcScKgJCiiadLn6XBJto79G+mPyzL" 7 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICRYSwy0c0OZ+ZhmZja6o8ZM7gETNAW0b0La5gSrcNhI" 8 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKcE2ufdpALohHDM54J/QJkq1UEDdml6zwyFjgYXUdls" 9 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBeOYgB2H2OtnkiKcJ+x9a5Z3LMzg7hK8OTc72JmMR7g" 10 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGhK0nUmeLqBBZH6rYzJnDZIUb+4k4Nu5HnX8SKDQp46" 11 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsg702YZAQb1w1zo2Bqky/ypK16FssjxxZCqBPCjhNf" 12 | ]; 13 | 14 | host-keys = { 15 | sef-macbook = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPi0lvFFKfS1IaqgQr7cnOCKrtF/LDQGLku1RfJ8Jgw7"; 16 | colon = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK6oy9VKAAHj9zrX5lf8JWU/hRLCgcYTTI3Zjrg4EjsL"; 17 | nobby = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEiYTgKFzvLaju5krZwlEz6IvwDMlsTLcH7Qlw7a/gRZ"; 18 | buddy = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPpyhC+Eq0Z+0JqNZb9cQ0SwdGAsO9pdT1D1FpProSmQ"; 19 | }; 20 | 21 | all-hosts = builtins.attrValues host-keys; 22 | in { 23 | "photoprism-admin.age".publicKeys = yusef-keys ++ [ host-keys.colon ]; 24 | 25 | "wireguard-privkey-colon.age".publicKeys = [ host-keys.colon ]; 26 | 27 | "plausible-admin-password.age".publicKeys = yusef-keys ++ [ host-keys.colon ]; 28 | "plausible-secret-keybase.age".publicKeys = yusef-keys ++ [ host-keys.colon ]; 29 | "plausible-maxmind-license.age".publicKeys = yusef-keys ++ [ host-keys.colon ]; 30 | 31 | "restic/nobby-env.age".publicKeys = yusef-keys ++ [ host-keys.nobby ]; 32 | "restic/nobby-repo.age".publicKeys = yusef-keys ++ [ host-keys.nobby ]; 33 | "restic/nobby-password.age".publicKeys = yusef-keys ++ [ host-keys.nobby ]; 34 | 35 | "kavita-token.age".publicKeys = yusef-keys ++ [ host-keys.colon ]; 36 | 37 | "tailscaleOAuthEnvFile.age".publicKeys = yusef-keys ++ [ host-keys.nobby ]; 38 | } 39 | -------------------------------------------------------------------------------- /nixos/hosts/hex-wsl/default.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, modulesPath, inputs, ... }: 2 | { 3 | imports = [ 4 | inputs.nixos-wsl.nixosModules.wsl 5 | 6 | ../../common.nix 7 | ]; 8 | 9 | 10 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/hex-wsl.nix; 11 | 12 | wsl = { 13 | enable = true; 14 | defaultUser = "yusef"; 15 | startMenuLaunchers = true; 16 | nativeSystemd = true; 17 | 18 | wslConf.interop.appendWindowsPath = false; 19 | 20 | # Enable native Docker support 21 | # docker-native.enable = true; 22 | 23 | # Enable integration with Docker Desktop (needs to be installed) 24 | # docker-desktop.enable = true; 25 | 26 | }; 27 | 28 | 29 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 30 | programs.fish.shellInit = '' 31 | # set DISPLAY to host IP:0 to use X410 instead of WSLg 32 | # motivation: X410 supports window snapping / fancy zones / komorebi, etc. 33 | # revisit if this is fixed: https://github.com/microsoft/wslg/issues/22 34 | # WSLg should be disabled (https://x410.dev/cookbook/wsl/disabling-wslg-or-using-it-together-with-x410) 35 | # unless you need it for wayland 36 | set -x DISPLAY (grep nameserver /etc/resolv.conf | sed 's/nameserver //'):0 37 | 38 | # prefer to use linux vscode from cli 39 | set -x DONT_PROMPT_WSL_INSTALL true 40 | ''; 41 | 42 | # enable gnome-keyring 43 | services.gnome = { 44 | gnome-keyring.enable = true; 45 | }; 46 | 47 | 48 | systemd.services.nixos-wsl-systemd-fix = { 49 | description = "Fix the /dev/shm symlink to be a mount"; 50 | unitConfig = { 51 | DefaultDependencies = "no"; 52 | Before = [ "sysinit.target" "systemd-tmpfiles-setup-dev.service" "systemd-tmpfiles-setup.service" "systemd-sysctl.service" ]; 53 | ConditionPathExists = "/dev/shm"; 54 | ConditionPathIsSymbolicLink = "/dev/shm"; 55 | ConditionPathIsMountPoint = "/run/shm"; 56 | }; 57 | serviceConfig = { 58 | Type = "oneshot"; 59 | ExecStart = [ 60 | "${pkgs.coreutils-full}/bin/rm /dev/shm" 61 | "/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm" 62 | ]; 63 | }; 64 | wantedBy = [ "sysinit.target" ]; 65 | }; 66 | 67 | programs.dconf.enable = true; 68 | security.pam.services.xdm.enableGnomeKeyring = true; 69 | 70 | programs.ssh.startAgent = true; 71 | services.openssh.ports = [ 2022 ]; 72 | 73 | networking.hostName = "Hex"; 74 | 75 | system.stateVersion = "22.05"; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /nixos/hosts/asahi/default.nix: -------------------------------------------------------------------------------- 1 | # Host config for 14" M1-Pro macbook pro 2 | 3 | { config, pkgs, lib, inputs, outputs, ... }: 4 | { 5 | imports = 6 | [ # Include the results of the hardware scan. 7 | ./hardware-configuration.nix 8 | 9 | # apple-silicon hardware support 10 | inputs.apple-silicon.nixosModules.apple-silicon-support 11 | 12 | ../../common.nix 13 | 14 | # enable various features 15 | ../../features/sound.nix 16 | ../../features/bluetooth.nix 17 | ../../features/tailscale.nix 18 | #../../features/sway.nix 19 | ../../features/kde.nix 20 | 21 | # font config 22 | ../../features/hidpi.nix 23 | 24 | # key mappings 25 | outputs.nixosModules.dual-function-keys 26 | ../../features/key-mapping/caps-to-ctrl-esc.nix 27 | ../../features/key-mapping/right-alt-to-ctrl-b.nix 28 | 29 | # loopback video (for virtual webcam) 30 | outputs.nixosModules.v4l2-loopback 31 | ]; 32 | 33 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/asahi.nix; 34 | 35 | v4l2-loopback = { 36 | enable = true; 37 | devices = [ 38 | { 39 | number = 0; 40 | label = "Droidcam"; 41 | } 42 | ]; 43 | }; 44 | 45 | 46 | environment.systemPackages = [ pkgs.droidcam ]; 47 | boot.kernelModules = [ "snd-aloop" ]; 48 | 49 | 50 | # asahi linux overlay 51 | # nixpkgs.overlays = [ inputs.apple-silicon.overlays.apple-silicon-overlay ]; 52 | 53 | # enable GPU support and audio 54 | hardware.asahi.useExperimentalGPUDriver = true; 55 | hardware.asahi.experimentalGPUInstallMode = "replace"; 56 | hardware.asahi.setupAsahiSound = true; 57 | 58 | # backlight control 59 | programs.light.enable = true; 60 | services.actkbd = { 61 | enable = true; 62 | bindings = [ 63 | { keys = [ 225 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -A 10"; } 64 | { keys = [ 224 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -U 10"; } 65 | ]; 66 | }; 67 | 68 | 69 | # Use the systemd-boot EFI boot loader. 70 | boot.loader.systemd-boot.enable = true; 71 | boot.loader.efi.canTouchEfiVariables = false; 72 | 73 | networking.hostName = "asahi"; # Define your hostname. 74 | networking.wireless.iwd = { 75 | enable = true; 76 | settings.General.EnableNetworkConfiguration = true; 77 | }; 78 | networking.networkmanager = { 79 | enable = true; 80 | wifi.backend = "iwd"; 81 | }; 82 | 83 | system.stateVersion = "23.05"; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /darwin/hosts/common.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, inputs, outputs, ... }: 2 | let 3 | inherit (inputs) nixpkgs; 4 | in 5 | { 6 | imports = [ 7 | inputs.home-manager.darwinModules.home-manager 8 | inputs.agenix.darwinModules.default 9 | ../fonts.nix 10 | ]; 11 | 12 | home-manager.extraSpecialArgs = { inherit inputs outputs; }; 13 | 14 | users.users = { 15 | yusef = { 16 | name = "yusef"; 17 | home = "/Users/yusef"; 18 | }; 19 | }; 20 | 21 | # List packages installed in system profile. To search by name, run: 22 | # $ nix-env -qaP | grep wget 23 | environment.systemPackages = [ 24 | pkgs.vim 25 | pkgs.fish 26 | pkgs.rustup 27 | inputs.agenix.packages.${pkgs.stdenv.system}.default 28 | ]; 29 | 30 | security.pam.services.sudo_local.touchIdAuth = true; 31 | 32 | programs.fish.enable = true; 33 | programs.fish.shellInit = '' 34 | set -gx PATH /run/current-system/sw/bin $HOME/.nix-profile/bin $PATH 35 | ''; 36 | 37 | # keep zsh as login shell, but immediately launch fish 38 | # see: https://nixos.wiki/wiki/Fish#Setting_fish_as_your_shell 39 | # and: https://discourse.nixos.org/t/using-fish-interactively-with-zsh-as-the-default-shell-on-macos/48402 40 | programs.zsh = { 41 | enable = true; 42 | loginShellInit = '' 43 | if [[ -f $HOME/.zshrc ]] 44 | then 45 | source $HOME/.zshrc 46 | fi 47 | if [[ -f $HOME/.zprofile ]] 48 | then 49 | source $HOME/.zprofile 50 | fi 51 | if [[ $(ps -o command= -p "$PPID" | awk '{print $1}') != 'fish' ]] 52 | then 53 | exec fish -l 54 | fi 55 | ''; 56 | }; 57 | 58 | #environment.shells = builtins.attrValues { inherit (pkgs) bashInteractive zsh fish; }; 59 | 60 | # Auto upgrade nix package and the daemon service. 61 | nix.package = pkgs.nix; 62 | nix.extraOptions = '' 63 | experimental-features = nix-command flakes 64 | ''+ lib.optionalString (pkgs.system == "aarch64-darwin") '' 65 | extra-platforms = x86_64-darwin aarch64-darwin 66 | ''; 67 | 68 | # pin nixpkgs in the system flake registry to the revision used 69 | # to build the config 70 | nix.registry.nixpkgs.flake = nixpkgs; 71 | 72 | nixpkgs.config.allowUnfree = true; 73 | nixpkgs.config.overlays = [ 74 | (final: prev: lib.optionalAttrs (prev.stdenv.system == "aarch64-darwin") { 75 | # Add access to x86 packages system is running Apple Silicon 76 | pkgs-x86 = import nixpkgs { 77 | system = "x86_64-darwin"; 78 | config.allowUnfree = true; 79 | }; 80 | }) 81 | ]; 82 | 83 | system.stateVersion = 4; 84 | } 85 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/fish.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, system, inputs, ... }: 2 | let 3 | inherit (lib.lists) optionals; 4 | inherit (lib.attrsets) optionalAttrs; 5 | inherit (pkgs.stdenv) isLinux isDarwin; 6 | nix-colors-lib = inputs.nix-colors.lib-contrib { inherit pkgs; }; 7 | 8 | inherit (nix-colors-lib) shellThemeFromScheme; 9 | in 10 | { 11 | 12 | home.packages = builtins.attrValues { 13 | inherit (pkgs) 14 | eza 15 | starship 16 | any-nix-shell 17 | ; 18 | }; 19 | 20 | programs.fish = { 21 | enable = true; 22 | 23 | shellAliases = { 24 | ls = "${pkgs.eza}/bin/eza"; 25 | nix-search = "nix-env -qaP"; 26 | http = "${pkgs.xh}/bin/xh"; 27 | cdrr = "cd (git repo-root)"; 28 | } 29 | // optionalAttrs isDarwin { 30 | idea = "open -an 'IntelliJ IDEA.app'"; 31 | }; 32 | 33 | functions = { 34 | # get the current nix store path for the given binary 35 | nix-which = if isDarwin then "readlink (which $argv[1])" else "readlink -e (which $argv[1])"; 36 | 37 | # like nix-which, but stripping out the /bin/$program_name bit 38 | # useful for checking out other files in the same package 39 | nix-which-dir = "nix-which $argv[1] | sed -e 's/\\/bin\\/.*$//'"; 40 | 41 | # shortcut to trick lazy brain into using `nix shell` instead of 42 | # `nix-shell -p` 43 | ns = "${pkgs.any-nix-shell}/bin/.any-nix-wrapper fish shell nixpkgs#{$argv}"; 44 | }; 45 | 46 | interactiveShellInit = '' 47 | # init starship prompt 48 | ${pkgs.starship}/bin/starship init fish | source 49 | 50 | # setup any-nix-shell integration 51 | ${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source 52 | 53 | # If we're at a text console, load shell colors using a script 54 | # generated by the nix-colors module. Terminal emulators (alacritty, etc) 55 | # have their colors set elsewhere. 56 | if [ "$TERM" = "linux" ] 57 | sh ${shellThemeFromScheme { scheme = config.colorScheme; }} 58 | end 59 | ''; 60 | 61 | plugins = [ 62 | { 63 | name = "fish-ssh-agent"; 64 | src = pkgs.fetchFromGitHub { 65 | owner = "danhper"; 66 | repo = "fish-ssh-agent"; 67 | rev = "fd70a2afdd03caf9bf609746bf6b993b9e83be57"; 68 | sha256 = "sha256-e94Sd1GSUAxwLVVo5yR6msq0jZLOn2m+JZJ6mvwQdLs="; 69 | }; 70 | } 71 | ]; 72 | }; 73 | 74 | programs.broot = { 75 | enable = true; 76 | enableFishIntegration = true; 77 | }; 78 | } 79 | -------------------------------------------------------------------------------- /modules/nixos/dual-function-keys.nix: -------------------------------------------------------------------------------- 1 | { pkgs 2 | , lib 3 | , config 4 | , ...}: 5 | let 6 | inherit (lib) mkEnableOption mkOption mkIf types; 7 | inherit (lib.strings) optionalString concatStringsSep; 8 | inherit (lib.lists) optionals; 9 | inherit (lib.generators) toYAML; 10 | 11 | mapping-submodule = with types; types.submodule { 12 | options = { 13 | key = mkOption { 14 | type = str; 15 | description = "Key code of key that triggers the event (physical key being pressed)"; 16 | example = "KEY_CAPSLOCK"; 17 | }; 18 | 19 | tap = mkOption { 20 | type = oneOf [str (listOf str)]; 21 | description = "Key code to send when key is tapped"; 22 | example = "KEY_LEFTCTRL"; 23 | }; 24 | 25 | hold = mkOption { 26 | type = oneOf [str (listOf str)]; 27 | description = "Key code to send when key is held"; 28 | example = "KEY_ESC"; 29 | }; 30 | 31 | hold-start = mkOption { 32 | type = nullOr (oneOf [str (listOf str)]); 33 | description = "Honestly can't remember... check interception-tools docs later :)"; 34 | default = null; 35 | }; 36 | }; 37 | }; 38 | 39 | cfg = config.key-remapping.dual-function-keys; 40 | mapping-values = builtins.attrValues cfg.mappings; 41 | 42 | input-keys = lib.forEach mapping-values (m: m.key); 43 | listen-key-string = (concatStringsSep ", " input-keys); 44 | 45 | mappings = lib.forEach mapping-values (m: { 46 | KEY = m.key; 47 | TAP = m.tap; 48 | HOLD = m.hold; 49 | } // lib.optionalAttrs (m.hold-start != null) { 50 | HOLD_START = m.hold-start; 51 | }); 52 | 53 | config-yaml = toYAML {} { 54 | MAPPINGS = mappings; 55 | }; 56 | 57 | config-file = pkgs.writeText "dual-function-keys.yaml" config-yaml; 58 | 59 | in { 60 | 61 | options.key-remapping.dual-function-keys = { 62 | enable = mkEnableOption "Enable configuration of dual-function keys using interception-tools"; 63 | 64 | mappings = mkOption { 65 | type = types.attrsOf mapping-submodule; 66 | description = "Key mapping definitions"; 67 | default = {}; 68 | }; 69 | }; 70 | 71 | config = { 72 | services.interception-tools = { 73 | enable = true; 74 | plugins = [ pkgs.interception-tools-plugins.dual-function-keys ]; 75 | udevmonConfig = '' 76 | - JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c ${config-file} | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE" 77 | DEVICE: 78 | EVENTS: 79 | EV_KEY: [${listen-key-string}] 80 | ''; 81 | }; 82 | }; 83 | } -------------------------------------------------------------------------------- /pkgs/wrapWine.nix: -------------------------------------------------------------------------------- 1 | # lifted from here (thanks!): https://github.com/lucasew/nixcfg/blob/master/pkgs/wrapWine.nix 2 | 3 | { pkgs }: 4 | let 5 | inherit (builtins) length concatStringsSep; 6 | inherit (pkgs) lib cabextract writeShellScriptBin; 7 | inherit (lib) makeBinPath; 8 | in 9 | { is64bits ? false 10 | , wine ? if is64bits then pkgs.wineWowPackages.stable else pkgs.wine 11 | , wineFlags ? "" 12 | , executable 13 | , chdir ? null 14 | , name 15 | , tricks ? [ ] 16 | , setupScript ? "" 17 | , firstrunScript ? "" 18 | , home ? "" 19 | }: 20 | let 21 | wineBin = "${wine}/bin/wine${if is64bits then "64" else ""}"; 22 | requiredPackages = [ 23 | wine 24 | cabextract 25 | ]; 26 | WINENIX_PROFILES = "$HOME/.wine-nix-profiles"; 27 | PATH = makeBinPath requiredPackages; 28 | NAME = name; 29 | HOME = 30 | if home == "" 31 | then "${WINENIX_PROFILES}/${name}" 32 | else home; 33 | WINEARCH = 34 | if is64bits 35 | then "win64" 36 | else "win32"; 37 | setupHook = '' 38 | ${wine}/bin/wineboot 39 | ''; 40 | tricksHook = 41 | if (length tricks) > 0 then 42 | let 43 | tricksStr = concatStringsSep " " tricks; 44 | tricksCmd = '' 45 | pushd $(mktemp -d) 46 | wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks 47 | chmod +x winetricks 48 | ./winetricks ${tricksStr} 49 | popd 50 | ''; 51 | in 52 | tricksCmd 53 | else ""; 54 | script = writeShellScriptBin name '' 55 | export APP_NAME="${NAME}" 56 | export WINEARCH=${WINEARCH} 57 | export WINE_NIX="$HOME/.wine-nix" # define antes de definir $HOME senão ele vai gravar na nova $HOME a .wine-nix 58 | export WINE_NIX_PROFILES="${WINENIX_PROFILES}" 59 | export PATH=$PATH:${PATH} 60 | export HOME="${HOME}" 61 | mkdir -p "$HOME" 62 | export WINEPREFIX="$WINE_NIX/${name}" 63 | export EXECUTABLE="${executable}" 64 | mkdir -p "$WINE_NIX" "$WINE_NIX_PROFILES" 65 | ${setupScript} 66 | if [ ! -d "$WINEPREFIX" ] # if the prefix does not exist 67 | then 68 | ${setupHook} 69 | # ${wineBin} cmd /c dir > /dev/null 2> /dev/null # initialize prefix 70 | wineserver -w 71 | ${tricksHook} 72 | rm "$WINEPREFIX/drive_c/users/$USER" -rf 73 | ln -s "$HOME" "$WINEPREFIX/drive_c/users/$USER" 74 | ${firstrunScript} 75 | fi 76 | ${if chdir != null 77 | then ''cd "${chdir}"'' 78 | else ""} 79 | if [ ! "$REPL" == "" ]; # if $REPL is setup then start a shell in the context 80 | then 81 | bash 82 | exit 0 83 | fi 84 | 85 | ${wineBin} ${wineFlags} "$EXECUTABLE" "$@" 86 | wineserver -w 87 | ''; 88 | in 89 | script 90 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/wayland/waybar/default.nix: -------------------------------------------------------------------------------- 1 | { lib, config, pkgs, ... }: 2 | let 3 | inherit (lib) optionals; 4 | 5 | gtk-colors = import ./colors-gtk-css.nix { inherit config; }; 6 | style = gtk-colors + builtins.readFile ./style.css; 7 | 8 | hasSway = config.wayland.windowManager.sway.enable; 9 | sway = config.wayland.windowManager.sway.package; 10 | hasHyprland = config.wayland.windowManager.hyprland.enable; 11 | hyprland = config.wayland.windowManager.hyprland.package; 12 | 13 | in { 14 | 15 | wayland.windowManager.hyprland.settings.exec-once = optionals hasHyprland [ "waybar &" ]; 16 | wayland.windowManager.sway.config.bars = optionals hasSway [{ command = "waybar"; }]; 17 | 18 | programs.waybar = { 19 | enable = true; 20 | 21 | style = style; 22 | settings = { 23 | mainBar = { 24 | layer = "top"; 25 | position = "bottom"; 26 | height = 32; 27 | modules-left = (optionals hasSway [ "sway/workspaces" "sway/mode" ]) 28 | ++ (optionals hasHyprland [ "hyprland/workspaces" "hyprland/submap" ]) 29 | ++ ["wlr/taskbar"]; 30 | 31 | modules-center = (optionals hasSway [ "sway/window" ]) 32 | ++ (optionals hasHyprland [ "hyprland/window" ]); 33 | 34 | modules-right = [ "tray" "custom/clock" "pulseaudio" "battery" ]; 35 | 36 | "sway/workspaces" = { 37 | disable-scroll = true; 38 | all-outputs = true; 39 | }; 40 | 41 | "hyprland/workspaces" = { 42 | on-click = "activate"; 43 | disable-scroll = true; 44 | all-outputs = true; 45 | }; 46 | 47 | "custom/clock" = { 48 | return-type = "json"; 49 | exec = '' 50 | text=$(date +'%I:%M %p') 51 | tt=$(date +'%A, %B %d, %Y') 52 | echo "{\"text\": \"$text\", \"tooltip\": \"$tt\", \"class\": \"custom-clock\"}" 53 | ''; 54 | interval = 5; 55 | }; 56 | 57 | clock = { 58 | format = "{:%I:%M %p}"; 59 | tooltip-format = "{:%A, %B %d, %Y}"; 60 | }; 61 | 62 | "wlr/taskbar" = { 63 | on-click = "activate"; 64 | }; 65 | 66 | tray = { 67 | spacing = 10; 68 | }; 69 | 70 | battery = { 71 | interval = 60; 72 | states = { 73 | warning = 20; 74 | critical = 10; 75 | }; 76 | format = "{capacity}% {icon}"; 77 | format-icons = ["" "" "" "" ""]; 78 | }; 79 | 80 | pulseaudio = { 81 | format = "{volume}% {icon}"; 82 | format-bluetooth = "{volume}% {icon}"; 83 | format-muted = ""; 84 | format-icons = { 85 | headphone = ""; 86 | hands-free = ""; 87 | headset = ""; 88 | phone = ""; 89 | portable = ""; 90 | car = ""; 91 | default = ["" ""]; 92 | }; 93 | scroll-step = 1; 94 | on-click = "pavucontrol"; 95 | }; 96 | }; 97 | }; 98 | }; 99 | } 100 | -------------------------------------------------------------------------------- /nixos/users.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | { 3 | users.users.yusef = { 4 | isNormalUser = true; 5 | extraGroups = [ "wheel" "docker" "onepassword" "video" "libvirtd" "input" ]; 6 | shell = pkgs.fish; 7 | 8 | openssh.authorizedKeys.keys = [ 9 | "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCcNEoHJz21abNd7p2go7+nXAOMc9onYQ75MhHUpm1Y5rb1Yrw3ZBOgVgGNriDDa4j3TUgpONid87p1gpUXGpGk+bH9vPLC9rP2icQRDYcpNogJODI5LKnzjZ3ZzVhwc+oel340h4sFUrEkB7NH0A61Yq3wLf4rpnqmj0oREVVNPWUD28nlIokLyNxDByfhZ2xY79lB+FMZkTLoKBgrazFqGH8heZ6mUuKWn97rsTULoNlRtWnEHgh9AjKszRq6tv8s4LzB9i4qB4FROxDjrAWy7UdMK9F6rPuPHjBwin9xYH49sdXN5sDLfWk72iRxFfKd0vVt6H5Uo1OUWzdVrgJd" 10 | "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDSwdRPhehw39PvuHYJ0STfFhpTzpYYnSfWUL7YBRVZB0UiBx02zpBpP2cWvuTLkBgU+CwZa+grOvJks4HYNGjpLxprTFry9hPK+W/sGMO0DFqi2ySeHoYTRqb+0/A5IBUQ3dqDUkj3taV3jY2sIZdnu99Eq9vqBG98Wp1vkGGGLHKdaX23pjVTXWoMtnE4SEWGu3IZ4WBfiWJx9uH+Bunr3jklWfcRve/6PeyeJUGBayqKUqgOWLBBH4pva3HVfErPoDBHP6LXfw9TzqWruvnQXpuYBYM1NRIGBSXDuErC35ySCAL9nhASy48Pp3MTcEgH1jgE+Pc3SI8s2UJZGhOU3mHFMhGkgpN1i3iclynKbLHAr2ILbWEhWxLn5zfIqgXg0DXY7hSnDIBr0jURKXs4mQ0pNTxo8jJpVIZtf1jSscLCYb9pAbWFlmeF4W9k67oec/YdKNv9PbdxYHB3HrHSeDzDX6XqyIOtfvH6GieISSOuAsJIf0Bzyzysvc9iEsQbzTh6tS052mh53ITTOYrcUz2bRT1e6++baDQZpUvdaLmECEWsfFXyfCZEbXuqIwHjfcwhGGxn1oJgfRh4LDGsr4V4Lax3KGozv3+qpaAVyjyOzU205uEy5nNam8njJWXNXYDDEBmXld9YTxjGkJVa7NyYA4Yx4gfXN2xffmx2Nw==" 11 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFDI+dmShHHGmqT6Cd1ocgJ+ZPDg8B4kmam9ffcS0VsP" 12 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII280YRFMNNpVO7qxroCmuodMY5Hzo4UwTPoXuukU4tW" 13 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAtGHkPPabyi3Ea1X5qKpOVyzAmkDTf7zHXs7PzIRQjq" 14 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICRYSwy0c0OZ+ZhmZja6o8ZM7gETNAW0b0La5gSrcNhI yusef@nobby" 15 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsg702YZAQb1w1zo2Bqky/ypK16FssjxxZCqBPCjhNf yusef@asahi" 16 | ]; 17 | }; 18 | 19 | users.users.root.openssh.authorizedKeys.keys = 20 | config.users.users.yusef.openssh.authorizedKeys.keys; 21 | 22 | # allow running nixos-rebuild as root without a password. 23 | # requires us to explicitly pull in nixos-rebuild from pkgs, so 24 | # we get the right path in the sudo config 25 | environment.systemPackages = [ pkgs.nixos-rebuild ]; 26 | security.sudo.extraRules = [ 27 | { users = [ "yusef" ]; 28 | commands = [ 29 | { command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; 30 | options = [ "NOPASSWD" "SETENV" ]; 31 | } 32 | { command = "/run/current-system/sw/bin/nixos-rebuild"; 33 | options = [ "NOPASSWD" "SETENV" ]; 34 | } 35 | { command = "${pkgs.systemd}/bin/systemctl"; 36 | options = [ "NOPASSWD" "SETENV" ]; 37 | } 38 | # reboot and shutdown are symlinks to systemctl, 39 | # but need to be authorized in addition to the systemctl binary 40 | # to allow nopasswd sudo 41 | { command = "/run/current-system/sw/bin/shutdown"; 42 | options = [ "NOPASSWD" "SETENV" ]; 43 | } 44 | { command = "/run/current-system/sw/bin/reboot"; 45 | options = [ "NOPASSWD" "SETENV" ]; 46 | } 47 | ]; 48 | } 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/i3/i3.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, ... }: 2 | let 3 | inherit (lib) mkOptionDefault; 4 | mod = "Mod4"; 5 | alt = "Mod1"; 6 | screenshots-dir = "$HOME/Screencaps"; 7 | backgroundImage = config.wallpaper; 8 | in { 9 | 10 | home.packages = [ 11 | pkgs.flameshot 12 | pkgs.rofi 13 | ]; 14 | 15 | # add pbcopy & pbpaste aliases for clipboard 16 | programs.fish.shellAliases = { 17 | pbcopy = "${pkgs.xclip}/bin/xclip -selection clipboard"; 18 | pbpaste = "${pkgs.xclip}/bin/xclip -selection clipboard -o"; 19 | }; 20 | 21 | programs.feh.enable = true; 22 | xsession.enable = true; 23 | 24 | xsession.windowManager.i3 = { 25 | enable = true; 26 | package = pkgs.i3-gaps; 27 | 28 | config = { 29 | modifier = mod; 30 | 31 | gaps = lib.mkDefault { 32 | inner = 10; 33 | outer = 5; 34 | }; 35 | 36 | keybindings = mkOptionDefault { 37 | # terminal 38 | "${mod}+Return" = "exec $TERMINAL"; 39 | 40 | # rofi drun on Mod+d and Mod+Space 41 | "${mod}+d" = "exec --no-startup-id rofi -show drun"; 42 | "${mod}+space"= "exec --no-startup-id rofi -show drun"; 43 | 44 | # rofi emoji picker on Mod+Shift+space 45 | "${mod}+Shift+space" = "exec --no-startup-id rofi -show emoji"; 46 | 47 | # rofi window switcher on Mod+Tab 48 | "${mod}+Tab" = "exec --no-startup-id rofi -show window"; 49 | 50 | # move the default commands for Mod+space and Mod+Shift+space to Mod+o / Mod+Shift+o 51 | "${mod}+o" = "focus mode_toggle"; 52 | "${mod}+Shift+o" = "floating toggle"; 53 | 54 | # screenshots: 55 | ## PrintScreen and Mod+Shift+S (for keyboards without print screen key) to flameshot gui 56 | "Print" = "exec flameshot gui -p ${screenshots-dir}"; 57 | "${mod}+Shift+s" = "exec flameshot gui -p ${screenshots-dir}"; 58 | 59 | ## Shift+PrintScreen and Mod+Alt+Shift+S to full screen capture 60 | "Shift+Print" = "exec flameshot full -p ${screenshots-dir}"; 61 | "${mod}+${alt}+Shift+s" = "exec flameshot full -p ${screenshots-dir}"; 62 | 63 | # alternative to mod+shift+q, since macos insists on eating it 64 | "${mod}+Shift+w" = "kill"; 65 | 66 | # alternative to mod+w for tabs, since t is for tabs 67 | "${mod}+t" = "layout tabbed"; 68 | 69 | # vim-style focus / movement 70 | "${mod}+h" = "focus left"; 71 | "${mod}+j" = "focus down"; 72 | "${mod}+k" = "focus up"; 73 | "${mod}+l" = "focus right"; 74 | "${mod}+Shift+h" = "move left"; 75 | "${mod}+Shift+j" = "move down"; 76 | "${mod}+Shift+k" = "move up"; 77 | "${mod}+Shift+l" = "move right"; 78 | 79 | # split horizontal moves to Mod+b, since Mod+h is repurposed 80 | "${mod}+v" = "split v"; 81 | "${mod}+b" = "split h"; 82 | }; 83 | 84 | # TODO: use nix-colors 85 | colors.focused = { 86 | border = "#00AF91"; 87 | childBorder = "#007965"; 88 | background = "#285577"; 89 | text = "#ffffff"; 90 | indicator = "#2e9ef4"; 91 | }; 92 | 93 | # polybar is started by home-manager's systemd service 94 | bars = [ ]; 95 | 96 | startup = [ 97 | { command = "feh --bg-scale --zoom fill ${backgroundImage}"; } 98 | { command = "i3-msg 'workspace 1'"; } 99 | ]; 100 | 101 | floating.modifier = mod; 102 | 103 | floating.criteria = [ 104 | { title = ".zoom "; } 105 | { title = "^zoom$"; } 106 | ]; 107 | }; 108 | }; 109 | 110 | } 111 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/i3/rofi/theme.nix: -------------------------------------------------------------------------------- 1 | # adapted from https://github.com/adi1090x/rofi/tree/master/1080p/launchers/colorful 2 | { scaled, config }: 3 | let 4 | inherit (config.lib.formats.rasi) mkLiteral; 5 | in 6 | { 7 | # colors: TODO: nix-colors 8 | "*" = { 9 | al = mkLiteral "#00000000"; 10 | bg = mkLiteral "#000000ff"; 11 | se = mkLiteral "#264653ff"; 12 | fg = mkLiteral "#FFFFFFff"; 13 | ac = mkLiteral "#2a9d8fff"; 14 | }; 15 | 16 | configuration = { 17 | font = "Iosevka Nerd Font ${(scaled 12.0)}"; 18 | show-icons = true; 19 | icon-theme = "Papirus"; 20 | display-drun = ""; 21 | drun-display-format = "{name}"; 22 | disable-history = false; 23 | sidebar-mode = false; 24 | }; 25 | 26 | window = { 27 | transparency = "real"; 28 | background-color = mkLiteral "@bg"; 29 | text-color = mkLiteral "@fg"; 30 | border = mkLiteral "0px"; 31 | border-color = mkLiteral "@ac"; 32 | border-radius = mkLiteral "12px"; 33 | width = mkLiteral "35%"; 34 | location = mkLiteral "center"; 35 | x-offset = 0; 36 | y-offset = 0; 37 | }; 38 | 39 | prompt = { 40 | enabled = true; 41 | padding = mkLiteral "0.30% 1% 0% -0.5%"; 42 | background-color = mkLiteral "@al"; 43 | text-color = mkLiteral "@bg"; 44 | font = "FantasqueSansMono Nerd Font ${(scaled 14.0)}"; 45 | }; 46 | 47 | entry = { 48 | font = "Iosevka Nerd Font ${(scaled 14.0)}"; 49 | background-color = mkLiteral "@al"; 50 | text-color = mkLiteral "@bg"; 51 | placeholder-color = mkLiteral "@bg"; 52 | expand = true; 53 | horizontal-align = 0; 54 | placeholder = "Search"; 55 | padding = mkLiteral "0.10% 0% 0% 0%"; 56 | blink = true; 57 | }; 58 | 59 | inputbar = { 60 | children = [(mkLiteral "prompt") (mkLiteral "entry")]; 61 | background-color = mkLiteral "@ac"; 62 | text-color = mkLiteral "@bg"; 63 | expand = false; 64 | border = mkLiteral "0% 0% 0% 0%"; 65 | border-radius = mkLiteral "0px"; 66 | border-color = mkLiteral "@ac"; 67 | margin = mkLiteral "0% 0% 0% 0%"; 68 | padding = mkLiteral "1.5%"; 69 | }; 70 | 71 | listview = { 72 | background-color = mkLiteral "@al"; 73 | padding = mkLiteral "10px"; 74 | columns = 5; 75 | lines = 3; 76 | spacing = mkLiteral "0%"; 77 | cycle = false; 78 | dynamic = true; 79 | layout = mkLiteral "vertical"; 80 | }; 81 | 82 | mainbox = { 83 | background-color = mkLiteral "@al"; 84 | border = mkLiteral "0% 0% 0% 0%"; 85 | border-radius = mkLiteral "0% 0% 0% 0%"; 86 | border-color = mkLiteral "@ac"; 87 | children = [ (mkLiteral "inputbar") (mkLiteral "listview") ]; 88 | spacing = mkLiteral "0%"; 89 | padding = mkLiteral "0%"; 90 | }; 91 | 92 | element = { 93 | background-color = mkLiteral "@al"; 94 | text-color = mkLiteral "@fg"; 95 | orientation = mkLiteral "vertical"; 96 | border-radius = mkLiteral "0%"; 97 | padding = mkLiteral "2% 0% 2% 0%"; 98 | }; 99 | 100 | element-icon = { 101 | background-color = mkLiteral "inherit"; 102 | text-color = mkLiteral "inherit"; 103 | horizontal-align = mkLiteral "0.5"; 104 | vertical-align = mkLiteral "0.5"; 105 | size = mkLiteral "64px"; 106 | border = mkLiteral "0px"; 107 | }; 108 | 109 | element-text = { 110 | background-color = mkLiteral "@al"; 111 | text-color = mkLiteral "inherit"; 112 | expand = true; 113 | horizontal-align = mkLiteral "0.5"; 114 | vertical-align = mkLiteral "0.5"; 115 | margin = mkLiteral "0.5% 0.5% -0.5% 0.5%"; 116 | }; 117 | 118 | "element selected" = { 119 | background-color = mkLiteral "@se"; 120 | text-color = mkLiteral "@fg"; 121 | border = mkLiteral "0% 0% 0% 0%"; 122 | border-radius = mkLiteral "12px"; 123 | border-color = mkLiteral "@bg"; 124 | }; 125 | } 126 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/sway/sway.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , config 3 | , pkgs 4 | , inputs 5 | , ... }: 6 | let 7 | inherit (lib) mkIf; 8 | inherit (lib.attrsets) optionalAttrs; 9 | inherit (lib.lists) optionals; 10 | inherit (lib.strings) optionalString; 11 | 12 | output-config = (import ./monitors.nix { 13 | inherit lib; 14 | inherit (config) monitors; 15 | }); 16 | 17 | cursor-size = 24; 18 | 19 | background-image = config.wallpaper; 20 | lock-cmd = "${config.programs.swaylock.package}/bin/swaylock -S --daemonize"; 21 | 22 | start-sway = pkgs.writeShellScriptBin "start-sway" '' 23 | exec ${pkgs.dbus}/bin/dbus-run-session sway $SWAY_CLI_FLAGS 24 | ''; 25 | 26 | color-config = with config.colorScheme.palette; '' 27 | # class border backgr. text indicator child_border 28 | client.focused #${base04} #${base0D} #${base02} #${base0E} #${base0D} 29 | client.focused_inactive #${base02} #${base02} #${base06} #${base0E} #${base0E} 30 | client.unfocused #${base02} #${base01} #${base07} #${base04} #${base04} 31 | client.urgent #${base0A} #${base09} #${base01} #${base04} #${base0A} 32 | client.placeholder #${base00} #${base04} #${base07} #${base00} #${base04} 33 | 34 | client.background #${base00} 35 | ''; 36 | 37 | in { 38 | 39 | imports = [ 40 | ../wayland 41 | ]; 42 | 43 | programs.fish.loginShellInit = '' 44 | # if running from tty1, start sway 45 | set TTY1 (tty) 46 | 47 | if [ "$TTY1" = "/dev/tty1" ] 48 | exec ${start-sway}/bin/start-sway 49 | end 50 | ''; 51 | 52 | home.packages = builtins.attrValues { 53 | inherit (pkgs) wl-clipboard; 54 | }; 55 | 56 | 57 | 58 | wayland.windowManager.sway = { 59 | enable = true; 60 | wrapperFeatures.gtk = true; 61 | 62 | config = { 63 | modifier = "Mod4"; 64 | terminal = config.home.sessionVariables.TERMINAL; 65 | output = output-config // { 66 | "*" = { 67 | bg = "${background-image} fill"; 68 | }; 69 | }; 70 | window.hideEdgeBorders = "both"; 71 | fonts = { 72 | names = [ "FiraCode Nerd Font" ]; 73 | style = "Regular"; 74 | size = 12.0; 75 | }; 76 | 77 | keybindings = 78 | let 79 | modifier = config.wayland.windowManager.sway.config.modifier; 80 | in lib.mkOptionDefault { 81 | #"${modifier}+space" = "exec ${pkgs.albert}/bin/albert show"; 82 | "${modifier}+Shift+slash" = "exec ${lock-cmd}"; 83 | "${modifier}+n" = "exec firefox"; 84 | "${modifier}+Shift+n" = "exec firefox --private-window"; 85 | "${modifier}+Shift+k" = "kill"; 86 | "${modifier}+t" = "layout tabbed"; 87 | }; 88 | 89 | focus.wrapping = "no"; 90 | 91 | startup = [ 92 | { command = "eval $(gnome-keyring-daemon --start --components=secrets);"; } 93 | ]; 94 | 95 | # set cursor size 96 | seat."*".xcursor_theme = "Vanilla-DMZ ${builtins.toString cursor-size}"; 97 | }; 98 | 99 | systemd.enable = true; 100 | 101 | extraConfig = color-config; 102 | 103 | extraSessionCommands = '' 104 | export QT_AUTO_SCREN_SCALING_FACTOR=1 105 | export QT_QPA_PLATFORM=wayland 106 | export QT_WAYLAND_DISABLE_WINDOW_DECORATIONS=1 107 | export GDK_BACKEND=wayland 108 | export MOZ_ENABLE_WAYLAND=1 109 | export XDG_SESSION_TYPE=wayland 110 | export XDG_SESSION_DESKTOP=sway 111 | export XDG_CURRENT_DESKTOP=sway 112 | export _JAVA_AWT_WM_NONREPARENTING=1 113 | ''; 114 | }; 115 | 116 | # cursor config 117 | home.pointerCursor = { 118 | package = pkgs.vanilla-dmz; 119 | name = "Vanilla-DMZ"; 120 | size = cursor-size; 121 | gtk.enable = true; 122 | }; 123 | } 124 | -------------------------------------------------------------------------------- /nixos/hosts/nobby/default.nix: -------------------------------------------------------------------------------- 1 | { lib, config, pkgs, inputs, outputs, ... }: 2 | { 3 | imports = 4 | [ # Include the results of the hardware scan. 5 | ./hardware-configuration.nix 6 | 7 | # base config 8 | ../../common.nix 9 | 10 | # optional features 11 | ../../features/docker.nix 12 | ../../features/tailscale.nix 13 | ../../features/sound.nix 14 | #../../features/sway.nix 15 | #../../features/i3.nix 16 | ../../features/kde.nix 17 | ../../features/kindle 18 | ../../features/steam.nix 19 | ../../features/sunshine.nix 20 | ../../features/plex-server.nix 21 | 22 | # key remapping 23 | outputs.nixosModules.dual-function-keys 24 | ../../features/key-mapping/caps-to-ctrl-esc.nix 25 | 26 | 27 | # local smb shares 28 | ./samba.nix 29 | 30 | # restic backup to Backblaze B2 31 | ./restic.nix 32 | 33 | ./stashapp.nix 34 | ]; 35 | 36 | 37 | programs.hyprland.enable = true; 38 | 39 | home-manager.users.yusef = import ../../../home-manager/yusef/hosts/nobby.nix; 40 | 41 | environment.systemPackages = builtins.attrValues { 42 | inherit (pkgs) pciutils usbutils cudatoolkit zfs btrfs-progs btrfs-snap geekbench; 43 | }; 44 | 45 | # nvidia GPU setup 46 | hardware.nvidia = { 47 | # use open-source driver 48 | #open = true; 49 | #package = config.boot.kernelPackages.nvidiaPackages.beta; 50 | 51 | # use beta driver until 555 hits nixpkgs unstable (less glitchy, esp for xwayland) 52 | package = config.boot.kernelPackages.nvidiaPackages.mkDriver { 53 | version = "555.42.02"; 54 | sha256_64bit = "sha256-k7cI3ZDlKp4mT46jMkLaIrc2YUx1lh1wj/J4SVSHWyk="; 55 | sha256_aarch64 = "sha256-rtDxQjClJ+gyrCLvdZlT56YyHQ4sbaL+d5tL4L4VfkA="; 56 | openSha256 = "sha256-rtDxQjClJ+gyrCLvdZlT56YyHQ4sbaL+d5tL4L4VfkA="; 57 | settingsSha256 = "sha256-rtDxQjClJ+gyrCLvdZlT56YyHQ4sbaL+d5tL4L4VfkA="; 58 | persistencedSha256 = lib.fakeSha256; 59 | }; 60 | 61 | modesetting.enable = true; 62 | powerManagement.enable = true; 63 | }; 64 | 65 | hardware.graphics = { 66 | enable = true; 67 | extraPackages = with pkgs; [ 68 | vaapiVdpau 69 | nvidia-vaapi-driver 70 | ]; 71 | }; 72 | 73 | 74 | # Fix for stupid nvidia wayland bug: https://github.com/NixOS/nixpkgs/issues/202454#issuecomment-1579609974 75 | # environment.etc."egl/egl_external_platform.d".source = let 76 | # nvidia_wayland = pkgs.writeText "10_nvidia_wayland.json" '' 77 | # { 78 | # "file_format_version" : "1.0.0", 79 | # "ICD" : { 80 | # "library_path" : "${inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.egl-wayland}/lib/libnvidia-egl-wayland.so" 81 | # } 82 | # } 83 | # ''; 84 | # nvidia_gbm = pkgs.writeText "15_nvidia_gbm.json" '' 85 | # { 86 | # "file_format_version" : "1.0.0", 87 | # "ICD" : { 88 | # "library_path" : "${config.hardware.nvidia.package}/lib/libnvidia-egl-gbm.so.1" 89 | # } 90 | # } 91 | # ''; 92 | #in 93 | # lib.mkForce (pkgs.runCommandLocal "nvidia-egl-hack" {} '' 94 | # mkdir -p $out 95 | # cp ${nvidia_wayland} $out/10_nvidia_wayland.json 96 | # cp ${nvidia_gbm} $out/15_nvidia_gbm.json 97 | # ''); 98 | 99 | 100 | services.xserver.videoDrivers = [ "nvidia" ]; 101 | boot.blacklistedKernelModules = [ "nouveau" ]; 102 | 103 | # Use grub instead of systemd-boot so we can use the OS prober to find Windows 104 | boot.loader.efi.canTouchEfiVariables = true; 105 | boot.loader.grub.enable = true; 106 | boot.loader.grub.devices = [ "nodev" ]; 107 | boot.loader.grub.efiSupport = true; 108 | boot.loader.grub.useOSProber = true; 109 | 110 | networking.hostName = "nobby"; # Define your hostname. 111 | networking.hostId = "b3e05958"; 112 | 113 | # enable DHCP for all interfaces, since my usb ethernet adapter sometimes 114 | # gets its "predictable" name changed depending on what else is plugged in 115 | # at boot 116 | networking.useDHCP = true; 117 | 118 | system.stateVersion = "22.11"; 119 | } 120 | 121 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/tmux.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: 2 | let 3 | oh-my-tmux = pkgs.fetchFromGitHub { 4 | owner = "gpakosz"; 5 | repo = ".tmux"; 6 | rev = "5641d3b3f5f9c353c58dfcba4c265df055a05b6b"; 7 | sha256 = "sha256-BTeej1vzyYx068AnU8MjbQKS9veS2jOS+CaJazCtP6s="; 8 | 9 | # see https://github.com/NixOS/nixpkgs/issues/80109#issuecomment-1172953187 10 | stripRoot = false; 11 | }; 12 | tmux-conf = "${oh-my-tmux}/.tmux-${oh-my-tmux.rev}/.tmux.conf"; 13 | 14 | colors = config.colorScheme.palette; 15 | in 16 | { 17 | home.packages = [ 18 | pkgs.tmux 19 | ]; 20 | 21 | home.file.tmux-conf = { 22 | target = ".tmux.conf"; 23 | source = tmux-conf; 24 | }; 25 | 26 | home.file.tmux-conf-local = { 27 | target = ".tmux.conf.local"; 28 | text = 29 | '' 30 | # use Powerline symbols in status bar 31 | tmux_conf_theme_left_separator_main='\uE0B0' 32 | tmux_conf_theme_left_separator_sub='\uE0B1' 33 | tmux_conf_theme_right_separator_main='\uE0B2' 34 | tmux_conf_theme_right_separator_sub='\uE0B3' 35 | 36 | # customize status bar 37 | # removes uptime and battery info from default config 38 | tmux_conf_theme_status_left=" ❐ #S" 39 | tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized} | #{username}#{root} | #{hostname} " 40 | 41 | # show bar at top of window instead of bottom 42 | set -g status-position top 43 | 44 | # use 12 hour time format for big clock view 45 | tmux_conf_theme_clock_style="12" 46 | 47 | # copy mouse-mode selections to system clipboard 48 | tmux_conf_copy_to_os_clipboard=true 49 | 50 | # retain current path for new windows 51 | tmux_conf_new_window_retain_current_path=true 52 | 53 | # just use C-b as prefix instead of C-b and C-a 54 | set -gu prefix2 55 | unbind C-a 56 | 57 | # start with mouse mode enabled 58 | set -g mouse on 59 | 60 | # use visual bell instead of audible beeps 61 | set -g visual-bell on 62 | 63 | # plugins 64 | set -g @plugin 'jabirali/tmux-tilish' 65 | # set -g @plugin 'ofirgall/tmux-window-name' 66 | 67 | # create a session called "main" if none exists 68 | # ref: https://gist.github.com/chakrit/5004006 69 | new-session -s main 70 | 71 | # use colors from current color color scheme 72 | # based on default ansi theme for "oh my tmux" config, 73 | # with colors from current "base 16" color scheme 74 | tmux_conf_theme_colour_1="#${colors.base00}" 75 | tmux_conf_theme_colour_2="#${colors.base08}" 76 | tmux_conf_theme_colour_3="#${colors.base08}" 77 | tmux_conf_theme_colour_4="#${colors.base0D}" 78 | tmux_conf_theme_colour_5="#${colors.base0B}" 79 | tmux_conf_theme_colour_6="#${colors.base00}" 80 | tmux_conf_theme_colour_7="#${colors.base0F}" 81 | tmux_conf_theme_colour_8="#${colors.base00}" 82 | tmux_conf_theme_colour_9="#${colors.base0B}" 83 | tmux_conf_theme_colour_10="#${colors.base0D}" 84 | tmux_conf_theme_colour_11="#${colors.base0A}" 85 | tmux_conf_theme_colour_12="#${colors.base08}" 86 | tmux_conf_theme_colour_13="#${colors.base0F}" 87 | tmux_conf_theme_colour_14="#${colors.base00}" 88 | tmux_conf_theme_colour_15="#${colors.base00}" 89 | tmux_conf_theme_colour_16="#${colors.base01}" 90 | tmux_conf_theme_colour_17="#${colors.base0F}" 91 | 92 | # switch windows with -n and -p, 93 | # or -Left or -Right 94 | bind -r n next-window 95 | bind -r Right next-window 96 | bind -r p previous-window 97 | bind -r Left previous-window 98 | ''; 99 | }; 100 | 101 | #programs.fish.interactiveShellInit = 102 | #'' 103 | # # auto-start tmux, if we're not already in a tmux session. 104 | # # the destroy-unattached option prevents stale sessions from 105 | # # piling up when you detach (ref: https://unix.stackexchange.com/a/222843) 106 | # 107 | # if not set -q TMUX 108 | # tmux new-session -t main \; set-option destroy-unattached 109 | # end 110 | #''; 111 | } 112 | -------------------------------------------------------------------------------- /home-manager/yusef/features/cli/nvim/default.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, inputs, ...}: 2 | let 3 | inherit (inputs) nixvim; 4 | 5 | vim-just = pkgs.vimUtils.buildVimPlugin { 6 | name = "vim-just"; 7 | src = pkgs.fetchFromGitHub { 8 | owner = "NoahTheDuke"; 9 | repo = "vim-just"; 10 | rev = "adf500b84eb98ba56ad3f10672e1b2dc1de47b5f"; 11 | sha256 = "sha256-YxqFZNtv7naC3faI1kPYI2pnzX8sm3akMBydZrYLHgM="; 12 | }; 13 | }; 14 | in 15 | { 16 | imports = [ 17 | inputs.nixvim.homeManagerModules.nixvim 18 | ]; 19 | 20 | programs.nixvim = { 21 | enable = true; 22 | 23 | globals = { 24 | mapleader = ";"; 25 | rust_recommended_style = false; 26 | }; 27 | 28 | opts = { 29 | number = true; 30 | relativenumber = true; 31 | tabstop = 2; 32 | shiftwidth = 2; 33 | clipboard = "unnamedplus"; 34 | 35 | # hide the native status line, since airline makes it redundant 36 | showmode = false; 37 | ruler = false; 38 | laststatus = 0; 39 | }; 40 | 41 | keymaps = [ 42 | # move between split panes with ctrl+ movement keys, without Ctrl+W prefix first 43 | { 44 | options.desc = "focus pane down"; 45 | key = ""; 46 | action = ""; 47 | } 48 | { 49 | options.desc = "focus pane left"; 50 | key = ""; 51 | action = ""; 52 | } 53 | { 54 | options.desc = "focus pane up"; 55 | key = ""; 56 | action = ""; 57 | } 58 | { 59 | options.desc = "focus pane right"; 60 | key = ""; 61 | action = ""; 62 | } 63 | { 64 | options.desc = "toggle nvim-tree"; 65 | key = "t"; 66 | action = "NvimTreeToggle"; 67 | } 68 | { 69 | options.desc = "clear search highlighting"; 70 | options.silent = true; 71 | mode = "n"; 72 | key = ""; 73 | action = ":noh"; 74 | } 75 | ]; 76 | 77 | # color scheme config 78 | extraConfigVim = import ./theme.nix config.colorScheme; 79 | 80 | extraPlugins = [ 81 | vim-just 82 | pkgs.vimPlugins.cheatsheet-nvim 83 | pkgs.vimPlugins.vim-airline-themes 84 | ]; 85 | 86 | plugins = { 87 | airline = { 88 | enable = true; 89 | settings = { 90 | powerline_fonts = 1; 91 | theme = "base16"; 92 | }; 93 | }; 94 | web-devicons.enable = true; 95 | 96 | barbar.enable = true; 97 | 98 | nix.enable = true; 99 | 100 | 101 | neogit = { 102 | enable = true; 103 | settings = { 104 | kind = "auto"; 105 | }; 106 | }; 107 | 108 | nvim-tree = { 109 | enable = true; 110 | openOnSetup = true; 111 | respectBufCwd = true; 112 | updateFocusedFile.enable = true; 113 | }; 114 | 115 | comment.enable = true; 116 | 117 | 118 | cmp = { 119 | enable = true; 120 | 121 | settings = { 122 | sources = [ 123 | { name = "nvim_lsp"; } 124 | { name = "path"; } 125 | { name = "buffer"; } 126 | ]; 127 | 128 | mapping = let 129 | if-visible = (action: '' 130 | function(fallback) 131 | if cmp.visible() then 132 | ${action} 133 | else 134 | fallback() 135 | end 136 | end 137 | ''); 138 | 139 | m = (action: if-visible "cmp.mapping(${action}, {'i', 's', 'c'})"); 140 | 141 | select-next = m "cmp.mapping.select_next_item()"; 142 | select-prev = m "cmp.mapping.select_prev_item()"; 143 | scroll-next = m "cmp.scroll_docs(4)"; 144 | scroll-prev = m "cmp.scroll_docs(-4)"; 145 | in { 146 | "" = "cmp.mapping.confirm({ select = false })"; 147 | "" = select-next; 148 | "" = select-next; 149 | "" = select-next; 150 | "" = select-prev; 151 | "" = select-prev; 152 | 153 | # scroll inside the popup view 154 | "" = scroll-prev; 155 | "" = scroll-prev; 156 | "" = scroll-next; 157 | "" = scroll-next; 158 | }; 159 | }; 160 | }; 161 | 162 | telescope = { 163 | enable = true; 164 | keymaps = { 165 | "ff" = "find_files"; 166 | "fg" = "live_grep"; 167 | "fb" = "buffers"; 168 | "fh" = "help_tags"; 169 | }; 170 | }; 171 | 172 | lsp = { 173 | enable = true; 174 | 175 | servers = { 176 | jsonls.enable = true; 177 | #rnix.enable = true; 178 | }; 179 | }; 180 | 181 | typescript-tools = { 182 | enable = true; 183 | }; 184 | 185 | #treesitter = { 186 | # enable = false; # TODO: figure out a smaller set of grammars - "all" takes forever to download 187 | # ensureInstalled = "all"; 188 | #}; 189 | }; 190 | 191 | }; 192 | } 193 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Your new nix config"; 3 | 4 | inputs = { 5 | # Nixpkgs 6 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 7 | # You can access packages and modules from different nixpkgs revs 8 | # at the same time. Here's an working example: 9 | nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 10 | # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. 11 | 12 | # Home manager 13 | home-manager.url = "github:nix-community/home-manager"; 14 | home-manager.inputs.nixpkgs.follows = "nixpkgs"; 15 | 16 | darwin = { 17 | url = "github:lnl7/nix-darwin"; 18 | inputs.nixpkgs.follows = "nixpkgs"; 19 | }; 20 | 21 | agenix = { 22 | url = "github:ryantm/agenix"; 23 | inputs.nixpkgs.follows = "nixpkgs"; 24 | }; 25 | 26 | nixos-wsl = { 27 | url = "github:nix-community/NixOS-WSL"; 28 | inputs.nixpkgs.follows = "nixpkgs"; 29 | }; 30 | 31 | apple-silicon.url = "github:tpwrules/nixos-apple-silicon"; 32 | nix-colors.url = "github:misterio77/nix-colors"; 33 | nixvim = { 34 | url = "github:nix-community/nixvim"; 35 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 36 | }; 37 | nur.url = "github:nix-community/nur"; 38 | firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; 39 | musnix = { 40 | url = "github:musnix/musnix"; 41 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 42 | }; 43 | 44 | native-access-nix = { 45 | url = "github:yusefnapora/native-access-nix"; 46 | inputs.nixpkgs.follows = "nixpkgs"; 47 | }; 48 | 49 | }; 50 | 51 | outputs = { self, nixpkgs, home-manager, ... }@inputs: 52 | let 53 | inherit (self) outputs; 54 | forAllSystems = nixpkgs.lib.genAttrs [ 55 | "aarch64-linux" 56 | "i686-linux" 57 | "x86_64-linux" 58 | "aarch64-darwin" 59 | "x86_64-darwin" 60 | ]; 61 | 62 | mkNixos = modules: nixpkgs.lib.nixosSystem { 63 | inherit modules; 64 | specialArgs = { inherit inputs outputs self; }; 65 | }; 66 | 67 | mkDarwin = system: modules: inputs.darwin.lib.darwinSystem { 68 | inherit modules system; 69 | specialArgs = { inherit inputs outputs self; }; 70 | }; 71 | 72 | mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration { 73 | inherit modules pkgs; 74 | extraSpecialArgs = { inherit inputs outputs self; }; 75 | }; 76 | in 77 | rec { 78 | # Your custom packages 79 | # Acessible through 'nix build', 'nix shell', etc 80 | packages = forAllSystems (system: 81 | let pkgs = nixpkgs.legacyPackages.${system}; 82 | in import ./pkgs { inherit pkgs; } 83 | ); 84 | # Devshell for bootstrapping 85 | # Acessible through 'nix develop' or 'nix-shell' (legacy) 86 | devShells = forAllSystems (system: 87 | let pkgs = nixpkgs.legacyPackages.${system}; 88 | in import ./shell.nix { inherit pkgs; } 89 | ); 90 | 91 | # Your custom packages and modifications, exported as overlays 92 | overlays = import ./overlays { inherit inputs; }; 93 | # Reusable nixos modules you might want to export 94 | # These are usually stuff you would upstream into nixpkgs 95 | nixosModules = import ./modules/nixos; 96 | # Reusable home-manager modules you might want to export 97 | # These are usually stuff you would upstream into home-manager 98 | homeManagerModules = import ./modules/home-manager; 99 | 100 | # NixOS configuration entrypoint 101 | # Available through 'nixos-rebuild --flake .#your-hostname' 102 | nixosConfigurations = { 103 | # 14" M1 Pro macbook 104 | asahi = mkNixos [ ./nixos/hosts/asahi ]; 105 | 106 | # Home NAS box 107 | nasty = mkNixos [ ./nixos/hosts/nasty ]; 108 | 109 | # Music production box 110 | buddy = mkNixos [ ./nixos/hosts/buddy ]; 111 | 112 | # dell xps 13 113 | magrat = mkNixos [ ./nixos/hosts/magrat ]; 114 | 115 | # Home router 116 | clacks = mkNixos [ ./nixos/hosts/clacks ]; 117 | 118 | # WSL2 on Windows 11 119 | Hex = mkNixos [ ./nixos/hosts/hex-wsl ]; 120 | 121 | # Oracle cloud aarch64 VM 122 | colon = mkNixos [ ./nixos/hosts/colon ]; 123 | 124 | # VMWare on 16" intel MBP 125 | detritus = mkNixos [ ./nixos/hosts/detritus ]; 126 | 127 | # Bare metal on dual-boot windows box 128 | nobby = mkNixos [ ./nixos/hosts/nobby ]; 129 | }; 130 | 131 | darwinConfigurations = { 132 | # 14" M1-Pro macbook 133 | sef-macbook = mkDarwin "aarch64-darwin" [ ./darwin/hosts/macbook.nix ]; 134 | 135 | # 16" intel MBP (ShareFile dev) 136 | AMERMACC02FC2U2MD6R = mkDarwin "x86_64-darwin" [ ./darwin/hosts/old-work-macbook.nix ]; 137 | 138 | # 14" M3-Pro macbook (ShareFile) 139 | KM73Y59KJQ = mkDarwin "aarch64-darwin" [ ./darwin/hosts/work-macbook.nix ]; 140 | }; 141 | 142 | # Standalone home-manager configuration entrypoint 143 | # Available through 'home-manager --flake .#your-username@your-hostname' 144 | homeConfigurations = { 145 | # TODO: add generic standalone home-manager config 146 | }; 147 | }; 148 | } 149 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/hyprland/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, inputs, ... }: 2 | let 3 | mod = "SUPER"; 4 | swaylock = "${config.programs.swaylock.package}/bin/swaylock"; 5 | terminal = "[float;tile] wezterm start --always-new-process"; 6 | # terminal = config.home.sessionVariables.TERMINAL; 7 | browser = config.home.sessionVariables.BROWSER; 8 | wofi = "${config.programs.wofi.package}/bin/wofi"; 9 | in 10 | { 11 | 12 | imports = [ 13 | ../wayland 14 | ]; 15 | 16 | home.packages = builtins.attrValues { 17 | inherit (pkgs) kitty dolphin wofi; 18 | }; 19 | 20 | #xdg.portal = { 21 | # extraPortals = [ inputs.hyprland.xdg-desktop-portal-hyprland ]; 22 | # configPackages = [ inputs.hyprland.hyprland ]; 23 | #}; 24 | 25 | wayland.windowManager.hyprland = { 26 | enable = true; 27 | 28 | settings = { 29 | monitor = ",preferred,auto,auto"; 30 | 31 | env = [ 32 | "XCURSOR_SIZE,24" 33 | ]; 34 | 35 | exec = [ 36 | "${pkgs.swaybg}/bin/swaybg -i ${config.wallpaper} --mode fill" 37 | ]; 38 | 39 | bind = [ 40 | # program keybinds 41 | "${mod},Return,exec,${terminal}" 42 | "${mod},n,exec,${browser}" 43 | "${mod},Space,exec,${wofi} -S drun" 44 | 45 | # hyprland controls 46 | "${mod} SHIFT, e, exit," 47 | 48 | # window management 49 | "${mod}, V, togglefloating," 50 | 51 | # Move focus with mainMod + arrow keys 52 | "${mod}, left, movefocus, l" 53 | "${mod}, right, movefocus, r" 54 | "${mod}, up, movefocus, u" 55 | "${mod}, down, movefocus, d" 56 | 57 | # Switch workspaces with mainMod + [0-9] 58 | "${mod}, 1, workspace, 1" 59 | "${mod}, 2, workspace, 2" 60 | "${mod}, 3, workspace, 3" 61 | "${mod}, 4, workspace, 4" 62 | "${mod}, 5, workspace, 5" 63 | "${mod}, 6, workspace, 6" 64 | "${mod}, 7, workspace, 7" 65 | "${mod}, 8, workspace, 8" 66 | "${mod}, 9, workspace, 9" 67 | "${mod}, 0, workspace, 10" 68 | 69 | # Move active window to a workspace with mainMod + SHIFT + [0-9] 70 | "${mod} SHIFT, 1, movetoworkspace, 1" 71 | "${mod} SHIFT, 2, movetoworkspace, 2" 72 | "${mod} SHIFT, 3, movetoworkspace, 3" 73 | "${mod} SHIFT, 4, movetoworkspace, 4" 74 | "${mod} SHIFT, 5, movetoworkspace, 5" 75 | "${mod} SHIFT, 6, movetoworkspace, 6" 76 | "${mod} SHIFT, 7, movetoworkspace, 7" 77 | "${mod} SHIFT, 8, movetoworkspace, 8" 78 | "${mod} SHIFT, 9, movetoworkspace, 9" 79 | "${mod} SHIFT, 0, movetoworkspace, 10" 80 | 81 | # Scroll through existing workspaces with mainMod + scroll 82 | "${mod}, mouse_down, workspace, e+1" 83 | "${mod}, mouse_up, workspace, e-1" 84 | ]; 85 | 86 | windowrulev2 = [ 87 | "fullscreen,class:(steam),title:(Steam Big Picture Mode)" 88 | ]; 89 | 90 | bindm = [ 91 | # Move/resize windows with mainMod + LMB/RMB and dragging 92 | "${mod}, mouse:272, movewindow" 93 | "${mod}, mouse:273, resizewindow" 94 | ]; 95 | 96 | input = { 97 | kb_layout = "us"; 98 | follow_mouse = 1; 99 | touchpad.natural_scroll = true; 100 | touchpad.disable_while_typing = false; 101 | }; 102 | 103 | general = { 104 | gaps_in = 5; 105 | gaps_out = 20; 106 | border_size = 2; 107 | "col.active_border" = "0xff${config.colorscheme.palette.base0C}"; 108 | "col.inactive_border" = "0xff${config.colorscheme.palette.base02}"; 109 | }; 110 | group = { 111 | "col.border_active" = "0xff${config.colorscheme.palette.base0B}"; 112 | "col.border_inactive" = "0xff${config.colorscheme.palette.base04}"; 113 | groupbar = { 114 | font_size = 11; 115 | }; 116 | }; 117 | misc = { 118 | vfr = true; 119 | close_special_on_empty = true; 120 | # Unfullscreen when opening something 121 | new_window_takes_over_fullscreen = 2; 122 | }; 123 | decoration = { 124 | active_opacity = 0.94; 125 | inactive_opacity = 0.75; 126 | fullscreen_opacity = 1.0; 127 | rounding = 5; 128 | blur = { 129 | enabled = true; 130 | size = 5; 131 | passes = 3; 132 | new_optimizations = true; 133 | ignore_opacity = true; 134 | }; 135 | drop_shadow = true; 136 | shadow_range = 12; 137 | shadow_offset = "3 3"; 138 | "col.shadow" = "0x44000000"; 139 | "col.shadow_inactive" = "0x66000000"; 140 | }; 141 | layerrule = [ 142 | "blur,waybar" 143 | "ignorezero,waybar" 144 | ]; 145 | blurls = [ 146 | "waybar" 147 | ]; 148 | animations = { 149 | enabled = true; 150 | bezier = [ 151 | "easein,0.11, 0, 0.5, 0" 152 | "easeout,0.5, 1, 0.89, 1" 153 | "easeinback,0.36, 0, 0.66, -0.56" 154 | "easeoutback,0.34, 1.56, 0.64, 1" 155 | ]; 156 | 157 | animation = [ 158 | "windowsIn,1,3,easeoutback,slide" 159 | "windowsOut,1,3,easeinback,slide" 160 | "windowsMove,1,3,easeoutback" 161 | "workspaces,1,2,easeoutback,slide" 162 | "fadeIn,1,3,easeout" 163 | "fadeOut,1,3,easein" 164 | "fadeSwitch,1,3,easeout" 165 | "fadeShadow,1,3,easeout" 166 | "fadeDim,1,3,easeout" 167 | "border,1,3,easeout" 168 | ]; 169 | }; 170 | }; 171 | }; 172 | } 173 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/common/wezterm.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | let 3 | inherit (pkgs.stdenv) isDarwin; 4 | 5 | theme-name = "nix-${config.colorScheme.slug}"; 6 | colors = config.colorScheme.palette; 7 | 8 | clipboard_key_mods = if isDarwin then "CMD" else "SHIFT|CTRL"; 9 | 10 | # use manually installed WezTerm binary on macOS, since it's 11 | # not building for me on x86_64 possibly due to this issue: 12 | # https://github.com/NixOS/nixpkgs/issues/239384 13 | # although that's been open since July 2023 & failures just started 14 | # happening on my box in December. 15 | macos-hack-wrapper = pkgs.writeShellScriptBin "wezterm" '' 16 | exec /Applications/WezTerm.app/Contents/MacOS/wezterm $@ 17 | ''; 18 | 19 | in { 20 | config = { 21 | programs.wezterm = { 22 | enable = true; 23 | package = if isDarwin then macos-hack-wrapper else pkgs.wezterm; 24 | 25 | colorSchemes."${theme-name}" = with colors; { 26 | ansi = [ 27 | "#${base00}" "#${base08}" "#${base0B}" "#${base0A}" 28 | "#${base0D}" "#${base0E}" "#${base0C}" "#${base05}" 29 | ]; 30 | brights = [ 31 | "#${base03}" "#${base08}" "#${base0B}" "#${base0A}" 32 | "#${base0D}" "#${base0E}" "#${base0C}" "#${base07}" 33 | ]; 34 | background = "#${base00}"; 35 | cursor_bg = "#${base05}"; 36 | cursor_border = "#${base05}"; 37 | cursor_fg = "#${base05}"; 38 | foreground = "#${base05}"; 39 | selection_bg = "#${base05}"; 40 | selection_fg = "#${base00}"; 41 | }; 42 | 43 | extraConfig = '' 44 | local wezterm = require("wezterm") 45 | return { 46 | font = wezterm.font { 47 | family = 'FiraCode Nerd Font', 48 | }, 49 | font_size = 14, 50 | check_for_updates = false, 51 | color_scheme = '${theme-name}', 52 | use_fancy_tab_bar = false, 53 | tab_max_width = 32, 54 | 55 | colors = { 56 | tab_bar = { 57 | background = '#${colors.base01}', 58 | active_tab = { 59 | bg_color = '#${colors.base0D}', 60 | fg_color = '#${colors.base00}', 61 | }, 62 | inactive_tab = { 63 | bg_color = '#${colors.base00}', 64 | fg_color = '#${colors.base08}', 65 | }, 66 | inactive_tab_hover = { 67 | bg_color = '#${colors.base00}', 68 | fg_color = '#${colors.base0D}', 69 | }, 70 | new_tab = { 71 | bg_color = '#${colors.base02}', 72 | fg_color = '#${colors.base08}', 73 | }, 74 | new_tab_hover = { 75 | bg_color = '#${colors.base00}', 76 | fg_color = '#${colors.base0D}', 77 | }, 78 | }, 79 | }, 80 | 81 | mouse_bindings = { 82 | -- Ctrl-click will open the link under the mouse cursor 83 | { 84 | event = { Up = { streak = 1, button = 'Left' } }, 85 | mods = 'CTRL', 86 | action = wezterm.action.OpenLinkAtMouseCursor, 87 | }, 88 | }, 89 | 90 | leader = { key="b", mods="CTRL" }, 91 | -- disable_default_key_bindings = true, 92 | keys = { 93 | -- Send "CTRL-B" to the terminal when pressing CTRL-B, CTRL-B 94 | { key = "b", mods = "LEADER|CTRL", action=wezterm.action.SendKey{ key="b", mods="CTRL" }}, 95 | { key = "-", mods = "LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}}, 96 | { key = "\\",mods = "LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}}, 97 | { key = "z", mods = "LEADER", action="TogglePaneZoomState" }, 98 | { key = "c", mods = "LEADER", action=wezterm.action{SpawnTab="CurrentPaneDomain"}}, 99 | { key = "h", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Left"}}, 100 | { key = "j", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Down"}}, 101 | { key = "k", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Up"}}, 102 | { key = "l", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Right"}}, 103 | { key = "H", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Left", 5}}}, 104 | { key = "J", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Down", 5}}}, 105 | { key = "K", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Up", 5}}}, 106 | { key = "L", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Right", 5}}}, 107 | { key = "1", mods = "LEADER", action=wezterm.action{ActivateTab=0}}, 108 | { key = "2", mods = "LEADER", action=wezterm.action{ActivateTab=1}}, 109 | { key = "3", mods = "LEADER", action=wezterm.action{ActivateTab=2}}, 110 | { key = "4", mods = "LEADER", action=wezterm.action{ActivateTab=3}}, 111 | { key = "5", mods = "LEADER", action=wezterm.action{ActivateTab=4}}, 112 | { key = "6", mods = "LEADER", action=wezterm.action{ActivateTab=5}}, 113 | { key = "7", mods = "LEADER", action=wezterm.action{ActivateTab=6}}, 114 | { key = "8", mods = "LEADER", action=wezterm.action{ActivateTab=7}}, 115 | { key = "9", mods = "LEADER", action=wezterm.action{ActivateTab=8}}, 116 | { key = "&", mods = "LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}}, 117 | { key = "x", mods = "LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}}, 118 | 119 | { key = "n", mods="SHIFT|CTRL", action="ToggleFullScreen" }, 120 | { key = "v", mods="${clipboard_key_mods}", action=wezterm.action.PasteFrom 'Clipboard'}, 121 | { key = "c", mods="${clipboard_key_mods}", action=wezterm.action.CopyTo 'Clipboard'}, 122 | }, 123 | } 124 | ''; 125 | }; 126 | }; 127 | } 128 | -------------------------------------------------------------------------------- /modules/nixos/ts-serve.nix: -------------------------------------------------------------------------------- 1 | # taken from https://github.com/yomaq/nix-config/blob/87a74a0b37853f0c648a57805d4e7843e3dc0923/modules/containers/tailscale-submodule.nix 2 | # Thanks! 3 | 4 | { 5 | options, 6 | config, 7 | lib, 8 | pkgs, 9 | inputs, 10 | ... 11 | }: 12 | let 13 | ### Set container name and image 14 | NAME = "tailscale"; 15 | IMAGE = "ghcr.io/tailscale/tailscale"; 16 | 17 | tailnetName = "chimera-tone"; 18 | cfg = config.yomaq.pods.tailscaled; 19 | inherit (config.networking) hostName; 20 | 21 | containerOpts = 22 | { name, config, ... }: 23 | let 24 | # this allows container modules to name their TS submodule "TS${containerName}" so it won't overlap with the main container 25 | # but the tailscale node won't have the "TS" prefix, which is unnecessary 26 | startsWithTS = lib.substring 0 2 name == "TS"; 27 | noTSname = if startsWithTS then lib.substring 2 (-1) name else name; 28 | in 29 | { 30 | options = { 31 | enable = lib.mkOption { 32 | type = lib.types.bool; 33 | default = false; 34 | description = '' 35 | enable custom ${NAME} container module 36 | ''; 37 | }; 38 | volumeLocation = lib.mkOption { 39 | type = lib.types.str; 40 | default = "/container-data/tailscale/${name}"; 41 | description = '' 42 | path to store container volumes 43 | ''; 44 | }; 45 | imageVersion = lib.mkOption { 46 | type = lib.types.str; 47 | default = "latest"; 48 | description = '' 49 | container image version 50 | ''; 51 | }; 52 | TSargs = lib.mkOption { 53 | type = lib.types.str; 54 | default = ""; 55 | description = '' 56 | TS_Extra_ARGS env var 57 | ''; 58 | }; 59 | TShostname = lib.mkOption { 60 | type = lib.types.str; 61 | default = "${hostName}-${noTSname}"; 62 | description = '' 63 | TS_HOSTNAME env var 64 | ''; 65 | }; 66 | TSserve = lib.mkOption { 67 | type = with lib.types; attrsOf str; 68 | default = { }; 69 | description = '' 70 | paths that should map to ports for tailscale serve 71 | ''; 72 | example = { 73 | "/" = "http://127.0.0.1:9000"; 74 | }; 75 | }; 76 | enableFunnel = lib.mkOption { 77 | type = lib.types.bool; 78 | default = false; 79 | description = '' 80 | if you are sure you want to enable funnel 81 | ''; 82 | }; 83 | tags = lib.mkOption { 84 | type = lib.types.listOf lib.types.str; 85 | default = [ "tag:lockdown" ]; 86 | description = '' 87 | list of tags owned by "tag:container" to assign to the container 88 | ''; 89 | }; 90 | }; 91 | }; 92 | # Helper function to create a container configuration from a submodule 93 | mkContainer = 94 | name: cfg: 95 | let 96 | formatTags = builtins.concatStringsSep "," cfg.tags; 97 | PathsToMap = a: b: { Proxy = "${b}"; }; 98 | Serveconfig = { 99 | TCP."443".HTTPS = true; 100 | Web."${cfg.TShostname}.${tailnetName}.ts.net:443".Handlers = lib.mapAttrs PathsToMap cfg.TSserve; 101 | AllowFunnel = { 102 | "${cfg.TShostname}.${tailnetName}.ts.net:443" = cfg.enableFunnel; 103 | }; 104 | }; 105 | in 106 | { 107 | image = "${IMAGE}:${cfg.imageVersion}"; 108 | autoStart = true; 109 | hostname = cfg.TShostname; 110 | environment = lib.mkMerge [ 111 | { 112 | "TS_HOSTNAME" = cfg.TShostname; 113 | "TS_STATE_DIR" = "/var/lib/tailscale"; 114 | "TS_EXTRA_ARGS" = "--advertise-tags=" + formatTags + " " + cfg.TSargs; 115 | } 116 | (lib.mkIf (cfg.TSserve != { }) { 117 | "TS_SERVE_CONFIG" = "config/tailscaleCfg.json"; 118 | "TS_USERSPACE" = "true"; 119 | }) 120 | (lib.mkIf (cfg.TSserve == { }) { 121 | # https://github.com/tailscale/tailscale/issues/11372 122 | "TS_USERSPACE" = "false"; 123 | }) 124 | ]; 125 | environmentFiles = [ 126 | # need to set "TS_AUTHKEY=key" in agenix and import here 127 | config.age.secrets."tailscaleOAuthEnvFile".path 128 | ]; 129 | volumes = [ 130 | "${cfg.volumeLocation}/data-lib:/var/lib" 131 | "/dev/net/tun:/dev/net/tun" 132 | "${ 133 | (pkgs.writeTextFile { 134 | name = "${name}TScfg"; 135 | text = builtins.toJSON Serveconfig; 136 | }) 137 | }:/config/tailscaleCfg.json" 138 | ]; 139 | extraOptions = [ 140 | "--pull=always" 141 | "--cap-add=net_admin" 142 | "--cap-add=sys_module" 143 | ]; 144 | }; 145 | mkTmpfilesRules = name: cfg: [ "d ${cfg.volumeLocation}/data-lib 0755 root root" ]; 146 | in 147 | { 148 | options.yomaq.pods = { 149 | tailscaled = lib.mkOption { 150 | default = { }; 151 | type = with lib.types; attrsOf (submodule containerOpts); 152 | example = { }; 153 | description = lib.mdDoc '' 154 | Additional tailscale containers to pair with container services to expose on the tailnet. 155 | ''; 156 | }; 157 | tailscaleAgenixKey = lib.mkOption { 158 | type = lib.types.path; 159 | default = (inputs.self + /secrets/tailscaleOAuthEnvFile.age); 160 | description = '' 161 | path to agenix secret file 162 | ''; 163 | }; 164 | }; 165 | config = lib.mkIf (cfg != { }) { 166 | age.secrets."tailscaleOAuthEnvFile".file = config.yomaq.pods.tailscaleAgenixKey; 167 | 168 | systemd.tmpfiles.rules = lib.flatten ( 169 | lib.mapAttrsToList (name: cfg: mkTmpfilesRules name cfg) config.yomaq.pods.tailscaled 170 | ); 171 | virtualisation.oci-containers.containers = lib.mapAttrs mkContainer config.yomaq.pods.tailscaled; 172 | }; 173 | } 174 | 175 | 176 | # This allows easy creation of tailscale containers to pair along side other dockerized services. 177 | # Configuration looks like: 178 | 179 | # # yomaq.pods.tailscaled."TS${containerName}" = { 180 | # # TSserve = { 181 | # # "/" = "http://127.0.0.1:3000"; 182 | # # }; 183 | # # tags = [ "tag:tagName" ]; 184 | # # }; 185 | 186 | # Then just make sure the docker containers are all set to use the tailscale container for their networking. 187 | # This will setup the Tailscale Serve config, as well as tagging the device. 188 | -------------------------------------------------------------------------------- /home-manager/yusef/features/desktop/i3/polybar.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, ... }: 2 | let 3 | inherit (lib) mkIf; 4 | inherit (lib.strings) floatToString concatStringsSep; 5 | 6 | monitor = if config.monitors == [] then { scale = 1.0; } else (builtins.head config.monitors); 7 | dpi-scale = monitor.scale; 8 | 9 | # polybar's font definition uses a trailing semicolon 10 | # to separate the font spec from the vertical offset. 11 | # `scaled` returns a float scaled by dpi-scale (converted to string) 12 | # `size-and-offset` returns two scaled floats, separated by ";" 13 | # note that this only works if the `size=` bit is at the end of the 14 | # font spec. 15 | scaled = size: (floatToString (size * dpi-scale)); 16 | size-and-offset = size: offset: 17 | (concatStringsSep ";" [(scaled size) (scaled offset)]); 18 | 19 | font-size-text-regular = (size-and-offset 9.0 3.0); 20 | font-size-text-large = (size-and-offset 19.0 5.0); 21 | font-size-material-icons = (size-and-offset 11.0 4.0); 22 | font-size-feather-icons = (size-and-offset 10.4 3.5); 23 | in 24 | { 25 | services.polybar = { 26 | enable = true; 27 | package = (pkgs.polybar.override { 28 | i3Support = true; 29 | #i3GapsSupport = true; 30 | }); 31 | script = '' 32 | #!/usr/bin/env bash 33 | 34 | # Terminate already running bar instances 35 | # If all your bars have ipc enabled, you can use 36 | polybar-msg cmd quit 37 | # Otherwise you can use the nuclear option: 38 | # killall -q polybar 39 | 40 | echo "---" | tee -a /tmp/polybar.log 41 | polybar 2>&1 | tee -a /tmp/polybar.log & disown 42 | 43 | echo "Bars launched..." 44 | ''; 45 | settings = { 46 | "bar/bottom" = { 47 | bottom = true; 48 | width = "100%"; 49 | height = 30 * dpi-scale; 50 | offset-y = 0; 51 | fixed-center = true; 52 | # override-redirect = true; 53 | # wm-restack = "i3"; 54 | scroll-up = "next"; 55 | scroll-down = "prev"; 56 | enable-ipc = true; 57 | background = "\${colors.trans}"; 58 | foreground = "\${colors.fg}"; 59 | tray-background = "\${colors.bg-alt}"; 60 | tray-position = "right"; 61 | tray-maxsize = 16; 62 | 63 | modules-left = "i3 round-right"; 64 | modules-center = "round-left title round-right"; 65 | modules-right = "round-left date"; 66 | 67 | font-0 = "JetBrainsMono Nerd Font:style=Normal:size=${font-size-text-regular}"; 68 | font-1 = "JetBrainsMono Nerd Font:style=Medium:size=${font-size-text-regular}"; 69 | font-2 = "JetBrainsMono Nerd Font:style=Bold:size=${font-size-text-regular}"; 70 | font-3 = "JetBrainsMono Nerd Font:style=Italic:size=${font-size-text-regular}"; 71 | font-4 = "JetBrainsMono Nerd Font:style=Medium Italic:size=${font-size-text-regular}"; 72 | font-5 = "JetBrainsMono Nerd Font:size=${font-size-text-large}"; 73 | font-6 = "feathericon:size=${font-size-feather-icons}"; 74 | font-7 = "Material Icons:size=${font-size-material-icons}"; 75 | font-8 = "Material Icons Outlined:size=${font-size-material-icons}"; 76 | font-9 = "Material Icons Round:size=${font-size-material-icons}"; 77 | font-10 = "Material Icons Sharp:size=${font-size-material-icons}"; 78 | font-11 = "Material Icons TwoTone:size=${font-size-material-icons}"; 79 | }; 80 | 81 | # TODO: nix-colors 82 | colors = { 83 | bg = "#2E3440"; 84 | bg-alt = "#3B4252"; 85 | fg = "#ECEFF4"; 86 | fg-alt = "#E5E9F0"; 87 | 88 | blue = "#81A1C1"; 89 | cyan = "#88C0D0"; 90 | green = "#A3BE8C"; 91 | orange = "#D08770"; 92 | purple = "#B48EAD"; 93 | red = "#BF616A"; 94 | yellow = "#EBCB8B"; 95 | 96 | black = "#000"; 97 | white = "#FFF"; 98 | 99 | trans = "#00ffffff"; 100 | semi-trans-black = "#aa000000"; 101 | }; 102 | 103 | "module/title" = { 104 | type = "internal/xwindow"; 105 | format = "