diff --git a/misc/nix.nix b/misc/nix.nix index 0123d39..7fe9529 100644 --- a/misc/nix.nix +++ b/misc/nix.nix @@ -5,13 +5,16 @@ args @ { pkgs, ... }: nixpkgs.config.permittedInsecurePackages = [ "freeimage-unstable-2021-11-01" ]; - + + home-manager.users.krizej.programs.home-manager.enable = true; home-manager.users.krizej.home.packages = [ (pkgs.writeShellScriptBin "rebuild" '' + set -e + # hack: update autorandr stuffs autorandr --match-edid --dry-run &> ~/nix/files/autorandr.txt - sudo nixos-rebuild switch --flake ~/nix --show-trace -v + sudo nixos-rebuild switch --flake ~/nix --show-trace -v $@ '') ]; diff --git a/misc/xdg.nix b/misc/xdg.nix index d3b13e0..c129fa5 100644 --- a/misc/xdg.nix +++ b/misc/xdg.nix @@ -1,19 +1,26 @@ { config, lib, pkgs, ... }: let HOME = config.home-manager.users.krizej.home.homeDirectory; + XDG_DATA_HOME = "${HOME}/.local/share"; + XDG_CONFIG_HOME = "${HOME}/.config"; + XDG_STATE_HOME = "${HOME}/.local/state"; + XDG_CACHE_HOME = "${HOME}/.cache"; in { + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.common.default = [ "*" ]; + }; + home-manager.users.krizej = { home.packages = with pkgs; [ xdg-user-dirs xdg-utils ]; - - home.sessionVariables = rec { + + home.sessionVariables = { # xdg crap thx poz - XDG_DATA_HOME = "${HOME}/.local/share"; - XDG_CONFIG_HOME = "${HOME}/.config"; - XDG_STATE_HOME = "${HOME}/.local/state"; - XDG_CACHE_HOME = "${HOME}/.cache"; ANDROID_USER_HOME = "${XDG_DATA_HOME}/android"; ANDROID_HOME = "${XDG_DATA_HOME}/android/sdk"; GRADLE_USER_HOME = "${XDG_DATA_HOME}/gradle"; @@ -30,50 +37,45 @@ in { GTK2_RC_FILES = lib.mkForce "${XDG_CONFIG_HOME}/gtk-2.0/gtkrc"; }; - xdg.userDirs = { - enable = true; - desktop = "${HOME}/desktop"; - documents = "${HOME}/documents"; - download = "${HOME}/downloads"; - music = "${HOME}/music"; - pictures = "${HOME}/pictures"; - publicShare = "${HOME}/public"; - templates = "${HOME}/templates"; - videos = "${HOME}/videos"; - }; + xdg = { + dataHome = XDG_DATA_HOME; + configHome = XDG_CONFIG_HOME; + stateHome = XDG_STATE_HOME; + cacheHome = XDG_CACHE_HOME; - # fix this scheisse - xdg.portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-kde ]; - config.common.default = [ "*" ]; - }; + userDirs = { + enable = true; + desktop = "${HOME}/desktop"; + documents = "${HOME}/documents"; + download = "${HOME}/downloads"; + music = "${HOME}/music"; + pictures = "${HOME}/pictures"; + publicShare = "${HOME}/public"; + templates = "${HOME}/templates"; + videos = "${HOME}/videos"; + }; - home.file = { - ".config/python/pythonrc".text = '' - def is_vanilla() -> bool: - import sys - return not hasattr(__builtins__, '__IPYTHON__') and 'bpython' not in sys.argv[0] + configFile = { + "python/pythonrc".text = '' + import os + import atexit + import readline - def setup_history(): - import os - import atexit - import readline - from pathlib import Path + history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history') + try: + readline.read_history_file(history) + except OSError: + pass - if state_home := os.environ.get('XDG_STATE_HOME'): - state_home = Path(state_home) - else: - state_home = Path.home() / '.local' / 'state' + def write_history(): + try: + readline.write_history_file(history) + except OSError: + pass - history: Path = state_home / 'python_history' - - readline.read_history_file(str(history)) - atexit.register(readline.write_history_file, str(history)) - - if is_vanilla(): - setup_history() - ''; + atexit.register(write_history) + ''; + }; }; }; } diff --git a/programs/default.nix b/programs/default.nix index 1a5223f..b39552a 100644 --- a/programs/default.nix +++ b/programs/default.nix @@ -19,29 +19,27 @@ environment.systemPackages = with pkgs; [ ed # is the standard text editor. + ripgrep file tree btop + eza + wget + zip unzip rar unrar p7zip p7zip-rar - wget + gcc gnumake pkg-config python39 ]; - # maybe i can just put it into the packages but idk whatever - home-manager.users.krizej.programs = { - home-manager.enable = true; - eza.enable = true; - yt-dlp.enable = true; - }; home-manager.users.krizej.home.packages = with pkgs; [ fortune @@ -70,6 +68,8 @@ sqlitebrowser feh vlc + obs-studio + yt-dlp gdb ccls @@ -78,10 +78,6 @@ valgrind linuxKernel.packages.linux_6_6.perf - gpu-screen-recorder # todo: config this shit so it works - gpu-screen-recorder-gtk - obs-studio - jetbrains.pycharm-community jetbrains.clion (pkgs.writeShellScriptBin "clion-nix" '' diff --git a/programs/fish.nix b/programs/fish.nix index a6e6c82..41e7bf8 100644 --- a/programs/fish.nix +++ b/programs/fish.nix @@ -1,5 +1,7 @@ -{ pkgs, ... }: -{ +{ pkgs, config, ... }: let + hmCfg = config.home-manager.users.krizej; + XDG_DATA_HOME = hmCfg.xdg.dataHome; +in { environment.systemPackages = [ pkgs.fish ]; programs.fish.enable = true; users.users.krizej.shell = pkgs.fish; @@ -17,6 +19,8 @@ "mv" = "mv -v"; "ytmp3" = "yt-dlp -o '%(title)s.%(ext)s' -x --audio-format mp3"; "myip" = "curl ifconfig.me"; + "0x0" = ''curl -F"file=@$argv" https://0x0.st''; + "wget" = "${pkgs.wget}/bin/wget --hsts-file='${XDG_DATA_HOME}/wget-hsts'"; }; shellAbbrs = { diff --git a/services/xserver.nix b/services/xserver.nix index cac1a6d..56bd21e 100644 --- a/services/xserver.nix +++ b/services/xserver.nix @@ -1,21 +1,22 @@ -{ config, lib, pkgs, ... }: +args @ { config, lib, pkgs, ... }: { services = { xserver = { enable = true; xkb.layout = "pl"; - displayManager = { + displayManager = let + monitors = import ../utils/monitors.nix args; + in { # THIS SHIT DOESN'T WORK!!! - # TODO: REPLACE MONITOR NAMES HERE WHEN I START CARING setupCommands = '' - xrandr --output DP-3 --mode 1920x1080 --rate 239.76 --primary - xrandr --output HDMI-1 --off + xrandr --output ${monitors.left} --mode 1920x1080 --rate 239.76 --primary + xrandr --output ${monitors.right} --off xset r rate 180 50 ''; sessionCommands = '' - xrandr --output DP-3 --mode 1920x1080 --rate 239.76 --primary - xrandr --output HDMI-1 --mode 1920x1080 --rate 74.97 --right-of DP-3 + xrandr --output ${monitors.left} --mode 1920x1080 --rate 239.76 --primary + xrandr --output ${monitors.right} --mode 1920x1080 --rate 74.97 --right-of ${monitors.left} xset r rate 180 50 ''; };