diff options
author | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-07-31 14:45:24 +0000 |
---|---|---|
committer | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-07-31 14:45:24 +0000 |
commit | 8fecc5f5924c9a56ee4ee034d74cd8af3efd5fee (patch) | |
tree | 0e862d2bd9029ca9d02ae0c2dff7ddf5da83fb0c | |
parent | f10f6922fb9ea8b2535e97549a92cdf2d5cee08e (diff) | |
download | nixos-configuration-8fecc5f5924c9a56ee4ee034d74cd8af3efd5fee.tar.gz nixos-configuration-8fecc5f5924c9a56ee4ee034d74cd8af3efd5fee.tar.bz2 nixos-configuration-8fecc5f5924c9a56ee4ee034d74cd8af3efd5fee.zip |
feat: inherited Nvidia configuration from old conf
-rw-r--r-- | home-manager/home.nix | 60 | ||||
-rw-r--r-- | home-manager/stvnliu/home.nix | 60 | ||||
-rw-r--r-- | nixos/configuration.nix | 22 | ||||
-rw-r--r-- | nixos/globals.nix | 4 | ||||
-rw-r--r-- | nixos/nvidia.nix | 34 | ||||
-rw-r--r-- | nixos/services/display-manager.nix | 11 | ||||
-rw-r--r-- | nixos/services/syncthing.service.nix | 8 |
7 files changed, 117 insertions, 82 deletions
diff --git a/home-manager/home.nix b/home-manager/home.nix deleted file mode 100644 index 5f20559..0000000 --- a/home-manager/home.nix +++ /dev/null @@ -1,60 +0,0 @@ -# This is your home-manager configuration file -# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ - inputs, - lib, - config, - pkgs, - ... -}: { - # You can import other home-manager modules here - imports = [ - # If you want to use home-manager modules from other flakes (such as nix-colors): - # inputs.nix-colors.homeManagerModule - - # You can also split up your configuration and import pieces of it here: - # ./nvim.nix - ]; - - nixpkgs = { - # You can add overlays here - overlays = [ - # If you want to use overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; - # Configure your nixpkgs instance - config = { - # Disable if you don't want unfree packages - allowUnfree = true; - # Workaround for https://github.com/nix-community/home-manager/issues/2942 - allowUnfreePredicate = _: true; - }; - }; - - # TODO: Set your username - home = { - username = "your-username"; - homeDirectory = "/home/your-username"; - }; - - # Add stuff for your user as you see fit: - # programs.neovim.enable = true; - # home.packages = with pkgs; [ steam ]; - - # Enable home-manager and git - programs.home-manager.enable = true; - programs.git.enable = true; - - # Nicely reload system units when changing configs - systemd.user.startServices = "sd-switch"; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "23.05"; -} diff --git a/home-manager/stvnliu/home.nix b/home-manager/stvnliu/home.nix new file mode 100644 index 0000000..6146457 --- /dev/null +++ b/home-manager/stvnliu/home.nix @@ -0,0 +1,60 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: +let +myUserName = "stvnliu"; +myEmail = "z.liu@outlook.com.gr"; +in +{ +# You can import other home-manager modules here + imports = [ +# If you want to use home-manager modules from other flakes (such as nix-colors): +# inputs.nix-colors.homeManagerModule + +# You can also split up your configuration and import pieces of it here: +# ./nvim.nix + ]; + + nixpkgs = { +# You can add overlays here + overlays = [ +# If you want to use overlays exported from other flakes: +# neovim-nightly-overlay.overlays.default + +# Or define it inline, for example: +# (final: prev: { +# hi = final.hello.overrideAttrs (oldAttrs: { +# patches = [ ./change-hello-to-hi.patch ]; +# }); +# }) + ]; +# Configure your nixpkgs instance + config = { +# Disable if you don't want unfree packages + allowUnfree = true; +# Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + home = { + username = "${myUserName}"; + homeDirectory = "/home/${myUserName}"; + }; + programs.neovim.enable = true; + home.packages = with pkgs; [ protonvpn-gui ]; + programs.home-manager.enable = true; + programs.git.enable = true; + programs.firefox.enable = true; +# Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + +# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "24.05"; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index bbcc3f8..2690c28 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -8,15 +8,11 @@ ... }: let -myHostName = "homelab-nix"; -stevenUserName = "stvnliu"; + globals = import ./globals.nix; in { imports = [ -#inputs.hardware.nixosModules.common-cpu-amd -#inputs.hardware.nixosModules.common-ssd ./hardware-configuration.nix - ./services/display-manager.nix ]; boot.loader = { efi.canTouchEfiVariables = true; @@ -36,6 +32,12 @@ in ''; }; }; + security.polkit.enable = true; + services.gnome.gnome-keyring.enable = true; + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; nixpkgs = { overlays = [ ]; @@ -56,20 +58,18 @@ in nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; }; networking = { - hostName = "${myHostName}"; + hostName = "${globals.myHostName}"; networkmanager.enable = true; }; users.users = { - "${stevenUserName}" = { + "${globals.myUserName}" = { initialPassword = "stevenpassword"; isNormalUser = true; openssh.authorizedKeys.keys = [ ]; packages = with pkgs; [ - nh - neovim - gitFull - ]; + nh + ]; extraGroups = ["wheel"]; }; }; diff --git a/nixos/globals.nix b/nixos/globals.nix new file mode 100644 index 0000000..e8dc5e6 --- /dev/null +++ b/nixos/globals.nix @@ -0,0 +1,4 @@ +{ + myUserName = "stvnliu"; + myHostName = "homelab-nix"; +} diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix new file mode 100644 index 0000000..e75a77a --- /dev/null +++ b/nixos/nvidia.nix @@ -0,0 +1,34 @@ +{ + config, + lib, + ... +}: { + specialisation = { + powersave.configuration = { + hardware.nvidia.prime = { + offload = { + enable = lib.mkForce true; + enableOffloadCmd = lib.mkForce true; + }; + sync.enable = lib.mkForce false; + }; + }; + }; + hardware.nvidia = { + prime = { + offload.enable = false; + sync = { + enable = true; + }; + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + forceFullCompositionPipeline = true; + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; +} diff --git a/nixos/services/display-manager.nix b/nixos/services/display-manager.nix deleted file mode 100644 index edbd360..0000000 --- a/nixos/services/display-manager.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, lib, ... }: -{ - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - }; - services.displayManager = { - enable = true; - execCmd = "${pkgs.lemurs}/bin/lemurs --no-logs"; - }; -} diff --git a/nixos/services/syncthing.service.nix b/nixos/services/syncthing.service.nix new file mode 100644 index 0000000..17d52b1 --- /dev/null +++ b/nixos/services/syncthing.service.nix @@ -0,0 +1,8 @@ +{pkgs, lib, ...}: +let + myUserName = ""; +in +{ + enable = true; + user = "" +} |