setup-env #1

Merged
noah.knegt merged 28 commits from setup-env into main 2025-02-28 21:49:32 +01:00
19 changed files with 276 additions and 29 deletions

View File

@@ -1,3 +1,13 @@
# setup-machines # setup-machines
This repo contains all the tools to correctly setup all the needed tools on a machine from clean install This repo contains all the tools to correctly setup all the needed tools on a machine from clean install
[home-manager manual](https://nix-community.github.io/home-manager/index.xhtml)
```sh
home-manager switch --flake ".#noahk@NixOS_Desktop"
```
```sh
sudo nixos-rebuild switch --flake ".#NixOS_Desktop"
```

16
flake.lock generated
View File

@@ -7,32 +7,32 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720042825, "lastModified": 1739757849,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-24.05", "ref": "release-24.11",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1723938990, "lastModified": 1740463929,
"narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=", "narHash": "sha256-4Xhu/3aUdCKeLfdteEHMegx5ooKQvwPHNkOgNCXQrvc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890", "rev": "5d7db4668d7a0c6cc5fc8cf6ef33b008b2b1ed8b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixos-24.05", "ref": "nixos-24.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@@ -2,9 +2,9 @@
description = "A very basic flake"; description = "A very basic flake";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
}; };

View File

@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./vscode.nix
];
}

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
catppuccin.catppuccin-vsc
catppuccin.catppuccin-vsc-icons
jnoortheen.nix-ide
mhutchie.git-graph
donjayamanne.githistory
eamodio.gitlens
];
};
}

View File

@@ -0,0 +1,42 @@
{ pkgs, ... }:
{
programs.git = {
enable = true;
package = pkgs.gitFull;
delta.enable = true;
userName = "Noah Knegt";
userEmail = "personal@noahknegt.com";
signing = {
key = "~/.ssh/id_ed25519.pub";
signByDefault = true;
};
extraConfig = {
gpg = { format = "ssh"; };
push = { autoSetupRemote = true; };
pull = { rebase = true; };
fetch = { prune = true; };
};
includes = [
{
condition = "gitdir:~/git.noahknegt.com";
path = "~/.config/git/git.noahknegt.com.gitconfig";
contents = {
userEmail = "git@noahknegt.com";
};
}
{
condition = "gitdir:~/open-source";
path = "~/.config/git/open-source.gitconfig";
contents = {
userEmail = "git@noahknegt.com";
};
}
];
};
}

View File

@@ -14,6 +14,13 @@
# You can also split up your configuration and import pieces of it here: # You can also split up your configuration and import pieces of it here:
# ./nvim.nix # ./nvim.nix
./IDEs
./tools
./git
./zsh
]; ];
nixpkgs = { nixpkgs = {
@@ -39,21 +46,26 @@
}; };
home = { home = {
username = noahk; username = "noahk";
homeDirectory = /home/noahk/; homeDirectory = "/home/noahk";
packages = [
(pkgs.nerdfonts.override { fonts = [ "SourceCodePro" ]; })
];
}; };
fonts.fontconfig.enable = true;
# Add stuff for your user as you see fit: # Add stuff for your user as you see fit:
# programs.neovim.enable = true; # programs.neovim.enable = true;
# home.packages = with pkgs; [ steam ]; # home.packages = with pkgs; [ steam ];
# Enable home-manager and git # Enable home-manager and git
programs.home-manager.enable = true; programs.home-manager.enable = true;
programs.git.enable = true;
# Nicely reload system units when changing configs # Nicely reload system units when changing configs
systemd.user.startServices = sd-switch; systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = 24.05; home.stateVersion = "24.11";
} }

View File

@@ -0,0 +1,7 @@
{ pkgs, inputs, ... }:
{
programs.bat = {
enable = true;
};
}

View File

@@ -0,0 +1,11 @@
{ ... }:
{
imports = [
./bat.nix
./eza.nix
./fzf.nix
./ripgrep.nix
./tmux.nix
];
}

View File

@@ -0,0 +1,16 @@
{ pkgs, inputs, ... }:
{
programs.eza = {
enable = true;
enableZshIntegration = true;
colors = "always";
icons = "always";
git = true;
extraOptions = [
"--group-directories-first"
];
};
}

View File

