Compare commits

..

9 Commits

Author SHA1 Message Date
88a1e08e52 add ame 2025-10-08 21:35:50 +02:00
a2cb841039 reuse variable 2025-10-08 21:32:35 +02:00
91baaf07d7 add profile name 2025-10-08 21:28:56 +02:00
01898ecafc new files 2025-10-08 19:48:34 +02:00
01b6bc1593 delete old 2025-10-08 19:47:45 +02:00
7c533ae24b update stuff 2025-06-02 11:53:44 +02:00
7127578fc7 update nix cli 2025-06-02 11:49:33 +02:00
f47c09f5aa add rclone 2025-01-03 00:18:26 +01:00
a0ca171816 update flake 2025-01-03 00:13:14 +01:00
7 changed files with 182 additions and 268 deletions

View File

@@ -1,28 +0,0 @@
# Nix
Nix setup for server
## Install
```bash
# First time install
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate
# Install / Update
nix run home-manager -- switch --flake github:cupcakearmy/nix-cli#root -b bkp
```
## Update
This can be run on any machine. Just update and then just rerun on the targets
```bash
nix flake update
# To test
nix run home-manager -- build --flake .#root
```
```
```

View File

@@ -1,160 +0,0 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
palette:
error-0: '#ff4040'
error-10: '#e23629'
error-15: '#d33220'
error-20: '#c52e18'
error-30: '#a8280d'
error-40: '#8a2106'
error-5: '#f03a34'
error-50: '#6d1b02'
error-60: '#501401'
error-70: '#330d00'
main-0: '#f7fbff'
main-10: '#b4cafd'
main-15: '#95a9fc'
main-20: '#7783fa'
main-30: '#5348f4'
main-40: '#4826e8'
main-5: '#d6e6fe'
main-50: '#3e10ca'
main-60: '#22036e'
main-70: '#020008'
success-0: '#40ff46'
success-10: '#29e243'
success-15: '#20d342'
success-20: '#18c541'
success-30: '#0da83d'
success-40: '#068a36'
success-5: '#34f044'
success-50: '#026d2d'
success-60: '#015022'
success-70: '#003316'
warning-0: '#ffff40'
warning-10: '#dae229'
warning-15: '#c8d320'
warning-20: '#b6c518'
warning-30: '#96a80d'
warning-40: '#788a06'
warning-5: '#ecf034'
warning-50: '#5d6d02'
warning-60: '#435001'
warning-70: '#2a3300'
blocks:
- type: prompt
alignment: left
segments:
- leading_diamond:
foreground: p:main-70
background: p:main-5
type: os
style: diamond
- properties:
style: full
template: " \uf0e7 "
foreground: p:main-70
powerline_symbol:
background: p:error-15
type: root
style: powerline
- properties:
style: full
template: ' {{ .Path }} '
foreground: p:main-0
powerline_symbol:
background: p:main-40
type: path
style: powerline
- template: ' {{ .HEAD }} '
foreground: p:main-70
powerline_symbol:
background: p:warning-10
type: git
style: powerline
- type: prompt
alignment: right
segments:
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: python
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: go
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: node
style: dynamic
- leading_diamond:
trailing_diamond:
template: '{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }}'
foreground: p:main-70
background: p:main-10
type: kubectl
style: dynamic
- leading_diamond:
trailing_diamond:
template: '{{ .Icon }} {{ .Server }}'
foreground: p:main-70
background: p:main-10
type: docker
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: rust
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: battery
style: dynamic
- properties:
always_enabled: true
leading_diamond:
template: "{{ if gt .Code 0 }}\uf00d {{ .Code }} {{ .Meaning }}{{ else }}\uf42e{{ end }}"
foreground: p:main-70
type: status
style: diamond
background_templates:
- '{{ if gt .Code 0 }}p:error-0{{ else }}p:main-10{{ end }}'
- properties:
always_enabled: true
style: round
foreground: p:main-70
powerline_symbol:
background: p:main-5
type: executiontime
style: powerline
- properties:
time_format: '15:04:05'
template: ' {{ .CurrentDate | date .Format }} '
foreground: p:main-70
powerline_symbol:
background: p:main-0
type: time
style: powerline
- type: prompt
alignment: left
segments:
- properties:
always_enabled: true
template: ' '
foreground: p:main-15
type: status
style: plain
foreground_templates:
- '{{ if gt .Code 0 }}p:error-15{{ end }}'
newline: true
version: 3

12
flake.lock generated
View File

