Initial commit

This commit is contained in:
Veneficium 2024-06-11 23:59:03 +02:00
commit 69d741b98b
29 changed files with 718 additions and 0 deletions

134
flake.lock generated Normal file
View file

@ -0,0 +1,134 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1718141734,
"narHash": "sha256-cA+6l8ZCZ7MXGijVuY/1f55+wF/RT4PlTR9+g4bx86w=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "892f76bd0aa09a0f7f73eb41834b8a904b6d0fad",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-vscode-extensions": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1718069152,
"narHash": "sha256-vqQxyerIHMTbkOkZ4zFKvSVrN8JEYiyqSIaoZrJ+MnA=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "d582c606b45b914278be09536a87350ea09ed33e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1713805509,
"narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1717974879,
"narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixpkgs": "nixpkgs_2"
}
},
"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
}

34
flake.nix Normal file
View file

@ -0,0 +1,34 @@
{
#need to put something funny in here
#this one is so boring :/
description = "fedfer nix flake config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }: {
nixosConfigurations = {
fedfer-main-laptop-nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/main-laptop/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = false;
home-manager.users.fedfer = import ./hosts/main-laptop/home.nix;
home-manager.backupFileExtension = "backup";
}
];
};
};
};
}

View file

@ -0,0 +1,6 @@
{ ... }: {
programs.bun = {
enable = true;
enableGitIntegration = true;
};
}

View file

@ -0,0 +1,6 @@
{ ... }: {
programs.fastfetch = {
enable = true;
#todo add fastfetch config
};
}

View file

@ -0,0 +1,11 @@
{ ... }: {
#todo config
programs.git = {
enable = true;
userEmail = "85629831+veneficium42@users.noreply.github.com";
userName = "Veneficium";
extraConfig = {
init.defaultBranch = "main";
};
};
}

View file

@ -0,0 +1,7 @@
{ ... }: {
imports = [ ./fastfetch.nix ];
programs.hyfetch = {
enable = true;
#todo add hyfetch config
};
}

View file

@ -0,0 +1,7 @@
{ pkgs, ... }: {
programs.firefox = {
enable = true;
#todo make sure this on only if gnome is setup correctly
nativeMessagingHosts = [ pkgs.gnome-browser-connector ];
};
}

View file

@ -0,0 +1,3 @@
{ pkgs, ... }: {
home.packages = [ pkgs.vesktop ];
}

View file

@ -0,0 +1,41 @@
{ pkgs, ... }: {
#The VSCoderrrrrrrr
#codepilled nixmaxxer
#god I love tumblr
#tumblrpilled mememaxxer
programs.vscode = {
enable = true;
package = pkgs.vscodium;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = false;
extensions = with pkgs.vscode-extensions; [
ms-vscode.cpptools
ms-vscode-remote.remote-ssh
mhutchie.git-graph
pkief.material-icon-theme
pkief.material-product-icons
oderwat.indent-rainbow
bierner.markdown-emoji
bierner.emojisense
jnoortheen.nix-ide
rust-lang.rust-analyzer
];
userSettings = {
"workbench.iconTheme" = "material-icon-theme";
"workbench.productIconTheme" = "material-product-icons";
"editor.formatOnSave" = true;
"workbench.sideBar.location" = "right";
"workbench.startupEditor" = "welcomePageInEmptyWorkbench";
"nix.enableLanguageServer" = true;
"C_Cpp.clang_format_fallbackStyle" = "LLVM";
"editor.fontFamily" = "FiraCode Nerd Font Mono";
"editor.fontLigatures" = true;
"terminal.integrated.fontFamily" = "FiraCode Nerd Font";
"terminal.integrated.fontSize" = 14;
"terminal.integrated.fontWeight" = 500;
};
};
}

View file

@ -0,0 +1,6 @@
{ ... }: {
programs.starship = {
enable = true;
enableZshIntegration = true;
};
}

View file

@ -0,0 +1,16 @@
{ ... }: {
#todo config
programs.zsh = {
enable = true;
completionInit.enable = true;
syntaxHighlighting.enable = true;
oh-my-zsh = {
enable = true;
plugins = [
"systemd"
"bun"
"common-aliases"
];
};
};
}

View file

@ -0,0 +1,29 @@
{ config, pkgs, ... }: {
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "fedfer-main-homelab-nixos";
systemd.network.enable = true;
environment.systemPackages = with pkgs; [
nano
lshw
neofetch
parted
];
programs.zsh.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
#enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
#DO NOT CHANGE THIS! IMPORTANT! DO NOT CHANGE THIS!
system.stateVersion = "23.11"; #DO NOT CHANGE THIS!
}

