Skip to content

Instantly share code, notes, and snippets.

@officialrajdeepsingh
Created June 13, 2024 13:00
Show Gist options
  • Save officialrajdeepsingh/eb67a6e901df93d93664afbea5e41f54 to your computer and use it in GitHub Desktop.
Save officialrajdeepsingh/eb67a6e901df93d93664afbea5e41f54 to your computer and use it in GitHub Desktop.
My NixOS for Nixvim uses Home Manager, flake, and NixOS.
{ config, pkgs, inputs, ... }: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./services
./programs
];
# trusted users config for https://devenv.sh/getting-started/
nix.settings.trusted-users = ["root" "officialrajdeepsingh"];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Allow to install unfree vscode package in nixos.
nixpkgs.config.allowUnfree = true;
# Set your time zone.
time.timeZone = "Asia/Kolkata";
# Select internationalisation properties.
i18n.defaultLocale = "en_IN";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_IN";
LC_IDENTIFICATION = "en_IN";
LC_MEASUREMENT = "en_IN";
LC_MONETARY = "en_IN";
LC_NAME = "en_IN";
LC_NUMERIC = "en_IN";
LC_PAPER = "en_IN";
LC_TELEPHONE = "en_IN";
LC_TIME = "en_IN";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# remove preinstall or unused package in gnome
environment.gnome.excludePackages = with pkgs; [gnome-tour gnome.gnome-music nixos-render-docs];
services.xserver.excludePackages = with pkgs; [xterm];
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
# jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default, no need to redefine it in your config for now)
# media-session.enable = true;
};
# Enable experimental-features in nixos
nix.settings.experimental-features = ["nix-command" "flakes"];
# change the deafult bash Shell to zsh shell
users.defaultUserShell = pkgs.zsh;
environment.shells = with pkgs; [zsh];
# Define env Editor for sudo
environment.variables = {
EDITOR = "lvim";
VISUAL = "lvim";
SUDO_EDITOR = "lvim";
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.officialrajdeepsingh = {
isNormalUser = true;
description = "officialrajdeepsingh";
extraGroups = ["networkmanager" "wheel" "docker"];
# openssh.authorizedKeys.keyFiles = [ .ssh/id_ed25519.pub ];
packages = with pkgs; [
## github:elythh/nixvim
# inputs.nixvim.packages.${pkgs.system}.default
];
};
# docker Config
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
# Enable automatic login for the user.
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "officialrajdeepsingh";
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
# Allow unfree packages
# nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# ];
# Some programs need SUID wrappers, can be configured further or are started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system. Before changing this value read the documentation for this option. (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}
{
description = "Nixos config flake";
inputs = {
## NixPkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
## Home Manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
## Currently using NixVim
# nixvim = {
# url = "github:elythh/nixvim";
# };
};
outputs = {
self,
nixpkgs,
home-manager,
nixvim,
...
} @ inputs: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
./configuration.nix
];
};
homeConfigurations.default = home-manager.lib.homeManagerConfiguration {
useGlobalPkgs = true;
useUserPackages = true;
inherit pkgs;
modules = [
./home.nix
];
extraSpecialArgs = {inherit inputs;};
};
};
}
{ config, pkgs, inputs, ... }: {
# programs.nixvim.enable = true;
programs.nixvim = {
enable = true;
colorschemes.gruvbox.enable = true;
plugins.lightline.enable = true;
};
# Home Manager needs a bit of information about you and the paths it should manage.
home.username = "officialrajdeepsingh";
home.homeDirectory = "/home/officialrajdeepsingh";
home.stateVersion = "23.11"; # Please read the comment before changing.
# command for install or rebuild system : sudo nixos-rebuild switch --flake /etc/nixos/#default
# Allow to install unfree package in nixos.
nixpkgs.config.allowUnfree = true;
# Using mismatched versions nixos and home manager.
home.enableNixpkgsReleaseCheck = false;
home.packages = with pkgs; [
# neovim
# youtube music
youtube-music
youtube-dl
# Database-cli (install for https://www.openstatus.dev )
turso-cli
# Browser
google-chrome
tor-browser
brave
# Notes App
notesnook
# Language
rustup
lua
zig
python3
# Install for meshery UI
# go
# cope
# gnumake
# gnumake42
# IDE
# lunarvim
# JavaScript
nodejs_20
# nodejs_18
deno
# nodePackages_latest.npm
nodePackages_latest.yarn
nodePackages_latest.pnpm
# turbo
node2nix
# Terminal
lazygit
bottom
(nerdfonts.override {fonts = ["FiraCode"];})
# Utility
git
gh
act
unzip
curl
unzip
wget
# Utility Command
xclip
tree
hugo
# thunderbird
# podcasts
# gnome-podcasts
# office
# libreoffice
# database
# surrealdb
# nodePackages.prisma
# others
# upwork
zoom-us
openssl
# It is sometimes useful to fine-tune packages, for example, by applying overrides. You can do that directly here, just don't forget the parentheses. Maybe you want to install Nerd Fonts with a limited number of fonts?
# You can also create simple shell scripts directly inside your configuration. For example, this adds a command 'my-hello' to your environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage plain files is through 'home.file'.
home.file = {
# Building this configuration will create a copy of 'dotfiles/screenrc' in the Nix store. Activating the configuration will then make '~/.screenrc' a symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through 'home.sessionVariables'. If you don't want to manage your shell through Home Manager then you have to manually source 'hm-session-vars.sh' located at either.
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
# or
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
# or
# /etc/profiles/per-user/officialrajdeepsingh/etc/profile.d/hm-session-vars.sh
home.sessionVariables = {
EDITOR = "nvim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment