Initial commit

This commit is contained in:
alsaiduq-lab 2025-03-13 14:50:27 -06:00
commit e886de58af
23 changed files with 926 additions and 0 deletions

11
.gitignore vendored Normal file
View file

@ -0,0 +1,11 @@
backup/
result
*.nix.bak
*.nix~
/nix/store/
*~
*.swp
*.swo

245
flake.lock generated Normal file
View file

@ -0,0 +1,245 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1741352980,
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1738453229,
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1741894454,
"narHash": "sha256-Mu2YXrGr/8Cid6W44AXci/YYnASoXjGrMV9Sjs66oyc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0b0baed7b2bf6a5e365d4cba042b580a2bc32e34",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729958008,
"narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.6",
"repo": "ixx",
"type": "github"
}
},
"nix-gaming": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1741657497,
"narHash": "sha256-2X7d94f9QcRnBKz1jJQfumATe8w4gXjwRly150ERnek=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "64a949349294543a48b3f946c9fca84332d1398b",
"type": "github"
},
"original": {
"owner": "fufexan",
"repo": "nix-gaming",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1741310760,
"narHash": "sha256-aizILFrPgq/W53Jw8i0a1h1GZAAKtlYOrG/A5r46gVM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "de0fe301211c267807afd11b12613f5511ff7433",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1740877520,
"narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "147dee35aab2193b174e4c0868bd80ead5ce755c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1741862977,
"narHash": "sha256-prZ0M8vE/ghRGGZcflvxCu40ObKaB+ikn74/xQoNrGQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cdd2ef009676ac92b715ff26630164bb88fec4e0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": [
"nixpkgs"
],
"nuschtosSearch": "nuschtosSearch"
},
"locked": {
"lastModified": 1741709061,
"narHash": "sha256-G1YTksB0CnVhpU1gEmvO3ugPS5CAmUpm5UtTIUIPnEI=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "3a3abf11700f76738d8ad9d15054ceaf182d2974",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1738508923,
"narHash": "sha256-4DaDrQDAIxlWhTjH6h/+xfG05jt3qDZrZE/7zDLQaS4=",
"owner": "NuschtOS",
"repo": "search",
"rev": "86e2038290859006e05ca7201425ea5b5de4aecb",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nix-gaming": "nix-gaming",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

48
flake.nix Normal file
View file

@ -0,0 +1,48 @@
{
description = "NixOS configuration for Cobray";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-gaming = {
url = "github:fufexan/nix-gaming";
};
};
outputs = { self, nixpkgs, home-manager, nixvim, nix-gaming, ... }@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
};
};
lib = nixpkgs.lib;
in {
nixosConfigurations = {
nixos = lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit system;
};
modules = [
./hosts/configuration.nix
];
};
};
};
}

11
home-manager/cobray.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, lib, ... }:
{
home.username = "cobray";
home.homeDirectory = "/home/cobray";
home.enableNixpkgsReleaseCheck = false;
programs.home-manager.enable = true;
home.packages = with pkgs; [
];
home.stateVersion = "24.11";
}

32
hosts/configuration.nix Normal file
View file

@ -0,0 +1,32 @@
# 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, lib, inputs, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./local-packages.nix
../modules
];
networking.hostName = "nixos";
# Setup garbage collection for old generations
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# Limit the number of generations
boot.loader.systemd-boot.configurationLimit = 5;
# 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 = "24.11"; # Did you read the comment?
}

View file

@ -0,0 +1,39 @@
# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "uas" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ca11e901-08e3-4655-89b6-6663e3a7d5c5";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5F97-DB57";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

85
hosts/local-packages.nix Normal file
View file

@ -0,0 +1,85 @@
{ config, pkgs, lib, ... }:
{
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# Applications
brave
ghostty
vesktop
# Development tools
nodejs
tree
gnumake
gcc
gdb
binutils
cmake
ninja
pkg-config
autoconf
automake
libtool
gawk
lazygit
# Python ecosystem
(python310.withPackages (ps: with ps; [
virtualenv
ipython
numpy
pandas
matplotlib
scipy
requests
pytorch-bin
torchvision-bin
torchaudio-bin
]))
(python311.withPackages (ps: with ps; [
virtualenv
ipython
jupyter
jupyterlab
numpy
pandas
matplotlib
scipy
requests
]))
uv
ruff
black
# Rust ecosystem with properly configured toolchain
rustup
rust-analyzer
cargo-edit
cargo-watch
cargo-outdated
cargo-audit
openssl
openssl.dev
pkg-config
libxml2
zlib
# Haskell ecosystem
ghc
cabal-install
stack
haskell-language-server
# Database tools
postgresql
sqlite
# Version control tools
git-lfs
gitAndTools.gh
gitAndTools.diff-so-fancy
# misc
ani-cli
nmap
psmisc
ugrep
unzip
starship
];
}