View file

@ -0,0 +1,83 @@
{ lib, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
../../nixosModules/default.nix
];
settings = {
programs.docker.enable = lib.mkForce true;
programs.tailscale.enable = lib.mkForce true;
drivers = {
printer.M2020.enable = lib.mkForce true;
ipod.enable = lib.mkForce true;
gpu.amd.enable = lib.mkForce true;
};
gnome.enable = lib.mkForce true;
services.printing.enable = lib.mkForce true;
services.audio.enable = lib.mkForce true;
};
#enable wayland for electron programs
environment.sessionVariables.NIXOS_OZONE_WL = "1";
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = 10;
#todo look further into networking options
#could be pretty interesting
networking.hostName = "fedfer-main-laptop-nixos";
networking.networkmanager.enable = true;
#todo need to move this to modules
services = {
fstrim.enable = true;
thermald.enable = true;
libinput = {
enable = true;
touchpad = {
tapping = true;
};
};
};
#remove various bloat
services.xserver.excludePackages = with pkgs; [ xterm ];
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
};
};
#todo modularize!
programs.xwayland.enable = true;
programs.zsh.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
nano
lshw
zsh
fastfetch
gparted
gcc
];
#enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
system.stateVersion = "23.11"; #DO NOT CHANGE THIS!
}

View file

@ -0,0 +1,40 @@
# 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, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-label/swap"; }
];
# 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.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,38 @@
{ pkgs, ... }: {
imports = [
../../homeManagerModules/zsh.nix
../../homeManagerModules/starship.nix
../../homeManagerModules/desktopPrograms/essentials/firefox.nix
../../homeManagerModules/desktopPrograms/vscodium.nix
../../homeManagerModules/desktopPrograms/vesktop.nix
../../homeManagerModules/cliPrograms/hyfetch.nix
../../homeManagerModules/cliPrograms/bun.nix
../../homeManagerModules/cliPrograms/git.nix
];
home.username = "fedfer";
home.homeDirectory = "/home/fedfer";
xdg.enable = true;
home.packages = with pkgs; [
prismlauncher
foliate
rustup
logseq
python3
impression
chatterino2
qbittorrent
nil
fira-code-nerdfont
];
nixpkgs.config.allowUnfree = true;
home.stateVersion = "23.11"; #DO NOT CHANGE
programs.home-manager.enable = true; #DO NOT CHANGE
}

42
nixosModules/default.nix Normal file
View file

@ -0,0 +1,42 @@
#todo declare options to more easily activate the right modules then use those to import the correct modules in the hosts configs
{ lib, ... }: {
imports =
[
./fedfer.nix
./drivers/samsung-printer.nix
./drivers/ipod.nix
./drivers/gpu/opengl.nix
./drivers/gpu/amd.nix
./drivers/gpu/nvidia.nix
./drivers/gpu/disableNvidia.nix
./services/locale.nix #todo turn into config module?
./services/gnome.nix
./services/pipewire.nix
./services/printing.nix
./programs/docker.nix
./programs/tailscale.nix
];
settings = {
programs.docker.enable = lib.mkDefault false;
programs.tailscale.enable = lib.mkDefault false;
drivers = {
printer.M2020.enable = lib.mkDefault false;
ipod.enable = lib.mkDefault false;
gpu = {
opengl.enable = lib.mkDefault true;
nvidia.enable = lib.mkDefault false;
nvidia.forceDisable = lib.mkDefault true;
amd.enable = lib.mkDefault false;
};
};
services.printing.enable = lib.mkDefault false;
services.audio.enable = lib.mkDefault false;
gnome.enable = lib.mkDefault false;
};
}

View file

@ -0,0 +1,11 @@
{ lib, config, ... }: {
options = {
settings.drivers.gpu.amd.enable = lib.mkEnableOption "enable AMD gpu drivers";
};
config = lib.mkIf config.settings.drivers.gpu.amd.enable {
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
};
}

View file

@ -0,0 +1,24 @@
{ lib, config, ... }: {
options = {
settings.drivers.gpu.nvidia.forceDisable = lib.mkEnableOption "force disable all nvidia drivers";
};
config = lib.mkIf config.settings.drivers.gpu.nvidia.forceDisable {
boot.extraModprobeConfig = ''
blacklist nouveau
options nouveau modeset=0
'';
services.udev.extraRules = ''
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA VGA/3D controller devices
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
'';
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
};
}

View file

@ -0,0 +1,25 @@
{ lib, config, ... }: {
options = {
settings.drivers.gpu.nvidia.enable = lib.mkEnableOption "Enable Nvidia proprietary drivers";
settings.drivers.gpu.nvidia.offload = lib.mkEnableOption "Enable prime offloading";
settings.drivers.gpu.nvidia.sync = lib.mkEnableOption "Enable prime sync";
};
config = lib.mkIf config.settings.drivers.gpu.nvidia.enable {
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
prime = {
nvidiaBusId = "pci:1:0:0";
amdgpuBusId = "pci:5:0:0";
};
prime.offload = lib.mkIf config.settings.drivers.gpu.nvidia.offload {
enable = true;
enableOffloadCmd = true;
};
prime.sync.enable = lib.mkIf config.settings.drivers.gpu.nvidia.sync true;
nvidiaSettings = true;
};
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, ... }: {
options = {
settings.drivers.gpu.opengl.enable = lib.mkEnableOption "enable OpenGL hardware support";
};
config = lib.mkIf config.settings.drivers.gpu.opengl.enable {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
}

View file

@ -0,0 +1,15 @@
{ lib, config, pkgs, ... }: {
options = {
settings.drivers.ipod.enable = lib.mkEnableOption "Enable necessary software for ipod communication";
};
config = lib.mkIf config.settings.drivers.ipod.enable {
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [
libimobiledevice
];
};
}

View file

@ -0,0 +1,10 @@
{ lib, config, pkgs, ... }: {
#use driver compatible with samsung M2020 printer
options = {
settings.drivers.printer.M2020.enable = lib.mkEnableOption "use the appropriate driver for the samsung M2020 printer";
};
config = lib.mkIf config.settings.drivers.printer.M2020.enable {
services.printing.drivers = [ pkgs.samsung-unified-linux-driver_1_00_37 ];
};
}

9
nixosModules/fedfer.nix Normal file
View file

@ -0,0 +1,9 @@
#need to move stuff to home-manager
{ pkgs, ... }: {
users.users.fedfer = {
isNormalUser = true;
description = "FedFer";
extraGroups = [ "networkmanager" "wheel" ];
shell = pkgs.zsh;
};
}

View file

@ -0,0 +1,10 @@
{ lib, config, ... }: {
#todo look further into virt options
options = {
settings.programs.docker.enable = lib.mkEnableOption "enables docker";
};
config = lib.mkIf config.settings.programs.docker.enable {
virtualisation.docker.enable = true;
};
}

View file

@ -0,0 +1,9 @@
{ config, lib, ... }: {
options = {
settings.programs.tailscale.enable = lib.mkEnableOption "enable tailscale";
};
config = lib.mkIf config.settings.programs.tailscale.enable {
services.tailscale.enable = true;
};
}

View file

@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }: {
options = {
settings.gnome.enable = lib.mkEnableOption "enable gnome de";
};
#todo make this more configurable
config = lib.mkIf config.settings.gnome.enable {
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
environment.systemPackages = [ pkgs.gnome.gnome-tweaks ];
#enable browser connector for installing extensions
services.gnome.gnome-browser-connector.enable = true;
# Gnome enables pulse by default smh
# make sure to have PIPEWIRE enabled!
hardware.pulseaudio.enable = false;
# remove various bloat
environment.gnome.excludePackages = with pkgs.gnome; [ epiphany gnome-contacts gnome-maps gnome-music gnome-weather totem yelp pkgs.gnome-tour ];
};
}

View file

@ -0,0 +1,24 @@
{ ... }: {
time.timeZone = "Europe/Rome";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "it_IT.UTF-8";
LC_IDENTIFICATION = "it_IT.UTF-8";
LC_MEASUREMENT = "it_IT.UTF-8";
LC_MONETARY = "it_IT.UTF-8";
LC_NAME = "it_IT.UTF-8";
LC_NUMERIC = "it_IT.UTF-8";
LC_PAPER = "it_IT.UTF-8";
LC_TELEPHONE = "it_IT.UTF-8";
LC_TIME = "it_IT.UTF-8";
};
console.keyMap = "it";
services.xserver.xkb = {
layout = "it";
variant = "";
};
}

View file

@ -0,0 +1,20 @@
{ config, lib, ... }: {
options = {
settings.services.audio.enable = lib.mkEnableOption "enable sound through pipewire and its compat layers";
};
config = lib.mkIf config.settings.services.audio.enable {
sound.enable = true;
#enable RealtimeKit for realtime audio ( req by PulseAudio )
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, ... }: {
options = {
settings.services.printing.enable = lib.mkEnableOption "enable printing";
};
config = lib.mkIf config.settings.services.printing.enable {
services = {
printing = {
enable = true;
};
#todo make this also configurable maybe a seperate module?
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
};
}