From 06cb8c1e4807c15a9e3194e92be822ecf2e532c0 Mon Sep 17 00:00:00 2001 From: Lily Anderson Date: Sun, 12 Oct 2025 10:17:09 -0500 Subject: [PATCH] First Commit. --- flake.lock | 48 +++++++++ flake.nix | 29 +++++ hosts/desktop/configuration.nix | 130 +++++++++++++++++++++++ hosts/desktop/hardware-configuration.nix | 57 ++++++++++ hosts/desktop/home.nix | 76 +++++++++++++ modules/nixos/ai/index.nix | 8 ++ modules/nixos/ai/ollama.nix | 10 ++ modules/nixos/ai/open-webui.nix | 18 ++++ modules/nixos/ai/sillytavern.nix | 31 ++++++ modules/nixos/gnome/.gnome.nix.swp | Bin 0 -> 16384 bytes modules/nixos/gnome/gnome.nix | 36 +++++++ modules/nixos/localization.nix | 29 +++++ result | 1 + 13 files changed, 473 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/desktop/configuration.nix create mode 100644 hosts/desktop/hardware-configuration.nix create mode 100644 hosts/desktop/home.nix create mode 100644 modules/nixos/ai/index.nix create mode 100644 modules/nixos/ai/ollama.nix create mode 100644 modules/nixos/ai/open-webui.nix create mode 100644 modules/nixos/ai/sillytavern.nix create mode 100644 modules/nixos/gnome/.gnome.nix.swp create mode 100644 modules/nixos/gnome/gnome.nix create mode 100644 modules/nixos/localization.nix create mode 120000 result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a158983 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1760015796, + "narHash": "sha256-c/WkaynHrRE1EHWATe5+vb9M9YabfTaR1GHivdybaSU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6564ee29d0521af3feba937a91024e6a3e77a8b6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1759831965, + "narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c9b6fb798541223bbb396d287d16f43520250518", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e4c79d8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Lily's NixOS Flake. LiNix"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager }@inputs: { + + packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; + + packages.x86_64-linux.default = self.packages.x86_64-linux.hello; + + nixosConfigurations = { + lily-desktop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/desktop/configuration.nix + inputs.home-manager.nixosModules.default + ]; + specialArgs = { inherit inputs; }; + }; + }; + }; +} diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix new file mode 100644 index 0000000..a15b805 --- /dev/null +++ b/hosts/desktop/configuration.nix @@ -0,0 +1,130 @@ +{ config, pkgs, inputs, ... }: +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../../modules/nixos/localization.nix + ../../modules/nixos/ai/index.nix + ../../modules/nixos/gnome/gnome.nix + inputs.home-manager.nixosModules.default + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "lily-desktop"; # Define your hostname. + # networking.wireless.enable = true; # 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"; + + # Enable networking + networking.networkmanager.enable = true; + + # Enable the X11 windowing system. + services.xserver.enable = true; + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; + 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; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.lily = { + isNormalUser = true; + description = "Lily Iliana Luna Ylva Anderson Appleseed Grigaitis"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + # thunderbird + ]; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + "lily" = import ./home.nix; + }; + }; + +programs.nh = { + enable = true; + flake = "/home/lily/Programming/New LiNix"; +}; + + + +nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + +tree +htop +nvtopPackages.full +libreoffice-fresh +hunspell +hunspellDicts.en_US +hunspellDicts.en_US-large + +nh + +steam-run + +git + ]; + + # 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; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 22 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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 = "25.05"; # Did you read the comment? + +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..d26009a --- /dev/null +++ b/hosts/desktop/hardware-configuration.nix @@ -0,0 +1,57 @@ +# 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" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ "nvidia" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ + config.boot.kernelPackages.nvidiaPackages.stable +]; + +hardware.graphics = { + enable = true; + enable32Bit = true; + }; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8279665b-b695-4747-9206-9cc06b7fe303"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."luks-8573b24b-461f-40bf-b16b-9de1207c0696".device = "/dev/disk/by-uuid/8573b24b-461f-40bf-b16b-9de1207c0696"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/383D-97DA"; + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp42s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix new file mode 100644 index 0000000..b6ec8e5 --- /dev/null +++ b/hosts/desktop/home.nix @@ -0,0 +1,76 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "lily"; + home.homeDirectory = "/home/lily"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "25.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/lily/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/modules/nixos/ai/index.nix b/modules/nixos/ai/index.nix new file mode 100644 index 0000000..047091c --- /dev/null +++ b/modules/nixos/ai/index.nix @@ -0,0 +1,8 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ + ./ollama.nix + ./open-webui.nix + ./sillytavern.nix + ]; +} diff --git a/modules/nixos/ai/ollama.nix b/modules/nixos/ai/ollama.nix new file mode 100644 index 0000000..1e3898b --- /dev/null +++ b/modules/nixos/ai/ollama.nix @@ -0,0 +1,10 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ ]; + services.ollama = { + enable = true; + acceleration = "cuda"; + host = "0.0.0.0"; + openFirewall = true; + }; +} diff --git a/modules/nixos/ai/open-webui.nix b/modules/nixos/ai/open-webui.nix new file mode 100644 index 0000000..fa971de --- /dev/null +++ b/modules/nixos/ai/open-webui.nix @@ -0,0 +1,18 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ ]; + services.open-webui = { + #enable = true; + enable = false; + host = "0.0.0.0"; + openFirewall = true; + port = 9001; + environment = + { + ANONYMIZED_TELEMETRY = "False"; + DO_NOT_TRACK = "True"; + SCARF_NO_ANALYTICS = "True"; + ENABLE_LOGIN_FORM = "True"; + }; + }; + } diff --git a/modules/nixos/ai/sillytavern.nix b/modules/nixos/ai/sillytavern.nix new file mode 100644 index 0000000..53cd3b8 --- /dev/null +++ b/modules/nixos/ai/sillytavern.nix @@ -0,0 +1,31 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ ]; + services.sillytavern = { + enable = true; + #enable = false; + port = 9002; + listen = true; + listenAddressIPv4 = "127.0.0.1"; + whitelist = true; + #user = "tavern"; + #group = "tavern"; + }; + + services.nginx = { + enable = true; + #additionalModules = [ pkgs.nginxModules.pam ]; + virtualHosts."192.168.0.101" = { + locations."/" = { + proxyPass = "http://localhost:9002"; + extraConfig = '' + auth_basic "Password Required"; + auth_basic_user_file /etc/htpasswd; + ''; + }; + }; + }; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 80 ]; #9002 +} diff --git a/modules/nixos/gnome/.gnome.nix.swp b/modules/nixos/gnome/.gnome.nix.swp new file mode 100644 index 0000000000000000000000000000000000000000..8af368e05f0cb31433564e6a9e6d5f29ad3c929e GIT binary patch literal 16384 zcmYc?2=nw+u+%eTU|?VnU|=vj`Z^=G!DW=z^Aqj zq)00nI7#kTHfD|h$DJlpHg@Tx)cr*k?Ltr!nMnhmU1V%$(Gz3ON zU^E0qLtuo2KuG~3Lp=in0~6H0Do~mcjb?`OVN@5C0aFL%j#8r`Fd71*Aut*OqaiRF z0;3@?8UmvsFd71*Aut*OqaiRF0)sFF5>pr$)OZ*e&hbFz|6%?Ahx`l-_xTwZPVqA^ zoaARv?&z~INrz@X2|z@Wv;z@W*? z!0?@if#D4g1H)q;28OFV3=9`}7#J=<-PXdxz~IWmz~I8ez#z%Pz#zfHz#z!O!0?Hi zf#EJU1H%Ds28IRP3=B=&3=DeQ3=CG>3=9U`3=I0*3=BHl3=G=b3=D$Y3=Ds{7#O~A zF)%#hVqiGW#lUcii-F-N7X!l)E(V6(Tnr4{Tnr2zTnr4#Tnr4HTnr2xTnr4)I2jl& zaxySn;ACLv=VV~$<78myL4lot;U60V!$~#=+qFl=OHV3^6uz);D`z!1#Jz+lYEz+lA6z`)PS!0?8Jf#Ej`1H%Ot28LZM z3=BJ27#NCK7#Iv#7#P@D7#P@C7#P+wGce>cGce>aGcedQGcbrUGcd3+Gcf#RVqo~i z#K3TkiGg7Y69YpZ69YpwY`{oCp*XduEHgQ^STDaIHLtihLoYQiF)1fi!B(N9s5I4@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