diff --git a/home/alisceon.nix b/home/alisceon.nix new file mode 100644 index 0000000..c51faab --- /dev/null +++ b/home/alisceon.nix @@ -0,0 +1,171 @@ +{ pkgs, config, hostName, lib, ... }: { + home.username = "alisceon"; + home.homeDirectory = "/home/alisceon"; + home.stateVersion = "24.05"; + manual.manpages.enable = true; + + programs = { + fish = { + enable = true; + # Disable greeting + interactiveShellInit = '' + set fish_greeting + ''; + preferAbbrs = true; + shellAbbrs = { + ls = "exa"; + ll = "exa -lah"; + grep = "rg"; + cat = "bat"; + tsla-fan = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"; + + # NixOS commands + nixoss = "sudo nixos-rebuild switch --flake .#${hostName}"; + nixos-main = "git checkout main && git pull && sudo nixos-rebuild switch --flake .#${hostName}"; + nixossr = "sudo nixos-rebuild switch --flake .#${hostName} && reboot"; + nixost = "sudo nixos-rebuild build-vm --flake .#${hostName}"; + + # Development commands + devt = "devenv test"; + devs = "devenv shell"; + devu = "devenv up"; + devi = "nix flake init -t path:/home/alisceon/Templates/devenv#python"; + + pypod = "podman run --rm -it --network host -v '.:/run' -w '/run' python /run/"; + + # Tower commands + weboot = "nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot"; + }; + }; # end fish + git = { + enable = true; + userName = "alisceon"; + userEmail = "alisceon@protonmail.com"; + extraConfig = { + push = { autoSetupRemote = true; }; + init.defaultBranch = "main"; + }; + }; # end git + vscode.enable = true; + firefox = { + enable = true; + nativeMessagingHosts = [ + pkgs.gnome-browser-connector + ]; + }; # end firefox + bat.enable = true; + ssh = { + enable = true; + matchBlocks = { + "alisceon.com" = { + hostname = "alisceon.com"; + user = "opc"; + }; + "miscbox" = { + hostname = "10.1.0.11"; + proxyJump = "alisceon.com"; + user = "opc"; + }; + "blogbox" = { + hostname = "10.1.0.10"; + proxyJump = "alisceon.com"; + user = "ubuntu"; + }; + "filurbox" = { + hostname = "oci.malice.zone"; + user = "opc"; + }; + "dnspi" = { + hostname = "10.40.0.2"; + user = "pi"; + }; + "tsla-exporter-bridge" = { + hostname = "alma02.lab.the.malice.zone"; + user = "root"; + }; + "tsla-runner-boi" = { + hostname = "alma03.lab.the.malice.zone"; + user = "root"; + }; + }; + }; # end ssh + direnv = { + enable = true; + silent = true; + }; # end direnv + }; # end programs + + # obsidian special case + programs.obsidian.enable = true; + # overide broken config + xdg.configFile."obsidian/obsidian.json".source = lib.mkForce ./conf/obsidian.json; + + home.packages = with pkgs; [ + signal-desktop + discord + eza + fd + ripgrep + ]; + + xdg = { + enable = true; + userDirs.enable = true; + mime.enable = true; + }; + + services.syncthing = { + enable = true; + }; + dconf.enable = true; + dconf.settings = { + "org/gnome/desktop/background" = { + color-shading-type = "solid"; + picture-options = "zoom"; + primary-color = "#000000000000"; + secondary-color = "#000000000000"; + picture-uri = "file:///home/alisceon/Pictures/system/bg.png"; + picture-uri-dark = "file:///home/alisceon/Pictures/system/bg.png"; + }; + "org/gnome/mutter" = { + auto-maximize = true; + }; + "org/gnome/desktop/interface" = { + accent-color = "red"; + color-scheme = "prefer-dark"; + }; + "org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = [ pkgs.gnomeExtensions.ddterm.extensionUuid ]; + favorite-apps = [ + "org.gnome.Nautilus.desktop" + "firefox.desktop" + "code.desktop" + "obsidian.desktop" + "discord.desktop" + "signal.desktop" + ]; + }; + "org/gnome/shell/keybindings" = { + show-screenshot-ui = [ "s" ]; + }; + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + ]; + }; + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + name = "GNOME Console"; + command = "kgx"; + binding = "Return"; + }; + "com/github/amezin/ddterm" = { + ddterm-toggle-hotkey = [ "Return" ]; + window-monitor = "focus"; + hide-when-focus-lost = true; + hide-window-on-esc = true; + tab-policy = "never"; + panel-icon-type = "none"; + }; + }; # end dconf.settings +} # end file diff --git a/home/alisceon/base.nix b/home/alisceon/base.nix index 7250f7c..1911dcb 100644 --- a/home/alisceon/base.nix +++ b/home/alisceon/base.nix @@ -110,4 +110,10 @@ }; # end programs # nixpkgs config xdg.configFile."nixpkgs/config.nix".source = ../conf/config.nix; + home.file.".xonshrc"= { + source = ../conf/xonshrc; + }; + + # Ensure fish exists for the completer backend + home.packages = [ pkgs.fish ]; } # end file diff --git a/home/conf/xonshrc b/home/conf/xonshrc new file mode 100644 index 0000000..3aca5f4 --- /dev/null +++ b/home/conf/xonshrc @@ -0,0 +1,16 @@ +# XONSH WEBCONFIG START +$XONSH_COLOR_STYLE = 'default' +$PROMPT = '{YELLOW}{env_name}{RESET}{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {cwd}{branch_color}{curr_branch: {}}{RESET} {RED}{last_return_code_if_nonzero:[{BOLD_INTENSE_RED}{}{RED}] }{RESET}{BOLD_BLUE}{prompt_end}{RESET} ' +xontrib load coreutils +xontrib load fish_completer +xontrib load direnv +xontrib load fzf-completions +xontrib load clp +xontrib load abbrevs + +from xonsh.built_ins import XSH +XSH.env['fzf_history_binding'] = "c-r" # Ctrl+R +XSH.env['fzf_ssh_binding'] = "c-s" # Ctrl+S +XSH.env['fzf_file_binding'] = "c-t" # Ctrl+T +XSH.env['fzf_dir_binding'] = "c-g" # Ctrl+G + diff --git a/hosts/common.nix b/hosts/common.nix new file mode 100644 index 0000000..64ecfc9 --- /dev/null +++ b/hosts/common.nix @@ -0,0 +1,131 @@ +{ config, pkgs, ... }: + +{ + system.stateVersion = "24.05"; + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + trusted-users = [ "root" "alisceon" ]; + }; # end nix settings + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; # end nix gc + + console.keyMap = "sv-latin1"; + networking.networkmanager.enable = true; + time.timeZone = "Europe/Stockholm"; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + security.sudo.wheelNeedsPassword = false; + + services = { + printing.enable = true; + pulseaudio.enable = false; + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + jack.enable = true; + }; + xserver.xkb.layout = "se"; + displayManager = { + gdm.enable = true; + gdm.wayland = true; + }; + desktopManager.gnome.enable = true; + gnome = { + gnome-keyring.enable = true; + gnome-initial-setup.enable = false; + }; + }; # end services + + environment.gnome.excludePackages = with pkgs; [ + evolution + geary + gnome-contacts + gnome-music + gnome-user-docs + gnome-tour + gnome-weather + gnome-maps + gnome-calendar + gnome-initial-setup + gnome-clocks + ]; + + services.fwupd.enable = true; + programs = { + dconf.enable = true; + fish.enable = true; + steam = { + enable = true; + remotePlay.openFirewall = true; + }; + }; # end programs + + environment.systemPackages = with pkgs; [ + # CLI tools + git + wget + curl + btop + ripgrep + bat + fd + eza + bash + + # Chat + discord + signal-desktop + + # Browser + firefox + + # Development + vscode + devenv + direnv + + # Virtualization + podman + + # GNOME tweaks and extensions + gnome-tweaks + dconf-editor + gnomeExtensions.ddterm + + # Other + syncthing + steam + krita + edk2-uefi-shell + obsidian + ]; + environment.shells = with pkgs; [ fish ]; + + virtualisation.podman = { + enable = true; + dockerCompat = true; + defaultNetwork.settings.dns_enabled = true; + }; + + users.users.alisceon = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "podman" ]; + shell = pkgs.fish; + }; + +} diff --git a/hosts/common/base.nix b/hosts/common/base.nix index c721d34..c77383c 100644 --- a/hosts/common/base.nix +++ b/hosts/common/base.nix @@ -102,6 +102,7 @@ nushell fish powershell + xonsh ]; }; # end environment @@ -114,11 +115,135 @@ users.users.alisceon = { isNormalUser = true; extraGroups = [ "wheel" "networkmanager" "podman" ]; - shell = pkgs.nushell; + shell = pkgs.xonsh; openssh.authorizedKeys.keys = [ "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPN1Cd2UlHo03Jqgi5Yb4io/3gh/X4wCb8LcmKlpAovQa271CKDBtYOUKn+Fts03g6dBMfaWMty6VGPMGDMONmc= alisceon@electra" ]; }; # end users - programs.command-not-found.enable = true; + programs = { + command-not-found.enable = true; + xonsh = { + enable = true; + extraPackages = ps: [ + ( + ps.buildPythonPackage + rec { + name = "xonsh-direnv"; + version = "1.6.5"; + src = pkgs.fetchFromGitHub { + owner = "74th"; + repo = "${name}"; + rev = "${version}"; + sha256 = "sha256-huBJ7WknVCk+WgZaXHlL+Y1sqsn6TYqMP29/fsUPSyU="; + }; + meta = { + homepage = "https://github.com/74th/xonsh-direnv"; + description = "direnv for xonsh"; + license = pkgs.lib.licenses.mit; + maintainers = [ ]; + }; + } + ) + ( + ps.buildPythonPackage + rec { + name = "xontrib-fish-completer"; + version = "0.0.1"; + src = pkgs.fetchFromGitHub { + owner = "xonsh"; + repo = "${name}"; + rev = "${version}"; + sha256 = "sha256-PhhdZ3iLPDEIG9uDeR5ctJ9zz2+YORHBhbsiLrJckyA="; + }; + meta = { + homepage = "https://github.com/xonsh/xontrib-fish-completer"; + description = "fish completions for xonsh"; + license = pkgs.lib.licenses.mit; + maintainers = [ ]; + }; + } + ) + ( + ps.buildPythonPackage + rec { + name = "xontrib-fzf-completions"; + version = "v0.0.2"; + format = "pyproject"; + src = pkgs.fetchFromGitHub { + owner = "doronz88"; + repo = "${name}"; + rev = "${version}"; + sha256 = "sha256-1z5xHX4Psevn8686QkwIzv/LOJ5IMJc2nQ5Hg/2svTc="; + }; + meta = { + homepage = "https://github.com/doronz88/xontrib-fzf-completions"; + description = "fuzzy completions for xonsh"; + license = pkgs.lib.licenses.mit; + maintainers = [ ]; + }; + } + ) + ( + ps.buildPythonPackage + rec { + name = "xontrib-clp"; + version = "0.1.7"; + src = pkgs.fetchFromGitHub { + owner = "anki-code"; + repo = "${name}"; + rev = "${version}"; + sha256 = "sha256-1ewWlwG8KY9s6qydErurvP2x+4DIPTFcjSGP1c5y83M="; + }; + meta = { + homepage = "https://github.com/anki-code/xontrib-clp"; + description = "clipboard completions for xonsh"; + license = pkgs.lib.licenses.mit; + maintainers = [ ]; + }; + } + ) + ( + ps.buildPythonPackage + rec { + name = "xontrib-abbrevs"; + version = "v0.1.0"; + format = "pyproject"; + src = pkgs.fetchFromGitHub { + owner = "xonsh"; + repo = "${name}"; + rev = "${version}"; + sha256 = "sha256-JxH5b2ey99tvHXSUreU5r6fS8nko4RrS/1c8psNbJNc="; + }; + meta = { + homepage = "https://github.com/xonsh/xontrib-abbrevs"; + description = "abbreviation completions for xonsh"; + license = pkgs.lib.licenses.mit; + maintainers = [ ]; + }; + } + ) + ( + ps.buildPythonPackage + rec { + name = "xontrib-bashisms"; + version = "0.0.5"; + format = "pyproject"; + src = pkgs.fetchFromGitHub { + owner = "xonsh"; + repo = "${name}"; + rev = "${version}"; + sha256 = "sha256-R1DCGMrRCJLnz/QMk6QB8ai4nx88vvyPdaCKg3od5/I="; + }; + meta = { + homepage = "https://github.com/xonsh/xontrib-bashisms"; + description = "bashisms for xonsh"; + license = pkgs.lib.licenses.mit; + maintainers = [ ]; + }; + } + ) + ]; + }; + }; } #end file diff --git a/run/.containerenv b/run/.containerenv new file mode 100755 index 0000000..e69de29