From dd4835f5209e2855ff48d1af99b38ee38263df4b Mon Sep 17 00:00:00 2001 From: Wesley Irvin Date: Thu, 29 Jun 2023 13:42:57 -0400 Subject: [PATCH] Initial flake commit Enough of an initial flake and layout for an initial commit. --- .gitignore | 2 -- base-config.nix => configs/desktop.nix | 36 +------------------ flake.lock | 49 ++++++++++++++++++++++++++ flake.nix | 30 ++++++++++++++++ hardware/nixos-bootstrap.nix | 36 +++++++++++++++++++ wes-home.nix => home/wesley.nix | 0 hosts/nixos-bootstrap.nix | 5 +++ updates/no-restart.nix | 9 +++++ users/wesley.nix | 25 +++++++++++++ 9 files changed, 155 insertions(+), 37 deletions(-) delete mode 100644 .gitignore rename base-config.nix => configs/desktop.nix (83%) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware/nixos-bootstrap.nix rename wes-home.nix => home/wesley.nix (100%) create mode 100644 hosts/nixos-bootstrap.nix create mode 100644 updates/no-restart.nix create mode 100644 users/wesley.nix diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6a44c4b..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore generated hardware configuration files -hardware-configuration.nix diff --git a/base-config.nix b/configs/desktop.nix similarity index 83% rename from base-config.nix rename to configs/desktop.nix index 6725295..a737f43 100644 --- a/base-config.nix +++ b/configs/desktop.nix @@ -5,17 +5,10 @@ { 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-base"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary @@ -43,10 +36,6 @@ LC_TIME = "en_US.UTF-8"; }; - # Enable automatic updates - system.autoUpgrade.enable = true; - system.autoUpgrade.allowReboot = true; - # Enable the X11 windowing system. services.xserver.enable = true; @@ -88,29 +77,6 @@ # to login make sure you set hashedPassword on users.users. using mkpasswd. users.mutableUsers = false; - # Define a user account. Don't forget to set a password with 'passwd'. - users.users.wesley = { - isNormalUser = true; - description = "Wesley Irvin"; - extraGroups = [ "networkmanager" "wheel" ]; - shell = pkgs.zsh; # Set our default shell for our user to zsh - hashedPassword = "$y$j9T$PXPH.OUWrqDkhAQR03weh/$Ge5dooWNGvExpXtA2Wtqe01e6CIyVvrMZiKZM6Ufzd3"; - packages = with pkgs; [ - alacritty - bottom - brave - element-desktop - jamesdsp - keepassxc - neofetch - neovim - nextcloud-client - retroarchFull - rustup - spotify - ]; - }; - # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -148,7 +114,7 @@ programs.tmux = { enable = true; keyMode = "vi"; - shortcut = "s"; + shortcut = "a"; clock24 = true; }; diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bd17dc0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687871164, + "narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1687555006, + "narHash": "sha256-GD2Kqb/DXQBRJcHqkM2qFZqbVenyO7Co/80JHRMg2U0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "33223d479ffde3d05ac16c6dff04ae43cc27e577", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3cd235e --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + description = "Wesley's NixOS Configurations Flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, home-manager, ... }@inputs: { + nixosConfigurations = { + "nixos-bootstrap" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hardware/nixos-bootstrap.nix + ./configs/desktop.nix + ./hosts/nixos-bootstrap.nix + ./users/wesley.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.wesley = import ./home/wesley.nix; + } + ./updates/no-restart.nix + ]; + }; + }; + }; +} diff --git a/hardware/nixos-bootstrap.nix b/hardware/nixos-bootstrap.nix new file mode 100644 index 0000000..2f14e72 --- /dev/null +++ b/hardware/nixos-bootstrap.nix @@ -0,0 +1,36 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/544f57e2-71e0-433b-8afe-305610bb4a6b"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/DE9E-321B"; + 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.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/wes-home.nix b/home/wesley.nix similarity index 100% rename from wes-home.nix rename to home/wesley.nix diff --git a/hosts/nixos-bootstrap.nix b/hosts/nixos-bootstrap.nix new file mode 100644 index 0000000..ded44d0 --- /dev/null +++ b/hosts/nixos-bootstrap.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: + +{ + networking.hostName = "nixos-bootstrap"; # Define your hostname. +} diff --git a/updates/no-restart.nix b/updates/no-restart.nix new file mode 100644 index 0000000..4f8f1d5 --- /dev/null +++ b/updates/no-restart.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + # Enable automatic updates + system.autoUpgrade.enable = true; + # Automatically restart after update + #system.autoUpgrade.allowReboot = true; +} + diff --git a/users/wesley.nix b/users/wesley.nix new file mode 100644 index 0000000..633fbcc --- /dev/null +++ b/users/wesley.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + users.users.wesley = { + isNormalUser = true; + description = "Wesley Irvin"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.zsh; # Set our default shell for our user to zsh + hashedPassword = "$y$j9T$PXPH.OUWrqDkhAQR03weh/$Ge5dooWNGvExpXtA2Wtqe01e6CIyVvrMZiKZM6Ufzd3"; + packages = with pkgs; [ + alacritty + bottom + brave + element-desktop + jamesdsp + keepassxc + neofetch + neovim + nextcloud-client + retroarchFull + rustup + spotify + ]; + }; +}