Initial config for jupiter

This commit is contained in:
2026-03-29 13:57:26 +02:00
commit ac166e2fdd
9 changed files with 984 additions and 0 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
# direnv cache
/.direnv
# "nix build" default output link
result
# nix pre-commit autogenerated by devShell
/.pre-commit-config.yaml

42
README.md Normal file
View File

@@ -0,0 +1,42 @@
Config for my computers.
## Common operations
Update computer from my configuration:
```
sudo darwin-rebuild switch --flake .
```
Update home from my configuration:
```
home-manager switch --flake .
```
Update all dependencies in my configuration:
```
nix flake update
```
NOTE: you have to update computer and update home from
configuration after doing this.
## Add/remove software
### First search for Nix
https://search.nixos.org/packages
Add to:
home.packages: `hosts/jupiter/home.nix`
### If not available in Nix
https://formulae.brew.sh/
Add to:
homebrew casks: `hosts/jupiter/darwin.nix`

651
flake.lock generated Normal file
View File

@@ -0,0 +1,651 @@
{
"nodes": {
"artem_dotfiles": {
"inputs": {
"darwin": "darwin",
"fw_nix": "fw_nix",
"git-hooks": "git-hooks_2",
"home-manager": "home-manager",
"nix-homebrew": "nix-homebrew",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-screen": "nixpkgs-screen",
"systems": "systems_2",
"vscode-server": "vscode-server"
},
"locked": {
"lastModified": 1774784938,
"narHash": "sha256-Chh4AxbE8iygGnNdUhuTULTvXod+kUFjJTpF0PN5g68=",
"ref": "refs/heads/master",
"rev": "8c375d0a995973abec7670c07e06ec0d6c95004f",
"revCount": 472,
"type": "git",
"url": "https://github.com/dotdoom/dotfiles.git"
},
"original": {
"type": "git",
"url": "https://github.com/dotdoom/dotfiles.git"
}
},
"brew-src": {
"flake": false,
"locked": {
"lastModified": 1774235677,
"narHash": "sha256-0ryNYmzDAeRlrzPTAgmzGH/Cgc8iv/LBN6jWGUANvIk=",
"owner": "Homebrew",
"repo": "brew",
"rev": "894a3d23ac0c8aaf561b9874b528b9cb2e839201",
"type": "github"
},
"original": {
"owner": "Homebrew",
"ref": "5.1.1",
"repo": "brew",
"type": "github"
}
},
"brew-src_2": {
"flake": false,
"locked": {
"lastModified": 1774235677,
"narHash": "sha256-0ryNYmzDAeRlrzPTAgmzGH/Cgc8iv/LBN6jWGUANvIk=",
"owner": "Homebrew",
"repo": "brew",
"rev": "894a3d23ac0c8aaf561b9874b528b9cb2e839201",
"type": "github"
},
"original": {
"owner": "Homebrew",
"ref": "5.1.1",
"repo": "brew",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"artem_dotfiles",
"nixpkgs"
]
},
"locked": {
"lastModified": 1773000227,
"narHash": "sha256-zm3ftUQw0MPumYi91HovoGhgyZBlM4o3Zy0LhPNwzXE=",
"owner": "nix-darwin",
"repo": "nix-darwin",
"rev": "da529ac9e46f25ed5616fd634079a5f3c579135f",
"type": "github"
},
"original": {
"owner": "nix-darwin",
"repo": "nix-darwin",
"type": "github"
}
},
"darwin_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1773000227,
"narHash": "sha256-zm3ftUQw0MPumYi91HovoGhgyZBlM4o3Zy0LhPNwzXE=",
"owner": "nix-darwin",
"repo": "nix-darwin",
"rev": "da529ac9e46f25ed5616fd634079a5f3c579135f",
"type": "github"
},
"original": {
"owner": "nix-darwin",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"fw_nix": {
"inputs": {
"git-hooks": "git-hooks",
"nixpkgs": [
"artem_dotfiles",
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1774734717,
"narHash": "sha256-mmIc5ZA+hWt9IfZolKOSFEHQc0//dNei3hy7V8yblCg=",
"ref": "refs/heads/main",
"rev": "581b0c951d83f25a532cea8209eb302c18c7a826",
"revCount": 13,
"type": "git",
"url": "https://github.com/futureware-tech/nix.git"
},
"original": {
"type": "git",
"url": "https://github.com/futureware-tech/nix.git"
}
},
"fw_nix_2": {
"inputs": {
"git-hooks": "git-hooks_3",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_4"
},
"locked": {
"lastModified": 1774734717,
"narHash": "sha256-mmIc5ZA+hWt9IfZolKOSFEHQc0//dNei3hy7V8yblCg=",
"ref": "refs/heads/main",
"rev": "581b0c951d83f25a532cea8209eb302c18c7a826",
"revCount": 13,
"type": "git",
"url": "https://github.com/futureware-tech/nix.git"
},
"original": {
"type": "git",
"url": "https://github.com/futureware-tech/nix.git"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"artem_dotfiles",
"fw_nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1774104215,
"narHash": "sha256-EAtviqz0sEAxdHS4crqu7JGR5oI3BwaqG0mw7CmXkO8=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "f799ae951fde0627157f40aec28dec27b22076d0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"git-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_2",
"gitignore": "gitignore_2",
"nixpkgs": [
"artem_dotfiles",
"nixpkgs"
]
},
"locked": {
"lastModified": 1774104215,
"narHash": "sha256-EAtviqz0sEAxdHS4crqu7JGR5oI3BwaqG0mw7CmXkO8=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "f799ae951fde0627157f40aec28dec27b22076d0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"git-hooks_3": {
"inputs": {
"flake-compat": "flake-compat_3",
"gitignore": "gitignore_3",
"nixpkgs": [
"fw_nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1774104215,
"narHash": "sha256-EAtviqz0sEAxdHS4crqu7JGR5oI3BwaqG0mw7CmXkO8=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "f799ae951fde0627157f40aec28dec27b22076d0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"git-hooks_4": {
"inputs": {
"flake-compat": "flake-compat_4",
"gitignore": "gitignore_4",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1774104215,
"narHash": "sha256-EAtviqz0sEAxdHS4crqu7JGR5oI3BwaqG0mw7CmXkO8=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "f799ae951fde0627157f40aec28dec27b22076d0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"artem_dotfiles",
"fw_nix",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"artem_dotfiles",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_3": {
"inputs": {
"nixpkgs": [
"fw_nix",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_4": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"artem_dotfiles",
"nixpkgs"
]
},
"locked": {
"lastModified": 1774007980,
"narHash": "sha256-FOnZjElEI8pqqCvB6K/1JRHTE8o4rer8driivTpq2uo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9670de2921812bc4e0452f6e3efd8c859696c183",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1774738535,
"narHash": "sha256-2jfBEZUC67IlnxO5KItFCAd7Oc+1TvyV/jQlR+2ykGQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "769e07ef8f4cf7b1ec3b96ef015abec9bc6b1e2a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-homebrew": {
"inputs": {
"brew-src": "brew-src"
},
"locked": {
"lastModified": 1774720267,
"narHash": "sha256-YYftFe8jyfpQI649yfr0E+dqEXE2jznZNcYvy/lKV1U=",
"owner": "zhaofengli",
"repo": "nix-homebrew",
"rev": "a7760a3a83f7609f742861afb5732210fdc437ed",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"repo": "nix-homebrew",
"type": "github"
}
},
"nix-homebrew_2": {
"inputs": {
"brew-src": "brew-src_2"
},
"locked": {
"lastModified": 1774720267,
"narHash": "sha256-YYftFe8jyfpQI649yfr0E+dqEXE2jznZNcYvy/lKV1U=",
"owner": "zhaofengli",
"repo": "nix-homebrew",
"rev": "a7760a3a83f7609f742861afb5732210fdc437ed",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"repo": "nix-homebrew",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1774386573,
"narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-screen": {
"locked": {
"lastModified": 1737753705,
"narHash": "sha256-fQeXAeNQrsEUH3fd6RTjN/W+8flJiAFHo7Eya2RT87M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e518d4ad2bcad74f98fec028cf21ce5b1e5020dd",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e518d4ad2bcad74f98fec028cf21ce5b1e5020dd",
"type": "github"
}
},
"nixpkgs-screen_2": {
"locked": {
"lastModified": 1737753705,
"narHash": "sha256-fQeXAeNQrsEUH3fd6RTjN/W+8flJiAFHo7Eya2RT87M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e518d4ad2bcad74f98fec028cf21ce5b1e5020dd",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e518d4ad2bcad74f98fec028cf21ce5b1e5020dd",
"type": "github"
}
},
"root": {
"inputs": {
"artem_dotfiles": "artem_dotfiles",
"darwin": "darwin_2",
"fw_nix": "fw_nix_2",
"git-hooks": "git-hooks_4",
"home-manager": "home-manager_2",
"nix-homebrew": "nix-homebrew_2",
"nixpkgs": "nixpkgs",
"nixpkgs-screen": "nixpkgs-screen_2",
"systems": "systems_5"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"vscode-server": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"artem_dotfiles",
"nixpkgs"
]
},
"locked": {
"lastModified": 1770124655,
"narHash": "sha256-yHmd2B13EtBUPLJ+x0EaBwNkQr9LTne1arLVxT6hSnY=",
"owner": "nix-community",
"repo": "nixos-vscode-server",
"rev": "92ce71c3ba5a94f854e02d57b14af4997ab54ef0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-vscode-server",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

103
flake.nix Normal file
View File

@@ -0,0 +1,103 @@
{
description = "home machine config from dotfiles";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# too many issues with screen 5.0
# - load average in status broken
# - background colors in programs (eg less) not showing
# - caption and hardstatus color lacks intensity
nixpkgs-screen.url = "github:NixOS/nixpkgs/e518d4ad2bcad74f98fec028cf21ce5b1e5020dd";
systems.url = "github:nix-systems/default";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
fw_nix = {
url = "git+https://github.com/futureware-tech/nix.git";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:nix-darwin/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
artem_dotfiles = {
url = "git+https://github.com/dotdoom/dotfiles.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
systems,
home-manager,
darwin,
...
}@inputs:
let
eachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
checks = eachSystem (system: {
pre-commit-check = inputs.git-hooks.lib.${system}.run (
{
src = ./.;
}
// inputs.fw_nix.lib.pre-commit
);
});
homeConfigurations."katarina@jupiter" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
extraSpecialArgs.primaryUser = "katarina";
modules = [
inputs.artem_dotfiles.homeModules.mac-portable
./hosts/jupiter/home.nix
];
};
darwinConfigurations.jupiter = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs.primaryUser = "katarina";
modules = [
inputs.artem_dotfiles.darwinModules.mac-portable
inputs.fw_nix.nixosModules.tools
inputs.fw_nix.nixosModules.nix-settings
inputs.fw_nix.nixosModules.futureware
inputs.nix-homebrew.darwinModules.nix-homebrew
(
{ lib, ... }:
{
# TODO: find solution to these ugly workarounds
options.programs.htop = lib.mkOption {
type = lib.types.deferredModule;
default = { };
};
}
)
./hosts/jupiter/darwin.nix
];
};
devShells = eachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages;
in
{
default = pkgs.mkShell {
packages = enabledPackages;
inherit shellHook;
};
}
);
};
}

5
hosts/jupiter/darwin.nix Normal file
View File

@@ -0,0 +1,5 @@
_: {
homebrew.casks = [
"android-studio"
];
}

6
hosts/jupiter/home.nix Normal file
View File

@@ -0,0 +1,6 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
antigravity
];
}

6
migrated/.zshenv Normal file
View File

@@ -0,0 +1,6 @@
# At least have the following in .zshenv_local:
# export GIT_AUTHOR_NAME='Alfred Muster'
# export GIT_AUTHOR_EMAIL='test@example.com'
# export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME?}"
# export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL?}"
[ -r ~/.zshenv_local ] && source ~/.zshenv_local || true

162
migrated/.zshrc Normal file
View File

@@ -0,0 +1,162 @@
# Interactive shell.
export PATH="${HOME}/bin:${PATH}"
# Login shell, connected via SSH, interactive (implied by running in this file),
# not in a GNU screen session already and screen is installed: jump to an active
# screen session or start a new, UTF-8 capable.
#
# Since we exec right afterwards, there's no point in setting this shell up.
if [[ -o login ]]; then
[ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && \
[ -z "$STY" ] && \
which screen 2>/dev/null && \
exec screen -URR
fi
HISTFILE=~/.zsh_history
# History in the file
HISTSIZE=10000
# History in RAM
SAVEHIST=10000
setopt appendhistory
setopt SHARE_HISTORY
# Self-explanatory
setopt hist_ignore_space
setopt hist_ignore_dups
# Remove older duplicates first
setopt hist_expire_dups_first
# Store timestamps
setopt EXTENDED_HISTORY
export EDITOR=vim
# Noticing this EDITOR setting, zsh will default to vim keybindings. No thanks.
bindkey -e
export PAGER='less -R -F -X -S -n -i -m'
export LESSCHARSET=utf-8
export PYTHONSTARTUP="$HOME/.pythonstartup"
export NCURSES_NO_UTF8_ACS=1
# For ls.
export CLICOLOR=1
# For dark terminal backgrounds.
export LSCOLORS=HxFxCxDxBxEgEdHbHgHcHd
# Looking for more environment variables? Check out .zshenv!
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias crontab='crontab -i'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gd='git diff'
alias gdc='git diff --cached'
alias gst='git status'
alias sudo='sudo -E '
alias su='su -m'
alias pager=$PAGER
alias grep='grep --line-buffered --color=auto'
alias ipt='iptables -nvL --line-numbers'
alias ip6t='ip6tables -nvL --line-numbers'
alias tcpdump='tcpdump -l'
alias ag='ag -C 2 --pager="$PAGER" --smart-case'
alias mysql='mysql --select_limit=1000'
alias logcat='adb logcat -v "color printable usec year zone" -T 10'
alias readelf='readelf -W'
alias l='ls -lA'
alias ll='ls -la'
# To kill the ControlMaster session (e.g. to modify it or when it's stuck).
alias unssh='ssh -O exit'
alias ffmpeg_q='ffmpeg -hide_banner -nostats -loglevel warning'
alias curl_t='curl -w \
"# dnslookup: %{time_namelookup} | \
connect: %{time_connect} | \
appconnect: %{time_appconnect} | \
pretransfer: %{time_pretransfer} | \
starttransfer: %{time_starttransfer} | \
total: %{time_total} | \
size: %{size_download}\n"'
# nix-deploy # current host
# nix-deploy nas # deploy nas
# nix-deploy test secondary # deploy secondary but do not add to boot
nix-deploy() {
ACTION=switch
if [ $# -gt 1 ]; then
ACTION=$1
shift
fi
if which nixos-rebuild &>/dev/null; then
COMMAND=(nixos-rebuild)
else
COMMAND=(nix run nixpkgs#nixos-rebuild --)
fi
if [ $# -gt 0 ]; then
TARGET_HOST=$1 # user@host.domain
TARGET_WITH_DOMAIN=${TARGET_HOST#*@} # host.domain
TARGET=${TARGET_WITH_DOMAIN%%.*} # host
shift
"${COMMAND[@]}" "${ACTION?}" \
--flake ".#${TARGET?}" \
--target-host "${TARGET_HOST?}" \
--sudo \
"$@" |& nom
else
sudo "${COMMAND[@]}" switch --flake . |& nom
fi
}
myip() {
if [ $# -eq 0 ]; then
curl -4 --silent http://ipecho.net/plain; echo
curl -6 --silent http://ipecho.net/plain; echo
else
ip addr show "$1" | sed -nr 's/\s+inet ([0-9.]+)\/.*/\1/p'
fi
}
colordiff() {
local gitarg file1 file2
for arg; do
gitarg="$gitarg $file1"
file1="$file2"
file2="$arg"
done
# git won't diff against a pipe, so a kind of workaround
cat "$file2" | git diff --no-prefix $gitarg --no-index "$file1" -
}
alias backup-home-explore='eval "ncdu $(grep -A1 -- --exclude $HOME/bin/backup-home | tr -d \|)"'
# stderr redirect for if direnv is missing
eval "$(direnv hook zsh 2>/dev/null)"
if [ -z "$SSH_AUTH_SOCK" -a -z "$SSH_CLIENT" ]; then
# This path is only needed in a local shell.
#
# In a screen session, we set SSH_AUTH_SOCK to a fixed path in
# .screenrc before a shell is started.
#
# That fixed path is a symlink which gets updated by .ssh/rc scrtipt.
eval `ssh-agent -s`
trap 'ssh-agent -k' EXIT
fi
autoload -Uz vcs_info
precmd_functions+=( vcs_info )
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '%F{green}*%f'
zstyle ':vcs_info:*' unstagedstr '%F{red}*%f'
zstyle ':vcs_info:git:*' formats ' (%F{cyan}%b%f%c%u)'
setopt prompt_subst
PROMPT='${IN_NIX_SHELL}%(?..%F{red}%?%f )[%n@%m] %3~${vcs_info_msg_0_} %# '
# Expand aliases by the press of TAB.
zstyle ':completion:*' completer _expand_alias _complete _ignored
[ -r ~/.zshrc_local ] && source ~/.zshrc_local || true