From 17004f6b4634ace66728b5f44af7a338c7f75c70 Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Tue, 23 Apr 2024 20:17:17 -0400 Subject: [PATCH 1/2] thinkpad --- flake.nix | 7 ++ hosts/thinkpad/configuration.nix | 129 ++++++++++++++++++++++ hosts/thinkpad/hardware-configuration.nix | 35 ++++++ hosts/thinkpad/home.nix | 32 ++++++ 4 files changed, 203 insertions(+) create mode 100644 hosts/thinkpad/configuration.nix create mode 100644 hosts/thinkpad/hardware-configuration.nix create mode 100644 hosts/thinkpad/home.nix diff --git a/flake.nix b/flake.nix index 30e676c..99e84ae 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,13 @@ ./hosts/nixos/configuration.nix ]; }; + thinkpad = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/thinkpad/configuration.nix + ]; + }; }; darwinConfigurations = { diff --git a/hosts/thinkpad/configuration.nix b/hosts/thinkpad/configuration.nix new file mode 100644 index 0000000..f93c9b5 --- /dev/null +++ b/hosts/thinkpad/configuration.nix @@ -0,0 +1,129 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; + +# Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + boot.loader.grub.useOSProber = true; + + networking.hostName = "thinkpad"; # Define your hostname. +# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + +# Enable networking + networking.networkmanager.enable = true; + +# Set your time zone. + time.timeZone = "America/Toronto"; + +# Select internationalisation properties. + i18n.defaultLocale = "en_CA.UTF-8"; + +# i3 relates stuff + environment.pathsToLink = [ "/libexec" ]; + services.xserver = { + enable = true; + + desktopManager = { + xterm.enable = false; + }; + + displayManager = { + defaultSession = "none+i3"; + lightdm.enable = true; + }; + + windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + i3blocks + feh + arandr + ]; + }; + + layout = "us"; + xkbVariant = ""; + }; + +# pipewire + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + +# Define a user account. Don't forget to set a password with ‘passwd’. + users.users.mthomson = { + isNormalUser = true; + description = "Michael Thomson"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + +# Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings = { + trusted-users = ["mthomson"]; + + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + ]; + + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + environment.systemPackages = with pkgs; [ + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + git + curl + ]; + + environment.variables.EDITOR = "nvim"; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + useGlobalPkgs = true; + useUserPackages = true; + users = { + mthomson = import ./home.nix; + }; + }; + + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ +# Add any missing dynamic libraries for unpackaged programs +# here, NOT in environment.systemPackages + ]; + +# 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 = "23.11"; # Did you read the comment? + +} diff --git a/hosts/thinkpad/hardware-configuration.nix b/hosts/thinkpad/hardware-configuration.nix new file mode 100644 index 0000000..346ed78 --- /dev/null +++ b/hosts/thinkpad/hardware-configuration.nix @@ -0,0 +1,35 @@ +# 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 = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/08ecde1d-02ae-4308-a6d1-93ec9361a2fc"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/add2134a-831a-42bd-8822-8a4f0702aa06"; } + ]; + + # 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.enp0s25.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/thinkpad/home.nix b/hosts/thinkpad/home.nix new file mode 100644 index 0000000..2d32e04 --- /dev/null +++ b/hosts/thinkpad/home.nix @@ -0,0 +1,32 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../../modules/home-manager/i3 + ../../modules/home-manager/neovim + ../../modules/home-manager/wezterm + ../../modules/home-manager/zsh + ../../modules/home-manager/tmux + ../../modules/home-manager/taskwarrior + ../../modules/home-manager/zoxide + ../../modules/home-manager/eza + ../../modules/home-manager/bat + ../../modules/home-manager/irssi + ]; + home.username = "mthomson"; + home.homeDirectory = "/home/mthomson"; + home.stateVersion = "23.11"; + + home.packages = with pkgs; [ + firefox + _1password-gui + gcc + fzf + ripgrep + jq + unzip + ]; + + programs.home-manager.enable = true; + programs.git.enable = true; +} From b10bee9588e32fa2fac92bd5e17499a9a8dbac6b Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Thu, 16 May 2024 21:00:47 -0400 Subject: [PATCH 2/2] update --- hosts/thinkpad/home.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hosts/thinkpad/home.nix b/hosts/thinkpad/home.nix index 2d32e04..8f9e32f 100644 --- a/hosts/thinkpad/home.nix +++ b/hosts/thinkpad/home.nix @@ -17,6 +17,14 @@ home.homeDirectory = "/home/mthomson"; home.stateVersion = "23.11"; + programs = { + direnv = { + enable = true; + enableZshIntegration = true; # see note on other shells below + nix-direnv.enable = true; + }; + }; + home.packages = with pkgs; [ firefox _1password-gui