Switch to NixOS
This commit is contained in:
@@ -1,16 +1,22 @@
|
||||
# Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
# man configuration.nix
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
|
||||
{
|
||||
imports = [ ./hardware-configuration.nix ];
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
|
||||
# Bootloader
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
boot.loader.grub.useOSProber = true;
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Use latest kernel
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
# Networking
|
||||
networking.hostName = "TrudePC";
|
||||
@@ -32,19 +38,22 @@
|
||||
|
||||
# Enable Wayland
|
||||
services.xserver.enable = true;
|
||||
services.xserver.displayManager.gdm.enable = true;
|
||||
services.xserver.desktopManager.gnome.enable = true;
|
||||
services.displayManager.gdm.enable = true;
|
||||
services.desktopManager.gnome.enable = true;
|
||||
|
||||
# Keymap
|
||||
services.xserver.xkb = {
|
||||
layout = "us";
|
||||
variant = "alt-intl";
|
||||
variant = "altgr-intl";
|
||||
options = "terminate:ctrl_alt_bksp";
|
||||
};
|
||||
console.keyMap = "us";
|
||||
|
||||
# Enable CUPS to print documents
|
||||
services.printing.enable = true;
|
||||
|
||||
# Enable dconf
|
||||
programs.dconf.enable = true;
|
||||
|
||||
# Enable sound with pipewire
|
||||
services.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
@@ -62,50 +71,39 @@
|
||||
description = "TrudeEH";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
packages = with pkgs; [
|
||||
# General Apps
|
||||
vscode
|
||||
vesktop
|
||||
google-chrome
|
||||
localsend
|
||||
keepassxc
|
||||
tailscale
|
||||
#stremio
|
||||
nextcloud-talk-desktop
|
||||
|
||||
# VR / Games
|
||||
bs-manager
|
||||
steam
|
||||
slimevr
|
||||
wivrn
|
||||
prismlauncher
|
||||
|
||||
# Gnome Apps
|
||||
commit
|
||||
binary
|
||||
];
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
users = {
|
||||
"trude" = import ./home.nix;
|
||||
};
|
||||
};
|
||||
|
||||
# Packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
];
|
||||
# system.autoUpgrade = {
|
||||
# enable = true;
|
||||
# flake = inputs.self.outPath;
|
||||
# flags = [
|
||||
# "--update-input"
|
||||
# "nixpkgs"
|
||||
# "-L"
|
||||
# ];
|
||||
# dates = "09:00";
|
||||
# randomizedDelaySec = "45min";
|
||||
# };
|
||||
system.autoUpgrade = {
|
||||
enable = true;
|
||||
flake = inputs.self.outPath;
|
||||
flags = [
|
||||
"--update-input"
|
||||
"nixpkgs"
|
||||
"-L"
|
||||
];
|
||||
dates = "09:00";
|
||||
randomizedDelaySec = "45min";
|
||||
};
|
||||
# Allow running executables
|
||||
programs.nix-ld.enable = true;
|
||||
programs.nix-ld.libraries = with pkgs; [
|
||||
# Add missing dynamic libraries for unpackaged executables here.
|
||||
];
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
@@ -121,10 +119,9 @@
|
||||
# services.openssh.enable = true;
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall.enable = true;
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
system.stateVersion = "25.11"; # Don't change after initial installation.
|
||||
|
||||
|
||||
48
nixos/flake.lock
generated
Normal file
48
nixos/flake.lock
generated
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769397130,
|
||||
"narHash": "sha256-TTM4KV9IHwa181X7afBRbhLJIrgynpDjAXJFMUOWfyU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "c37679d37bdbecf11bbe3c5eb238d89ca4f60641",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1769170682,
|
||||
"narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c5296fdd05cfa2c187990dd909864da9658df755",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
22
nixos/flake.nix
Normal file
22
nixos/flake.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
description = "Nixos config flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
nixosConfigurations.TrudePC = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs;};
|
||||
modules = [
|
||||
./configuration.nix
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
33
nixos/hardware-configuration.nix
Normal file
33
nixos/hardware-configuration.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/e8428e24-2b69-46e4-80d2-328a3fa676d0";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/1AEE-516A";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/4c979cc9-574c-4e15-865f-bde3031ccafa"; }
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
328
nixos/home.nix
Normal file
328
nixos/home.nix
Normal file
@@ -0,0 +1,328 @@
|
||||
# man home-configuration.nix
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
home.username = "trude";
|
||||
home.homeDirectory = "/home/trude";
|
||||
home.stateVersion = "25.11"; # Do not change after initial installation.
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
home.packages = with pkgs; [
|
||||
nerd-fonts.jetbrains-mono
|
||||
bat
|
||||
|
||||
vscode
|
||||
vesktop
|
||||
google-chrome
|
||||
localsend
|
||||
keepassxc
|
||||
tailscale
|
||||
#stremio
|
||||
opencode
|
||||
|
||||
# VR / Games
|
||||
bs-manager
|
||||
steam
|
||||
slimevr
|
||||
wivrn
|
||||
prismlauncher
|
||||
|
||||
# Gnome Extensions
|
||||
gnomeExtensions.caffeine
|
||||
gnomeExtensions.vitals
|
||||
gnomeExtensions.appindicator
|
||||
gnomeExtensions.blur-my-shell
|
||||
|
||||
# Gnome Apps
|
||||
commit
|
||||
binary
|
||||
|
||||
# Scripts
|
||||
(pkgs.writeShellScriptBin "colors" ''
|
||||
#! /bin/bash
|
||||
|
||||
for i in {0..255}; do
|
||||
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
|
||||
if ((i == 15)) || ((i > 15)) && (((i - 15) % 6 == 0)); then
|
||||
printf "\n"
|
||||
fi
|
||||
done
|
||||
'')
|
||||
(pkgs.writeShellScriptBin "gitssh" ''
|
||||
#! /bin/sh
|
||||
|
||||
current_url=$(git remote get-url origin)
|
||||
if echo "$current_url" | grep -q '^git@'; then
|
||||
echo "Remote origin already uses SSH."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ssh_url=$(echo "$current_url" | sed -E 's|https?://([^/]+)/(.+)|git@\1:\2|')
|
||||
echo "Changing remote origin from $current_url to $ssh_url"
|
||||
git remote set-url origin "$ssh_url"
|
||||
'')
|
||||
(pkgs.writeShellScriptBin "rebuild" ''
|
||||
#! /bin/bash
|
||||
set -e
|
||||
pushd ~/dotfiles
|
||||
git diff -U0 *.nix
|
||||
echo "NixOS Rebuilding..."
|
||||
sudo nixos-rebuild switch --flake ./nixos#TrudePC &> ~/.nixos-rebuild.log || ( cat ~/.nixos-rebuild.log | grep --color error && false )
|
||||
gen=$(nixos-rebuild list-generations | grep current)
|
||||
echo "Pushing changes..."
|
||||
git commit -am "$gen"
|
||||
git push
|
||||
sudo nix-collect-garbage --delete-older-than 15d
|
||||
popd
|
||||
'')
|
||||
];
|
||||
|
||||
home.sessionVariables = {
|
||||
EDITOR = "gnome-text-editor";
|
||||
SSH_AUTH_SOCK = "$XDG_RUNTIME_DIR/ssh-agent";
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user = {
|
||||
email = "ehtrude@gmail.com";
|
||||
name = "TrudeEH";
|
||||
# signingKey will be provided by SSH agent (KeePassXC)
|
||||
};
|
||||
gpg.format = "ssh";
|
||||
gpg.ssh.defaultKeyCommand = "ssh-add -L";
|
||||
core.editor = "commit";
|
||||
commit.gpgSign = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
matchBlocks = {
|
||||
"*" = {
|
||||
# Use keys from SSH agent instead of identity files
|
||||
identitiesOnly = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
l = "ls -alh";
|
||||
ls = "ls --color=auto";
|
||||
grep = "grep --color=auto";
|
||||
ll = "ls -lhi";
|
||||
ta = "tmux attach";
|
||||
t = "tmux";
|
||||
v = "nvim";
|
||||
raid = "sudo mdadm --detail /dev/md0";
|
||||
unp = "unp -U";
|
||||
cat = "bat";
|
||||
};
|
||||
historySize = 10000;
|
||||
historyFileSize = 100000;
|
||||
initExtra = ''
|
||||
shopt -s histappend
|
||||
shopt -s checkwinsize
|
||||
shopt -s extglob
|
||||
set completion-ignore-case On
|
||||
export PS1="\n[\[\e[37m\]\u\[\e[0m\]@\[\e[37;2m\]\h\[\e[0m\]] \[\e[1m\]\w \[\e[0;2m\]J:\[\e[0m\]\j\n\$ "
|
||||
'';
|
||||
enableCompletion = true;
|
||||
};
|
||||
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
baseIndex = 1;
|
||||
clock24 = false;
|
||||
escapeTime = 250;
|
||||
keyMode = "vi";
|
||||
mouse = true;
|
||||
terminal = "tmux-256color";
|
||||
aggressiveResize = true;
|
||||
extraConfig = ''
|
||||
set -g pane-base-index 1
|
||||
|
||||
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
|
||||
|
||||
# hjkl pane traversal
|
||||
bind-key h select-pane -L
|
||||
bind-key j select-pane -D
|
||||
bind-key k select-pane -U
|
||||
bind-key l select-pane -R
|
||||
|
||||
# easy reload config
|
||||
bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded."
|
||||
|
||||
# set window split
|
||||
bind-key v split-window -h -c "#{pane_current_path}"
|
||||
bind-key b split-window -v -c "#{pane_current_path}"
|
||||
|
||||
# Styling
|
||||
set-option -g status-position top
|
||||
set -g mode-style "fg=black,bg=orange"
|
||||
set-option -g pane-border-style fg=colour236
|
||||
set-option -g pane-active-border-style fg=orange
|
||||
set-window-option -g window-status-current-style fg=orange,bg=default,bright
|
||||
set-window-option -g window-status-style fg=colour244,bg=default
|
||||
set-window-option -g clock-mode-colour orange
|
||||
set-option -g status-style "bg=default,fg=white"
|
||||
set-option -g status-left ""
|
||||
set-option -g status-right '#[fg=orange]S:#[default]#S %d#[fg=orange]/#[default]%m#[fg=orange]/#[default]%Y %I:%M#[fg=orange]%P#[default]'
|
||||
set -g status-interval 1
|
||||
set -g status-right-length 60
|
||||
|
||||
set -g @cpu_high_fg_color "#[fg=#FF0000]"
|
||||
set -g @ram_high_fg_color "#[fg=#FF0000]"
|
||||
'';
|
||||
};
|
||||
|
||||
home.file = {
|
||||
"Templates/markdown.md".text = "";
|
||||
"Templates/text.txt".text = "";
|
||||
".config/vesktop/settings/settings.json" = {
|
||||
source = ../vencord/settings.json;
|
||||
force = true;
|
||||
};
|
||||
".config/vesktop/themes/trude.theme.css" = {
|
||||
source = ../vencord/trude.theme.css;
|
||||
force = true;
|
||||
};
|
||||
};
|
||||
|
||||
dconf = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"org/gnome/desktop/background" = {
|
||||
color-shading-type = "solid";
|
||||
picture-options = "zoom";
|
||||
picture-uri = "file://${config.home.homeDirectory}/dotfiles/wallpapers/bg.png";
|
||||
picture-uri-dark = "file://${config.home.homeDirectory}/dotfiles/wallpapers/dragon.png";
|
||||
primary-color = "#000000";
|
||||
secondary-color = "#000000";
|
||||
};
|
||||
"org/gnome/desktop/input-sources" = {
|
||||
show-all-sources = true;
|
||||
sources = [ ["xkb" "us+altgr-intl"] ];
|
||||
xkb-options = [ "terminate:ctrl_alt_bksp" ];
|
||||
};
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = "prefer-dark";
|
||||
cursor-size = 22;
|
||||
cursor-theme = "Adwaita";
|
||||
enable-hot-corners = false;
|
||||
font-name = "Adwaita Sans 11";
|
||||
gtk-theme = "Adwaita";
|
||||
document-font-name = "Adwaita Sans 11";
|
||||
icon-theme = "Adwaita";
|
||||
monospace-font-name = "JetBrainsMono NF 13";
|
||||
clock-format = "12h";
|
||||
accent-color = "teal";
|
||||
show-battery-percentage = true;
|
||||
};
|
||||
"org/gnome/desktop/screensaver" = {
|
||||
color-shading-type = "solid";
|
||||
picture-options = "zoom";
|
||||
picture-uri = "file://${config.home.homeDirectory}/dotfiles/wallpapers/bg.png";
|
||||
primary-color = "#000000";
|
||||
secondary-color = "#000000";
|
||||
};
|
||||
"org/gnome/desktop/wm/preferences" = {
|
||||
button-layout = ":minimize,close";
|
||||
resize-with-right-button = true;
|
||||
};
|
||||
"org/gnome/mutter" = {
|
||||
edge-tiling = true;
|
||||
dynamic-workspaces = true;
|
||||
};
|
||||
"org/gnome/shell" = {
|
||||
disabled-extensions = [ "tiling-assistant@ubuntu.com" "ubuntu-dock@ubuntu.com" "ding@rastersoft.com" ];
|
||||
enabled-extensions = [ "blur-my-shell@aunetx" "gsconnect@andyholmes.github.io" "appindicatorsupport@rgcjonas.gmail.com" "caffeine@patapon.info" "Vitals@CoreCoding.com" ];
|
||||
};
|
||||
"org/gnome/shell/extensions/dash-to-dock" = {
|
||||
dash-max-icon-size = 32;
|
||||
dock-fixed = false;
|
||||
dock-position = "BOTTOM";
|
||||
extend-height = false;
|
||||
};
|
||||
"org/gnome/shell/extensions/ding" = {
|
||||
check-x11wayland = true;
|
||||
icon-size = "small";
|
||||
show-home = false;
|
||||
};
|
||||
"org/gnome/shell/world-clocks" = {
|
||||
locations = [];
|
||||
};
|
||||
"org/gnome/Console" = {
|
||||
use-system-font = false;
|
||||
custom-font = "JetBrainsMono Nerd Font 10";
|
||||
};
|
||||
"org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9" = {
|
||||
background-color = "rgb(29,29,29)";
|
||||
cell-width-scale = 1.0;
|
||||
font = "JetBrainsMono NF 10";
|
||||
foreground-color = "rgb(208,207,204)";
|
||||
palette = [ "rgb(36,31,49)" "rgb(192,28,40)" "rgb(46,194,126)" "rgb(245,194,17)" "rgb(30,120,228)" "rgb(152,65,187)" "rgb(10,185,220)" "rgb(192,191,188)" "rgb(94,92,100)" "rgb(237,51,59)" "rgb(87,227,137)" "rgb(248,228,92)" "rgb(81,161,255)" "rgb(192,97,203)" "rgb(79,210,253)" "rgb(246,245,244)" ];
|
||||
use-system-font = false;
|
||||
use-theme-colors = false;
|
||||
};
|
||||
"org/gnome/Ptyxis" = {
|
||||
cursor-shape = "block";
|
||||
default-profile-uuid = "e2f22120c44e38d269767ed967d0430c";
|
||||
font-name = "JetBrainsMono Nerd Font 10";
|
||||
profile-uuids = [ "e2f22120c44e38d269767ed967d0430c" ];
|
||||
use-system-font = false;
|
||||
};
|
||||
"org/gnome/Ptyxis/Profiles/e2f22120c44e38d269767ed967d0430c" = {
|
||||
bold-is-bright = false;
|
||||
label = "Trude";
|
||||
palette = "Vs Code";
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
mic-mute = [ "<Super>F9" ];
|
||||
next = [ "<Super>F8" ];
|
||||
play = [ "<Super>F7" ];
|
||||
previous = [ "<Super>F6" ];
|
||||
volume-down = [ "<Super>F10" ];
|
||||
volume-mute = [ "<Super>F11" ];
|
||||
volume-up = [ "<Super>F12" ];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/color" = {
|
||||
night-light-enabled = true;
|
||||
night-light-temperature = 2700;
|
||||
};
|
||||
"org/gnome/TextEditor" = {
|
||||
highlight-current-line = true;
|
||||
show-map = true;
|
||||
};
|
||||
"org/gnome/desktop/sound" = {
|
||||
event-sounds = true;
|
||||
};
|
||||
"org/gnome/epiphany" = {
|
||||
use-google-search-suggestions = true;
|
||||
default-search-engine = "Google";
|
||||
};
|
||||
"org/gnome/epiphany/web" = {
|
||||
show-developer-actions = true;
|
||||
remember-passwords = false;
|
||||
};
|
||||
"org/gnome/shell/extensions/vitals" = {
|
||||
fixed-widths = false;
|
||||
hot-sensors = [ "_processor_usage_" "_gpu#1_usage_" "_memory_usage_" "__temperature_max__" ];
|
||||
icon-style = 1;
|
||||
menu-centered = false;
|
||||
position-in-panel = 0;
|
||||
show-battery = false;
|
||||
show-gpu = true;
|
||||
show-system = true;
|
||||
use-higher-precision = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
Reference in New Issue
Block a user