From e55db22d796864361912271192add2d8d9be7f11 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 7 Nov 2022 09:44:05 -0500 Subject: [PATCH 1/2] refactor: rm omega (currently not using hive); welcome back later --- comb/omega/colmenaConfigurations.nix | 7 - .../blacklion/default.nix | 114 ------------ .../blacklion/hardware-configuration.nix | 38 ---- .../colmenaConfigurations/blacklion/zfs.nix | 8 - comb/omega/homeConfigurations.nix | 24 --- comb/omega/homeProfiles.nix | 172 ------------------ comb/omega/homeSuites.nix | 23 --- comb/omega/nixosProfiles.nix | 18 -- 8 files changed, 404 deletions(-) delete mode 100644 comb/omega/colmenaConfigurations.nix delete mode 100644 comb/omega/colmenaConfigurations/blacklion/default.nix delete mode 100644 comb/omega/colmenaConfigurations/blacklion/hardware-configuration.nix delete mode 100644 comb/omega/colmenaConfigurations/blacklion/zfs.nix delete mode 100644 comb/omega/homeConfigurations.nix delete mode 100644 comb/omega/homeProfiles.nix delete mode 100644 comb/omega/homeSuites.nix delete mode 100644 comb/omega/nixosProfiles.nix diff --git a/comb/omega/colmenaConfigurations.nix b/comb/omega/colmenaConfigurations.nix deleted file mode 100644 index f8bbda4..0000000 --- a/comb/omega/colmenaConfigurations.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - # blacklion = { - # bee.system = "x86_64-linux"; - # bee.pkgs = inputs.nixos.legacyPackages; - # imports = [./nixosConfigurations/blacklion]; - # }; -} diff --git a/comb/omega/colmenaConfigurations/blacklion/default.nix b/comb/omega/colmenaConfigurations/blacklion/default.nix deleted file mode 100644 index 28f3a94..0000000 --- a/comb/omega/colmenaConfigurations/blacklion/default.nix +++ /dev/null @@ -1,114 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - pkgs, - inputs, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ./zfs.nix - ]; - - nixpkgs.config.allowUnfree = true; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Set your time zone. - time.timeZone = "Africa/Nairobi"; - - # The global useDHCP flag is deprecated, therefore explicitly set to false here. - # Per-interface useDHCP will be mandatory in the future, so this generated config - # replicates the default behaviour. - networking.useDHCP = false; - networking.interfaces.eno1.useDHCP = true; - networking.interfaces.wlo1.useDHCP = true; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - services.sshd.enable = true; - - # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - - # Configure keymap in X11 - # services.xserver.layout = "us"; - # services.xserver.xkbOptions = "eurosign:e"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - sound.enable = true; - hardware.pulseaudio.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.omega = { - isNormalUser = true; - initialPassword = "password123"; - extraGroups = ["wheel"]; # Enable ‘sudo’ for the user. - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - firefox - slack - tty-share - git - alacritty - kakoune - ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "21.11"; # Did you read the comment? -} diff --git a/comb/omega/colmenaConfigurations/blacklion/hardware-configuration.nix b/comb/omega/colmenaConfigurations/blacklion/hardware-configuration.nix deleted file mode 100644 index b9e2989..0000000 --- a/comb/omega/colmenaConfigurations/blacklion/hardware-configuration.nix +++ /dev/null @@ -1,38 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-label/NIXBOOT"; - fsType = "vfat"; - }; - - swapDevices = [ - { - device = "/.swapfile"; - } - ]; - - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/comb/omega/colmenaConfigurations/blacklion/zfs.nix b/comb/omega/colmenaConfigurations/blacklion/zfs.nix deleted file mode 100644 index d25d61f..0000000 --- a/comb/omega/colmenaConfigurations/blacklion/zfs.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - config, - pkgs, - ... -}: { - boot.supportedFilesystems = ["zfs"]; - networking.hostId = "628b429e"; -} diff --git a/comb/omega/homeConfigurations.nix b/comb/omega/homeConfigurations.nix deleted file mode 100644 index 6329cfb..0000000 --- a/comb/omega/homeConfigurations.nix +++ /dev/null @@ -1,24 +0,0 @@ -let - inherit (cell) homeSuites homeProfiles; - - name = "Omega Dilebo"; - email = "omega.meseret@iohk.io"; - gitSigningKey = "FFFFFFFFFFFFFFFF"; -in { - omega = { - bee = { - system = "x86_64-linux"; - inherit (inputs) home; - pkgs = inputs.nixos.legacyPackages; - }; - imports = with homeSuites; with homeProfiles; shell; - programs.git = { - userName = name; - userEmail = email; - # signing = { - # key = gitSigningKey; - # signByDefault = true; - # }; - }; - }; -} diff --git a/comb/omega/homeProfiles.nix b/comb/omega/homeProfiles.nix deleted file mode 100644 index 4e464cc..0000000 --- a/comb/omega/homeProfiles.nix +++ /dev/null @@ -1,172 +0,0 @@ -let - inherit (inputs) nixpkgs; -in { - bat.programs.bat.enable = true; - broot.programs.broot.enable = true; - direnv.programs.direnv.enable = true; - fzf.programs.fzf.enable = true; - gpg.programs.gpg.enable = true; - jq.programs.jq.enable = true; - mcfly.programs.mcfly.enable = true; - starship.programs.starship.enable = true; - zoxide.programs.zoxide.enable = true; - gh.programs.gh = { - enable = true; - settings.git_protocol = "ssh"; - }; - packages.home.packages = with nixpkgs; [ - bottom # more modern top / htop - choose # between cut & awk - beautiful - curlie # modern curl - dogdns # modern dig - duf # modern df - du-dust # modern du - exa # modern ls (not on LSD) - fx # jq, but don't admit you somtimes like to use a mouse - fd # modern find - gitui # git tui, the nicer one - gping # modern ping - hyperfine # benchmark shell commands like a boss - ijq # interactive jq wrapper, requires jq - magic-wormhole # secure file sharing over cli - navi # interactive cli cheat sheet with cheat.sh / tldr integration - # NB: nixpkgs#tldr doesn't support the --makdown flag and wouldn't work with navi - tealdeer # fast tldr in rust - an (optional) navi runtime dependency - procs # modern ps - sd # modern sed - thefuck # if you mistyped: fuck - tty-share # Secure terminal-session sharing - watchexec # Executes commands in response to file modifications - h # faster shell navigation of projects - jd-diff-patch # semantic json differ - arping - pijul # modern darcs-inspired vcs - eva # modern bc - manix # explore nixos/hm options - borgbackup # backup tool - git-filter-repo # rewrite git history like a pro (and fast) - ]; - alacritty.programs.alacritty = { - enable = true; - CSIuSupport = true; - settings = { - env.TERM = "xterm-256color"; - window.decorations = "full"; - font.size = 9.0; - cursor.style = "Beam"; - - # snazzy theme - colors = { - # Default colors - primary = { - background = "0x282a36"; - foreground = "0xeff0eb"; - }; - - # Normal colors - normal = { - black = "0x282a36"; - red = "0xff5c57"; - green = "0x5af78e"; - yellow = "0xf3f99d"; - blue = "0x57c7ff"; - magenta = "0xff6ac1"; - cyan = "0x9aedfe"; - white = "0xf1f1f0"; - }; - - # Bright colors - bright = { - black = "0x686868"; - red = "0xff5c57"; - green = "0x5af78e"; - yellow = "0xf3f99d"; - blue = "0x57c7ff"; - magenta = "0xff6ac1"; - cyan = "0x9aedfe"; - white = "0xf1f1f0"; - }; - }; - }; - }; - git.programs.git = { - enable = true; - delta.enable = true; - lfs.enable = true; - - delta.options = { - plus-style = "syntax #012800"; - minus-style = "syntax #340001"; - syntax-theme = "Monokai Extended"; - navigate = true; - }; - - extraConfig = { - core.autocrlf = "input"; - init.defaultBranch = "main"; - pull.rebase = true; - rebase.autosquash = true; - rerere.enabled = true; - }; - }; - zsh.programs.zsh = { - enable = true; - enableAutosuggestions = true; - enableCompletion = true; - autocd = true; - history.share = true; - dotDir = ".config/zsh"; - shellGlobalAliases = { - "..." = "../.."; - "...." = "../../.."; - "....." = "../../../..."; - }; - shellAliases = { - d = "direnv"; - g = "git"; - jc = "journalctl"; - la = "exa -lah"; - l = "exa -lh"; - ls = "exa"; - md = "mkdir -p"; - n = "nix"; - rd = "rmdir"; - sc = "systemctl"; - "_" = "sudo "; - }; - initExtra = '' - export EDITOR=$(which vim) - export GPG_TTY=$(tty) - - # Remove when intregrations are set up - eval "$(thefuck --alias)" - - eval "$(h --setup ~/src)" - - ######################################### oh-my-zsh/lib/key-bindings.zsh ######################################### - # Start typing + [Up-Arrow] - fuzzy find history forward - if [[ "''${terminfo[kcuu1]}" != "" ]]; then - autoload -U up-line-or-beginning-search - zle -N up-line-or-beginning-search - bindkey "''${terminfo[kcuu1]}" up-line-or-beginning-search - fi - # Start typing + [Down-Arrow] - fuzzy find history backward - if [[ "''${terminfo[kcud1]}" != "" ]]; then - autoload -U down-line-or-beginning-search - zle -N down-line-or-beginning-search - bindkey "''${terminfo[kcud1]}" down-line-or-beginning-search - fi - - bindkey '^[[127;5u' backward-kill-word # [Ctrl-Backspace] - delete whole backward-word - bindkey '^[[127;2u' backward-kill-word # [Shift-Backspace] - delete whole backward-word - bindkey '^[[127;4u' backward-kill-line # [Shift-Alt-Backspace] - delete line up to cursor - bindkey '^[[3;5~' kill-word # [Ctrl-Delete] - delete whole forward-word - bindkey '^[[3;2~' kill-word # [Shift-Delete] - delete whole forward-word - bindkey '^[[3;4~' kill-line # [Shift-Alt-Delete] - delete line from cursor - bindkey '^[[Z' reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards - bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word - bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word - ################################################################################################################## - ''; - }; -} diff --git a/comb/omega/homeSuites.nix b/comb/omega/homeSuites.nix deleted file mode 100644 index a2a470b..0000000 --- a/comb/omega/homeSuites.nix +++ /dev/null @@ -1,23 +0,0 @@ -let - inherit (inputs.cells) blaggacao; - - inherit (cell) homeProfiles; -in { - shell = with homeProfiles; [ - blaggacao.homeModules.alacritty - alacritty - bat - broot - direnv - fzf - gh - git - gpg - jq - mcfly - packages - starship - zoxide - zsh - ]; -} diff --git a/comb/omega/nixosProfiles.nix b/comb/omega/nixosProfiles.nix deleted file mode 100644 index 627c67c..0000000 --- a/comb/omega/nixosProfiles.nix +++ /dev/null @@ -1,18 +0,0 @@ -let - inherit (inputs) nixpkgs; -in { - iog-patched-nix = { - nix = { - package = nixpkgs.nix; - gc.automatic = true; - gc.options = "--max-freed $((10 * 1024 * 1024))"; - optimise.automatic = true; - autoOptimiseStore = true; - extraOptions = '' - experimental-features = nix-command flakes recursive-nix - ''; - binaryCaches = ["https://hydra.iohk.io"]; - binaryCachePublicKeys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="]; - }; - }; -} From 33469539a5bb96525d832d5b64e93814c65abe73 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sat, 5 Nov 2022 15:51:15 -0500 Subject: [PATCH 2/2] feat(lina2358): add initial [working] configuration --- comb/lina2358/colmenaConfigurations.nix | 14 ++ comb/lina2358/hardwareProfiles.nix | 13 ++ .../hardwareProfiles/lavinox/default.nix | 24 +++ .../hardwareProfiles/lavinox/disko-config.nix | 39 ++++ comb/lina2358/nixosConfigurations.nix | 14 ++ .../nixosConfigurations/lavinox/default.nix | 204 ++++++++++++++++++ .../nixosConfigurations/lavinox/ptconfig.py | 164 ++++++++++++++ 7 files changed, 472 insertions(+) create mode 100644 comb/lina2358/colmenaConfigurations.nix create mode 100644 comb/lina2358/hardwareProfiles.nix create mode 100644 comb/lina2358/hardwareProfiles/lavinox/default.nix create mode 100644 comb/lina2358/hardwareProfiles/lavinox/disko-config.nix create mode 100644 comb/lina2358/nixosConfigurations.nix create mode 100644 comb/lina2358/nixosConfigurations/lavinox/default.nix create mode 100644 comb/lina2358/nixosConfigurations/lavinox/ptconfig.py diff --git a/comb/lina2358/colmenaConfigurations.nix b/comb/lina2358/colmenaConfigurations.nix new file mode 100644 index 0000000..2a2aca1 --- /dev/null +++ b/comb/lina2358/colmenaConfigurations.nix @@ -0,0 +1,14 @@ +{ + lavinox = { + bee.system = "x86_64-linux"; + bee.pkgs = import inputs.nixos { + inherit (inputs.nixpkgs) system; + config.allowUnfree = true; + overlays = []; + }; + deployment = { + targetHost = "192.168.0.64"; + }; + imports = [cell.nixosConfigurations.lavinox]; + }; +} diff --git a/comb/lina2358/hardwareProfiles.nix b/comb/lina2358/hardwareProfiles.nix new file mode 100644 index 0000000..a6779bc --- /dev/null +++ b/comb/lina2358/hardwareProfiles.nix @@ -0,0 +1,13 @@ +{ + lavinox = { + imports = [ + inputs.disko.nixosModules.disko + ./hardwareProfiles/lavinox/default.nix + {disko.devices = import ./hardwareProfiles/lavinox/disko-config.nix;} + inputs.nixos-hardware.nixosModules.common-pc-laptop + inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd + inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate + inputs.nixos-hardware.nixosModules.common-gpu-amd + ]; + }; +} diff --git a/comb/lina2358/hardwareProfiles/lavinox/default.nix b/comb/lina2358/hardwareProfiles/lavinox/default.nix new file mode 100644 index 0000000..85b294f --- /dev/null +++ b/comb/lina2358/hardwareProfiles/lavinox/default.nix @@ -0,0 +1,24 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = []; + + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + networking.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.enableRedistributableFirmware = true; + hardware.enableAllFirmware = true; + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/comb/lina2358/hardwareProfiles/lavinox/disko-config.nix b/comb/lina2358/hardwareProfiles/lavinox/disko-config.nix new file mode 100644 index 0000000..2d06fe4 --- /dev/null +++ b/comb/lina2358/hardwareProfiles/lavinox/disko-config.nix @@ -0,0 +1,39 @@ +{ + disk = { + nvme0n1 = { + device = "/dev/nvme0n1"; + type = "disk"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + name = "ESP"; + start = "1MiB"; + end = "100MiB"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + name = "root"; + type = "partition"; + start = "100MiB"; + end = "100%"; + part-type = "primary"; + bootable = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + } + ]; + }; + }; + }; +} diff --git a/comb/lina2358/nixosConfigurations.nix b/comb/lina2358/nixosConfigurations.nix new file mode 100644 index 0000000..f9a651f --- /dev/null +++ b/comb/lina2358/nixosConfigurations.nix @@ -0,0 +1,14 @@ +{ + lavinox = { + bee.system = "x86_64-linux"; + bee.pkgs = import inputs.nixos { + inherit (inputs.nixpkgs) system; + config.allowUnfree = true; + overlays = []; + }; + imports = [ + cell.hardwareProfiles.lavinox + ./nixosConfigurations/lavinox + ]; + }; +} diff --git a/comb/lina2358/nixosConfigurations/lavinox/default.nix b/comb/lina2358/nixosConfigurations/lavinox/default.nix new file mode 100644 index 0000000..744e473 --- /dev/null +++ b/comb/lina2358/nixosConfigurations/lavinox/default.nix @@ -0,0 +1,204 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + pkgs, + ... +}: { + swapDevices = [ + { + device = "/.swapfile"; + size = 8192; # ~8GB - will be autocreated + } + ]; + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Set your time zone. + time.timeZone = "America/Bogota"; + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.useDHCP = false; + networking.interfaces.wlp2s0.useDHCP = true; + networking.networkmanager.enable = true; + systemd.services.NetworkManager-wait-online = { + enable = false; + serviceConfig.TimeoutSec = 15; + wantedBy = ["network-online.target"]; + }; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # }; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + # Enable the GNOME Desktop Environment. + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + # Enable touchpad support (enabled default in most desktopManager). + libinput.enable = true; + # Configure keymap in X11 + layout = "es"; + xkbOptions = ""; + }; + + services.sshd.enable = true; + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + sound.mediaKeys.enable = true; + hardware.pulseaudio.enable = true; + # Enable scanning + hardware.sane.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.lar = { + isNormalUser = true; + initialPassword = "password123"; + extraGroups = ["wheel"]; # Enable ‘sudo’ for the user. + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + tty-share + alacritty + element-desktop + firefox + chromium + # Office + libreoffice + onlyoffice-bin + beancount + fava + # Git & Tools + git + gh + gitoxide + ghq + # Nix + # nil # nix language server + rnix-lsp # nix language server + alejandra # nix formatter + # Python + (python3Full.withPackages (p: + with p; [ + numpy + pandas + ptpython + requests + scipy + ])) + poetry # python project files + black # python formatter + (vscode-with-extensions.override { + vscode = vscodium; + vscodeExtensions = with vscode-extensions; + [] + ++ + # When the extension is already available in the default extensions set. + [ + yzhang.markdown-all-in-one + editorconfig.editorconfig + ms-python.python + ms-python.vscode-pylance + ms-pyright.pyright + jnoortheen.nix-ide # TODO: how to configure + timonwong.shellcheck + marp-team.marp-vscode + kubukoz.nickel-syntax + ms-vscode-remote.remote-ssh + ] + # Concise version from the vscode market place when not available in the default set. + ++ vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "beancount"; + publisher = "Lencerf"; + version = "0.9.1"; + sha256 = "sha256-88hSGTcjFx0n+tncGSoCgprNNnMihYZ6mSJc267thwE="; + } + ]; + }) + ]; + environment.sessionVariables = { + PYTHONSTARTUP = let + startup = + pkgs.writers.writePython3 "ptpython.py" + { + libraries = with pkgs.python3Packages; [ptpython]; + } '' + from __future__ import unicode_literals + from pygments.token import Token + from ptpython.layout import CompletionVisualisation + import sys + ${builtins.readFile ./ptconfig.py} + try: + from ptpython.repl import embed + except ImportError: + print("ptpython is not available: falling back to standard prompt") + else: + sys.exit(embed(globals(), locals(), configure=configure)) + ''; + in "${startup}"; + }; + + # Programs configuration + programs.starship.enable = true; + programs.nix-ld.enable = true; # quality of life for downloaded programs + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + autosuggestions.async = true; + syntaxHighlighting.enable = true; + }; + programs.git = { + enable = true; + config = { + init.defaultBranch = "main"; + core.autocrlf = "input"; + pull.rebase = true; + rebase.autosquash = true; + rerere.enable = true; + }; + }; + programs.chromium = { + enable = true; + extensions = [ + # UID of extension + "kmcfomidfpdkfieipokbalgegidffkal" # EnPass + "bpconcjcammlapcogcnnelfmaeghhagj" # Nimbus + ]; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; # Did you read the comment? +} diff --git a/comb/lina2358/nixosConfigurations/lavinox/ptconfig.py b/comb/lina2358/nixosConfigurations/lavinox/ptconfig.py new file mode 100644 index 0000000..2a67f3d --- /dev/null +++ b/comb/lina2358/nixosConfigurations/lavinox/ptconfig.py @@ -0,0 +1,164 @@ +__all__ = ("configure",) + + +def configure(repl): + """ + Configuration method. This is called during the start-up of ptpython. + :param repl: `PythonRepl` instance. + """ + # Show function signature (bool). + repl.show_signature = True + + # Show docstring (bool). + repl.show_docstring = True + + # Show the "[Meta+Enter] Execute" message when pressing [Enter] only + # inserts a newline instead of executing the code. + repl.show_meta_enter_message = True + + # Show completions. (NONE, POP_UP, MULTI_COLUMN or TOOLBAR) + repl.completion_visualisation = CompletionVisualisation.POP_UP + + # When CompletionVisualisation.POP_UP has been chosen, use this + # scroll_offset in the completion menu. + repl.completion_menu_scroll_offset = 0 + + # Show line numbers (when the input contains multiple lines.) + repl.show_line_numbers = False + + # Show status bar. + repl.show_status_bar = True + + # When the sidebar is visible, also show the help text. + repl.show_sidebar_help = True + + # Swap light/dark colors on or off + repl.swap_light_and_dark = False + + # Highlight matching parethesis. + repl.highlight_matching_parenthesis = True + + # Line wrapping. (Instead of horizontal scrolling.) + repl.wrap_lines = True + + # Mouse support. + repl.enable_mouse_support = True + + # Complete while typing. (Don't require tab before the + # completion menu is shown.) + repl.complete_while_typing = True + + # Fuzzy and dictionary completion. + repl.enable_fuzzy_completion = False + repl.enable_dictionary_completion = False + + # Vi mode. + repl.vi_mode = True + + # Paste mode. (When True, don't insert whitespace after new line.) + repl.paste_mode = False + + # Use the classic prompt. (Display '>>>' instead of 'In [1]'.) + repl.prompt_style = "classic" # 'classic' or 'ipython' + + # Don't insert a blank line after the output. + repl.insert_blank_line_after_output = True + + # History Search. + # When True, going back in history will filter the history on the records + # starting with the current input. (Like readline.) + # Note: When enable, please disable the `complete_while_typing` option. + # otherwise, when there is a completion available, the arrows will + # browse through the available completions instead of the history. + repl.enable_history_search = False + + # Enable auto suggestions. (Pressing right arrow will complete the input, + # based on the history.) + repl.enable_auto_suggest = False + + # Enable open-in-editor. Pressing C-X C-E in emacs mode or 'v' in + # Vi navigation mode will open the input in the current editor. + repl.enable_open_in_editor = True + + # Enable system prompt. Pressing meta-! will display the system prompt. + # Also enables Control-Z suspend. + repl.enable_system_bindings = True + + # Ask for confirmation on exit. + repl.confirm_exit = True + + # Enable input validation. (Don't try to execute when the input contains + # syntax errors.) + repl.enable_input_validation = True + + # Use this colorscheme for the code. + repl.use_code_colorscheme("monokai") + + # Set color depth (keep in mind that not all terminals support true color). + + # repl.color_depth = 'DEPTH_1_BIT' # Monochrome. + # repl.color_depth = 'DEPTH_4_BIT' # ANSI colors only. + # repl.color_depth = "DEPTH_8_BIT" # The default, 256 colors. + repl.color_depth = "DEPTH_24_BIT" # True color. + + # Syntax. + repl.enable_syntax_highlighting = True + + # Install custom colorscheme named 'my-colorscheme' and use it. + """ + repl.install_ui_colorscheme('my-colorscheme', _custom_ui_colorscheme) + repl.use_ui_colorscheme('my-colorscheme') + """ + + # Add custom key binding for PDB. + """ + @repl.add_key_binding(Keys.ControlB) + def _(event): + ' Pressing Control-B will insert "pdb.set_trace()" ' + event.cli.current_buffer.insert_text('\nimport pdb; pdb.set_trace()\n') + """ + + # Typing ControlE twice should also execute the current command. + # (Alternative for Meta-Enter.) + """ + @repl.add_key_binding(Keys.ControlE, Keys.ControlE) + def _(event): + event.current_buffer.validate_and_handle() + """ + + # Typing 'jj' in Vi Insert mode, should send escape. (Go back to navigation + # mode.) + """ + @repl.add_key_binding('j', 'j', filter=ViInsertMode()) + def _(event): + " Map 'jj' to Escape. " + event.cli.key_processor.feed(KeyPress(Keys.Escape)) + """ + + # Custom key binding for some simple autocorrection while typing. + """ + corrections = { + 'impotr': 'import', + 'pritn': 'print', + } + @repl.add_key_binding(' ') + def _(event): + ' When a space is pressed. Check & correct word before cursor. ' + b = event.cli.current_buffer + w = b.document.get_word_before_cursor() + if w is not None: + if w in corrections: + b.delete_before_cursor(count=len(w)) + b.insert_text(corrections[w]) + b.insert_text(' ') + """ + + +# Custom colorscheme for the UI. See `ptpython/layout.py` and +# `ptpython/style.py` for all possible tokens. +_custom_ui_colorscheme = { + # Blue prompt. + Token.Layout.Prompt: "bg:#eeeeff #000000 bold", + # Make the status toolbar red. + Token.Toolbar.Status: "bg:#ff0000 #000000", +}