first
This commit is contained in:
48
flake.lock
generated
Normal file
48
flake.lock
generated
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1754575993,
|
||||||
|
"narHash": "sha256-0ut8TM76DeMnexgwNyMx2c5flhp4IPtqQ79XR0hpmY0=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "d8a475e179888553b6863204a93295da6ee13eb4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1754498491,
|
||||||
|
"narHash": "sha256-erbiH2agUTD0Z30xcVSFcDHzkRvkRXOQ3lb887bcVrs=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c2ae88e026f9525daf89587f3cbee584b92b6134",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
45
flake.nix
Normal file
45
flake.nix
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
description = ''
|
||||||
|
For questions just DM me on X: https://twitter.com/@m3tam3re
|
||||||
|
There is also some NIXOS content on my YT channel: https://www.youtube.com/@m3tam3re
|
||||||
|
|
||||||
|
One of the best ways to learn NIXOS is to read other peoples configurations. I have personally learned a lot from Gabriel Fontes configs:
|
||||||
|
https://github.com/Misterio77/nix-starter-configs
|
||||||
|
https://github.com/Misterio77/nix-config
|
||||||
|
|
||||||
|
Please also check out the starter configs mentioned above.
|
||||||
|
'';
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
home-manager,
|
||||||
|
nixpkgs,
|
||||||
|
...
|
||||||
|
} @ inputs: let
|
||||||
|
inherit (self) outputs;
|
||||||
|
in {
|
||||||
|
overlays = import ./overlays {inherit inputs outputs;};
|
||||||
|
|
||||||
|
homeConfigurations = {
|
||||||
|
"m3tam3re@m3-daedalus" = home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = nixpkgs.legacyPackages."aarch64-linux";
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit inputs outputs;
|
||||||
|
systemConfig = {};
|
||||||
|
};
|
||||||
|
modules = [
|
||||||
|
./users/m3tam3re
|
||||||
|
./users/m3tam3re/profiles/server.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
22
modules/base.nix
Normal file
22
modules/base.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
nixpkgs = {
|
||||||
|
overlays = [
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
allowUnfree = true;
|
||||||
|
allowUnfreePredicate = _: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
package = lib.mkDefault pkgs.nix;
|
||||||
|
settings = {
|
||||||
|
experimental-features = ["nix-command" "flakes"];
|
||||||
|
warn-dirty = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
80
modules/cli/default.nix
Normal file
80
modules/cli/default.nix
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
{pkgs, ...}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./fzf.nix
|
||||||
|
./nitch.nix
|
||||||
|
./nushell.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.carapace = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.zoxide = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
vimdiffAlias = true;
|
||||||
|
withNodeJs = true;
|
||||||
|
withPython3 = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.bat = {enable = true;};
|
||||||
|
|
||||||
|
programs.direnv = {
|
||||||
|
enable = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
nix-direnv.enable =
|
||||||
|
true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.eza = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
extraOptions = ["-l" "--icons" "--git" "-a"];
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.lf = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
preview = true;
|
||||||
|
drawbox = true;
|
||||||
|
hidden = true;
|
||||||
|
icons = true;
|
||||||
|
theme = "Dracula";
|
||||||
|
previewer = "bat";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
agenix-cli
|
||||||
|
alejandra
|
||||||
|
btop
|
||||||
|
comma
|
||||||
|
coreutils
|
||||||
|
devenv
|
||||||
|
fd
|
||||||
|
httpie
|
||||||
|
jq
|
||||||
|
just
|
||||||
|
lazygit
|
||||||
|
nix-index
|
||||||
|
progress
|
||||||
|
ripgrep
|
||||||
|
tldr
|
||||||
|
trash-cli
|
||||||
|
unzip
|
||||||
|
zip
|
||||||
|
];
|
||||||
|
}
|
40
modules/cli/fzf.nix
Normal file
40
modules/cli/fzf.nix
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.features.cli.tools.fzf;
|
||||||
|
in {
|
||||||
|
options.features.cli.tools.fzf.enable = mkEnableOption "enable fuzzy finder";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.fzf = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
colors = {
|
||||||
|
"fg" = "#f8f8f2";
|
||||||
|
"bg" = "#282a36";
|
||||||
|
"hl" = "#bd93f9";
|
||||||
|
"fg+" = "#f8f8f2";
|
||||||
|
"bg+" = "#44475a";
|
||||||
|
"hl+" = "#bd93f9";
|
||||||
|
"info" = "#ffb86c";
|
||||||
|
"prompt" = "#50fa7b";
|
||||||
|
"pointer" = "#ff79c6";
|
||||||
|
"marker" = "#ff79c6";
|
||||||
|
"spinner" = "#ffb86c";
|
||||||
|
"header" = "#6272a4";
|
||||||
|
};
|
||||||
|
defaultOptions = [
|
||||||
|
"--preview='bat --color=always -n {}'"
|
||||||
|
"--bind 'ctrl-/:toggle-preview'"
|
||||||
|
"--header 'Press CTRL-Y to copy command into clipboard'"
|
||||||
|
"--bind 'ctrl-/:toggle-preview'"
|
||||||
|
"--bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort'"
|
||||||
|
];
|
||||||
|
defaultCommand = "fd --type f --exclude .git --follow --hidden";
|
||||||
|
changeDirWidgetCommand = "fd --type d --exclude .git --follow --hidden";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
15
modules/cli/nitch.nix
Normal file
15
modules/cli/nitch.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.features.cli.shell.nitch;
|
||||||
|
in {
|
||||||
|
options.features.cli.shell.nitch.enable = mkEnableOption "enable nitch";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = with pkgs; [nitch];
|
||||||
|
};
|
||||||
|
}
|
139
modules/cli/nushell.nix
Normal file
139
modules/cli/nushell.nix
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.features.cli.shell.nushell;
|
||||||
|
in {
|
||||||
|
options.features.cli.shell.nushell.enable = mkEnableOption "enable nushell";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.nushell = {
|
||||||
|
enable = true;
|
||||||
|
envFile.text = ''
|
||||||
|
$env.config.show_banner = false
|
||||||
|
$env.NIX_PATH = "nixpkgs=channel:nixos-unstable"
|
||||||
|
$env.NIX_LOG = "iunfo"
|
||||||
|
$env.WEBKIT_DISABLE_COMPOSITING_MODE = "1"
|
||||||
|
$env.TERMINAL = "kitty"
|
||||||
|
$env.EDITOR = "nvim"
|
||||||
|
$env.VISUAL = "zed"
|
||||||
|
$env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden"
|
||||||
|
$env.FZF_DEFAULT_OPTS = "--preview='bat --color=always -n {}' --bind 'ctrl-/:toggle-preview' --header 'Press CTRL-Y to copy command into clipboard' --bind 'ctrl-/:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort' --color bg:#282a36,bg+:#44475a,fg:#f8f8f2,fg+:#f8f8f2,header:#6272a4,hl:#bd93f9,hl+:#bd93f9,info:#ffb86c,marker:#ff79c6,pointer:#ff79c6,prompt:#50fa7b,spinner:#ffb86c"
|
||||||
|
$env.XDG_DATA_HOME = $"($env.HOME)/.local/share"
|
||||||
|
$env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden"
|
||||||
|
$env.SSH_AUTH_SOCK = "/run/user/1000/gnupg/S.gpg-agent.ssh"
|
||||||
|
$env.FLAKE = $"($env.HOME)/p/nixos/nixos-config"
|
||||||
|
source /run/agenix/${config.home.username}-secrets
|
||||||
|
'';
|
||||||
|
configFile.text = ''
|
||||||
|
alias .. = cd ..
|
||||||
|
alias ... = cd ...
|
||||||
|
alias h = cd $env.HOME
|
||||||
|
alias b = yazi
|
||||||
|
alias lt = eza --tree --level=2 --long --icons --git
|
||||||
|
alias grep = rg
|
||||||
|
alias just = just --unstable
|
||||||
|
|
||||||
|
alias n = nix
|
||||||
|
alias nd = nix develop -c $nu.current-shell
|
||||||
|
alias ns = nix shell
|
||||||
|
alias nsn = nix shell nixpkgs#
|
||||||
|
alias nb = nix build
|
||||||
|
alias nbn = nix build nixpkgs#
|
||||||
|
alias nf = nix flake
|
||||||
|
|
||||||
|
alias nr = sudo nixos-rebuild --flake .
|
||||||
|
alias nrs = sudo nixos-rebuild switch --flake .#(sys host | get hostname)
|
||||||
|
alias snr = sudo nixos-rebuild --flake .
|
||||||
|
alias snrs = sudo nixos-rebuild --flake . switch
|
||||||
|
alias hm = home-manager --flake .
|
||||||
|
alias hms = home-manager --flake . switch
|
||||||
|
alias hmr = do { cd ~/projects/nix-configurations; nix flake lock --update-input dotfiles; home-manager --flake .#(whoami)@(hostname) switch }
|
||||||
|
|
||||||
|
alias tsu = sudo tailscale up
|
||||||
|
alias tsd = sudo tailscale down
|
||||||
|
|
||||||
|
alias vi = nvim
|
||||||
|
alias vim = nvim
|
||||||
|
|
||||||
|
def history_fuzzy [] {
|
||||||
|
let selected = (
|
||||||
|
history
|
||||||
|
| reverse
|
||||||
|
| get command
|
||||||
|
| uniq
|
||||||
|
| to text
|
||||||
|
| ^fzf
|
||||||
|
)
|
||||||
|
if ($selected | is-not-empty) {
|
||||||
|
commandline edit ($selected)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def --env dir_fuzzy [] {
|
||||||
|
let selected = (
|
||||||
|
fd --type directory
|
||||||
|
| ^fzf
|
||||||
|
)
|
||||||
|
cd $selected
|
||||||
|
}
|
||||||
|
def find_fuzzy [] {
|
||||||
|
# Find non-hidden text files with matches for any content and select one via fuzzy search
|
||||||
|
let selected = (
|
||||||
|
^fd --type file --no-hidden -X rg -l --files-with-matches .
|
||||||
|
| lines
|
||||||
|
| to text
|
||||||
|
| ^fzf
|
||||||
|
)
|
||||||
|
if ($selected | is-not-empty) {
|
||||||
|
^$env.EDITOR $selected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$env.config = {
|
||||||
|
keybindings: [
|
||||||
|
{
|
||||||
|
name: history_fuzzy
|
||||||
|
modifier: control
|
||||||
|
keycode: char_r
|
||||||
|
mode: [emacs, vi_insert, vi_normal]
|
||||||
|
event: [
|
||||||
|
{
|
||||||
|
send: executehostcommand
|
||||||
|
cmd: "history_fuzzy"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name: dir_fuzzy
|
||||||
|
modifier: alt
|
||||||
|
keycode: char_c
|
||||||
|
mode: [emacs, vi_insert, vi_normal]
|
||||||
|
event: [
|
||||||
|
{
|
||||||
|
send: executehostcommand
|
||||||
|
cmd: "dir_fuzzy"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name: history_fuzzy
|
||||||
|
modifier: control
|
||||||
|
keycode: char_t
|
||||||
|
mode: [emacs, vi_insert, vi_normal]
|
||||||
|
event: [
|
||||||
|
{
|
||||||
|
send: executehostcommand
|
||||||
|
cmd: "find_fuzzy"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/default.nix
Normal file
6
modules/default.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./cli
|
||||||
|
./base.nix
|
||||||
|
];
|
||||||
|
}
|
36
overlays/default.nix
Normal file
36
overlays/default.nix
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{inputs, ...}: {
|
||||||
|
# This one brings our custom packages from the 'pkgs' directory
|
||||||
|
additions = final: prev:
|
||||||
|
(import ../pkgs {pkgs = final;});
|
||||||
|
# This one contains whatever you want to overlay
|
||||||
|
# You can change versions, add patches, set compilation flags, anything really.
|
||||||
|
# https://nixos.wiki/wiki/Overlays
|
||||||
|
modifications = final: prev: {
|
||||||
|
|
||||||
|
brave = prev.brave.override {
|
||||||
|
commandLineArgs = "--password-store=gnome-libsecret";
|
||||||
|
};
|
||||||
|
|
||||||
|
# nodejs_24 = inputs.nixpkgs-stable.legacyPackages.${prev.system}.nodejs_24;
|
||||||
|
# paperless-ngx = inputs.nixpkgs-45570c2.legacyPackages.${prev.system}.paperless-ngx;
|
||||||
|
# anytype-heart = inputs.nixpkgs-9e58ed7.legacyPackages.${prev.system}.anytype-heart;
|
||||||
|
# trezord = inputs.nixpkgs-2744d98.legacyPackages.${prev.system}.trezord;
|
||||||
|
# mesa = inputs.nixpkgs-master.legacyPackages.${prev.system}.mesa;
|
||||||
|
# hyprpanel = inputs.hyprpanel.packages.${prev.system}.default.overrideAttrs (prev: {
|
||||||
|
# version = "latest"; # or whatever version you want
|
||||||
|
# src = final.fetchFromGitHub {
|
||||||
|
# owner = "Jas-SinghFSU";
|
||||||
|
# repo = "HyprPanel";
|
||||||
|
# rev = "master"; # or a specific commit hash
|
||||||
|
# hash = "sha256-l623fIVhVCU/ylbBmohAtQNbK0YrWlEny0sC/vBJ+dU=";
|
||||||
|
# };
|
||||||
|
# });
|
||||||
|
};
|
||||||
|
|
||||||
|
# stable-packages = final: _prev: {
|
||||||
|
# stable = import inputs.nixpkgs-stable {
|
||||||
|
# system = final.system;
|
||||||
|
# config.allowUnfree = true;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
}
|
46
users/m3tam3re/default.nix
Normal file
46
users/m3tam3re/default.nix
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{ config,
|
||||||
|
lib,
|
||||||
|
systemConfig ? {},
|
||||||
|
...}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../modules
|
||||||
|
];
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
|
home = {
|
||||||
|
username = "m3tam3re";
|
||||||
|
homeDirectory = lib.mkDefault "/home/${config.home.username}";
|
||||||
|
stateVersion = "25.05";
|
||||||
|
};
|
||||||
|
programs = {
|
||||||
|
home-manager.enable = true;
|
||||||
|
|
||||||
|
git = {
|
||||||
|
enable = true;
|
||||||
|
difftastic.enable = true;
|
||||||
|
userName = "m3tam3re";
|
||||||
|
userEmail = "m@m3tam3re.com";
|
||||||
|
aliases = {
|
||||||
|
st = "status";
|
||||||
|
logd = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||||
|
};
|
||||||
|
extraConfig = {
|
||||||
|
core.excludesfile = "~/.gitignore_global";
|
||||||
|
init.defaultBranch = "master";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
jujutsu = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
user = {
|
||||||
|
email = "m@m3tam3re.com";
|
||||||
|
name = "Sascha Koenig";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};}
|
||||||
|
(lib.mkIf (systemConfig != {}) systemConfig)
|
||||||
|
];
|
||||||
|
}
|
9
users/m3tam3re/profiles/server.nix
Normal file
9
users/m3tam3re/profiles/server.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{...}: {
|
||||||
|
features = {
|
||||||
|
cli = {
|
||||||
|
shell.nushell.enable = true;
|
||||||
|
shell.nitch.enable = true;
|
||||||
|
tools.fzf.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user