@@ -0,0 +1,9 @@
{ pkgs, inputs, ... }:
{
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
}

View File

@@ -0,0 +1,7 @@
{ pkgs, inputs, ... }:
{
programs.ripgrep = {
enable = true;
};
}

View File

@@ -0,0 +1,7 @@
{ pkgs, inputs, ... }:
{
programs.tmux = {
enable = true;
};
}

View File

@@ -0,0 +1,33 @@
{ pkgs, inputs, ... }:
{
programs.zsh.antidote = {
enable = true;
plugins = [
# popular fish-like plugins
"mattmc3/zfunctions"
"zsh-users/zsh-autosuggestions"
"zdharma-continuum/fast-syntax-highlighting kind:defer"
"zsh-users/zsh-history-substring-search"
# set up Zsh completions with plugins
"mattmc3/ez-compinit"
"zsh-users/zsh-completions kind:fpath path:src"
# frameworks like oh-my-zsh are supported
"getantidote/use-omz" # handle OMZ dependencies
"ohmyzsh/ohmyzsh path:lib" # load OMZ's library
# List of plugins
"ohmyzsh/ohmyzsh path:plugins/extract"
"ohmyzsh/ohmyzsh path:plugins/fzf"
"ohmyzsh/ohmyzsh path:plugins/git"
"ohmyzsh/ohmyzsh path:plugins/git-auto-fetch"
"ohmyzsh/ohmyzsh path:plugins/gitignore"
"ohmyzsh/ohmyzsh path:plugins/jsontools"
"ohmyzsh/ohmyzsh path:plugins/sudo"
"ohmyzsh/ohmyzsh path:plugins/tmux"
];
};
}

View File

@@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./antidote.nix
./starship.nix
./zoxide.nix
./zsh.nix
];
}

View File

@@ -0,0 +1,8 @@
{ pkgs, inputs, ... }:
{
programs.starship = {
enable = true;
enableZshIntegration = true;
};
}

View File

@@ -0,0 +1,8 @@
{ pkgs, inputs, ... }:
{
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
}

28
home-manager/zsh/zsh.nix Normal file
View File

@@ -0,0 +1,28 @@
{ pkgs, inputs, ... }:
{
programs.zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
history = {
append = true;
};
shellAliases = {
ls = "eza";
ll = "eza -lh";
lal = "eza -lah";
cd = "z";
grep = "rg";
cat = "bat";
less = "bat --pager=less";
};
};
}

View File

@@ -32,11 +32,23 @@
channel.enable = false; channel.enable = false;
}; };
networking = {
hostName = "NixOS_Desktop"; # Define your hostname.
networkmanager.enable = true;
firewall = {
allowedTCPPorts = [
# Allow discovery for spotify on the network
57621
];
allowedUDPPorts = [
# Allow discovery for spotify on the network
5353
];
};
};
networking.hostName = "NixOS_Desktop"; # Define your hostname.
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";
@@ -56,15 +68,14 @@
LC_TIME = "nl_NL.UTF-8"; LC_TIME = "nl_NL.UTF-8";
}; };
# Enable the X11 windowing system. # Configure X11
services.xserver.enable = true;
# Enable the XFCE Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.xfce.enable = true;
# Configure keymap in X11
services.xserver = { services.xserver = {
enable = true;
# XFCE
displayManager.lightdm.enable = true;
desktopManager.xfce.enable = true;
xkb.layout = "us"; xkb.layout = "us";
xkb.variant = ""; xkb.variant = "";
}; };
@@ -88,11 +99,14 @@
#media-session.enable = true; #media-session.enable = true;
}; };
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with 'passwd'. # Define a user account. Don't forget to set a password with 'passwd'.
users.users.noahk = { users.users.noahk = {
isNormalUser = true; isNormalUser = true;
description = "Noah Knegt"; description = "Noah Knegt";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
shell = pkgs.zsh;
}; };
# Install firefox. # Install firefox.
@@ -109,6 +123,9 @@
papirus-icon-theme papirus-icon-theme
# Menu kind # Menu kind
xfce.xfce4-whiskermenu-plugin xfce.xfce4-whiskermenu-plugin
# Spotify
spotify
]; ];
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
@@ -117,6 +134,5 @@
# this value at the release version of the first install of this system. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?
} }