21
modules/audio.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, pkgs, lib, ... }:
{
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;
};
environment.systemPackages = with pkgs; [
cava
];
}

17
modules/bluetooth.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, pkgs, lib, ... }:
{
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
environment.systemPackages = with pkgs; [
blueman
];
}

17
modules/boot.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, pkgs, lib, ... }:
{
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.memtest86.enable = true;
boot.loader.timeout = 5;
# Create the traditional /bin directory with a symlink to bash for scripts
system.activationScripts.binbash = {
deps = [];
text = ''
mkdir -p /bin
ln -sf ${pkgs.bash}/bin/bash /bin/bash
'';
};
}

39
modules/default.nix Normal file
View file

@ -0,0 +1,39 @@
{ config, pkgs, lib, ... }:
{
imports = [
./audio.nix
./bluetooth.nix
./boot.nix
./docker.nix
./env.nix
./fish.nix
./fonts.nix
./home-manager.nix
./i3-xfce.nix
./net.nix
./nixos.nix
./nvidia.nix
./steam.nix
./timezone.nix
./user.nix
];
# Enable CUPS to print documents.
services.printing.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;
};
environment.systemPackages = with pkgs; [
wget
curl
git
home-manager
];
}

14
modules/docker.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }:
{
virtualisation.docker = {
enable = true;
enableOnBoot = true;
autoPrune.enable = true;
};
environment.systemPackages = with pkgs; [
docker
docker-compose
];
}

66
modules/env.nix Normal file
View file

@ -0,0 +1,66 @@
{ config, pkgs, lib, ... }:
{
# Add user's bin directory to PATH and set up environment variables
environment.shellInit = ''
if [ -d $HOME/.cargo/bin ]; then
export PATH=$PATH:$HOME/.cargo/bin
fi
if [ -f /run/current-system/sw/bin/python3 ]; then
alias python3=/run/current-system/sw/bin/python3
alias python=/run/current-system/sw/bin/python3
fi
'';
# Setup development environment variables
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
TERM = "xterm-256color";
GTK_THEME = "Adwaita:dark";
CC = "${pkgs.gcc}/bin/gcc";
PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" [
pkgs.openssl.dev
pkgs.libxml2.dev
pkgs.zlib.dev
];
};
environment.pathsToLink = [
"/share/fish"
"/lib/python3.10/site-packages"
"/lib/python3.11/site-packages"
"/bin"
];
# Terminal utilities
environment.systemPackages = with pkgs; [
neovim
tmux
htop
bat
ripgrep
fd
yt-dlp
eza
jq
fzf
starship
yazi
fastfetch
# Core utilities
wget
libnotify
curl
git
file
which
psmisc
];
# Enable direnv with nix integration
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

14
modules/fish.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }:
{
programs.fish.enable = true;
environment.systemPackages = with pkgs; [
starship
fzf
bat
eza
fd
ripgrep
];
}

37
modules/fonts.nix Normal file
View file

@ -0,0 +1,37 @@
{ config, pkgs, lib, ... }:
{
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
(nerdfonts.override { fonts = [ "0xProto" "FiraCode" "JetBrainsMono" "Hack" "Noto" "NerdFontsSymbolsOnly" ]; })
ipafont
kochi-substitute
# Custom BinaryClock font
(stdenv.mkDerivation {
name = "binary-clock-font";
src = fetchurl {
url = "https://github.com/jamessouth/polybar-binary-clock-fonts/raw/master/BinaryClockBoldMono.ttf";
sha256 = "0vxy23zr8r8faa5s7vy5bf8z2q7my39ghmd9ilk7aww9wqsrsjqx";
};
dontUnpack = true;
installPhase = ''
mkdir -p $out/share/fonts/truetype
cp $src $out/share/fonts/truetype/BinaryClockBoldMono.ttf
'';
})
];
fontconfig = {
enable = true;
defaultFonts = {
monospace = [ "JetBrains Mono" "Noto Sans Mono CJK JP" ];
sansSerif = [ "Noto Sans" "Noto Sans CJK JP" ];
serif = [ "Noto Serif" "Noto Serif CJK JP" ];
emoji = [ "Noto Color Emoji" ];
};
};
};
}

16
modules/home-manager.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, inputs, ... }:
{
imports = [
inputs.home-manager.nixosModules.home-manager
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
};
# Import the home-manager config for cobray user
users.cobray = import ../home-manager/cobray.nix;
};
}

84
modules/i3-xfce.nix Normal file
View file

