Bring back deploy script for remote bootstrap
And make linode config a regular module.
This commit is contained in:
parent
106c18b9e5
commit
589c1c04a1
21
Makefile
21
Makefile
|
@ -5,19 +5,17 @@ FLAGS := -I "my=$(PWD)" $(FLAGS)
|
||||||
COMMAND := test
|
COMMAND := test
|
||||||
|
|
||||||
# The real Labowski
|
# The real Labowski
|
||||||
all: channels config secrets.nix
|
all: channels secrets.nix
|
||||||
@sudo nixos-rebuild $(FLAGS) $(COMMAND)
|
@sudo nixos-rebuild $(FLAGS) $(COMMAND)
|
||||||
|
|
||||||
install: result channels update config
|
install: channels update config
|
||||||
@nixos-generate-config --root "$(PREFIX)"
|
@sudo nixos-install --root "$(PREFIX)" $(FLAGS)
|
||||||
@nixos-install --root "$(PREFIX)"
|
|
||||||
|
|
||||||
install-linode: result channels update
|
|
||||||
@sudo mkdir -p "$(NIXOS_PREFIX)"
|
|
||||||
@echo "(import $(PWD)/dotfiles \"linode\") \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
|
||||||
|
|
||||||
upgrade: update switch
|
upgrade: update switch
|
||||||
|
|
||||||
|
update:
|
||||||
|
@sudo nix-channel --update
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
@sudo nixos-rebuild $(FLAGS) switch
|
@sudo nixos-rebuild $(FLAGS) switch
|
||||||
|
|
||||||
|
@ -29,9 +27,6 @@ clean:
|
||||||
|
|
||||||
|
|
||||||
# Parts
|
# Parts
|
||||||
update:
|
|
||||||
@sudo nix-channel --update
|
|
||||||
|
|
||||||
config: $(NIXOS_PREFIX)/configuration.nix
|
config: $(NIXOS_PREFIX)/configuration.nix
|
||||||
|
|
||||||
channels:
|
channels:
|
||||||
|
@ -40,8 +35,8 @@ channels:
|
||||||
@sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
|
@sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
|
||||||
|
|
||||||
$(NIXOS_PREFIX)/configuration.nix:
|
$(NIXOS_PREFIX)/configuration.nix:
|
||||||
@sudo mkdir -p "$(NIXOS_PREFIX)"
|
@sudo nixos-generate-config --root "$(PREFIX)"
|
||||||
@echo "import $(PWD)/dotfiles \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
@echo "import $(PWD)/dotfiles \"$(HOST)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
||||||
|
|
||||||
secrets.nix: secrets.nix.gpg
|
secrets.nix: secrets.nix.gpg
|
||||||
@nix-shell -p gnupg --run "gpg -dq $< > $@"
|
@nix-shell -p gnupg --run "gpg -dq $< > $@"
|
||||||
|
|
37
README.md
37
README.md
|
@ -14,16 +14,41 @@ white whale and annihilate what vestiges of my social life remain.
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Make sure your partitions are set up by this point
|
# Assumes your partitions are set up and root is mounted on /mnt
|
||||||
git clone https://github.com/hlissner/dotfiles /etc/dotfiles
|
curl https://raw.githubusercontent.com/hlissner/dotfiles/nixos/deploy | sh
|
||||||
HOST=hostname make install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This is equivalent to:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
DOTFILES=/home/$USER/.dotfiles
|
||||||
|
git clone https://github.com/hlissner/dotfiles $DOTFILES
|
||||||
|
ln -s /etc/dotfiles $DOTFILES
|
||||||
|
chown -R $USER:users $DOTFILES
|
||||||
|
|
||||||
|
# make channels
|
||||||
|
nix-channel --add "https://nixos.org/channels/nixos-${NIXOS_VERSION}" nixos
|
||||||
|
nix-channel --add "https://github.com/rycee/home-manager/archive/release-${NIXOS_VERSION}.tar.gz" home-manager
|
||||||
|
nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
|
||||||
|
|
||||||
|
# make /etc/nixos/configuration.nix
|
||||||
|
nixos-generate-config --root /mnt
|
||||||
|
echo "import /etc/dotfiles \"$$(hostname)\"" >/mnt/etc/nixos/configuration.nix
|
||||||
|
|
||||||
|
# make secrets.nix
|
||||||
|
nix-shell -p gnupg --run "gpg -dq secrets.nix.gpg >secrets.nix"
|
||||||
|
|
||||||
|
# make install
|
||||||
|
nixos-install --root /mnt -I "my=/etc/dotfiles"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Management
|
||||||
|
|
||||||
+ `make` = `nixos-rebuild test`
|
+ `make` = `nixos-rebuild test`
|
||||||
+ `make switch` = `nixos-rebuild switch`
|
+ `make switch` = `nixos-rebuild switch`
|
||||||
+ `make upgrade` = `nix-channel --update && nixos-rebuild switch`
|
+ `make upgrade` = `nix-channel --update && nixos-rebuild switch`
|
||||||
+ `make install` = `nixos-generate-config --root $PREFIX && nixos-install
|
+ `make install` = `nixos-generate-config --root $PREFIX && nixos-install --root
|
||||||
--root $PREFIX`
|
$PREFIX`
|
||||||
+ `make gc` = `nix-collect-garbage -d` (use sudo to clear system profile)
|
+ `make gc` = `nix-collect-garbage -d` (use sudo to clear system profile)
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
@ -32,7 +57,7 @@ HOST=hostname make install
|
||||||
+ Shell: zsh
|
+ Shell: zsh
|
||||||
+ DE/WM: bspwm + polybar
|
+ DE/WM: bspwm + polybar
|
||||||
+ Editor: [Doom Emacs][doom-emacs] (and occasionally [vim][vimrc])
|
+ Editor: [Doom Emacs][doom-emacs] (and occasionally [vim][vimrc])
|
||||||
+ Terminal: st + extensions
|
+ Terminal: st
|
||||||
+ Browser: firefox (waiting for qutebrowser to mature)
|
+ Browser: firefox (waiting for qutebrowser to mature)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
device:
|
device:
|
||||||
{ pkgs, options, lib, config, ... }:
|
{ pkgs, options, lib, config, ... }:
|
||||||
{
|
{
|
||||||
networking.hostName = device;
|
networking.hostName = lib.mkDefault device;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
||||||
|
|
29
deploy
Normal file
29
deploy
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p git gnumake
|
||||||
|
|
||||||
|
set -e # bail if an error occurs
|
||||||
|
if [ $EUID -nq 0 ]; then
|
||||||
|
>&2 echo "Must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER=${USER:-hlissner}
|
||||||
|
HOST=${1:-${HOST:-kuro}}
|
||||||
|
|
||||||
|
DOTFILES="/home/$USER/.dotfiles"
|
||||||
|
if [ ! -d /etc/dotfiles ]; then
|
||||||
|
git clone https://github.com/hlissner/dotfiles "$DOTFILES"
|
||||||
|
chown -R $USER:users "$DOTFILES"
|
||||||
|
fi
|
||||||
|
ln -sf "$DOTFILES" /etc/dotfiles
|
||||||
|
|
||||||
|
if [ ! -f "$DOTFILES/machines/$HOST.nix" ]; then
|
||||||
|
>&2 echo "No configuration exists for host '$HOST'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$LINODE" ]; then
|
||||||
|
ARGS="\"$HOST\""
|
||||||
|
HOST=linode
|
||||||
|
fi
|
||||||
|
make -C "$DOTFILES" install
|
23
machines/holo.nix
Normal file
23
machines/holo.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# FIXME
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
<my/modules/linode.nix>
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "holo";
|
||||||
|
time.timeZone = "America/Toronto";
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
# user = config.my.username;
|
||||||
|
virtualHosts = {
|
||||||
|
# "domain.com" = {
|
||||||
|
# default = true;
|
||||||
|
# enableACME = true;
|
||||||
|
# forceSSL = true;
|
||||||
|
# root = "...";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -27,7 +27,6 @@
|
||||||
#
|
#
|
||||||
# 5. Reboot into profile.
|
# 5. Reboot into profile.
|
||||||
|
|
||||||
host:
|
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
|
@ -39,7 +38,6 @@ host:
|
||||||
<my/modules/shell/git.nix>
|
<my/modules/shell/git.nix>
|
||||||
<my/modules/shell/zsh.nix>
|
<my/modules/shell/zsh.nix>
|
||||||
<my/modules/services/ssh.nix>
|
<my/modules/services/ssh.nix>
|
||||||
"./${host}.nix"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# GRUB
|
# GRUB
|
Loading…
Reference in a new issue