From fb581407fe0a996a8619cdbe74cb0dda0dbb8194 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 12 Dec 2022 00:27:37 +0100 Subject: Add wrapper script Signed-off-by: TheArcaneBrony --- build.sh | 17 +++++++ flake.nix | 5 +-- modules/base-server.nix | 1 + modules/base.nix | 6 +-- modules/users.nix | 13 ------ modules/users/Rory.nix | 19 ++++++++ modules/users/chris.nix | 18 ++++++++ old/configuration.nix | 117 ------------------------------------------------ 8 files changed, 58 insertions(+), 138 deletions(-) create mode 100755 build.sh delete mode 100644 modules/users.nix create mode 100644 modules/users/Rory.nix create mode 100644 modules/users/chris.nix delete mode 100644 old/configuration.nix diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1fdf453 --- /dev/null +++ b/build.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +if [ $# -ne 2 ]; then + echo "Usage: $0 " + echo "NOTE: hardware config will be generated from root!" + echo "Defined configs:" + cat flake.nix | grep 'nixpkgs.lib.nixosSystem' | sed 's/ =.*//' | sed 's/^[ \t]*//;s/[ \t]*$//' | while read cfg; do echo " - $cfg"; done + exit 1 +fi +if [ "$1" = "/" ]; then + nixos-generate-config --show-hardware-config > hardware-configuration.nix + nixos-rebuild --flake ".#${2}" build + exit 1 +else + nixos-generate-config --show-hardware-config > hardware-configuration.nix + nixos-install --root "${1}" --flake ".#${2}" + exit 1 +fi diff --git a/flake.nix b/flake.nix index 0dd50e0..19dd825 100644 --- a/flake.nix +++ b/flake.nix @@ -16,13 +16,10 @@ # nixosConfigurations is the key that nixos-rebuild looks for. nixosConfigurations = { Rory-discordbots = nixpkgs.lib.nixosSystem { - # A lot of times online you will see the use of flake-utils + a - # function which iterates over many possible systems. My system - # is x86_64-linux, so I'm only going to define that system = "x86_64-linux"; - # Import our old system configuration.nix modules = [ ./host/Rory-discordbots/configuration.nix + ./hardware-configuration.nix ]; }; }; diff --git a/modules/base-server.nix b/modules/base-server.nix index 16dd45d..5e7fc1c 100644 --- a/modules/base-server.nix +++ b/modules/base-server.nix @@ -4,6 +4,7 @@ imports = [ ./base.nix + ./users/chris.nix ]; # My servers always use /dev/sda as boot disk... diff --git a/modules/base.nix b/modules/base.nix index 4033813..89e070e 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -4,7 +4,7 @@ imports = [ ./packages/vim.nix - ./users.nix + ./users/Rory.nix /etc/nixos/hardware-configuration.nix ]; @@ -41,7 +41,6 @@ neofetch lnav zsh - feh git lsd #sshfs @@ -51,5 +50,4 @@ system.stateVersion = "22.11"; # DO NOT EDIT! -} - +} \ No newline at end of file diff --git a/modules/users.nix b/modules/users.nix deleted file mode 100644 index 15e76a0..0000000 --- a/modules/users.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, pkgs, ... }: - -{ - - users.users.Rory = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ - ]; - initialPassword = "password"; - }; -} - diff --git a/modules/users/Rory.nix b/modules/users/Rory.nix new file mode 100644 index 0000000..b5c0dae --- /dev/null +++ b/modules/users/Rory.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + + users.users.Rory = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + packages = with pkgs; [ + ]; + #initialPassword = "password"; + openssh.authorizedKeys.keys = [ + #"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCpmQMHBFOpLfb0Y138VUK1p4FxEPSOz5FRpDK8/eOFwBmEKDjLnT4d/e/Rz2VknCTSKXLMZ4KBMYM014NW3SZR90cDAFwlkdSX638fQlEO3usfALNLWsLbzqzkufw6PKWqrybZvlpwjcacYlRItvit/GH7FLqfiT/G6BdyBErn/lmmcBxF0So0aeba2G/xf7BPPQqqaTqQgE9ml87fdFVw4zVcix823K92SQIx7PkSInpgJwqjLR8cVkL2lkvMdq6IjAEsHAiUYNbAQTUl6xhYa6+Cl8CdvCyINzCpWS3Md2rSH84dZEq0ymZ40orF9JZbHHPgSGFbrg5PUOuJ57iaCPK20z474q2APUJ7aQXiifToZKqcWHFHCj7hqWja1rEt3rQbqRPgttSg5aP3lQ3GXbR/XhdcSYln1QpPTCBxklrfN1P6hF6lWBtGhtGzOvZ5Lt1uofdsK71k5eMwYHTcBnVaMtxbYzR9ihFN6LCNvvnrj+2NvHOiYSCr+y3G4kk= thearcanebrony@DESKTOP-RMRJ2VG" + #"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICT+53Hy3wbIlNVIomK2RroaimMWrTlUkndjHt1dFuyh root@pfSense-arcane-home.localdomain" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILF2IuNu//0DP/wKMuDvBgVT3YBS2uULsipbdrhJCTM7 thearcanebrony@tab-linux-desktop" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN/kNkY/E5b6rvCQLMaSbpLQ/xoyywIwVVu9uo2j/B6p Rory@RoryNix" + ]; + }; +} + diff --git a/modules/users/chris.nix b/modules/users/chris.nix new file mode 100644 index 0000000..86acee5 --- /dev/null +++ b/modules/users/chris.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + + users.users.chris = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + packages = with pkgs; [ + nano + nodejs-slim + ]; + #initialPassword = "password"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMd9U0+wKjBG3Q9Qg249xJY+ybYeRV9/VMPjuwKvFBEI" + ]; + }; +} + diff --git a/old/configuration.nix b/old/configuration.nix deleted file mode 100644 index 1d99ef6..0000000 --- a/old/configuration.nix +++ /dev/null @@ -1,117 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = - [ - ./hardware-configuration.nix - ./vim.nix - ]; - - boot = { - loader = { - grub = { - enable = true; - version = 2; - device = "/dev/sda"; # nodev for EFI only - - # EFI - efiSupport = false; - efiInstallAsRemovable = false; - }; - }; - }; - - networking = { - hostName = "RoryNix"; - networkmanager.enable = true; - wireless.enable = false; - - firewall = { - enable = false; - # allowedTCPPorts = [ ... ]; - # allowedUDPPorts = [ ... ]; - }; - }; - - time.timeZone = "Europe/Brussels"; - i18n.defaultLocale = "en_US.UTF-8"; - - services = { - xserver = { - enable = true; - videoDrivers = [ "intel" ]; - desktopManager.gnome.enable = true; - libinput.enable = true; - layout = "us"; - modules = [ pkgs.xorg.xf86videointel ]; - }; - gnome = { - - core-developer-tools.enable = false; - core-utilities.enable = false; - tracker-miners.enable = false; - tracker.enable = false; - }; - - printing.enable = false; - openssh = { - enable = true; - extraConfig = '' - MaxAuthTries 32 - ''; - }; - }; - security.sudo.wheelNeedsPassword = false; - nixpkgs.config.allowUnfree = true; - - sound.enable = true; - hardware.pulseaudio.enable = true; - - users.users.Rory = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ - #xterm - gnomeExtensions.vitals - gnomeExtensions.runcat - ]; - initialPassword = "password"; - }; - - environment.systemPackages = with pkgs; [ - wget - neofetch - lnav - pciutils - zsh - gnome-console - feh - git - lsd - #nerdfonts - #element-web - sshfs - cinnamon.nemo - firefox-bin - kitty.terminfo - glxinfo - #epiphany - # Various extensions... - # - Gnome - #gnomeExtensions.vitals - #gnomeExtensions.runcat - # - Dont work on gnome 43: - #gnomeExtensions.undecorate - #gnomeExtensions.inactivity - #gnomeExtensions.left-clock - # - Vim - vimPlugins.vim-nix - ]; - fonts.fonts = with pkgs; [ - (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) - ]; - - - system.stateVersion = "22.11"; # DO NOT EDIT! -} - -- cgit 1.4.1