trying out xonsh
This commit is contained in:
parent
0442a88d08
commit
cb51f8e6d6
10 changed files with 296 additions and 29 deletions
2
TODO
Normal file
2
TODO
Normal file
|
@ -0,0 +1,2 @@
|
|||
use exa?
|
||||
fix xonsh, implement plugins
|
|
@ -1 +0,0 @@
|
|||
basically just laptop
|
42
flake.lock
generated
42
flake.lock
generated
|
@ -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": {
|
||||
|
|
83
home/dots/xonshrc
Normal file
83
home/dots/xonshrc
Normal file
|
@ -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
|
63
home/dots/xonshrc.py
Normal file
63
home/dots/xonshrc.py
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
44
pkgs/coconut.nix
Normal file
44
pkgs/coconut.nix
Normal file
|
@ -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 ];
|
||||
};
|
||||
}
|
|
@ -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 {};
|
||||
|
|
53
pkgs/pygments.nix
Normal file
53
pkgs/pygments.nix
Normal file
|
@ -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
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue