Skip to content

Instantly share code, notes, and snippets.

@nahuelDev23
Forked from mingodev/configuration.default.nix
Created September 3, 2024 22:26
Show Gist options
  • Save nahuelDev23/3687eaba51ef27edf3853710bd3d3eeb to your computer and use it in GitHub Desktop.
Save nahuelDev23/3687eaba51ef27edf3853710bd3d3eeb to your computer and use it in GitHub Desktop.
NixOS configuration for PC
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
# 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;
# Set your time zone.
time.timeZone = "America/Toronto";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Flakes setup
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Define a user account. Don't forget to set a password with ‘passwd’.
# users.users.<your_username> = {
# isNormalUser = true;
# description = "<your_name>";
# extraGroups = [ "networkmanager" "wheel" ];
# packages = with pkgs; [];
# };
# home-manager.users.<your_username> = {
# home.stateVersion = "23.11";
# home.packages = with pkgs; [
# # Custom Packages here
# google-chrome
# ];
# };
# nix.settings.allowed-users = [ "<your_username>" ];
# 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
neovim
kitty
wl-clipboard
neofetch
waybar
firefox
pavucontrol
blueberry
libnotify
mako
rofi-wayland
(pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
})
)
];
environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
NIXOS_OZONE_WL = "1";
};
# Fonts
fonts.packages = with pkgs; [
nerdfonts
];
# 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;
# };
programs.hyprland = {
enable = true;
enableNvidiaPatches = true;
xwayland.enable = true;
};
hardware = {
opengl.enable = true;
nvidia.modesetting.enable = true;
};
# XDG
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Sound
sound.enable = true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
# alsa.support32bit = true;
pulse.enable = true;
jack.enable = true;
};
# Bluetooth
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = 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.11"; # Did you read the comment?
}
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
# 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;
# Set your time zone.
time.timeZone = "America/Toronto";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Flakes setup
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.mingodev = {
isNormalUser = true;
description = "MingoDev";
extraGroups = [ "networkmanager" "wheel" "docker" ];
packages = with pkgs; [];
};
home-manager.users.mingodev = {
home.stateVersion = "23.11";
home.packages = with pkgs; [
# Progamming languages
go
gcc # C Compiler for Neovim
nodejs
typescript
# Softwares
_1password
_1password-gui
bitwarden
bitwarden-cli
dbeaver
discord
gimp
google-chrome
mariadb
morgen
lens
ripgrep
robo3t
slack
spotify
swaylock-effects
sublime
unzip
wget
zip
# VS Code Extensions
(vscode-with-extensions.override {
vscodeExtensions = with vscode-extensions; [
vscodevim.vim
mvllow.rose-pine
golang.go
eamodio.gitlens
dbaeumer.vscode-eslint
];
})
# CLIs & Others
awscli
cava
kubectl
kubectx
swww
zellij
];
};
nix.settings.allowed-users = [ "mingodev" ];
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
blueberry
docker
docker-compose
firefox
gh
git
kitty
kitty-themes
libnotify
mako
neofetch
neovim
pavucontrol
rofi-wayland
waybar
wl-clipboard
zsh
(pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
})
)
];
# Cursor fix for Hyprland
environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
# NIXOS_OZONE_WL = "1";
};
# Fonts
fonts.packages = with pkgs; [
nerdfonts
];
# Change default bash to ZSH for all users
users.defaultUserShell = pkgs.zsh;
# Nvidia
hardware = {
opengl.enable = true;
nvidia.modesetting.enable = true;
};
# 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;
# };
programs.hyprland = {
enable = true;
enableNvidiaPatches = true;
xwayland.enable = true;
};
programs.sway = {
enable = true;
};
# Custom aliases
programs.zsh = {
enable = true;
autosuggestions.enable = true;
shellAliases = {
# NixOS Aliases
nxc = "sudo -E -s nvim /etc/nixos/configuration.nix";
nxrb = "sudo nixos-rebuild switch";
nxgc = "sudo nix-store --gc --print-roots | egrep -v \"^(/nix/var|/run/\w+-system|\{memory|/proc)\"";
# Config Aliases
hlc = "nvim $HOME/.config/hypr/hyprland.conf";
wbc = "nvim $HOME/.config/waybar/config";
mkc = "nvim $HOME/.config/mako/config";
# Styling Aliases
wbcss = "nvim $HOME/.config/waybar/style.css";
tcss = "nvim $HOME/.config/themes/current/css";
# Themes Aliases
rpc = "nvim $HOME/.config/themes/rosepine.css";
};
};
# /bin/sh fix
system.activationScripts.binBash = {
deps = [ "binsh" ];
text = ''
ln -s /bin/sh /bin/bash
'';
};
# 1Password
programs._1password-gui = {
enable = true;
polkitPolicyOwners = [ "mingodev" ];
};
# Docker
virtualisation.docker.enable = true;
# XDG
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Bluetooth
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
# Sound
sound.enable = true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
# alsa.support32bit = true;
pulse.enable = true;
#jack.enable = true;
};
environment.etc = {
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
# Swaylock
security.pam.services.swaylock.text = ''
auth include login
'';
# List services that you want to enable:
# SDDM Greeter
services.xserver.enable = true;
services.xserver.xkb.layout = "us";
services.xserver.xkb.variant = "";
services.xserver.displayManager.sddm.enable = true;
services.xserver.displayManager.sddm.wayland.enable = true;
services.xserver.displayManager.sddm.theme = "";
services.xserver.displayManager.sddm.enableHidpi = true;
services.xserver.displayManager.defaultSession = "hyprland";
# Enable the OpenSSH daemon.
# services.openssh.enable = 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.11"; # Did you read the comment?
}
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# 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;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.hostName = "nixos"; # Define your hostname.
# Set your time zone.
time.timeZone = "America/Toronto";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Flakes setup
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.mingodev-laptop = {
isNormalUser = true;
description = "MingoDev";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
};
home-manager.users.mingodev-laptop = {
home.stateVersion = "23.11";
home.packages = with pkgs; [
# Progamming languages
go
nodejs
typescript
# Softwares
_1password
_1password-gui
betterbird
dbeaver
discord
gimp
google-chrome
lens
robo3t
slack
spotify
swaylock-effects
sublime
# VS Code Extensions
(vscode-with-extensions.override {
vscodeExtensions = with vscode-extensions; [
vscodevim.vim
mvllow.rose-pine
golang.go
eamodio.gitlens
dbaeumer.vscode-eslint
];
})
# CLIs & Others
awscli
cava
kubectl
kubectx
swww
zellij
];
};
nix.settings.allowed-users = [ "mingodev-laptop" ];
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
blueberry
firefox
gh
git
kitty
kitty-themes
libnotify
mako
neofetch
neovim
pavucontrol
rofi-wayland
waybar
wl-clipboard
zsh
(pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
})
)
];
# Cursor fix for Hyprland
environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
# NIXOS_OZONE_WL = "1";
};
# Fonts
fonts.packages = with pkgs; [
nerdfonts
];
# Change default bash to ZSH for all users
users.defaultUserShell = pkgs.zsh;
# Nvidia
# hardware = {
# opengl.enable = true;
# nvidia.modesetting.enable = true;
# };
# 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;
# };
programs.hyprland = {
enable = true;
# enableNvidiaPatches = true;
xwayland.enable = true;
};
programs.sway = {
enable = true;
};
# Custom aliases
programs.zsh = {
enable = true;
autosuggestions.enable = true;
shellAliases = {
# NixOS Aliases
nxc = "sudo nvim /etc/nixos/configuration.nix";
nxrb = "sudo nixos-rebuild switch";
nxgc = "sudo nix-store --gc --print-roots | egrep -v \"^(/nix/var|/run/\w+-system|\{memory|/proc)\"";
# Config Aliases
hlc = "nvim $HOME/.config/hypr/hyprland.conf";
wbc = "nvim $HOME/.config/waybar/config";
mkc = "nvim $HOME/.config/mako/config";
# Styling Aliases
wbcss = "nvim $HOME/.config/waybar/style.css";
tcss = "nvim $HOME/.config/themes/current/css";
# Themes Aliases
rpc = "nvim $HOME/.config/themes/rosepine.css";
};
};
# /bin/sh fix
system.activationScripts.binBash = {
deps = [ "binsh" ];
text = ''
ln -s /bin/sh /bin/bash
'';
};
# 1Password
programs._1password-gui = {
enable = true;
polkitPolicyOwners = [ "mingodev-laptop" ];
};
# XDG
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Bluetooth
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
# Sound
sound.enable = true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
# alsa.support32bit = true;
pulse.enable = true;
jack.enable = true;
};
# Swaylock
security.pam.services.swaylock.text = ''
auth include login
'';
# List services that you want to enable:
# SDDM Greeter
services.xserver.enable = true;
services.xserver.xkb.layout = "us";
services.xserver.xkb.variant = "";
services.xserver.displayManager.sddm.enable = true;
services.xserver.displayManager.sddm.wayland.enable = true;
services.xserver.displayManager.sddm.theme = "";
services.xserver.displayManager.sddm.enableHidpi = true;
services.xserver.displayManager.defaultSession = "hyprland";
# Enable the OpenSSH daemon.
# services.openssh.enable = 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.11"; # Did you read the comment?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment