diff --git a/devshells/python_310/flake.lock b/devshells/python_310/flake.lock new file mode 100644 index 0000000..adf40ff --- /dev/null +++ b/devshells/python_310/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "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" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1752480373, + "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "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 +} diff --git a/devshells/python_310/flake.nix b/devshells/python_310/flake.nix new file mode 100644 index 0000000..917c3ce --- /dev/null +++ b/devshells/python_310/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Bare Python 3.10 dev shell without sphinx"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + python310 + gcc + ]; + }; + } + ); +} diff --git a/devshells/python_310_cuda/flake.lock b/devshells/python_310_cuda/flake.lock new file mode 100644 index 0000000..61a95f2 --- /dev/null +++ b/devshells/python_310_cuda/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1752747119, + "narHash": "sha256-2Kp9St3Pbsmu+xMsobLcgzzUxPvZR7alVJWyuk2BAPc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fa0ef8a6bb1651aa26c939aeb51b5f499e86b0ec", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devshells/python_310_cuda/flake.nix b/devshells/python_310_cuda/flake.nix new file mode 100644 index 0000000..65f900e --- /dev/null +++ b/devshells/python_310_cuda/flake.nix @@ -0,0 +1,44 @@ + { + description = "Python 3.10 development environment"; + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + in { + devShells.${system}.default = (pkgs.buildFHSEnv { + name = "nvidia-fuck-you"; + targetPkgs = pkgs: (with pkgs; [ + python310 + cudaPackages_12.cudatoolkit + python310Packages.pytorch-bin + python310Packages.pip + python310Packages.sphinx + gcc + linuxPackages.nvidia_x11 + libGLU libGL + xorg.libXi xorg.libXmu freeglut + xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr zlib + ncurses5 stdenv.cc binutils + ffmpeg + + # I daily drive the fish shell + # you can remove this, the default is bash + fish + + ]); + + profile = '' + export LD_LIBRARY_PATH="${pkgs.linuxPackages.nvidia_x11}/lib" + export CUDA_PATH="${pkgs.cudatoolkit}" + export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib" + export EXTRA_CCFLAGS="-I/usr/include" + ''; + + # again, you can remove this if you like bash + runScript = "fish"; + }).env; + }; + } diff --git a/flake.lock b/flake.lock index 2b4f72a..cf16dc0 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -7,33 +22,95 @@ ] }, "locked": { - "lastModified": 1726989464, - "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", + "lastModified": 1752544374, + "narHash": "sha256-ReX0NG6nIAEtQQjLqeu1vUU2jjZuMlpymNtb4VQYeus=", "owner": "nix-community", "repo": "home-manager", - "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", + "rev": "2e00ed310c218127e02ffcf28ddd4e0f669fde3e", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-24.05", + "ref": "release-25.05", "repo": "home-manager", "type": "github" } }, + "nix-alien": { + "inputs": { + "flake-compat": "flake-compat", + "nix-index-database": "nix-index-database", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1752566074, + "narHash": "sha256-hWPv6S5lFn6qOQdSL5Ad/m0mge2ALTC8WEAR7c6YWcE=", + "owner": "thiagokokada", + "repo": "nix-alien", + "rev": "ccf263b7ac5f44f89fd990594b09aa52de3d6585", + "type": "github" + }, + "original": { + "owner": "thiagokokada", + "repo": "nix-alien", + "type": "github" + } + }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nix-alien", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752441837, + "narHash": "sha256-FMH1OSSJp8Cx8MZHXz6KckxJGbCnVMotZNAH3v2WneU=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "839e02dece5845be3a322e507a79712b73a96ba2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, + "nix-ld": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752564969, + "narHash": "sha256-4858rI66/cpCFZR+iHl6sklXZQ11f9WdlHG5n/ZAS/Q=", + "owner": "Mic92", + "repo": "nix-ld", + "rev": "5b4edcb0357c684b69f406c808646135ee985f8a", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-ld", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1751943650, - "narHash": "sha256-7orTnNqkGGru8Je6Un6mq1T8YVVU/O5kyW4+f9C1mZQ=", + "lastModified": 1751984180, + "narHash": "sha256-LwWRsENAZJKUdD3SpLluwDmdXY9F45ZEgCb0X+xgOL0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88983d4b665fb491861005137ce2b11a9f89f203", + "rev": "9807714d6944a957c2e036f84b0ff8caf9930bc0", "type": "github" }, "original": { - "id": "nixpkgs", - "ref": "nixos-25.05", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs-unstable": { @@ -52,10 +129,27 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1751943650, + "narHash": "sha256-7orTnNqkGGru8Je6Un6mq1T8YVVU/O5kyW4+f9C1mZQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "88983d4b665fb491861005137ce2b11a9f89f203", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-25.05", + "type": "indirect" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "nix-alien": "nix-alien", + "nix-ld": "nix-ld", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" } } diff --git a/flake.nix b/flake.nix index 85215ef..ad3b1df 100644 --- a/flake.nix +++ b/flake.nix @@ -4,11 +4,23 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-25.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - home-manager.url = "github:nix-community/home-manager/release-24.05"; + + home-manager.url = "github:nix-community/home-manager/release-25.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + nix-alien.url = "github:thiagokokada/nix-alien"; + + nix-ld.url = "github:Mic92/nix-ld"; + # this line assume that you also have nixpkgs as an input + nix-ld.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, home-manager, ... }: { + outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, nix-ld, ... }: + let + system = "x86_64-linux"; # or aarch64-linux + pkgs = import nixpkgs { inherit system; }; + in + { nixosConfigurations = { dev-vm = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -20,6 +32,7 @@ ./hosts/dev-vm/default.nix ]; }; + alex-laptop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { @@ -30,6 +43,21 @@ ./hosts/alex-laptop/default.nix ]; }; + + alex-desktop = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit self system; + }; + modules = [ + ./system/common.nix + ./hosts/alex-desktop/default.nix + home-manager.nixosModules.home-manager + #nix-ld.nixosModules.nix-ld + # The module in this repository defines a new module under (programs.nix-ld.dev) instead of (programs.nix-ld) + # to not collide with the nixpkgs version. + #{ programs.nix-ld.dev.enable = true; } + ]; + }; }; }; } diff --git a/hosts/alex-desktop/default.nix b/hosts/alex-desktop/default.nix new file mode 100755 index 0000000..08a135b --- /dev/null +++ b/hosts/alex-desktop/default.nix @@ -0,0 +1,90 @@ +{ config, pkgs, lib, home-manager, ... }: + +{ + imports = [ + ../../system/modules/sway.nix + ../../system/modules/dev.nix + ../../system/modules/ml_dev.nix + ../../system/modules/latex.nix + ../../system/modules/docker.nix + ../../system/modules/bluetooth.nix + ../../system/modules/desktop_tools.nix + ../../system/modules/keyd.nix + ../../system/modules/entertainment.nix + ../../system/modules/gaming.nix + + ../../system/cpu/amd + #../../system/gpu/nvidia/ampere + ../../system/pc/ssd + ../../system/pc/audio/pipewire.nix + ../../system/modules/mullvad.nix + + ./hardware-configuration.nix + + ./user.nix + ]; + environment.systemPackages = with pkgs; [ + keymapp + ]; + + home-manager.useUserPackages = true; + home-manager.useGlobalPkgs = true; + + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub = { + enable = true; + version = 2; + efiSupport = true; + enableCryptodisk = true; + device = "nodev"; + }; + + boot.initrd.luks.devices = { + crypted = { + device = "/dev/disk/by-uuid/58ae6681-79a6-418e-94e1-8ed298b19e7c"; + preLVM = true; + }; + }; + + boot.kernelParams = [ "kvm.enable_virt_at_load=0" ]; + + console.keyMap = "us-acentos"; + + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + # hibernation setup + boot.resumeDevice = "/dev/disk/by-uuid/3876d89-a80d-4422-b852-d308fec68d4a"; + + # Suspend first + + # Define time delay for hibernation + systemd.sleep.extraConfig = '' + HibernateDelaySec=30m + SuspendState=mem + ''; + + # networking and connection + networking.hostName = "alex-desktop"; + + hardware.bluetooth.powerOnBoot = true; + + # time and localization + time.timeZone = "Europe/Berlin"; + + # users + programs.fish.enable = true; + users.users.alex = { + isNormalUser = true; + extraGroups = [ "wheel" "video" "network" "audio" "networkmanager" "vboxusers" "docker" ]; + shell = pkgs.fish; + }; +} diff --git a/hosts/alex-desktop/hardware-configuration.nix b/hosts/alex-desktop/hardware-configuration.nix new file mode 100644 index 0000000..45bc3f3 --- /dev/null +++ b/hosts/alex-desktop/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/9f30b01a-fe8d-42e5-925e-02b971513c32"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/8D94-3117"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/33876d89-a80d-4422-b852-d308fec68d4a"; } + ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.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; +} diff --git a/hosts/alex-desktop/user.nix b/hosts/alex-desktop/user.nix new file mode 100755 index 0000000..9c03975 --- /dev/null +++ b/hosts/alex-desktop/user.nix @@ -0,0 +1,70 @@ +{ config, lib, pkgs, home-manager, ... }: +{ + home-manager.users.alex= { + imports = [ + (import ../../user/common.nix ) + ../../user/modules/sway.nix + ../../user/modules/mako.nix + ../../user/modules/rofi.nix + ../../user/modules/waybar.nix + ../../user/modules/terminal.nix + ../../user/modules/ranger.nix + ../../user/modules/fish.nix + ../../user/modules/alacritty.nix + ../../user/modules/zellij.nix + ../../user/modules/dev.nix + ../../user/modules/dev_helpers.nix + ]; + home.packages = with pkgs; [ + neovim + ]; + # set custom scree resolution and refresh rate + wayland.windowManager.sway = { + config= { + output = { + "HDMI-A-1"= { + resolution = "3840x2160@120HZ"; + }; + }; + bars = [ + { + command = "waybar"; + mode = "hide"; + hiddenState = "hide"; + } + ]; + }; + }; + + # place waybar on the bottom + programs.waybar = { + settings.main = lib.mkMerge [{ + position = lib.mkForce "bottom"; + ipc = true; + }]; + }; + + # turn off swaylock background image + programs.swaylock.settings = lib.mkForce { + color = "000000"; + }; + services.swayidle.timeouts = [ + { + timeout = 300; + command = "${pkgs.bash}/bin/bash -c '${pkgs.mpv}/bin/mpv --fs --no-audio --image-display-duration=inf --loop --no-osc /home/alex/nixos/resources/blank.png & echo $! > /home/alex/black_screen.pid;'"; + #resumeCommand = "${pkgs.bash}/bin/bash -c '${pkgs.procps}/bin/pkill -U $(id -u) -x mpv; ${pkgs.coreutils}/bin/rm -f /tmp/black_screen.pid'"; + resumeCommand = "${pkgs.bash}/bin/bash -c 'pid=$(${pkgs.coreutils}/bin/cat /home/alex/black_screen.pid); ${pkgs.coreutils}/bin/kill $pid && ${pkgs.coreutils}/bin/rm /home/alex/black_screen.pid'"; + + + } + ]; + + # put notifications to bottom right + services.mako = { + settings = { + anchor = "bottom-righ"; + }; + }; + + }; +} diff --git a/quit-on-input.lua b/quit-on-input.lua new file mode 100644 index 0000000..47e9a0d --- /dev/null +++ b/quit-on-input.lua @@ -0,0 +1,10 @@ +local function quit() + mp.command("quit") +end + +-- Bind to every sane input type +mp.add_forced_key_binding(nil, "any_key", quit) +mp.add_forced_key_binding("MBTN_LEFT", "left_click", quit) +mp.add_forced_key_binding("MBTN_RIGHT", "right_click", quit) +mp.add_forced_key_binding("WHEEL_UP", "scroll_up", quit) +mp.add_forced_key_binding("WHEEL_DOWN", "scroll_down", quit) diff --git a/resources/black.mp4 b/resources/black.mp4 new file mode 100644 index 0000000..6187b5e Binary files /dev/null and b/resources/black.mp4 differ diff --git a/resources/black.png b/resources/black.png new file mode 100644 index 0000000..e69de29 diff --git a/resources/blank.png b/resources/blank.png new file mode 100644 index 0000000..199c3f0 Binary files /dev/null and b/resources/blank.png differ diff --git a/scripts/waybar/amixer-toggle.sh b/resources/scripts/waybar/amixer-toggle.sh similarity index 100% rename from scripts/waybar/amixer-toggle.sh rename to resources/scripts/waybar/amixer-toggle.sh diff --git a/scripts/waybar/brightness.sh b/resources/scripts/waybar/brightness.sh similarity index 100% rename from scripts/waybar/brightness.sh rename to resources/scripts/waybar/brightness.sh diff --git a/scripts/waybar/colorpicker.sh b/resources/scripts/waybar/colorpicker.sh similarity index 100% rename from scripts/waybar/colorpicker.sh rename to resources/scripts/waybar/colorpicker.sh diff --git a/scripts/waybar/cpu_linux.sh b/resources/scripts/waybar/cpu_linux.sh similarity index 100% rename from scripts/waybar/cpu_linux.sh rename to resources/scripts/waybar/cpu_linux.sh diff --git a/scripts/waybar/myUpdates.sh b/resources/scripts/waybar/myUpdates.sh similarity index 100% rename from scripts/waybar/myUpdates.sh rename to resources/scripts/waybar/myUpdates.sh diff --git a/scripts/waybar/myupdate.sh b/resources/scripts/waybar/myupdate.sh similarity index 100% rename from scripts/waybar/myupdate.sh rename to resources/scripts/waybar/myupdate.sh diff --git a/scripts/waybar/powerdraw.sh b/resources/scripts/waybar/powerdraw.sh similarity index 100% rename from scripts/waybar/powerdraw.sh rename to resources/scripts/waybar/powerdraw.sh diff --git a/scripts/waybar/weather.sh b/resources/scripts/waybar/weather.sh similarity index 100% rename from scripts/waybar/weather.sh rename to resources/scripts/waybar/weather.sh diff --git a/system/common.nix b/system/common.nix index b4b63b9..872a80f 100644 --- a/system/common.nix +++ b/system/common.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, system, nix-alien, ... }: { system.stateVersion = "25.05"; diff --git a/system/cpu/amd/default.nix b/system/cpu/amd/default.nix new file mode 100644 index 0000000..10ec6fd --- /dev/null +++ b/system/cpu/amd/default.nix @@ -0,0 +1,5 @@ +{ config, lib, ... }: + +{ + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/gpu/nvidia/ampere/default.nix b/system/gpu/nvidia/ampere/default.nix new file mode 100644 index 0000000..5e8d48f --- /dev/null +++ b/system/gpu/nvidia/ampere/default.nix @@ -0,0 +1,10 @@ +{ lib, config, ... }: +let + nvidiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the open source drivers if the package supports it + hardware.nvidia.open = lib.mkOverride 990 (nvidiaPackage ? open && nvidiaPackage ? firmware); +} diff --git a/system/modules/desktop_tools.nix b/system/modules/desktop_tools.nix index d06c1ac..1e0b623 100644 --- a/system/modules/desktop_tools.nix +++ b/system/modules/desktop_tools.nix @@ -8,8 +8,26 @@ brave firefox chromium - + + thunderbird + # misc + zotero + evince + pcmanfm + krusader + + # graphic and image stuff + gimp + nomacs + + # video playing + vlc + mpv + + qbittorrent + nextcloud-client + ]; diff --git a/system/modules/dev.nix b/system/modules/dev.nix old mode 100755 new mode 100644 index 3f11cf8..7032076 --- a/system/modules/dev.nix +++ b/system/modules/dev.nix @@ -1,11 +1,22 @@ { config, lib, pkgs, ... }: - { environment.systemPackages = with pkgs; [ jdk jetbrains.pycharm-professional + #(jetbrains.plugins.addPlugins jetbrains.pycharm-professional ["github-copilot"]) + R mongodb-compass ]; + virtualisation.virtualbox.host.enable = true; + virtualisation.virtualbox.host.enableExtensionPack = true; + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + zlib # numpy + libgcc # sqlalchemy + # that's where the shared libs go, you can find which one you need using + # nix-locate --top-level libstdc++.so.6 (replace this with your lib) + # ^ this requires `nix-index` pkg + ]; } diff --git a/system/modules/docker.nix b/system/modules/docker.nix index 39088f4..2d88281 100644 --- a/system/modules/docker.nix +++ b/system/modules/docker.nix @@ -1,8 +1,8 @@ { config, lib, pkgs, ... }: { virtualisation.docker.enable = true; - virtualisation.docker.rootless = { - enable = true; - setSocketVariable = true; - }; + #virtualisation.docker.rootless = { + # enable = true; + # setSocketVariable = true; + #}; } diff --git a/system/modules/entertainment.nix b/system/modules/entertainment.nix new file mode 100644 index 0000000..f8d5db8 --- /dev/null +++ b/system/modules/entertainment.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + spotify + ffmpeg + ]; +} diff --git a/system/modules/gaming.nix b/system/modules/gaming.nix new file mode 100644 index 0000000..de9bf65 --- /dev/null +++ b/system/modules/gaming.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + (lutris.override { + extraLibraries = pkgs: [ + # List library dependencies here + ]; + }) + wineWowPackages.stable # 32/64-bit Wine + winetricks + lutris + vulkan-tools # for testing Vulkan + libpulseaudio # often needed for audio in Wine games + protonup-qt + ]; + + + programs.steam.enable = true; +} diff --git a/system/modules/keyd.nix b/system/modules/keyd.nix index 241abbd..d254774 100644 --- a/system/modules/keyd.nix +++ b/system/modules/keyd.nix @@ -10,6 +10,7 @@ main = { capslock = "layer(capslayer)"; "'" = "G-'"; + rightcontrol = "rightcontrol"; }; otherlayer = {}; capslayer = { @@ -35,10 +36,10 @@ # Optional, but makes sure that when you type the make palm rejection work with keyd # https://github.com/rvaiya/keyd/issues/723 - environment.etc."libinput/local-overrides.quirks".text = '' - [Serial Keyboards] - MatchUdevType=keyboard - MatchName=keyd virtual keyboard - AttrKeyboardIntegration=internal - ''; + #environment.etc."libinput/local-overrides.quirks".text = '' + # [Serial Keyboards] + # MatchUdevType=keyboard + # MatchName=keyd virtual keyboard + # AttrKeyboardIntegration=internal + #''; } diff --git a/system/modules/latex.nix b/system/modules/latex.nix new file mode 100644 index 0000000..9c6e087 --- /dev/null +++ b/system/modules/latex.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + texlive.combined.scheme-full + biber + ]; +} diff --git a/system/modules/ml_dev.nix b/system/modules/ml_dev.nix new file mode 100644 index 0000000..6e17a31 --- /dev/null +++ b/system/modules/ml_dev.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: +{ + nix.settings = { + substituters = [ + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + environment.systemPackages = with pkgs; [ + cudaPackages.cudatoolkit + cudaPackages.cudnn + ]; + hardware.nvidia-container-toolkit.enable = true; + environment.variables = { + CUDA_HOME = "${pkgs.cudaPackages.cudatoolkit}"; + CUDNN_PATH = "${pkgs.cudaPackages.cudnn}"; + }; + systemd.services.docker.serviceConfig = { + Environment = "DOCKER_CLI_EXPERIMENTAL=enabled"; + }; +} diff --git a/system/modules/mullvad.nix b/system/modules/mullvad.nix new file mode 100644 index 0000000..987efc9 --- /dev/null +++ b/system/modules/mullvad.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +let + mullvad-autostart = pkgs.makeAutostartItem { + name = "mullvad-vpn"; + package = pkgs.mullvad-vpn; + }; +in +{ + services.mullvad-vpn.enable = true; + services.mullvad-vpn.package = pkgs.mullvad-vpn; + environment.systemPackages = [ mullvad-autostart ]; +} diff --git a/system/modules/sway.nix b/system/modules/sway.nix index 2181c79..0ea62d7 100644 --- a/system/modules/sway.nix +++ b/system/modules/sway.nix @@ -14,14 +14,16 @@ wl-clipboard mako + libnotify ]; programs.dconf.enable = true; services.greetd = { enable = true; + vt = 2; # clean login screen, no startup logs settings = { default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd 'sway --unsupported-gpu'"; user = "greeter"; }; }; diff --git a/system/pc/audio/pipewire.nix b/system/pc/audio/pipewire.nix index 91be448..5421a37 100644 --- a/system/pc/audio/pipewire.nix +++ b/system/pc/audio/pipewire.nix @@ -4,6 +4,7 @@ # Install tools environment.systemPackages = with pkgs; [ pavucontrol + playerctl ]; # Enable PipeWire and its PulseAudio compatibility layer diff --git a/user/common.nix b/user/common.nix new file mode 100644 index 0000000..5663782 --- /dev/null +++ b/user/common.nix @@ -0,0 +1,9 @@ +{ config, pkgs, system, ... }: + +{ + home.packages = with pkgs; [ + ]; + home.stateVersion = "25.05"; + +} + diff --git a/user/modules/alacritty.nix b/user/modules/alacritty.nix index 3fab37c..cf47f9c 100644 --- a/user/modules/alacritty.nix +++ b/user/modules/alacritty.nix @@ -4,17 +4,17 @@ enable = true; settings = { terminal.shell = { - program = "/bin/sh"; - args = [ - "-c" - '' - if command -v zellij >/dev/null 2>&1; then - exec zellij - else - exec "${SHELL:-/bin/bash}" - fi - '' - ]; + program = "${pkgs.fish}/bin/fish"; +# args = [ +# "-c" +# '' +# if command -v zellij >/dev/null 2>&1; then +# exec zellij +# else +# exec "${SHELL:-/bin/bash}" +# fi +# '' +# ]; }; }; }; diff --git a/user/modules/common.nix b/user/modules/common.nix deleted file mode 100644 index db8e55b..0000000 --- a/user/modules/common.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, ... }: - -{ - home.packages = with pkgs; [ - ]; - home.stateVersion = "24.05"; -} - diff --git a/user/modules/dev.nix b/user/modules/dev.nix new file mode 100644 index 0000000..03db9f9 --- /dev/null +++ b/user/modules/dev.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + # pyenv setup + programs.pyenv = { + enable = true; + enableFishIntegration = true; + }; +} diff --git a/user/modules/dev_helpers.nix b/user/modules/dev_helpers.nix new file mode 100644 index 0000000..03d8035 --- /dev/null +++ b/user/modules/dev_helpers.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +let + devScript = pkgs.writeShellScriptBin "dev" '' + if [ -z "$1" ]; then + echo "Usage: dev " + exit 1 + fi + + nix develop ~/nixos/devshells/$1 + ''; +in +{ + home.packages = [ + devScript + ]; +} diff --git a/user/modules/gammastep.nix b/user/modules/gammastep.nix index 8632b4b..eeab822 100644 --- a/user/modules/gammastep.nix +++ b/user/modules/gammastep.nix @@ -6,7 +6,7 @@ provider = "geoclue2"; tray = true; temperature = { - night = 1700; + night = 2500; }; }; } diff --git a/user/modules/mako.nix b/user/modules/mako.nix new file mode 100644 index 0000000..da84c27 --- /dev/null +++ b/user/modules/mako.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, ... }: +{ + services.mako = { + enable = true; + settings = { + actions = true; + sort = "-time"; + anchor = lib.mkDefault "top-right"; + background-color = "#000000"; + border-color = "#88c0d0"; + border-radius = 0; + default-timeout = 10000; + font = "monospace 20"; + height = 150; + width = 400; + icons = true; + ignore-timeout = false; + layer = "overlay"; + markup = true; + + # Section example + "urgency=high" = { + border-color = "fc0f0f"; + default-timeout = 0; + + }; + }; + }; +} diff --git a/user/modules/sway.nix b/user/modules/sway.nix index 9274acc..1466624 100644 --- a/user/modules/sway.nix +++ b/user/modules/sway.nix @@ -35,8 +35,16 @@ in terminal = "alacritty"; startup = [ { command = "blueman-applet";} + { command = "mullvad-vpn";} + { command = "swaymsg workspace 1";} + { command = "thunderbird";} + { command = "nextcloud";} + { command = "spotify";} + { command = "brave";} + { command = "alacritty";} ]; defaultWorkspace = "1"; + workspaceAutoBackAndForth = true; bars = []; fonts = { names = [ "MesloLGS NF" ]; @@ -144,18 +152,17 @@ in value = "workspace ${key}"; } { - name = "${mod}+Ctrl+${key}"; + name = "${mod}+Shift+${key}"; value = "move container to workspace ${key}"; } { - name = "${mod}+Shift+${key}"; + name = "${mod}+Ctrl+${key}"; value = "move container to workspace ${key}; workspace ${key}"; } - ]) (lib.range 0 8)); + ]) (lib.range 1 9)); assigns = { - "2: web" = [{ class = "^Brave$"; }]; - "9: mail" = [{ class = "Thunderbird"; }]; + "9: mail" = [{ app_id = "thunderbird"; }]; }; modes = { @@ -213,7 +220,7 @@ in }; }; extraConfig = '' - default_border pixel 1 + default_border pixel 2 floating_modifier ${mod} # === Floating Windows === @@ -224,8 +231,15 @@ in for_window [class="Blueman-manager"] floating enable border normal for_window [class="GParted"] floating enable border normal for_window [class="pavucontrol"] floating enable - for_window [class="Volume Control"] floating enable - for_window [class="(?i)VirtualBox"] floating enable border normal + for_window [title="Volume Control"] floating enable + for_window [class="Spotify"] move scratchpad + + # Float all windows with "VirtualBox" in the title + for_window [class=".*VirtualBox.*"] floating enable + # EXCEPT: unfloat those that also contain "Manager" or "Machine" + for_window [class=".*VirtualBox Manager.*"] floating disable + for_window [class=".*VirtualBox Machine"] floating disable + ''; }; } diff --git a/user/modules/waybar.nix b/user/modules/waybar.nix index 2eb3557..2f69d6d 100644 --- a/user/modules/waybar.nix +++ b/user/modules/waybar.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: let - scriptDir = ./../../scripts/waybar; + scriptDir = ./../../resources/scripts/waybar; # Get all files in the scriptDir scriptFiles = builtins.filter (name: @@ -28,11 +28,11 @@ in { programs.waybar = { enable = true; systemd.enable = true; - settings = [{ + settings.main = lib.mkMerge [{ command = "waybar"; layer = "top"; - position = "top"; - "modules-left" = [ + position = lib.mkDefault "top"; + "modules-left" = lib.mkDefault [ "tray" #"custom/cpu_linux" "cpu" @@ -41,8 +41,8 @@ in { "disk" "custom/nvidia" ]; - "modules-center" = [ "sway/window" ]; - "modules-right" = [ + "modules-center" = lib.mkDefault [ "sway/window" ]; + "modules-right" = lib.mkDefault [ "group/blight" "custom/colorpicker" "idle_inhibitor" @@ -219,7 +219,7 @@ in { } window#waybar { - background: transparent; + background: black; } .modules-right { diff --git a/user/modules/zellij.nix b/user/modules/zellij.nix index 8d8e1c6..eb50fc4 100644 --- a/user/modules/zellij.nix +++ b/user/modules/zellij.nix @@ -2,7 +2,7 @@ { programs.zellij = { enable = true; - enableFishIntegration = true; + #enableFishIntegration = true; settings = { theme = "dracula"; copy_on_select = true; diff --git a/wl-copy b/wl-copy new file mode 100644 index 0000000..4ecdbe0 --- /dev/null +++ b/wl-copy @@ -0,0 +1,47 @@ +{ + description = "NixOS config with modules, host overrides, and Home Manager"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-25.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager/release-25.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nix-alien.url = "github:thiagokokada/nix-alien"; + }; + + outputs = { self, nixpkgs, home-manager, nix-alien, ... }: { + nixosConfigurations = { + dev-vm = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit home-manager; + }; + modules = [ + ./common.nix + ./hosts/dev-vm/default.nix + ]; + }; + alex-laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit home-manager; + }; + modules = [ + ./system/common.nix + ./hosts/alex-laptop/default.nix + ]; + }; + alex-desktop= nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit home-manager; + inherit (self.inputs) nix-alien; + }; + modules = [ + ./system/common.nix + ./hosts/alex-desktop/default.nix + ]; + }; + }; + }; +}