@ -0,0 +1,84 @@
{ config, pkgs, lib, ... }:
{
services.xserver.enable = true;
services.xserver.xkb = {
layout = "us";
variant = "";
};
services.xserver.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
extraPackages = with pkgs; [
dmenu
i3status
i3lock
i3blocks
picom
feh
rofi
dunst
polybar
];
extraSessionCommands = ''
# Set random wallpaper
${pkgs.feh}/bin/feh --randomize --bg-fill ~/wallpapers/* || ${pkgs.feh}/bin/feh --bg-fill ${pkgs.nixos-artwork.wallpapers.nineish-dark-gray}/share/backgrounds/nixos/nineish-dark-gray.png &
'';
};
services.xserver.desktopManager.xfce = {
enable = true;
noDesktop = true;
enableXfwm = false;
};
services.xserver.displayManager.lightdm = {
enable = true;
background = "#000000";
greeters.gtk = {
enable = true;
theme.name = "Adwaita-dark";
iconTheme.name = "Papirus-Dark";
};
};
services.xserver.displayManager.defaultSession = "xfce+i3";
services.xserver.displayManager.autoLogin = {
enable = true;
user = "cobray";
};
environment.etc."xdg/autostart/i3-setup.desktop" = {
text = ''
[Desktop Entry]
Type=Application
Name=i3 Setup
Exec=${pkgs.bash}/bin/bash -c "${pkgs.feh}/bin/feh --randomize --bg-fill ~/wallpapers/* || ${pkgs.feh}/bin/feh --bg-fill ${pkgs.nixos-artwork.wallpapers.nineish-dark-gray}/share/backgrounds/nixos/nineish-dark-gray.png"
Terminal=false
X-GNOME-Autostart-enabled=true
'';
mode = "0644";
};
qt.enable = true;
qt.platformTheme = "gnome";
qt.style = "adwaita-dark";
environment.etc."gtk-3.0/settings.ini".text = ''
[Settings]
gtk-application-prefer-dark-theme=1
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=Papirus-Dark
gtk-font-name=Sans 10
'';
environment.systemPackages = with pkgs; [
arandr
nitrogen
xclip
lxappearance
arc-theme
arc-icon-theme
papirus-icon-theme
numix-icon-theme-circle
candy-icons
];
}

18
modules/net.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }:
{
networking.wireless.enable = false; # 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";
networking.networkmanager.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
}

34
modules/nixos.nix Normal file
View file

@ -0,0 +1,34 @@
{ config, pkgs, lib, ... }:
{
nixpkgs.config.allowUnfree = true;
# Fix Python package issues
nixpkgs.overlays = [
(final: prev: {
python310Packages = prev.python310Packages.override {
overrides = pyFinal: pyPrev: {
terminado = pyPrev.terminado.overrideAttrs (old: {
doCheck = false;
doInstallCheck = false;
});
};
};
})
];
# Enable nix-index for command-not-found
programs.nix-index.enable = true;
programs.command-not-found.enable = false;
# Setup nix settings
nix.settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
substituters = [
"https://cache.nixos.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
}

18
modules/nvidia.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }:
{
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
# Set to true for RTX 4000 series and newer GPUs
open = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
nvidiaSettings = true;
};
environment.systemPackages = with pkgs; [
cudaPackages.cudatoolkit
];
}

34
modules/steam.nix Normal file
View file

@ -0,0 +1,34 @@
{ config, pkgs, lib, inputs, system, ... }:
{
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
gamescopeSession.enable = true;
extraCompatPackages = [
inputs.nix-gaming.packages.${system}.proton-ge
];
};
hardware.graphics = {
enable = true;
enable32Bit = true;
};
environment.systemPackages = with pkgs; [
lutris
wineWowPackages.stable
winetricks
protontricks
gamemode
mangohud
vulkan-tools
vulkan-loader
vulkan-headers
vulkan-validation-layers
libstrangle
piper
];
environment.variables = {
LD_LIBRARY_PATH = "${pkgs.mangohud}/lib";
};
}

6
modules/timezone.nix Normal file
View file

@ -0,0 +1,6 @@
{ config, pkgs, lib, ... }:
{
time.timeZone = "America/Edmonton";
i18n.defaultLocale = "en_CA.UTF-8";
}

20
modules/user.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, pkgs, lib, ... }:
{
# Define a user account. Don't forget to set a password with 'passwd'.
users.users.cobray = {
isNormalUser = true;
description = "Mon Aie";
extraGroups = [ "networkmanager" "wheel" "docker" "video" ];
shell = pkgs.fish;
packages = with pkgs; [
# User-specific packages can be defined here
# or through home-manager
];
};
security.sudo = {
enable = true;
wheelNeedsPassword = true;
};
}