diff --git a/core/audio.nix b/core/audio.nix new file mode 100644 index 0000000..5e2ce38 --- /dev/null +++ b/core/audio.nix @@ -0,0 +1,16 @@ +{ config, ... }: + +{ + hardware.pulseaudio.enable = false; + + services.pipewire = { + enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + + pulse.enable = true; + + jack.enable = true; + }; +} \ No newline at end of file diff --git a/core/boot.nix b/core/boot.nix new file mode 100644 index 0000000..993e926 --- /dev/null +++ b/core/boot.nix @@ -0,0 +1,10 @@ + + +{ config, ... }: + +{ + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; +} \ No newline at end of file diff --git a/core/core.nix b/core/core.nix new file mode 100644 index 0000000..51d0816 --- /dev/null +++ b/core/core.nix @@ -0,0 +1,14 @@ + +{ config, ... }: + +{ + imports = [ + ./user.nix + ./audio.nix + ./graphics.nix + ./locale.nix + ./network.nix + ./boot.nix + ./security.nix + ]; +} \ No newline at end of file diff --git a/core/graphics.nix b/core/graphics.nix new file mode 100644 index 0000000..fbc3c1b --- /dev/null +++ b/core/graphics.nix @@ -0,0 +1,20 @@ +{ config, ... }: + +{ + services.xserver.videoDrivers = ["nvidia"]; + + hardware = { + graphics = { + enable = true; + }; + + nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.beta; + }; + }; +} \ No newline at end of file diff --git a/core/locale.nix b/core/locale.nix new file mode 100644 index 0000000..7036886 --- /dev/null +++ b/core/locale.nix @@ -0,0 +1,20 @@ +{ config, ... }: + +{ + time.timeZone = "America/Chicago"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; +} \ No newline at end of file diff --git a/core/network.nix b/core/network.nix new file mode 100644 index 0000000..a203f1b --- /dev/null +++ b/core/network.nix @@ -0,0 +1,10 @@ + + +{ config, ... }: + +{ + networking = { + hostName = "nix"; + networkmanager.enable = true; + }; +} \ No newline at end of file diff --git a/core/security.nix b/core/security.nix new file mode 100644 index 0000000..fdedca8 --- /dev/null +++ b/core/security.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + security = { + rtkit.enable = true; + + sudo = { + enable = true; + wheelNeedsPassword = false; + }; + }; +} \ No newline at end of file diff --git a/core/user.nix b/core/user.nix new file mode 100644 index 0000000..f828e9c --- /dev/null +++ b/core/user.nix @@ -0,0 +1,9 @@ +{ config, ... }: + +{ + users.users.bug = { + isNormalUser = true; + description = "Bug"; + extraGroups = [ "networkmanager" "wheel" ]; + }; +} \ No newline at end of file diff --git a/etc/nixos/configuration.nix b/etc/nixos/configuration.nix index ef45dda..0aba953 100644 --- a/etc/nixos/configuration.nix +++ b/etc/nixos/configuration.nix @@ -1,11 +1,11 @@ { config, lib, pkgs, ... }: { - imports = [ - ./hardware-configuration.nix - /home/bug/nix/main.nix - ]; + imports = [ + ./hardware-configuration.nix + /home/bug/nix/main.nix + ]; - # nix os release version - system.stateVersion = "24.11"; + # nix os release version + system.stateVersion = "24.11"; } \ No newline at end of file diff --git a/etc/nixos/flake.nix b/etc/nixos/flake.nix index 4b68fc2..3bffbcb 100644 --- a/etc/nixos/flake.nix +++ b/etc/nixos/flake.nix @@ -1,20 +1,20 @@ { - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; - flatpaks.url = "github:gmodena/nix-flatpak/?ref=latest"; - }; - outputs = inputs@{ self, nixpkgs, home-manager, flatpaks, ... }: + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; + flatpaks.url = "github:gmodena/nix-flatpak/?ref=latest"; + }; + outputs = inputs@{ self, nixpkgs, home-manager, flatpaks, ... }: let - system = "x86_64-linux"; + system = "x86_64-linux"; in { - nixosConfigurations.nix = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - flatpaks.nixosModules.nix-flatpak - ./configuration.nix - ]; - }; + nixosConfigurations.nix = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + flatpaks.nixosModules.nix-flatpak + ./configuration.nix + ]; + }; }; } diff --git a/gnome.nix b/gnome.nix new file mode 100644 index 0000000..8056a19 --- /dev/null +++ b/gnome.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + gnomeExtensions.arcmenu + gnomeExtensions.rounded-window-corners-reborn + gnomeExtensions.just-perfection + gnomeExtensions.clipboard-history + ]; + + services = { + displayManager = { + autoLogin = { + enable = true; + user = "bug"; + }; + }; + + xserver = { + enable = true; + + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + + xkb = { + layout = "us"; + variant = ""; + }; + }; + }; + + systemd = { + services."getty@tty1".enable = false; + services."autovt@tty1".enable = false; + }; +} \ No newline at end of file diff --git a/main.nix b/main.nix index e1365d2..25064b5 100644 --- a/main.nix +++ b/main.nix @@ -1,269 +1,14 @@ { config, lib, pkgs, ... }: -{ - users.users.bug = { - isNormalUser = true; - description = "Bug"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - vscode - - go - - (python3.withPackages (ps: with ps; [ - pip - pynput - python-uinput - ])) - - luau - - (luajit.withPackages (ps: with ps; [ - luasocket - bit32 - luautf8 - jsregexp - ])) - - nodejs - - blender - plasticity - - kdenlive - - neofetch - fastfetch - - tree - gnome-tweaks - wine - - obsidian - - vesktop - nicotine-plus - furnace - - pulseaudio - - # rpi-imager - - mapscii - - cloudflared - - base16-schemes - - ptyxis - ]; - }; - - programs.dconf.enable = lib.mkDefault true; - - programs = { - bash.shellAliases = { - rebuild = "sudo nixos-rebuild switch --impure && home-manager switch --impure"; - - pissh = "ssh -t $(avahi-resolve-host-name -4 pi.home | awk '{print $2}')"; - pi = "pissh \"cd $(pwd) && bash\""; - - pico = "ssh pico.sh"; - - # tuns name port - tuns = "bash -c '\''if [ \"$#\" -ne 2 ]; then echo \"Usage: tun name port\"; exit 1; fi; -if [[ \"$1\" =~ ^[0-9]+$ ]]; then port=\"$1\"; name=\"$2\"; -elif [[ \"$2\" =~ ^[0-9]+$ ]]; then port=\"$2\"; name=\"$1\"; -else echo \"Error: One argument must be a number (port)\"; exit 1; fi; -ssh -R \"$\{name}:80:localhost:$\{port}\" tuns.sh'\'' _"; - - # pgs name directory - pgs = "bash -c '\''if [ \"$#\" -ne 2 ]; then echo \"Usage: pgs NAME DIRECTORY\"; exit 1; fi; rsync -rv \"$2\" pgs.sh:/\"$1\"'\'' _"; - }; - - firefox.enable = true; - - steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - localNetworkGameTransfers.openFirewall = true; - }; - }; - - # virtualisation.waydroid.enable = true; - - nixpkgs.config.allowUnfree = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - environment.systemPackages = with pkgs; [ - home-manager - git - wget - gcc - nmap - inetutils - sshs - gnumake - evtest - - gnomeExtensions.arcmenu - gnomeExtensions.rounded-window-corners-reborn - gnomeExtensions.just-perfection - gnomeExtensions.clipboard-history +{ + imports = [ + ./core/core.nix + ./packages/packages.nix + ./gnome.nix + ./theming.nix ]; - fonts = { - fontDir.enable = true; - enableDefaultPackages = true; - - packages = with pkgs; [ - twitter-color-emoji - ]; - - fontconfig = { - enable = true; - useEmbeddedBitmaps = true; - - defaultFonts = { - emoji = [ "Twitter Color Emoji" ]; - }; - }; - }; - - services = { - flatpak = { - enable = true; - - remotes = lib.mkOptionDefault [{ - name = "flathub-beta"; - location = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo"; - }]; - - update.auto.enable = true; - uninstallUnmanaged = false; - - packages = [ - { appId = "com.github.tchx84.Flatseal"; origin = "flathub"; } - { flatpakref = "https://sober.vinegarhq.org/sober.flatpakref"; sha256 = "1pj8y1xhiwgbnhrr3yr3ybpfis9slrl73i0b1lc9q89vhip6ym2l"; } - { flatpakref = "https://dl.flathub.org/repo/appstream/org.gimp.GIMP.flatpakref"; sha256 = "1xw8vwpgmyjf5xhh101gqffpwa8x41pysfdl3glx2xv7ydhpc3bj"; } - "dev.qwery.AddWater" - "io.github.Foldex.AdwSteamGtk" - "com.jeffser.Alpaca" - "org.vinegarhq.Vinegar" - "com.bambulab.BambuStudio" - # "com.boxy_svg.BoxySVG" - "org.gabmus.gfeeds" - "org.gnome.Decibels" - "org.pipewire.Helvum" - "io.github.giantpinkrobots.flatsweep" - ]; - }; - - displayManager = { - autoLogin = { - enable = true; - user = "bug"; - }; - }; - - xserver = { - enable = true; - - videoDrivers = ["nvidia"]; - - displayManager.gdm.enable = true; - desktopManager.gnome.enable = true; - - xkb = { - layout = "us"; - variant = ""; - }; - }; - - printing.enable = true; - - pipewire = { - enable = true; - - alsa.enable = true; - alsa.support32Bit = true; - - pulse.enable = true; - - jack.enable = true; - }; - - ollama = { - enable = true; - acceleration = "cuda"; - }; - - syncthing = { - enable = true; - user = "bug"; - group = "wheel"; - dataDir = "/home/bug/"; - }; - }; - - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - - networking = { - hostName = "nix"; - networkmanager.enable = true; - }; - - time.timeZone = "America/Chicago"; - - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - }; - - hardware = { - pulseaudio.enable = false; - - graphics = { - enable = true; - }; - - nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.beta; - }; - }; - - security = { - rtkit.enable = true; - - sudo = { - enable = true; - wheelNeedsPassword = false; - }; - }; - - systemd = { - services."getty@tty1".enable = false; - services."autovt@tty1".enable = false; - }; + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; } \ No newline at end of file diff --git a/packages/flatpak.nix b/packages/flatpak.nix new file mode 100644 index 0000000..58719c9 --- /dev/null +++ b/packages/flatpak.nix @@ -0,0 +1,19 @@ + +{ config, lib, pkgs, ... }: + +{ + services.flatpak.packages = [ + { appId = "com.github.tchx84.Flatseal"; origin = "flathub"; } + { flatpakref = "https://sober.vinegarhq.org/sober.flatpakref"; sha256 = "1pj8y1xhiwgbnhrr3yr3ybpfis9slrl73i0b1lc9q89vhip6ym2l"; } + { flatpakref = "https://dl.flathub.org/repo/appstream/org.gimp.GIMP.flatpakref"; sha256 = "1xw8vwpgmyjf5xhh101gqffpwa8x41pysfdl3glx2xv7ydhpc3bj"; } + "dev.qwery.AddWater" + "io.github.Foldex.AdwSteamGtk" + "com.jeffser.Alpaca" + "org.vinegarhq.Vinegar" + "com.bambulab.BambuStudio" + "org.gabmus.gfeeds" + "org.gnome.Decibels" + "org.pipewire.Helvum" + "io.github.giantpinkrobots.flatsweep" + ]; +} \ No newline at end of file diff --git a/packages/packages.nix b/packages/packages.nix new file mode 100644 index 0000000..bd21fa3 --- /dev/null +++ b/packages/packages.nix @@ -0,0 +1,70 @@ + +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./user.nix + ./system.nix + ./flatpak.nix + ]; + + services.flatpak = { + enable = true; + + remotes = lib.mkOptionDefault [{ + name = "flathub-beta"; + location = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo"; + }]; + + update.auto.enable = true; + uninstallUnmanaged = false; + }; + + programs = { + bash.shellAliases = { + rebuild = "sudo nixos-rebuild switch --impure && home-manager switch --impure"; + + pissh = "ssh -t $(avahi-resolve-host-name -4 pi.home | awk '{print $2}')"; + pi = "pissh \"cd $(pwd) && bash\""; + + pico = "ssh pico.sh"; + + # tuns name port + tuns = "bash -c '\''if [ \"$#\" -ne 2 ]; then echo \"Usage: tun name port\"; exit 1; fi; +if [[ \"$1\" =~ ^[0-9]+$ ]]; then port=\"$1\"; name=\"$2\"; +elif [[ \"$2\" =~ ^[0-9]+$ ]]; then port=\"$2\"; name=\"$1\"; +else echo \"Error: One argument must be a number (port)\"; exit 1; fi; +ssh -R \"$\{name}:80:localhost:$\{port}\" tuns.sh'\'' _"; + + # pgs name directory + pgs = "bash -c '\''if [ \"$#\" -ne 2 ]; then echo \"Usage: pgs NAME DIRECTORY\"; exit 1; fi; rsync -rv \"$2\" pgs.sh:/\"$1\"'\'' _"; + }; + + dconf.enable = lib.mkDefault true; + + firefox.enable = true; + + steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + }; + }; + + services = { + printing.enable = true; + + ollama = { + enable = true; + acceleration = "cuda"; + }; + + syncthing = { + enable = true; + user = "bug"; + group = "wheel"; + dataDir = "/home/bug/"; + }; + }; +} \ No newline at end of file diff --git a/packages/system.nix b/packages/system.nix new file mode 100644 index 0000000..d218647 --- /dev/null +++ b/packages/system.nix @@ -0,0 +1,16 @@ + +{ config, lib, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + home-manager + git + wget + gcc + nmap + inetutils + sshs + gnumake + evtest + ]; +} \ No newline at end of file diff --git a/packages/user.nix b/packages/user.nix new file mode 100644 index 0000000..58443ef --- /dev/null +++ b/packages/user.nix @@ -0,0 +1,57 @@ + +{ config, lib, pkgs, ... }: + +{ + users.users.bug.packages = with pkgs; [ + vscode + + go + + (python3.withPackages (ps: with ps; [ + pip + pynput + python-uinput + ])) + + luau + + (luajit.withPackages (ps: with ps; [ + luasocket + bit32 + luautf8 + jsregexp + ])) + + nodejs + + blender + plasticity + + kdenlive + + neofetch + fastfetch + + tree + gnome-tweaks + wine + + obsidian + + vesktop + nicotine-plus + furnace + + pulseaudio + + # rpi-imager + + mapscii + + cloudflared + + base16-schemes + + ptyxis + ]; +} \ No newline at end of file diff --git a/theming.nix b/theming.nix new file mode 100644 index 0000000..66f60d5 --- /dev/null +++ b/theming.nix @@ -0,0 +1,22 @@ + +{ config, pkgs, ... }: + +{ + fonts = { + fontDir.enable = true; + enableDefaultPackages = true; + + packages = with pkgs; [ + twitter-color-emoji + ]; + + fontconfig = { + enable = true; + useEmbeddedBitmaps = true; + + defaultFonts = { + emoji = [ "Twitter Color Emoji" ]; + }; + }; + }; +} \ No newline at end of file