From 78d4c8021c42991385612e9fba0ff8460c5ca4cf Mon Sep 17 00:00:00 2001 From: John Ogle Date: Mon, 19 Aug 2024 11:33:31 -0700 Subject: [PATCH] Add nix-book --- flake.lock | 21 +++ flake.nix | 12 +- machines/nix-book/configuration.nix | 128 ++++++++++++++++++ machines/nix-book/hardware-configuration.nix | 42 ++++++ machines/z790prors/configuration.nix | 2 +- .../virtualisation/default.nix | 0 6 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 machines/nix-book/configuration.nix create mode 100644 machines/nix-book/hardware-configuration.nix rename {machines/roles => roles}/virtualisation/default.nix (100%) diff --git a/flake.lock b/flake.lock index eabe566..ccba845 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723986931, + "narHash": "sha256-Fy+KEvDQ+Hc8lJAV3t6leXhZJ2ncU5/esxkgt3b8DEY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2598861031b78aadb4da7269df7ca9ddfc3e1671", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1723637854, @@ -18,6 +38,7 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 22bd127..0e952c9 100644 --- a/flake.nix +++ b/flake.nix @@ -3,13 +3,23 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs }: { + outputs = { self, nixpkgs, home-manager, ... }: { nixosConfigurations.z790prors-nix = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./machines/z790prors/configuration.nix ]; }; + + nixosConfigurations.nix-book = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/nix-book/configuration.nix + home-manager.nixosModules.home-manager + ]; + }; }; } diff --git a/machines/nix-book/configuration.nix b/machines/nix-book/configuration.nix new file mode 100644 index 0000000..6ffd926 --- /dev/null +++ b/machines/nix-book/configuration.nix @@ -0,0 +1,128 @@ +# 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 + ]; + + nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.initrd.luks.devices."luks-b614167b-9045-4234-a441-ac6f60a96d81".device = "/dev/disk/by-uuid/b614167b-9045-4234-a441-ac6f60a96d81"; + networking.hostName = "nix-book"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + boot.kernelPackages = pkgs.linuxPackages_latest; + + # 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/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"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + options = "caps:escape"; + }; + + hardware.pulseaudio.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.johno = { + isNormalUser = true; + description = "John Ogle"; + extraGroups = [ "networkmanager" "wheel" "audio" ]; + packages = with pkgs; []; + }; + + # Enable automatic login for the user. + services.getty.autologinUser = "johno"; + + # 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; + }; + + virtualisation.docker.enable = true; + users.extraGroups.docker.members = [ "johno" ]; + + # 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 = "24.05"; # Did you read the comment? + + + # Desktop + + programs.steam.enable = true; + + #services.xserver.enable = true; + services.displayManager = { + sddm.enable = true; + sddm.wayland.enable = true; + #defaultSession = "plasmax11"; + }; + services.desktopManager.plasma6.enable = true; + programs.hyprland.enable = true; +} diff --git a/machines/nix-book/hardware-configuration.nix b/machines/nix-book/hardware-configuration.nix new file mode 100644 index 0000000..13574b7 --- /dev/null +++ b/machines/nix-book/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "thunderbolt" "vmd" "nvme" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/bd396529-e2c4-47cb-b844-8d6ed841f81a"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-4126fbd4-bd09-4ece-af0d-6fff414c21b3".device = "/dev/disk/by-uuid/4126fbd4-bd09-4ece-af0d-6fff414c21b3"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/7A0B-CF88"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/ec1f70ea-27b6-4646-ad3b-eac41bd83e3e"; } + ]; + + # 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.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/z790prors/configuration.nix b/machines/z790prors/configuration.nix index c60c8c6..fe48ad7 100644 --- a/machines/z790prors/configuration.nix +++ b/machines/z790prors/configuration.nix @@ -13,7 +13,7 @@ in imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix - ../roles/virtualisation/default.nix + ../../roles/virtualisation/default.nix ]; # Use the systemd-boot EFI boot loader. diff --git a/machines/roles/virtualisation/default.nix b/roles/virtualisation/default.nix similarity index 100% rename from machines/roles/virtualisation/default.nix rename to roles/virtualisation/default.nix