diff --git a/home-manager/dots/bashrc b/home-manager/dots/bashrc index 8aa74e6..a9598a0 100644 --- a/home-manager/dots/bashrc +++ b/home-manager/dots/bashrc @@ -2,17 +2,6 @@ set -o vi unset HISTFILE -if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then - PROMPT_COLOR="1;31m" - ((UID)) && PROMPT_COLOR="1;32m" - if [ -n "$INSIDE_EMACS" ]; then - # Emacs term mode doesn't support xterm title escape sequence (\e]0;) - PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] " - else - PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h:\w\a\]\u@\h:\w]\\$\[\033[0m\]\n" - fi -fi -export "$PS1" # Functions function search() { diff --git a/hosts/default.nix b/hosts/default.nix index 980479e..1cccfc9 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -49,4 +49,25 @@ } ]; }; + vm = lib.nixosSystem { + inherit system; + specialArgs = { inherit user inputs; }; + modules = [ + ../nixos/all.nix + ../nixos/cli.nix + ./vm/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user; }; + home-manager.users.${user.name} = { + imports = [ + ../home-manager/all.nix + ../home-manager/cli.nix + ./vm/home.nix + ]; + }; + } + ]; + }; } diff --git a/hosts/fireweed/configuration.nix b/hosts/fireweed/configuration.nix index 0eedfbf..d2b91ff 100644 --- a/hosts/fireweed/configuration.nix +++ b/hosts/fireweed/configuration.nix @@ -1,4 +1,4 @@ -# Buckwheat configuration.nix +# Fireweed configuration.nix { config, lib, pkgs, inputs, user, ... }: let hostname="fireweed"; diff --git a/hosts/fireweed/hardware-configuration.nix b/hosts/fireweed/hardware-configuration.nix index d016e64..6b5f35d 100644 --- a/hosts/fireweed/hardware-configuration.nix +++ b/hosts/fireweed/hardware-configuration.nix @@ -1,4 +1,4 @@ -# Buckwheat hardware-configuration.nix +# Fireweed hardware-configuration.nix { config, lib, pkgs, modulesPath, ... }: { diff --git a/hosts/fireweed/home.nix b/hosts/fireweed/home.nix index bcf3913..c0c3eb5 100644 --- a/hosts/fireweed/home.nix +++ b/hosts/fireweed/home.nix @@ -1,4 +1,4 @@ -# Buckwheat home.nix +# Fireweed home.nix { config, lib, pkgs, inputs, user, ... }: { services = { diff --git a/hosts/vm/configuration.nix b/hosts/vm/configuration.nix new file mode 100644 index 0000000..56d3367 --- /dev/null +++ b/hosts/vm/configuration.nix @@ -0,0 +1,47 @@ +# NixOS VM configuration.nix +{ config, lib, pkgs, inputs, user, ... }: +let + hostname="nixos"; +in +{ + imports = [ + ./hardware-configuration.nix + ]; + boot = { + loader.grub = { + enable = true; + device = "/dev/vda"; + useOSProber = true; + }; + + # Hardware-configuration edits + kernel.sysctl."net.ipv4.ip_forward" = 1; + + # Clean /tmp at boot + tmp.cleanOnBoot = true; + }; + networking = { + hostName = "${hostname}"; # Define your hostname. + firewall = { + # To disable the firewall altogether: + # enable = false; + allowedTCPPorts = [ 445 139 ]; + allowedUDPPorts = [ 137 138 ]; + }; + # Proxy configuration + # proxy = { + # default = "http://user:password@proxy:port/"; + # noProxy = "127.0.0.1,localhost,internal.domain"; + # }; + }; + users.users.${user.name} = { + extraGroups = [ + ]; + packages = with pkgs; [ + ]; + }; + services = { + # Enable automatic login for the user. + getty.autologinUser = "${user.name}"; + }; +} diff --git a/hosts/vm/default-configuration.nix b/hosts/vm/default-configuration.nix new file mode 100644 index 0000000..c7b515c --- /dev/null +++ b/hosts/vm/default-configuration.nix @@ -0,0 +1,98 @@ +# 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.grub.enable = true; + boot.loader.grub.device = "/dev/vda"; + boot.loader.grub.useOSProber = 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; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # 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 = { + layout = "us"; + xkbVariant = ""; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.user = { + isNormalUser = true; + description = "user"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + # 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.05"; # Did you read the comment? + +} diff --git a/hosts/vm/hardware-configuration.nix b/hosts/vm/hardware-configuration.nix new file mode 100644 index 0000000..bf98465 --- /dev/null +++ b/hosts/vm/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3df45abe-2951-4346-a792-f03ce89e16bb"; + fsType = "ext4"; + }; + + 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/hosts/vm/home.nix b/hosts/vm/home.nix new file mode 100644 index 0000000..b091fde --- /dev/null +++ b/hosts/vm/home.nix @@ -0,0 +1,6 @@ +# NixOS VM home.nix +{ config, lib, pkgs, inputs, user, ... }: +{ + services = { + }; +}