diff --git a/flake.lock b/flake.lock index 5354826..3708ed1 100644 --- a/flake.lock +++ b/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "hardware": { - "locked": { - "lastModified": 1710123225, - "narHash": "sha256-j3oWlxRZxB7cFsgEntpH3rosjFHRkAo/dhX9H3OfxtY=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "ad2fd7b978d5e462048729a6c635c45d3d33c9ba", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -35,26 +20,39 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1710123225, + "narHash": "sha256-j3oWlxRZxB7cFsgEntpH3rosjFHRkAo/dhX9H3OfxtY=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "ad2fd7b978d5e462048729a6c635c45d3d33c9ba", + "type": "github" + }, + "original": { + "id": "nixos-hardware", + "type": "indirect" + } + }, "nixpkgs": { "locked": { "lastModified": 1710451336, "narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=", - "owner": "nixos", + "owner": "NixOS", "repo": "nixpkgs", "rev": "d691274a972b3165335d261cc4671335f5c67de9", "type": "github" }, "original": { - "owner": "nixos", + "id": "nixpkgs", "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "indirect" } }, "root": { "inputs": { - "hardware": "hardware", "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index b5e949e..e28ec78 100644 --- a/flake.nix +++ b/flake.nix @@ -1,47 +1,35 @@ { - description = "Jet's nix config"; + description = "Jet's Nix Config"; inputs = { - # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "nixpkgs/nixos-unstable"; + nixos-hardware.url = "nixos-hardware"; + # nixos-raspberrypi.url = "github:ramblurr/nixos-raspberrypi"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; - # Home manager - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; + nixConfig = { }; outputs = { self, nixpkgs, + nixos-hardware, home-manager, ... - } @ inputs: let - inherit (self) outputs; - in { - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' + } @ inputs: { nixosConfigurations = { laptop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - # > Our main nixos configuration file < - modules = [./nixos/configuration.nix]; - }; - }; - - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - "jet@laptop" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs outputs;}; - # > Our main home-manager configuration file < - modules = [./home-manager/home.nix]; + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = [ + home-manager.nixosModules.home-manager + nixos-hardware.nixosModules.lenovo-thinkpad-x1-6th-gen + ./laptop.nix + ]; }; }; }; diff --git a/home-manager/home.nix b/home-manager/home.nix deleted file mode 100644 index 823af19..0000000 --- a/home-manager/home.nix +++ /dev/null @@ -1,70 +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: - ./neovim-flake/flake.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 = "jet"; - homeDirectory = "/home/jet"; - }; - - # Add stuff for your user as you see fit: - programs.neovim.enable = true; - home.packages = with pkgs; [ - steam - neofetch - zip - unzip - eza - tree - which - file - btop - powertop - ]; - - # 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/neovim-flake b/home-manager/neovim-flake deleted file mode 160000 index 7bcc215..0000000 --- a/home-manager/neovim-flake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7bcc215d38226892849411721cfbc096fd7e4d2d diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..8da0832 --- /dev/null +++ b/home.nix @@ -0,0 +1,15 @@ +{ + # pkgs, + # inputs, + ... +}: { + programs = { + neovim = { + enable = true; + }; + }; + + home.username = "jet"; + home.homeDirectory = "/home/jet"; + home.stateVersion = "23.11"; +} diff --git a/laptop.nix b/laptop.nix new file mode 100644 index 0000000..bde01e0 --- /dev/null +++ b/laptop.nix @@ -0,0 +1,123 @@ +{ + inputs, + pkgs, + lib, + config, + modulesPath, + ... +}: { + environment.systemPackages = with pkgs; [ + # c + gcc + gdb + gnumake + clang + clang-tools + + # nix + nil + alejandra + + # else + bat + wget + firefox + git + tree + neovim + nushell + kitty + ]; + + hardware.bluetooth.enable = true; + + networking.networkmanager.enable = true; + services.automatic-timezoned.enable = true; + services.xserver.enable = true; + services.desktopManager.plasma6.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.xkb.layout = "us"; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + }; + + environment.variables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + PAGER = "bat"; + }; + environment.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + PAGER = "bat"; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"]; + # boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + # boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/ecfaab5f-dc2e-4bf0-a4cc-9a873de92c6f"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5426-5447"; + fsType = "vfat"; + }; + + swapDevices = [ + {device = "/dev/disk/by-uuid/db16204a-f762-4252-a7bb-1ff4f333fc17";} + ]; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + fonts.packages = with pkgs; [ + noto-fonts-cjk + noto-fonts-color-emoji + ]; + + i18n.defaultLocale = "en_US.UTF-8"; + i18n.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"; + }; + + users.users.jet = { + isNormalUser = true; + extraGroups = ["wheel"]; + shell = pkgs.nushell; + }; + home-manager.useGlobalPkgs = true; + home-manager.users.jet = import ./home.nix {inherit inputs pkgs;}; + + nix.settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + trusted-users = ["root" "@wheel"]; + }; + nixpkgs.config = {allowUnfree = true;}; + + networking.hostName = "laptop"; + + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + system.stateVersion = "23.05"; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index 36f6a96..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,165 +0,0 @@ -# This is your system's configuration file. -# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) -{ - inputs, - lib, - config, - pkgs, - ... -}: { - # You can import other NixOS modules here - imports = [ - # If you want to use modules from other flakes (such as nixos-hardware): - # inputs.hardware.nixosModules.common-cpu-amd - # inputs.hardware.nixosModules.common-ssd - inputs.hardware.nixosModules.lenovo-thinkpad-x1-6th-gen - - # You can also split up your configuration and import pieces of it here: - # ./users.nix - - # Import your generated (nixos-generate-config) hardware configuration - ./hardware-configuration.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; - }; - }; - - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nix.nixPath = ["/etc/nix/path"]; - environment.etc = - lib.mapAttrs' - (name: value: { - name = "nix/path/${name}"; - value.source = value.flake; - }) - config.nix.registry; - - nix.settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; - - # FIXME: Add the rest of your current configuration - - networking.hostName = "laptop"; - networking.networkmanager.enable = true; - - hardware.bluetooth.enable = true; # enables support for Bluetooth - - # TODO: This is just an example, be sure to use whatever bootloader you prefer - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Set your time zone. - time.timeZone = "America/Los_Angeles"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.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"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the KDE Plasma Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; - - # Configure keymap in X11 - services.xserver.xkb = { - layout = "us"; - variant = ""; - }; - - # Enable sound with pipewire. - sound.enable = true; - hardware.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; - }; - - - # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. - users.users = { - jet = { - isNormalUser = true; - openssh.authorizedKeys.keys = [ - # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect - ]; - # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) - extraGroups = ["wheel" "networkmanager"]; - packages = with pkgs; [ - firefox - # thunderbird - ]; - }; - }; - 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 - git - vim - wget - curl - ]; - - environment.variables.EDITOR = "vim"; - # This setups a SSH server. Very important if you're setting up a headless system. - # Feel free to remove if you don't need it. - services.openssh = { - enable = true; - settings = { - # Forbid root login through SSH. - PermitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - PasswordAuthentication = false; - }; - }; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "23.05"; -} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix deleted file mode 100644 index dd00939..0000000 --- a/nixos/hardware-configuration.nix +++ /dev/null @@ -1,10 +0,0 @@ -# This is just an example, you should generate yours with nixos-generate-config and put it in here. -{ - fileSystems."/" = { - device = "/dev/sda1"; - fsType = "ext4"; - }; - - # Set your system kind (needed for flakes) - nixpkgs.hostPlatform = "x86_64-linux"; -}