Compare commits
No commits in common. "13aa63b44421589985fdc9bb21a95f065ecf61e3" and "0d76e71b3a9e58cb093f8fcd31cc53b975fc34e2" have entirely different histories.
13aa63b444
...
0d76e71b3a
11 changed files with 45 additions and 3782 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,2 @@
|
||||||
hosts/configuration.nix
|
hosts/configuration.nix
|
||||||
__pycache__
|
__pycache__
|
||||||
*.qcow2
|
|
||||||
result
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,94 +0,0 @@
|
||||||
from pathlib import Path
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def run(cmd: list[str]) -> subprocess.CompletedProcess:
|
|
||||||
print(f"* {' '.join(cmd)}")
|
|
||||||
return subprocess.run(cmd, check=True)
|
|
||||||
|
|
||||||
@aliases.register
|
|
||||||
@aliases.return_command
|
|
||||||
def _sudo(args):
|
|
||||||
return ["sudo", "--", *aliases.eval_alias(args)]
|
|
||||||
|
|
||||||
@aliases.register
|
|
||||||
def _vm(args):
|
|
||||||
if not args:
|
|
||||||
args = ["nixpkgs"]
|
|
||||||
vm_name = args.pop(0)
|
|
||||||
build_vm_args = args
|
|
||||||
if vm_name == "nixpkgs":
|
|
||||||
build_vm_args.extend(["-I", "nixpkgs=/bulk/home/cswimr/Projects/nixpkgs"])
|
|
||||||
vm_path = Path(f"/etc/nixos/hosts/virtual-machines/{vm_name}")
|
|
||||||
if vm_path.exists():
|
|
||||||
print(f"Building virtual machine {vm_name}")
|
|
||||||
run(["nixos-rebuild", "build-vm", "-I", "nixos-config=./default.nix", *build_vm_args, "--no-flake"], cwd=vm_path)
|
|
||||||
print(f"Running virtual vachine {vm_name}")
|
|
||||||
run([str(vm_path / "result" / "bin" / "run-nixos-vm")], cwd=vm_path)
|
|
||||||
print(f"Virtual machine {vm_name} has stopped.")
|
|
||||||
else:
|
|
||||||
raise FileNotFoundError(f"Virtual machine {vm_name} does not exist.")
|
|
||||||
|
|
||||||
|
|
||||||
@aliases.register
|
|
||||||
@aliases.return_command
|
|
||||||
def _edit(args):
|
|
||||||
if not args:
|
|
||||||
args = ["."]
|
|
||||||
if "$SSH_CONNECTION":
|
|
||||||
return ["$EDITOR", *args]
|
|
||||||
return ["$VISUAL", *args]
|
|
||||||
|
|
||||||
|
|
||||||
alias_dictionary = {
|
|
||||||
"ff": "fastfetch",
|
|
||||||
"neofetch": "fastfetch",
|
|
||||||
"nf": "fastfetch",
|
|
||||||
|
|
||||||
"lg": "lazygit",
|
|
||||||
"lad": "lazydocker",
|
|
||||||
|
|
||||||
"clip": "wl-copy",
|
|
||||||
"paste": "wl-paste",
|
|
||||||
|
|
||||||
"cat": "bat",
|
|
||||||
"git": "hub",
|
|
||||||
|
|
||||||
"l": "eza -lhg --time-style=long-iso --icons=auto",
|
|
||||||
"la": "eza -lAh --time-style=long-iso --icons=auto",
|
|
||||||
"ll": "eza -lhg --time-style=long-iso --icons=auto",
|
|
||||||
"ls": "eza --time-style=long-iso --icons=auto",
|
|
||||||
"lsa": "eza -lah --time-style=long-iso --icons=auto",
|
|
||||||
"tree": "eza --tree --git-ignore --time-style=long-iso --icons=auto",
|
|
||||||
|
|
||||||
"create-devenv": "nix flake init --template github:cachix/devenv and direnv allow",
|
|
||||||
"dev": "nix develop --no-pure-eval",
|
|
||||||
"nixpkgs-update": "nix run --option extra-substituters 'https://nix-community.cachix.org/' --option extra-trusted-public-keys 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' github:ryantm/nixpkgs-update --",
|
|
||||||
"nixrc": "edit /etc/nixos",
|
|
||||||
|
|
||||||
"upd": '''sudo nixos-generate-config --dir /etc/nixos/hosts and \
|
|
||||||
sudo rm /etc/nixos/hosts/configuration.nix and \
|
|
||||||
sudo mv /etc/nixos/hosts/hardware-configuration.nix /etc/nixos/hosts/@($HOSTNAME).nix \
|
|
||||||
and git -C /etc/nixos --git-dir=/etc/nixos/.git add /etc/nixos/hosts/@($HOSTNAME).nix and \
|
|
||||||
rm -rf ~/.config/Code/User/settings.json.bak and \
|
|
||||||
sudo nixos-rebuild switch --flake /etc/nixos --impure @($args)''', #TODO: Remove --impure once the Starship module is merged - see ../../nixos/shell.nix for more information
|
|
||||||
|
|
||||||
"taildrop": "tailscale file",
|
|
||||||
|
|
||||||
"forgejo-runner": "act_runner",
|
|
||||||
"runactions": "act_runner exec --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com",
|
|
||||||
|
|
||||||
"e": "edit",
|
|
||||||
"c": "clear",
|
|
||||||
"s": "sudo",
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create aliases for scripts with the .py extension stripped
|
|
||||||
script_path = Path("/etc/nixos/scripts")
|
|
||||||
if script_path.exists():
|
|
||||||
for script in script_path.glob("*.py"):
|
|
||||||
if script.name == "__init__.py":
|
|
||||||
continue
|
|
||||||
script_name = script.name.strip(".py")
|
|
||||||
aliases.update({script_name: [str(script)]})
|
|
||||||
|
|
||||||
aliases.update(alias_dictionary)
|
|
|
@ -54,7 +54,6 @@
|
||||||
./nixos/pkg.nix
|
./nixos/pkg.nix
|
||||||
./nixos/shell.nix
|
./nixos/shell.nix
|
||||||
./nixos/sudo.nix
|
./nixos/sudo.nix
|
||||||
./nixos/symlinks.nix
|
|
||||||
./nixos/tailscale.nix
|
./nixos/tailscale.nix
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
programs.vscode = {
|
programs.vscode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.vscode.fhsWithPackages
|
package = pkgs.vscode.fhsWithPackages
|
||||||
(ps: with pkgs; [ dotnetCorePackages.sdk_8_0 mypy jdk21 ]);
|
(ps: with pkgs; [ dotnetCorePackages.sdk_8_0 mypy ]);
|
||||||
extensions =
|
extensions =
|
||||||
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace;
|
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace;
|
||||||
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace-release; [
|
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace-release; [
|
||||||
|
@ -107,7 +107,6 @@
|
||||||
# Misc - Language Support
|
# Misc - Language Support
|
||||||
jnoortheen.nix-ide
|
jnoortheen.nix-ide
|
||||||
tamasfe.even-better-toml
|
tamasfe.even-better-toml
|
||||||
jnoortheen.xonsh
|
|
||||||
matthewpi.caddyfile-support
|
matthewpi.caddyfile-support
|
||||||
editorconfig.editorconfig
|
editorconfig.editorconfig
|
||||||
prisma.prisma
|
prisma.prisma
|
||||||
|
@ -322,7 +321,6 @@
|
||||||
".env" = "properties";
|
".env" = "properties";
|
||||||
"*.ini" = "paradox";
|
"*.ini" = "paradox";
|
||||||
"*.kt" = "kotlin";
|
"*.kt" = "kotlin";
|
||||||
"**/xonsh/*.py" = "xonsh";
|
|
||||||
};
|
};
|
||||||
"editor.semanticHighlighting.enabled" = true;
|
"editor.semanticHighlighting.enabled" = true;
|
||||||
"[css]" = { "editor.defaultFormatter" = "vscode.css-language-features"; };
|
"[css]" = { "editor.defaultFormatter" = "vscode.css-language-features"; };
|
||||||
|
@ -345,7 +343,7 @@
|
||||||
"python.analysis.inlayHints.functionReturnTypes" = true;
|
"python.analysis.inlayHints.functionReturnTypes" = true;
|
||||||
"explorer.confirmDragAndDrop" = false;
|
"explorer.confirmDragAndDrop" = false;
|
||||||
"editor.unicodeHighlight.allowedLocales" = { ru = true; };
|
"editor.unicodeHighlight.allowedLocales" = { ru = true; };
|
||||||
"terminal.integrated.defaultProfile.linux" = "xonsh";
|
"terminal.integrated.defaultProfile.linux" = "zsh";
|
||||||
"explorer.confirmPasteNative" = false;
|
"explorer.confirmPasteNative" = false;
|
||||||
"editor.renderWhitespace" = "none";
|
"editor.renderWhitespace" = "none";
|
||||||
"explorer.fileNesting.patterns" = {
|
"explorer.fileNesting.patterns" = {
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
gnomeExtensions = with pkgs.gnomeExtensions; [ totp ];
|
|
||||||
packages = with pkgs; [ fastfetch ];
|
|
||||||
in {
|
|
||||||
imports = [
|
|
||||||
../template.nix
|
|
||||||
#../../../nixos/shell.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
services.xserver = {
|
|
||||||
enable = true;
|
|
||||||
displayManager.gdm.enable = true;
|
|
||||||
desktopManager.gnome.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation.vmVariant.virtualisation = {
|
|
||||||
memorySize = 8192;
|
|
||||||
cores = 6;
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = lib.lists.unique (packages ++ gnomeExtensions);
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
imports = [
|
|
||||||
../template.nix
|
|
||||||
../../../nixos/shell.nix
|
|
||||||
];
|
|
||||||
environment.systemPackages = with pkgs; [ fastfetch ];
|
|
||||||
}
|
|
|
@ -1,25 +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, on
|
|
||||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
|
||||||
|
|
||||||
{
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
networking.hostName = "nixos";
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
|
||||||
time.timeZone = "America/New_York";
|
|
||||||
|
|
||||||
users.users.cswimr = {
|
|
||||||
isNormalUser = true;
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
group = "cswimr";
|
|
||||||
initialPassword = "cswimr";
|
|
||||||
};
|
|
||||||
users.groups.cswimr = { };
|
|
||||||
|
|
||||||
services.qemuGuest.enable = true;
|
|
||||||
|
|
||||||
system.stateVersion = "24.11";
|
|
||||||
}
|
|
|
@ -45,12 +45,11 @@ let
|
||||||
fontforge
|
fontforge
|
||||||
packwiz
|
packwiz
|
||||||
xclip
|
xclip
|
||||||
starship
|
|
||||||
|
|
||||||
# for xonsh
|
# for scripts
|
||||||
python311
|
python312
|
||||||
python311Packages.pip
|
python312Packages.requests
|
||||||
python311Packages.python-lsp-server
|
python312Packages.pyperclip
|
||||||
];
|
];
|
||||||
flakePackages = with inputs; [ compose2nix.packages.${system}.default ];
|
flakePackages = with inputs; [ compose2nix.packages.${system}.default ];
|
||||||
in {
|
in {
|
||||||
|
|
112
nixos/shell.nix
Normal file → Executable file
112
nixos/shell.nix
Normal file → Executable file
|
@ -1,9 +1,4 @@
|
||||||
{ config, pkgs, ... }: {
|
{ pkgs, ... }: {
|
||||||
#TODO: Submit a PR to nixpkgs to add xonsh support to the Starship module
|
|
||||||
# After that, we can remove this import and the disabledModules line
|
|
||||||
disabledModules = [ "programs/starship.nix" ];
|
|
||||||
imports = [ /bulk/home/cswimr/Projects/nixpkgs/nixos/modules/programs/starship.nix ];
|
|
||||||
|
|
||||||
# starship - a customizable prompt for any shell
|
# starship - a customizable prompt for any shell
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -62,81 +57,52 @@
|
||||||
add_newline = false;
|
add_newline = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
users.defaultUserShell = pkgs.fish;
|
||||||
# enable bash completions
|
programs.fish = {
|
||||||
# even though we don't use bash as our shell, xonsh uses bash completion scripts
|
|
||||||
programs.bash.completion.enable = true;
|
|
||||||
|
|
||||||
users.defaultUserShell = pkgs.xonsh;
|
|
||||||
programs.xonsh = let bashcfg = config.programs.bash;
|
|
||||||
in {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
config = ''
|
shellInit = ''
|
||||||
$BASH_COMPLETIONS = ('${bashcfg.completion.package}/etc/profile.d/bash_completion.sh')
|
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
||||||
#execx($(starship init xonsh))
|
|
||||||
#xontrib load cd
|
|
||||||
xontrib load direnv
|
|
||||||
xontrib load sh
|
|
||||||
'';
|
'';
|
||||||
package = pkgs.xonsh.override {
|
|
||||||
extraPackages = ps: [
|
|
||||||
# (ps.buildPythonPackage rec {
|
|
||||||
# name = "xontrib-cd";
|
|
||||||
# version = "0.3.1";
|
|
||||||
|
|
||||||
# src = pkgs.fetchFromGitHub {
|
shellAliases = let ezaArgs = "--time-style='+%Y-%m-%d %H:%M' --icons=auto";
|
||||||
# owner = "eugenesvk";
|
in {
|
||||||
# repo = name;
|
ff = "fastfetch";
|
||||||
# rev = version;
|
neofetch = "fastfetch";
|
||||||
# sha256 = "XxSxjyCg7PeX1v3e2KKicvAPmNeq+qVqbW4fXTwAiic=";
|
nf = "fastfetch";
|
||||||
# };
|
|
||||||
|
|
||||||
# meta = {
|
lg = "lazygit";
|
||||||
# homepage = "https://github.com/eugenesvk/xontrib-cd";
|
lad = "lazydocker";
|
||||||
# description =
|
|
||||||
# "`cd` to any path without escaping in xonsh shell: `cd ~/[te] st`";
|
|
||||||
# license = pkgs.lib.licenses.mit;
|
|
||||||
# maintainers = [ "cswimr" ];
|
|
||||||
# };
|
|
||||||
# })
|
|
||||||
(ps.buildPythonPackage rec {
|
|
||||||
name = "xonsh-direnv";
|
|
||||||
version = "1.6.5";
|
|
||||||
|
|
||||||
src = pkgs.fetchFromGitHub {
|
clip = "wl-copy";
|
||||||
owner = "74th";
|
paste = "wl-paste";
|
||||||
repo = name;
|
cat = "bat";
|
||||||
rev = version;
|
|
||||||
sha256 = "huBJ7WknVCk+WgZaXHlL+Y1sqsn6TYqMP29/fsUPSyU=";
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
l = "eza -lhg ${ezaArgs}";
|
||||||
homepage = "https://github.com/74th/xonsh-direnv";
|
la = "eza -lAh ${ezaArgs}";
|
||||||
description = "xonsh extension for using direnv";
|
ll = "eza -lhg ${ezaArgs}";
|
||||||
license = pkgs.lib.licenses.mit;
|
ls = "eza ${ezaArgs}";
|
||||||
maintainers = [ "cswimr" ];
|
lsa = "eza -lah ${ezaArgs}";
|
||||||
};
|
tree = "eza --tree --git-ignore ${ezaArgs}";
|
||||||
})
|
git = "hub";
|
||||||
(ps.buildPythonPackage rec {
|
|
||||||
name = "xontrib-sh";
|
|
||||||
version = "0.3.1";
|
|
||||||
|
|
||||||
src = pkgs.fetchFromGitHub {
|
create-devenv = "nix flake init --template github:cachix/devenv && direnv allow";
|
||||||
owner = "anki-code";
|
develop = "nix develop --no-pure-eval";
|
||||||
repo = name;
|
nixpkgs-update = "nix run --option extra-substituters 'https://nix-community.cachix.org/' --option extra-trusted-public-keys 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' github:ryantm/nixpkgs-update --";
|
||||||
rev = version;
|
nixrc = "$EDITOR /etc/nixos";
|
||||||
sha256 = "KL/AxcsvjxqxvjDlf1axitgME3T+iyuW6OFb1foRzN8=";
|
delete-vscode-settings-backup = "rm -rf ~/.config/Code/User/settings.json.bak";
|
||||||
};
|
upd =
|
||||||
|
"sudo nixos-generate-config --dir /etc/nixos/hosts && sudo rm /etc/nixos/hosts/configuration.nix && sudo mv /etc/nixos/hosts/hardware-configuration.nix /etc/nixos/hosts/$(hostname).nix && git -C /etc/nixos --git-dir=/etc/nixos/.git add /etc/nixos/hosts/$(hostname).nix && delete-vscode-settings-backup && sudo nixos-rebuild switch --flake /etc/nixos";
|
||||||
|
|
||||||
meta = {
|
taildrop = "tailscale file";
|
||||||
homepage = "https://github.com/anki-code/xontrib-sh";
|
|
||||||
description =
|
forgejo-runner = "act_runner";
|
||||||
"Paste and run commands from bash, zsh, fish, tcsh in xonsh shell.";
|
runactions =
|
||||||
license = pkgs.lib.licenses.mit;
|
"act_runner exec --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com";
|
||||||
maintainers = [ "cswimr" ];
|
|
||||||
};
|
c = "clear";
|
||||||
})
|
# alias sudo to itself so user aliases can be sudoed
|
||||||
];
|
sudo = "sudo ";
|
||||||
|
s = "sudo ";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
environment.etc = {
|
|
||||||
"xonsh/rc.d".source = ../config/xonsh;
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue