From 091400ba7d60f7a8029ae1af8888c6fd343b9f7b Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Mon, 25 Dec 2023 21:49:09 -0500 Subject: [PATCH 1/7] feat: init thinkcentre --- flake.nix | 18 +++ machines/thinkcentre/configuration.nix | 129 ++++++++++++++++++ .../thinkcentre/hardware-configuration.nix | 37 +++++ 3 files changed, 184 insertions(+) create mode 100644 machines/thinkcentre/configuration.nix create mode 100644 machines/thinkcentre/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 659c618..37460da 100644 --- a/flake.nix +++ b/flake.nix @@ -98,6 +98,24 @@ specialArgs = {inherit inputs;}; }; + thinkcentre = nixpkgs.lib.nixosSystem { + system = utils.lib.system.x86_64-linux; + modules = [ + self.overlaysModule + home-manager.nixosModules.home-manager + # ./modules/common.nix + # ./modules/containers.nix + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.michael = import ./user/environments/nixos/home.nix; + } + + ./machines/thinkcentre/configuration.nix + ]; + specialArgs = {inherit inputs;}; + }; + # WSL environment work = inputs.nixpkgs.lib.nixosSystem { system = utils.lib.system.x86_64-linux; diff --git a/machines/thinkcentre/configuration.nix b/machines/thinkcentre/configuration.nix new file mode 100644 index 0000000..1e7f9e0 --- /dev/null +++ b/machines/thinkcentre/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, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos"; # 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; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # 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 GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # 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; + }; + + # 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.michael = { + isNormalUser = true; + description = "Michael Thomas"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + firefox + # thunderbird + ]; + }; + + # 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 + ]; + + # 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 = [ ... ]; + # 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 = "23.11"; # Did you read the comment? + +} diff --git a/machines/thinkcentre/hardware-configuration.nix b/machines/thinkcentre/hardware-configuration.nix new file mode 100644 index 0000000..3a46158 --- /dev/null +++ b/machines/thinkcentre/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/2b1793d6-feff-48df-9180-03e8c2bef7bf"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/2082-08EF"; + fsType = "vfat"; + }; + + 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.enp0s31f6.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} From 1d4a2c18f5038c834b84abd0dd7bc88661baf081 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 16 Jan 2024 23:11:52 -0500 Subject: [PATCH 2/7] fix(kitchen): clean up header --- machines/kitchen/configuration.nix | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/machines/kitchen/configuration.nix b/machines/kitchen/configuration.nix index 19b7d29..54d32b8 100644 --- a/machines/kitchen/configuration.nix +++ b/machines/kitchen/configuration.nix @@ -1,11 +1,4 @@ -# 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, - ... -}: { +{pkgs, ...}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix From b799c8ff8f7e74696f4b88bf46db46149d12b372 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 16 Jan 2024 23:12:25 -0500 Subject: [PATCH 3/7] feat(thinkcentre): initial configuration solidified --- machines/thinkcentre/configuration.nix | 103 ++++--------------------- 1 file changed, 16 insertions(+), 87 deletions(-) diff --git a/machines/thinkcentre/configuration.nix b/machines/thinkcentre/configuration.nix index 1e7f9e0..04459d7 100644 --- a/machines/thinkcentre/configuration.nix +++ b/machines/thinkcentre/configuration.nix @@ -1,28 +1,10 @@ -# 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’). +{pkgs, ...}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; -{ config, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "nixos"; # 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; + networking.hostName = "venus"; # Define your hostname. # Set your time zone. time.timeZone = "America/New_York"; @@ -42,82 +24,30 @@ LC_TIME = "en_US.UTF-8"; }; - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - # Configure keymap in X11 services.xserver = { layout = "us"; xkbVariant = ""; }; - # Enable CUPS to print documents. - services.printing.enable = true; + swapDevices = [ + { + device = "/swapfile"; + priority = 0; + size = 16384; + } + ]; - # 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; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; + programs.zsh.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.michael = { isNormalUser = true; description = "Michael Thomas"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - firefox - # thunderbird - ]; + extraGroups = ["wheel" "docker" "podman" "adbusers" "dialout"]; + shell = pkgs.zsh; }; - # 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 - ]; - - # 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 = [ ... ]; - # 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 @@ -125,5 +55,4 @@ # 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? - } From 9c6793a9738132308eb002fcab953d2ffd097552 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 16 Jan 2024 23:12:42 -0500 Subject: [PATCH 4/7] feat(sound): enable pipewire --- modules/sound.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/sound.nix b/modules/sound.nix index 8c32227..e0f7994 100644 --- a/modules/sound.nix +++ b/modules/sound.nix @@ -1,5 +1,20 @@ { # Enable sound. sound.enable = true; - hardware.pulseaudio.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + + # Enable pipewire + 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; + }; } From 80596625b28a6866fd963f9b41399ad7e7ccf0a8 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 16 Jan 2024 23:13:09 -0500 Subject: [PATCH 5/7] feat(git_nixos): support oauth credential verification --- user/modules/git_nixos.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user/modules/git_nixos.nix b/user/modules/git_nixos.nix index c48e043..81d9dd7 100644 --- a/user/modules/git_nixos.nix +++ b/user/modules/git_nixos.nix @@ -1,9 +1,12 @@ {pkgs, ...}: { - # Use pkgs.gitAndTools.gitFull in order to get libsecret support programs.git = { package = pkgs.gitAndTools.gitFull; extraConfig = { - credential.helper = "libsecret"; + credential.helper = "oauth"; }; }; + + home.packages = with pkgs; [ + git-credential-oauth + ]; } From afb572e1b9150ed0b004ff1200286ea58e66067e Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 16 Jan 2024 23:13:32 -0500 Subject: [PATCH 6/7] feat(thinkcentre): add home-manager modules --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 37460da..c5eb652 100644 --- a/flake.nix +++ b/flake.nix @@ -103,8 +103,8 @@ modules = [ self.overlaysModule home-manager.nixosModules.home-manager - # ./modules/common.nix - # ./modules/containers.nix + ./modules/common.nix + ./modules/containers.nix { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; From 287f3f959371a3938d4fc5c9e78c30b7a6616221 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 16 Jan 2024 23:13:46 -0500 Subject: [PATCH 7/7] fix(bootloader): add quiet param --- modules/bootloader.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/bootloader.nix b/modules/bootloader.nix index b8c0550..760e6d2 100644 --- a/modules/bootloader.nix +++ b/modules/bootloader.nix @@ -4,4 +4,5 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = false; boot.plymouth.enable = true; + boot.kernelParams = ["quiet"]; }