On VMware
sudo chown $USER:users -R /etc/nixos /etc/nix
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
sudo nix-channel --update
# Add VMware guest
echo "$(head -n -1 /etc/nixos/hardware-configuration.nix; echo ' virtualisation.vmware.guest.enable = true;'; echo '}}' )" > /etc/nixos/hardware-configuration.nix
# Changes packages
sed -zi 's/environment.systemPackages.*];/environment.systemPackages = with pkgs; [\n nvim\n tmux\n git\n home-manager\n ];/' /etc/nixos/configuration.nix
sudo nixos-rebuild switch
(cd /etc/nix && git init && git branch -m main && git add .)
(cd /etc/nixos && git init && git branch -m main && git add .)
mkdir -p ~/.config/nixpkgs && touch ~/.config/nixpkgs/home.nix
(cd ~/.config/nixpkgs && git init && git branch -m main && git add .)
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
mkdir -p ~/.config/nixpkgs
echo "{ allowUnfree = true; }" > ~/.config/nixpkgs/config.nix
cat <<EOF | sudo tee /etc/nix/nix.conf
build-users-group = nixbld
extra-trusted-substituters = https://cache.floxdev.com
extra-trusted-public-keys = flox-store-public-0:8c/B+kjIaQ+BloCmNkRUKwaVPFWkriSAd0JJvuDu4F0=
EOF
# install flox
nix profile install --impure \
--profile /nix/var/nix/profiles/default \
--experimental-features "nix-command flakes" \
--accept-flake-config \
'github:flox/floxpkgs#flox.fromCatalog'
On WSL with Ubuntu
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
sudo nix-channel --add https://nixos.org/channels/nixos-23.05 nixos
sudo nix-channel --update
sudo nixos-rebuild switch
# Podman
sudo apt-get install uidmap -y
sudo mkdir -p /etc/containers
echo '{"default": [{"type": "insecureAcceptAnything"}]}' | sudo tee /etc/containers/policy.json
nix-env -iA nixpkgs.podman
# Run podman
# podman run --rm -it docker.io/alpine
# Install icon theme
sudo apt-get install gnome-icon-theme gnome-themes-standard -y
# nix-env -iA nixpkgs.gnome.gnome-themes-extra
# sudo mount --bind -o ro ~/.nix-profile/share/icons/ /usr/share/icons
# sudo mount --bind -o ro ~/.nix-profile/share/applications/ /usr/share/applications/
# Install Remmina
# nix-env -iA nixpkgs.remmina
# Show Nix GUI applications in the Windows Start Menu
# ln -sf ~/.nix-profile/share/applications/ ~/.local/share/applications
# ln -sf ~/.nix-profile/share/icons/ ~/.local/share/icons
/etc/nixos/home-manager.nix
{ config, pkgs, ... }:
let
astroNvim = builtins.fetchGit {
url = "https://github.com/AstroNvim/AstroNvim";
ref = "main"; # replace with desired branch, tag, or commit hash
};
in
{
home-manager.users.mandy = { pkgs, ... }: {
home.stateVersion = "22.11";
# programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [
tree-sitter-grammars.tree-sitter-nix
ripgrep
gnomeExtensions.dash-to-dock
gnomeExtensions.caffeine
gnomeExtensions.clipboard-indicator
gnomeExtensions.space-bar
gnomeExtensions.sound-output-device-chooser
];
home.file.".config/nvim" = {
source = "${astroNvim}";
recursive = true;
};
home.file.".config/albert/albert.conf".text = ''
[General]
showTray=true
[org.albert.extension.applications]
enabled=true
[org.albert.frontend.widgetboxmodel]
alwaysOnTop=true
clearOnHide=false
displayIcons=true
displayScrollbar=false
displayShadow=true
hideOnClose=false
hideOnFocusLoss=true
itemCount=5
showCentered=true
theme=Dark
'';
programs.zsh = {
enable = true;
oh-my-zsh = {
enable = true;
plugins = [
"git"
"thefuck"
];
};
initExtra = ''
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
'';
};
programs.neovim = {
enable = true;
# defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs; [
vimPlugins.nvim-treesitter
vimPlugins.nvim-treesitter-context
vimPlugins.nvim-treesitter-textobjects
vimPlugins.nvim-treesitter-refactor
vimPlugins.telescope-nvim
vimPlugins.tokyonight-nvim
vimPlugins.vim-nix
];
# extraLuaConfig = ''
# vim.opt.number = true
# vim.opt.relativenumber = true
# vim.opt.mouse = "a"
# vim.opt.colorcolumn = "80"
# '';
};
programs.tmux = {
enable = true;
sensibleOnTop = true;
extraConfig = ''
set -g mouse on
set -g pane-border-status top
setw -g mode-keys vi
set -g default-terminal "xterm-256-color"
'';
# Force tmux to use /tmp for sockets (WSL2 compat)
secureSocket = false;
# mouse = true;
# clock24 = true;
};
# see https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/
gtk = {
enable = true;
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
dconf.settings = {
"org/gnome/desktop/wm/keybindings" = {
"switch-input-source" = [ ];
"switch-input-source-backward" = [ ];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
"binding" = "<Super>space";
"command" = "albert toggle";
name = "Albert";
};
"org/gnome/settings-daemon/plugins/media-keys" = {
"custom-keybindings" = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
];
};
"org/gnome/shell" = {
"enabled-extensions" = [
"clipboard-indicator@tudmotu.com"
"dash-to-dock@micxgx.gmail.com"
"caffeine@patapon.info"
"space-bar@luchrioh"
"sound-output-device-chooser@kgshank.net"
];
"favorite-apps" = [
"org.gnome.Nautilus.desktop"
"vivaldi-stable.desktop"
"org.gnome.Console.desktop"
];
};
"org/gnome/shell/extensions/dash-to-dock" = {
"dash-max-icon-size" = 32;
"preferred-monitor" = -2;
"dock-position" = "BOTTOM";
"dock-fixed" = true;
"show-trash" = false;
"show-mounts" = false;
"hot-keys" = false;
"click-action" = "focus-minimize-or-appspread";
"disable-overview-on-startup" = true;
"custom-theme-shrink" = true;
};
};
};
}
On VMware
On WSL with Ubuntu
/etc/nixos/home-manager.nix