@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734344598, "lastModified": 1759853171,
"narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=", "narHash": "sha256-uqbhyXtqMbYIiMqVqUhNdSuh9AEEkiasoK3mIPIVRhk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "83ecd50915a09dca928971139d3a102377a8d242", "rev": "1a09eb84fa9e33748432a5253102d01251f72d6d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -22,11 +22,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734424634, "lastModified": 1759831965,
"narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "rev": "c9b6fb798541223bbb396d287d16f43520250518",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -1,8 +1,7 @@
{ {
description = "Home Manager configuration of root"; description = "Server Shell";
inputs = { inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
@@ -10,20 +9,34 @@
}; };
}; };
outputs = { nixpkgs, home-manager, ... }: outputs =
{
nixpkgs,
home-manager,
...
}:
let let
system = "x86_64-linux"; profiles = import ./profiles.nix;
in
{
homeConfigurations = nixpkgs.lib.genAttrs (builtins.map (p: p.name) profiles) (
profile:
let
p = (nixpkgs.lib.findFirst (p: p.name == profile) null profiles);
system = p.architecture;
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in
homeConfigurations."root" = home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ]; modules = [ ./home.nix ];
# Optionally use extraSpecialArgs extraSpecialArgs = {
# to pass through arguments to home.nix username = p.username;
homeDirectory = p.homeDirectory;
name = p.name;
}; };
}
);
}; };
} }

View File

@@ -1,57 +1,73 @@
{ config, pkgs, ... }: {
config,
pkgs,
username,
name,
homeDirectory,
...
}:
{ {
home.username = "root"; home.username = username;
home.homeDirectory = "/root"; home.homeDirectory = homeDirectory;
# home.stateVersion = "25.11";
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "24.05"; # Please read the comment before changing.
home.packages = [ home.packages = (import ./pkgs.nix { inherit pkgs; });
pkgs.neovim
pkgs.tmux
pkgs.oh-my-posh
pkgs.git fonts.fontconfig.enable = true;
pkgs.gnutar
pkgs.btop
pkgs.nerd-fonts.jetbrains-mono home = {
sessionVariables = {
];
home.file = {
".config/omp/config.yaml".source = ./files/omp/config.yaml;
};
home.sessionVariables = {
EDITOR = "nvim"; EDITOR = "nvim";
}; };
programs.home-manager.enable = true; shellAliases = {
# Rust re-maps
l = "eza -a1lh";
ls = "eza";
cat = "bat";
cd = "z";
home.shellAliases = { # QOL
l = "ls -hal";
dc = "docker compose"; dc = "docker compose";
rsync = "rsync -az --info=progress2"; rsync = "rsync -az --info=progress2";
t = "tmux new-session -A -s main"; t = "tmux new-session -A -s main";
e = "nvim"; e = "nvim";
hms = "home-manager switch --flake ~/nix#root -b backup"; g = "lazygit";
d = "lazydocker";
p = "pnpm";
px = "pnpm -s dlx";
n = "fnm use --install-if-missing";
c = "pwd | pbcopy";
k = "kubectl";
hm = "nix run home-manager/master -- switch --flake github:cupcakearmy/nix-cli/v3#${name} -b backup";
};
}; };
programs.fish = { programs = {
direnv.enable = true;
zoxide.enable = true;
fish = {
enable = true; enable = true;
shellInit = '' interactiveShellInit = ''
oh-my-posh init fish --config ~/.config/omp/config.yaml | source if type -q starship
starship init fish | source
end
if type -q fnm
fnm env --use-on-cd | source
end
if type -q nvs
nvs env --source | source
end
''; '';
}; };
programs.bash = { bash = {
enable = true; enable = true;
}; };
programs.tmux = { tmux = {
enable = true; enable = true;
clock24 = true; clock24 = true;
mouse = true; mouse = true;
@@ -71,4 +87,5 @@
shell = "${pkgs.fish}/bin/fish"; shell = "${pkgs.fish}/bin/fish";
terminal = "tmux-256color"; terminal = "tmux-256color";
}; };
};
} }

46
pkgs.nix Normal file
View File

@@ -0,0 +1,46 @@
{ pkgs }:
with pkgs;
[
# Base
tmux
git
git-lfs
git-crypt
gnutar
gnupg
htop
btop
rclone
rename
tmux
tree
wget
rsync
yq
delta
# Rust utils
bat
eza
fd
ripgrep
ripgrep-all
zoxide
uutils-coreutils-noprefix
dust
yazi
starship
# Dev
lazydocker
k9s
kubectl
# Editor
neovim
fzf
lazygit
# Fonts
nerd-fonts.jetbrains-mono
]

26
profiles.nix Normal file
View File

@@ -0,0 +1,26 @@
[
{
name = "root_x86_linux";
username = "root";
architecture = "x86_64-linux";
homeDirectory = "/root";
}
{
name = "root_x86_macos";
username = "root";
architecture = "x86_64-darwin";
homeDirectory = "/root";
}
{
name = "root_arm_linux";
username = "root";
architecture = "aarch64-linux";
homeDirectory = "/root";
}
{
name = "root_arm_macos";
username = "root";
architecture = "aarch64-darwin";
homeDirectory = "/root";
}
]