diff --git a/TODO b/TODO new file mode 100644 index 0000000..e974afe --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +use exa? +fix xonsh, implement plugins diff --git a/flake-todo b/flake-todo deleted file mode 100644 index ce1b12b..0000000 --- a/flake-todo +++ /dev/null @@ -1 +0,0 @@ -basically just laptop \ No newline at end of file diff --git a/flake.lock b/flake.lock index c77f698..273250c 100644 --- a/flake.lock +++ b/flake.lock @@ -218,11 +218,11 @@ ] }, "locked": { - "lastModified": 1683560683, - "narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=", + "lastModified": 1685457039, + "narHash": "sha256-bEFtQm+YyLxQjKQAaBHJyPN1z2wbhBnr2g1NJWSYjwM=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "006c75898cf814ef9497252b022e91c946ba8e17", + "rev": "80717d11615b6f42d1ad2e18ead51193fc15de69", "type": "github" }, "original": { @@ -319,11 +319,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1685289082, - "narHash": "sha256-fryIaVSDYZAZWxlBQwldxGjINJnHh27DQRabOIx/oYI=", + "lastModified": 1685487437, + "narHash": "sha256-hxcl/seMmFtFhr2Nv/bBEEVgcFSyrvE2MLMtQJtG9nM=", "owner": "helix-editor", "repo": "helix", - "rev": "3334e7e4b2181590ddfa9aa72a19429b9b2381ea", + "rev": "d511122279b3b479362830305f4812f096273b6a", "type": "github" }, "original": { @@ -339,11 +339,11 @@ ] }, "locked": { - "lastModified": 1685189510, - "narHash": "sha256-Hq5WF7zIixojPgvhgcd6MBvywwycVZ9wpK/8ogOyoaA=", + "lastModified": 1685480784, + "narHash": "sha256-pkk3J9gX745LEkkeTGhSRJqPJkmCPQzwI/q7a720XaY=", "owner": "nix-community", "repo": "home-manager", - "rev": "2d963854ae2499193c0c72fd67435fee34d3e4fd", + "rev": "54a9d6456eaa6195998a0f37bdbafee9953ca0fb", "type": "github" }, "original": { @@ -360,11 +360,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1685307013, - "narHash": "sha256-sin6htYT96qZSJKrhgBNuiBnMgem7IL/Mg9A51bqGPg=", + "lastModified": 1685380658, + "narHash": "sha256-LPih0Q//p8IurXG9kGRVGAqV4AUKVYj9xkk3sYYAj6I=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "438d063ec684c2194563678ace5a625e6fb56517", + "rev": "51a930f802c71a0e67f05e7b176ded74e8e95f87", "type": "github" }, "original": { @@ -556,11 +556,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1685168767, - "narHash": "sha256-wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk=", + "lastModified": 1685383865, + "narHash": "sha256-3uQytfnotO6QJv3r04ajSXbEFMII0dUtw0uqYlZ4dbk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e10802309bf9ae351eb27002c85cfdeb1be3b262", + "rev": "5e871d8aa6f57cc8e0dc087d1c5013f6e212b4ce", "type": "github" }, "original": { @@ -572,11 +572,11 @@ }, "nur": { "locked": { - "lastModified": 1685320818, - "narHash": "sha256-QRLfYOJuL/1lwPHmelTbvCK6EDQeWcKZfGF0QSbsJ5c=", + "lastModified": 1685501578, + "narHash": "sha256-PdohObEAlSPfzwJfi0EwrxsQX2yAzcRgY1ntDw8l82w=", "owner": "nix-community", "repo": "NUR", - "rev": "e7bf6b743fc8b1aea39b926a5b4ca657270d393b", + "rev": "90fbc75ebade34e5e881cd88def6aee2008609a6", "type": "github" }, "original": { @@ -678,11 +678,11 @@ ] }, "locked": { - "lastModified": 1685327024, - "narHash": "sha256-mSFu5QI7St1Wj4BIKJkO8mEKZHJ6PosHoG6fEco16jg=", + "lastModified": 1685500416, + "narHash": "sha256-P6wLC+P8o9w4XNLZAbZy3BwKkp1xi/+H9dF+7SXDP70=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d6ac24aa7ff658552ce57913df4b0cb823cf15ab", + "rev": "9651f0beee6e7a9783cc02eac722854851c65ae7", "type": "github" }, "original": { diff --git a/home/dots/xonshrc b/home/dots/xonshrc new file mode 100644 index 0000000..f04ab3a --- /dev/null +++ b/home/dots/xonshrc @@ -0,0 +1,83 @@ +# nix fix +import sys +import os.path +if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"): + $NIX_REMOTE="daemon" + $NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER + $NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile" + $NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + $NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels" + $PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"] + + +new_paths = [#NEWPATHS] +# new_paths = new_paths + list(map(lambda s: str(s.resolve()), p"~/.local/lib/".glob("python*/site-packages"))) +for p in new_paths: + if p not in sys.path: + sys.path.append(p) + $PYTHONPATH.append(p) + +# prompt +execx($(/run/current-system/sw/bin/starship init xonsh --print-full-init)) + +# zjump +execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide') + +# envs +$AUTO_CONTINUE = True +$AUTO_CD = True +$DOTGLOB = True +$GLOB_SORTED = True +$INDENT = ' ' +$AUTO_SUGGEST = True +$AUTO_SUGGEST_IN_COMPLETIONS = True +$VI_MODE = True +$XONSH_AUTOPAIR = True +$XONSH_COPY_ON_DELETE = True +$ALIAS_COMPLETIONS_OPTIONS_BY_DEFAULT = True +$CASE_SENSITIVE_COMPLETIONS = False +$COMPLETIONS_BRACKETS = True +$COMPLETION_IN_THREAD = True + +# aliases +def la_alias(dir=""): + exa -lha --icons --group-directories-first --color=always @(dir) | do_culr + +def l_alias(dir=""): + exa -lh --icons --group-directories-first --color=always @(dir) | do_culr + +def p_alias(opts=""): + ps ww @(opts) | do_culr + +def mnt_alias(): + mount | column -t | do_culr +def fresh_alias(): + clear + echo + ~/.nix/header.sh + +aliases["fresh"] = fresh_alias +aliases["icat"] = [ "kitty", "+kitten", "icat" ] +aliases["chmox"] = [ "chmod", "+x" ] +aliases["gs"] = [ "git", "status" ] +aliases["gcl"] = [ "git", "clone" ] +aliases["ga"] = [ "git", "add" ] +aliases["gcb"] = [ "git", "checkout", "-b" ] +aliases["gco"] = [ "git", "checkout" ] +aliases["gl"] = [ "git", "pull" ] +aliases["gp"] = [ "git", "push" ] +aliases["gd"] = [ "git", "diff" ] +aliases["gcam"] = [ "git", "commit", "-am" ] +aliases["gcm"] = [ "git", "commit", "-m" ] +aliases["gr"] = [ "git", "restore" ] +aliases["gm"] = [ "git", "merge" ] +aliases["p"] = p_alias +aliases["l"] = l_alias +aliases["la"] = la_alias +aliases["mnt"] = mnt_alias +aliases["zz"] = [ "z", "$(xplr)" ] +aliases["do_culr"] = [ "culr", "-t", "80", "-o", "roygbiv-split" ] +# alias kaboom='printf "type any input if you wish to update\n\npress enter to continue\n"; read upgrade; if [ -n "$upgrade" ]; then echo upgrading..; sudo nix-channel --update; else echo no upgrade!; fi; sudo nixos-rebuild switch -j9 && rm ~/.gtkrc-2.0; home-manager switch && sudo nix-collect-garbage && nix-store --optimise' + +# greet +fresh diff --git a/home/dots/xonshrc.py b/home/dots/xonshrc.py new file mode 100644 index 0000000..6853c79 --- /dev/null +++ b/home/dots/xonshrc.py @@ -0,0 +1,63 @@ +# nix fix +import os.path +if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"): + $NIX_REMOTE="daemon" + $NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER + $NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile" + $NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + $NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels" + $PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"] + +# prompt +execx($(/run/current-system/sw/bin/starship init xonsh --print-full-init)) + +# envs +$AUTO_CONTINUE = True +$AUTO_CD = True +$DOTGLOB = True +$GLOB_SORTED = True +$INDENT = ' ' +$AUTO_SUGGEST = True +$AUTO_SUGGEST_IN_COMPLETIONS = True +$VI_MODE = True +$XONSH_AUTOPAIR = True +$XONSH_COPY_ON_DELETE = True +$ALIAS_COMPLETIONS_OPTIONS_BY_DEFAULT = True +$CASE_SENSITIVE_COMPLETIONS = False +$COMPLETIONS_BRACKETS = True +$COMPLETION_IN_THREAD = True + +# aliases +def la_culr(dir=""): + exa -lha --icons --group-directories-first --color=always @(dir) | culr -t 80 -o roygbiv-split + +def ls_culr(dir=""): + exa -lh --icons --group-directories-first --color=always @(dir) | culr -t 80 -o roygbiv-split + +def ps_culr(opts=""): + ps ww @(opts) | culr -t 80 -o roygbiv-split + +aliases["fresh"] = [ "clear;", "echo;", "~/.nix/header.sh" ] +aliases["icat"] = [ "kitty", "+kitten", "icat" ] +aliases["chmox"] = [ "chmod", "+x" ] +aliases["gs"] = [ "git", "status" ] +aliases["gcl"] = [ "git", "clone" ] +aliases["ga"] = [ "git", "add" ] +aliases["gcb"] = [ "git", "checkout", "-b" ] +aliases["gco"] = [ "git", "checkout" ] +aliases["gl"] = [ "git", "pull" ] +aliases["gp"] = [ "git", "push" ] +aliases["gd"] = [ "git", "diff" ] +aliases["gcam"] = [ "git", "commit", "-am" ] +aliases["gcm"] = [ "git", "commit", "-m" ] +aliases["gr"] = [ "git", "restore" ] +aliases["gm"] = [ "git", "merge" ] +aliases["l"] = [ "ls_culr" ] +aliases["la"] = [ "la_culr" ] +aliases["p"] = [ "ps_culr" ] +aliases["mnt"] = [ "mount", "|", "column", "-t", "|", "culr", "-t", "80", "-o", "roygbiv-split" ] +aliases["zz"] = [ "z", "$(xplr)" ] +# alias kaboom='printf "type any input if you wish to update\n\npress enter to continue\n"; read upgrade; if [ -n "$upgrade" ]; then echo upgrading..; sudo nix-channel --update; else echo no upgrade!; fi; sudo nixos-rebuild switch -j9 && rm ~/.gtkrc-2.0; home-manager switch && sudo nix-collect-garbage && nix-store --optimise' + +# greet +fresh diff --git a/home/home.nix b/home/home.nix index b38fc85..db0eb0e 100644 --- a/home/home.nix +++ b/home/home.nix @@ -25,7 +25,6 @@ in { btop bat - xplr ripgrep fd lazygit @@ -45,6 +44,7 @@ in { waylock playerctl + xplr culr swayosd fuzzel @@ -102,6 +102,16 @@ in { (builtins.readFile dots/hyprland/hyprland.conf)); }; + programs.starship = { + enable = true; + settings = { + format = "$directory$os$all"; + directory = { + truncate_to_repo = false; + }; + }; + }; + programs.eww-hyprland = { enable = true; colors = with palette-hex; (builtins.replaceStrings diff --git a/pkgs/coconut.nix b/pkgs/coconut.nix new file mode 100644 index 0000000..475cb6b --- /dev/null +++ b/pkgs/coconut.nix @@ -0,0 +1,44 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, cpyparsing +, ipykernel +, mypy +, pexpect +, pygments +, pytestCheckHook +, prompt-toolkit +, tkinter +, watchdog +, pkgs +}:let + pygments = pkgs.python310Packages.callPackage ./pygments.nix {}; +in buildPythonPackage rec { + pname = "coconut"; + version = "3.0.2"; + + src = fetchFromGitHub { + owner = "evhub"; + repo = "coconut"; + rev = "v${version}"; + sha256 = lib.fakeSha256; + }; + + propagatedBuildInputs = [ cpyparsing ipykernel mypy pygments prompt-toolkit watchdog ]; + + checkInputs = [ pexpect pytestCheckHook tkinter ]; + + # Currently most tests have performance issues + pytestFlagsArray = [ + "coconut/tests/constants_test.py" + ]; + + pythonImportsCheck = [ "coconut" ]; + + meta = with lib; { + homepage = "http://coconut-lang.org/"; + description = "Simple, elegant, Pythonic functional programming"; + license = licenses.asl20; + maintainers = with maintainers; [ fabianhjr ]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 09eb2e5..b35cba0 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,7 +1,9 @@ -{pkgs, ...}: { +{pkgs, ...}: +{ hyprland-system76-scheduler-integration = pkgs.callPackage ./hyprland-system76-scheduler-integration.nix {}; culr = pkgs.callPackage ./culr.nix {}; everforest-theme = pkgs.callPackage ./everforst-theme.nix {}; + # coconut = pkgs.python310Packages.callPackage ./coconut.nix {}; # kanagawa-icons = pkgs.callPackage ./kanagawa-icons.nix {}; # gruvbox-kvantum = pkgs.callPackage ./gruvbox-kvantum.nix {}; # gruvbox-gtk-theme = pkgs.callPackage ./gruvbox-gtk-theme.nix {}; diff --git a/pkgs/pygments.nix b/pkgs/pygments.nix new file mode 100644 index 0000000..dbf6c76 --- /dev/null +++ b/pkgs/pygments.nix @@ -0,0 +1,53 @@ +{ lib +, buildPythonPackage +, fetchPypi +, docutils +, lxml +, pytestCheckHook +, wcag-contrast-ratio +}: + +let pygments = buildPythonPackage + rec { + pname = "pygments"; + version = "2.15.1"; + + src = fetchPypi { + pname = "Pygments"; + inherit version; + sha256 = "sha256-is5NPB3UgYlLIAX1YOrQ+fGe5k/pgzZr4aIeFx0Sd1w="; + }; + + format = "egg"; + + propagatedBuildInputs = [ + docutils + ]; + + # circular dependencies if enabled by default + doCheck = false; + checkInputs = [ + lxml + pytestCheckHook + wcag-contrast-ratio + ]; + + disabledTestPaths = [ + # 5 lines diff, including one nix store path in 20000+ lines + "tests/examplefiles/bash/ltmain.sh" + ]; + + pythonImportsCheck = [ "pygments" ]; + + passthru.tests = { + check = pygments.overridePythonAttrs (_: { doCheck = true; }); + }; + + meta = with lib; { + homepage = "https://pygments.org/"; + description = "A generic syntax highlighter"; + license = licenses.bsd2; + maintainers = with maintainers; [ SuperSandro2000 ]; + }; + }; +in pygments diff --git a/system/configuration.nix b/system/configuration.nix index 473d8ca..48e630e 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -6,7 +6,8 @@ pkgs, nix-rice, ... -}: { +}: +{ nixpkgs = { overlays = [ inputs.nur.overlay @@ -114,7 +115,17 @@ qt.style = "gtk2"; programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; + programs.xonsh = { + enable = true; + config = builtins.replaceStrings + ["#NEWPATHS"] + ['' + '${pkgs.xonsh}/lib/python3.10/site-packages', + '${pkgs.python310Packages.pip}/lib/python3.10/site-packages' + ''] + (builtins.readFile ../home/dots/xonshrc); + }; + users.defaultUserShell = pkgs.xonsh; services.tailscale.enable = true; @@ -126,21 +137,21 @@ home-manager cachix - # helix ark curl + exa git - zsh - nix-index comma + starship cachix alejandra + ]; # services.mullvad-vpn.enable = true;