Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
cdb3b7c5bf
15 changed files with 202 additions and 148 deletions
44
flake.lock
44
flake.lock
|
@ -59,11 +59,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696266752,
|
"lastModified": 1699781810,
|
||||||
"narHash": "sha256-wJnMDFM21+xXdsXSs6pXMElbv4YfqmQslcPApRuaYKs=",
|
"narHash": "sha256-LD+PIUbm1yQmQmGIbSsc/PB1dtJtGqXFgxRc1C7LlfQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "646ee25c25fffee122a66282861f5f56ad3e0fd9",
|
"rev": "2d7d77878c5d70f66f3d676ff66708d8d4f9d7df",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -145,11 +145,11 @@
|
||||||
},
|
},
|
||||||
"hardware": {
|
"hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1699701045,
|
"lastModified": 1700559156,
|
||||||
"narHash": "sha256-mDzUXK7jNO/utInWpSWEX1NgEEunVIpJg+LyPsDTfy0=",
|
"narHash": "sha256-gL4epO/qf+wo30JjC3g+b5Bs8UrpxzkhNBBsUYxpw2g=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "b689465d0c5d88e158e7d76094fca08cc0223aad",
|
"rev": "c3abafb01cd7045dba522af29b625bd1e170c2fb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -189,11 +189,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696145345,
|
"lastModified": 1700553346,
|
||||||
"narHash": "sha256-3dM7I/d4751SLPJah0to1WBlWiyzIiuCEUwJqwBdmr4=",
|
"narHash": "sha256-kW7uWsCv/lxuA824Ng6EYD9hlVYRyjuFn0xBbYltAeQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "6f9b5b83ad1f470b3d11b8a9fe1d5ef68c7d0e30",
|
"rev": "1aabb0a31b25ad83cfaa37c3fe29053417cd9a0f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -214,11 +214,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1699391198,
|
"lastModified": 1700592218,
|
||||||
"narHash": "sha256-HrnlCdZBqqE37gFORapfSGEGcqhCyhX2aSMRnDEmR0k=",
|
"narHash": "sha256-vHzDbBrZ5EsfVUMLgjuugf6OqB+iOLjKLO9O5n2occ4=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "Hyprland",
|
"repo": "Hyprland",
|
||||||
"rev": "751d2851cc270c3322ffe2eb83c156e4298a0c0e",
|
"rev": "472926528428cd714c90f157e639fc0466611c8b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -276,11 +276,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1697723726,
|
"lastModified": 1700390070,
|
||||||
"narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=",
|
"narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0",
|
"rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -354,11 +354,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1695284550,
|
"lastModified": 1700362823,
|
||||||
"narHash": "sha256-z9fz/wz9qo9XePEvdduf+sBNeoI9QG8NJKl5ssA8Xl4=",
|
"narHash": "sha256-/H7XgvrYM0IbkpWkcdfkOH0XyBM5ewSWT1UtaLvOgKY=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "2f375ed8702b0d8ee2430885059d5e7975e38f78",
|
"rev": "49a87c6c827ccd21c225531e30745a9a6464775c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -453,18 +453,18 @@
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"host": "gitlab.freedesktop.org",
|
"host": "gitlab.freedesktop.org",
|
||||||
"lastModified": 1697909146,
|
"lastModified": 1699292815,
|
||||||
"narHash": "sha256-jU0I6FoCKnj4zIBL4daosFWh81U1fM719Z6cae8PxSY=",
|
"narHash": "sha256-HXu98PyBMKEWLqiTb8viuLDznud/SdkdJsx5A5CWx7I=",
|
||||||
"owner": "wlroots",
|
"owner": "wlroots",
|
||||||
"repo": "wlroots",
|
"repo": "wlroots",
|
||||||
"rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2",
|
"rev": "5de9e1a99d6642c2d09d589aa37ff0a8945dcee1",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"host": "gitlab.freedesktop.org",
|
"host": "gitlab.freedesktop.org",
|
||||||
"owner": "wlroots",
|
"owner": "wlroots",
|
||||||
"repo": "wlroots",
|
"repo": "wlroots",
|
||||||
"rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2",
|
"rev": "5de9e1a99d6642c2d09d589aa37ff0a8945dcee1",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,8 +2,85 @@
|
||||||
|
|
||||||
## Update Server
|
## Update Server
|
||||||
|
|
||||||
```shell
|
**NOTE**: I want to establish a solid way to do this without `root@`.
|
||||||
|
|
||||||
|
```fish
|
||||||
g a; set host beefcake; nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
|
g a; set host beefcake; nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
|
||||||
--target-host "root@$host" --build-host "root@$host" \
|
--target-host "root@$host" --build-host "root@$host" \
|
||||||
switch --show-trace
|
switch --show-trace
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Safer Method
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# make sure all files are at least staged so nix flakes will see them
|
||||||
|
git add -A
|
||||||
|
|
||||||
|
# initialize a delayed reboot by a process you can kill later if things look good
|
||||||
|
# note that the amount of time you give it probably needs to be enough time to both complete the upgrade
|
||||||
|
# _and_ perform whatever testing you need
|
||||||
|
host=your_host
|
||||||
|
ssh -t "root@$host" "bash -c '
|
||||||
|
set -m
|
||||||
|
(sleep 300; reboot;) &
|
||||||
|
jobs -p
|
||||||
|
bg
|
||||||
|
disown
|
||||||
|
'"
|
||||||
|
|
||||||
|
# build the system and start running it, but do NOT set the machine up to boot to that system yet
|
||||||
|
# we will test things and make sure it works first
|
||||||
|
# if it fails, the reboot we started previously will automatically kick in once the timeout is reached
|
||||||
|
# and the machine will boot to the now-previous iteration
|
||||||
|
nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
|
||||||
|
--target-host "root@$host" --build-host "root@$host" \
|
||||||
|
test --show-trace
|
||||||
|
|
||||||
|
# however you like, verify the system is running as expected
|
||||||
|
# if it is, run the same command with "switch" instead of "test"
|
||||||
|
# otherwise, we will wait until the machine reboots back into the
|
||||||
|
# this is crude, but should be pretty foolproof
|
||||||
|
# the main gotcha is that the system is already unbootable or non-workable, but
|
||||||
|
# if you always use this method, that should be an impossible state to get into
|
||||||
|
|
||||||
|
# if we still have ssh access and the machine fails testing, just rollback
|
||||||
|
# instead of waiting for the reboot
|
||||||
|
ssh "root@$host" nixos-rebuild --rollback switch
|
||||||
|
```
|
||||||
|
|
||||||
|
## Provisioning New NixOS Hosts
|
||||||
|
|
||||||
|
Note that for best results the target flake attribute should first be built and
|
||||||
|
cached to the binary cache at `nix.h.lyte.dev`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# establish network access
|
||||||
|
# plug in ethernet or do the wpa_cli song and dance for wifi
|
||||||
|
wpa_cli scan
|
||||||
|
wpa_cli scan_results
|
||||||
|
wpa_cli add_network 0
|
||||||
|
wpa_cli set_network 0 ssid "MY_SSID"
|
||||||
|
wpa_cli set_network 0 psk "MY_WIFI_PASSWORD"
|
||||||
|
wpa_cli enable_network 0
|
||||||
|
wpa_cli save_config
|
||||||
|
|
||||||
|
# disk encryption key (if needed)
|
||||||
|
echo -n "password" > /tmp/secret.key
|
||||||
|
|
||||||
|
# partition disks
|
||||||
|
nix-shell --packages git --run "sudo nix run \
|
||||||
|
--extra-experimental-features nix-command \
|
||||||
|
--extra-experimental-features flakes \
|
||||||
|
github:nix-community/disko -- \
|
||||||
|
--flake 'git+https://git.lyte.dev/lytedev/nix#${PARTITION_SCHEME}' \
|
||||||
|
--mode disko \
|
||||||
|
--arg disks '[ \"/dev/${DISK}\" ]'"
|
||||||
|
|
||||||
|
# install
|
||||||
|
nix-shell --packages git \
|
||||||
|
--run "sudo nixos-install \
|
||||||
|
--flake 'git+https://git.lyte.dev/lytedev/nix#${FLAKE_ATTR}' \
|
||||||
|
--option trusted-substituters 'https://cache.nixos.org https://nix.h.lyte.dev' \
|
||||||
|
--option trusted-public-keys 'cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0='"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,18 @@
|
||||||
programs.bat = {
|
programs.bat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
theme = "Catppuccin-mocha";
|
theme = "ansi";
|
||||||
};
|
|
||||||
themes = {
|
|
||||||
"Catppuccin-mocha" = builtins.readFile (pkgs.fetchFromGitHub
|
|
||||||
{
|
|
||||||
owner = "catppuccin";
|
|
||||||
repo = "bat";
|
|
||||||
rev = "477622171ec0529505b0ca3cada68fc9433648c6";
|
|
||||||
sha256 = "6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=";
|
|
||||||
}
|
|
||||||
+ "/Catppuccin-mocha.tmTheme");
|
|
||||||
};
|
};
|
||||||
|
# themes = {
|
||||||
|
# "Catppuccin-mocha" = builtins.readFile (pkgs.fetchFromGitHub
|
||||||
|
# {
|
||||||
|
# owner = "catppuccin";
|
||||||
|
# repo = "bat";
|
||||||
|
# rev = "477622171ec0529505b0ca3cada68fc9433648c6";
|
||||||
|
# sha256 = "6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=";
|
||||||
|
# }
|
||||||
|
# + "/Catppuccin-mocha.tmTheme");
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
home.shellAliases = {
|
home.shellAliases = {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{...}: {
|
{colors, ...}: {
|
||||||
programs.broot = {
|
programs.broot = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
enableFishIntegration = true;
|
||||||
settings = {
|
settings = {
|
||||||
modal = false; # vim mode?
|
modal = true; # vim mode?
|
||||||
|
|
||||||
verbs = [
|
verbs = [
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,23 @@
|
||||||
execution = "$EDITOR {file}";
|
execution = "$EDITOR {file}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
skin = with colors.withHashPrefix; {
|
||||||
|
status_normal_fg = fg;
|
||||||
|
status_normal_bg = bg;
|
||||||
|
status_error_fg = red;
|
||||||
|
status_error_bg = yellow;
|
||||||
|
tree_fg = red;
|
||||||
|
selected_line_bg = bg2;
|
||||||
|
permissions_fg = purple;
|
||||||
|
size_bar_full_bg = red;
|
||||||
|
size_bar_void_bg = bg;
|
||||||
|
directory_fg = yellow;
|
||||||
|
input_fg = blue;
|
||||||
|
flag_value_fg = yellow;
|
||||||
|
table_border_fg = red;
|
||||||
|
code_fg = yellow;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
iex
|
iex
|
||||||
zellij
|
zellij
|
||||||
broot
|
broot
|
||||||
|
nnn
|
||||||
cargo
|
cargo
|
||||||
senpai
|
senpai
|
||||||
tmux
|
tmux
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
zellij = import ./zellij.nix;
|
zellij = import ./zellij.nix;
|
||||||
firefox = import ./firefox.nix;
|
firefox = import ./firefox.nix;
|
||||||
broot = import ./broot.nix;
|
broot = import ./broot.nix;
|
||||||
|
nnn = import ./nnn.nix;
|
||||||
waybar = import ./waybar.nix;
|
waybar = import ./waybar.nix;
|
||||||
swaylock = import ./swaylock.nix;
|
swaylock = import ./swaylock.nix;
|
||||||
desktop = import ./desktop.nix;
|
desktop = import ./desktop.nix;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
# TODO: uses nixpkgs.pass so pass otp doesn't work
|
# TODO: uses nixpkgs.pass so pass otp doesn't work
|
||||||
package = pkgs.firefox.override {extraNativeMessagingHosts = [pkgs.passff-host];};
|
package = pkgs.firefox.override {nativeMessagingHosts = [pkgs.passff-host];};
|
||||||
|
|
||||||
# extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
# extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
||||||
# ublock-origin
|
# ublock-origin
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{outputs, ...}: let
|
{outputs, ...}: let
|
||||||
scale = 1.5;
|
scale = 1.25;
|
||||||
in {
|
in {
|
||||||
imports = with outputs.homeManagerModules; [
|
imports = with outputs.homeManagerModules; [
|
||||||
sway
|
sway
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
"desc:Dell Inc. DELL U2720Q D3TM623,3840x2160@60,3840x0,1.5,transform,3"
|
"desc:Dell Inc. DELL U2720Q D3TM623,3840x2160@60,3840x0,1.5,transform,3"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
xwayland = {
|
||||||
|
force_zero_scaling = true;
|
||||||
|
};
|
||||||
|
|
||||||
exec-once = [
|
exec-once = [
|
||||||
"hyprpaper"
|
"hyprpaper"
|
||||||
"mako"
|
"mako"
|
||||||
|
|
5
modules/home-manager/nnn.nix
Normal file
5
modules/home-manager/nnn.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{...}: {
|
||||||
|
programs.nnn = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -6,9 +6,7 @@
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
{
|
{
|
||||||
name = "daniel";
|
name = "daniel";
|
||||||
ensurePermissions = {
|
ensureDBOwnership = true;
|
||||||
"DATABASE daniel" = "ALL PRIVILEGES";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
enableTCPIP = true;
|
enableTCPIP = true;
|
||||||
|
|
|
@ -119,12 +119,6 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
|
||||||
owner = config.systemd.services.plausible.serviceConfig.User;
|
owner = config.systemd.services.plausible.serviceConfig.User;
|
||||||
group = config.systemd.services.plausible.serviceConfig.Group;
|
group = config.systemd.services.plausible.serviceConfig.Group;
|
||||||
};
|
};
|
||||||
plausible-erlang-cookie = {
|
|
||||||
path = "/var/lib/plausible/plausible-erlang-cookie";
|
|
||||||
mode = "0440";
|
|
||||||
owner = config.systemd.services.plausible.serviceConfig.User;
|
|
||||||
group = config.systemd.services.plausible.serviceConfig.Group;
|
|
||||||
};
|
|
||||||
plausible-secret-key-base = {
|
plausible-secret-key-base = {
|
||||||
path = "/var/lib/plausible/plausible-secret-key-base";
|
path = "/var/lib/plausible/plausible-secret-key-base";
|
||||||
mode = "0440";
|
mode = "0440";
|
||||||
|
@ -359,6 +353,12 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# services.gitea-actions-runner.instances.main = {
|
||||||
|
# # TODO: simple git-based automation would be dope? maybe especially for
|
||||||
|
# # mirroring to github super easy?
|
||||||
|
# enable = false;
|
||||||
|
# };
|
||||||
|
|
||||||
services.gitea = {
|
services.gitea = {
|
||||||
enable = true;
|
enable = true;
|
||||||
appName = "git.lyte.dev";
|
appName = "git.lyte.dev";
|
||||||
|
@ -370,6 +370,9 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
|
||||||
HTTP_PORT = 3088;
|
HTTP_PORT = 3088;
|
||||||
DOMAIN = "git.lyte.dev";
|
DOMAIN = "git.lyte.dev";
|
||||||
};
|
};
|
||||||
|
actions = {
|
||||||
|
ENABLED = true;
|
||||||
|
};
|
||||||
service = {
|
service = {
|
||||||
DISABLE_REGISTRATION = true;
|
DISABLE_REGISTRATION = true;
|
||||||
};
|
};
|
||||||
|
@ -406,7 +409,6 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
|
||||||
services.plausible = {
|
services.plausible = {
|
||||||
# TODO: enable
|
# TODO: enable
|
||||||
enable = false;
|
enable = false;
|
||||||
releaseCookiePath = config.sops.secrets.plausible-erlang-cookie.path;
|
|
||||||
database = {
|
database = {
|
||||||
clickhouse.setup = true;
|
clickhouse.setup = true;
|
||||||
postgres = {
|
postgres = {
|
||||||
|
@ -433,21 +435,15 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
{
|
{
|
||||||
name = "daniel";
|
name = "daniel";
|
||||||
ensurePermissions = {
|
ensureDBOwnership = true;
|
||||||
"DATABASE daniel" = "ALL PRIVILEGES";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "plausible";
|
name = "plausible";
|
||||||
ensurePermissions = {
|
ensureDBOwnership = true;
|
||||||
"DATABASE plausible" = "ALL PRIVILEGES";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "nextcloud";
|
name = "nextcloud";
|
||||||
ensurePermissions = {
|
ensureDBOwnership = true;
|
||||||
"DATABASE nextcloud" = "ALL PRIVILEGES";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
dataDir = "/storage/postgres";
|
dataDir = "/storage/postgres";
|
||||||
|
|
|
@ -24,13 +24,32 @@
|
||||||
inputs.hardware.nixosModules.framework-13-7040-amd
|
inputs.hardware.nixosModules.framework-13-7040-amd
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO: hibernation? does sleep suffice?
|
swapDevices = [
|
||||||
|
# TODO: move this to disko?
|
||||||
|
# sudo btrfs subvolume create /swap
|
||||||
|
# sudo btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
|
||||||
|
# sudo swapon /swap/swapfile
|
||||||
|
{device = "/swap/swapfile";}
|
||||||
|
];
|
||||||
|
|
||||||
|
# findmnt -no UUID -T /swap/swapfile
|
||||||
|
boot.resumeDevice = "/dev/disk/by-uuid/3076912c-ac61-4067-b6b2-361f68b2d038";
|
||||||
|
|
||||||
|
services.logind = {
|
||||||
|
lidSwitch = "suspend-then-hibernate";
|
||||||
|
extraConfig = ''
|
||||||
|
HandlePowerKey=suspend-then-hibernate
|
||||||
|
IdleAction=suspend-then-hibernate
|
||||||
|
IdleActionSec=10m
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
systemd.sleep.extraConfig = "HibernateDelaySec=30m";
|
||||||
|
|
||||||
services.fwupd.enable = true;
|
services.fwupd.enable = true;
|
||||||
services.fwupd.extraRemotes = ["lvfs-testing"];
|
services.fwupd.extraRemotes = ["lvfs-testing"];
|
||||||
|
|
||||||
hardware.opengl.extraPackages = [
|
hardware.opengl.extraPackages = [
|
||||||
pkgs.rocmPackages.clr.icd
|
# pkgs.rocmPackages.clr.icd
|
||||||
pkgs.amdvlk
|
pkgs.amdvlk
|
||||||
# encoding/decoding acceleration
|
# encoding/decoding acceleration
|
||||||
pkgs.libvdpau-va-gl
|
pkgs.libvdpau-va-gl
|
||||||
|
@ -44,11 +63,16 @@
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
};
|
};
|
||||||
kernelPackages = pkgs.linuxPackages_6_5;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
# sudo filefrag -v /swap/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}'
|
||||||
|
# the above won't work for btrfs, instead you need
|
||||||
|
# btrfs inspect-internal map-swapfile -r /swap/swapfile
|
||||||
|
# https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file
|
||||||
# many of these come from https://wiki.archlinux.org/title/Framework_Laptop_13#Suspend
|
# many of these come from https://wiki.archlinux.org/title/Framework_Laptop_13#Suspend
|
||||||
kernelParams = [
|
kernelParams = [
|
||||||
"amdgpu.sg_display=0"
|
# "amdgpu.sg_display=0"
|
||||||
"acpi_osi=\"!Windows 2020\""
|
"acpi_osi=\"!Windows 2020\""
|
||||||
|
"resume_offset=39331072"
|
||||||
# "nvme.noacpi=1" # maybe causing crashes upon waking?
|
# "nvme.noacpi=1" # maybe causing crashes upon waking?
|
||||||
# "rtc_cmos.use_acpi_alarm=1" # maybe causing excessive battery drain while sleeping -- perhaps due to waking?
|
# "rtc_cmos.use_acpi_alarm=1" # maybe causing excessive battery drain while sleeping -- perhaps due to waking?
|
||||||
];
|
];
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
HandlePowerKey=suspend-then-hibernate
|
HandlePowerKey=suspend-then-hibernate
|
||||||
IdleAction=suspend-then-hibernate
|
IdleAction=suspend-then-hibernate
|
||||||
IdleActionSec=1m
|
IdleActionSec=10m
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
systemd.sleep.extraConfig = "HibernateDelaySec=30m";
|
systemd.sleep.extraConfig = "HibernateDelaySec=30m";
|
||||||
|
|
103
readme.md
103
readme.md
|
@ -13,14 +13,22 @@ here is useful inspiration.
|
||||||
$ nixos-rebuild switch --flake git+https://git.lyte.dev/lytedev/nix#${FLAKE_ATTR}
|
$ nixos-rebuild switch --flake git+https://git.lyte.dev/lytedev/nix#${FLAKE_ATTR}
|
||||||
```
|
```
|
||||||
|
|
||||||
You don't have even have to clone this crap yourself. How cool is that!
|
You don't have even have to clone this crap yourself. How cool is that! But if you do, it looks like this:
|
||||||
|
|
||||||
But if you're gonna change stuff you had better setup the pre-commit hook:
|
```shell_session
|
||||||
|
$ nixos-rebuild switch --flake ./repo/dir/for/nix#${FLAKE_ATTR}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
If you're gonna change stuff you had better setup the pre-commit hook:
|
||||||
|
|
||||||
```shell_session
|
```shell_session
|
||||||
$ ln -s $PWD/pre-commit.bash .git/hooks/pre-commit
|
$ ln -s $PWD/pre-commit.bash .git/hooks/pre-commit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Secrets
|
||||||
|
|
||||||
If you're deploying anything secrets-related, you will need the proper keys:
|
If you're deploying anything secrets-related, you will need the proper keys:
|
||||||
|
|
||||||
```shell_session
|
```shell_session
|
||||||
|
@ -31,99 +39,23 @@ $ pass age-key >> ${XDG_CONFIG_HOME:-~/.config}/sops/age/keys.txt
|
||||||
## NixOS
|
## NixOS
|
||||||
|
|
||||||
```shell_session
|
```shell_session
|
||||||
$ nixos-rebuild switch --flake .
|
$ nixos-rebuild switch --flake
|
||||||
```
|
```
|
||||||
|
|
||||||
## Not NixOS
|
## Not NixOS
|
||||||
|
|
||||||
|
**NOTE**: I pretty much solely use Home Manager as a NixOS module presently, so this is not fully supported.
|
||||||
|
|
||||||
```shell_session
|
```shell_session
|
||||||
$ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
$ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||||
$ nix profile install github:nix-community/home-manager
|
$ nix profile install github:nix-community/home-manager
|
||||||
$ home-manager switch --flake git+https://git.lyte.dev/lytedev/nix
|
$ FLAKE_ATTR=base-x86_64-linux
|
||||||
|
$ home-manager switch --flake git+https://git.lyte.dev/lytedev/nix#$FLAKE_ATTR
|
||||||
```
|
```
|
||||||
|
|
||||||
# Advanced Usage
|
# Internal/Advanced Usage
|
||||||
|
|
||||||
## Push NixOS Config
|
See [lib/internal.md](./lib/internal.md).
|
||||||
|
|
||||||
```bash
|
|
||||||
host=your_host
|
|
||||||
nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
|
|
||||||
--target-host "root@$host" --build-host "root@$host" \
|
|
||||||
switch --show-trace
|
|
||||||
```
|
|
||||||
|
|
||||||
### Safer Method
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# initialize a delayed reboot by a process you can kill later if things look good
|
|
||||||
# note that the amount of time you give it probably needs to be enough time to both complete the upgrade
|
|
||||||
# _and_ perform whatever testing you need
|
|
||||||
host=your_host
|
|
||||||
ssh -t "root@$host" "bash -c '
|
|
||||||
set -m
|
|
||||||
(sleep 300; reboot;) &
|
|
||||||
jobs -p
|
|
||||||
bg
|
|
||||||
disown
|
|
||||||
'"
|
|
||||||
|
|
||||||
# build the system and start running it, but do NOT set the machine up to boot to that system yet
|
|
||||||
# we will test things and make sure it works first
|
|
||||||
# if it fails, the reboot we started previously will automatically kick in once the timeout is reached
|
|
||||||
# and the machine will boot to the now-previous iteration
|
|
||||||
nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
|
|
||||||
--target-host "root@$host" --build-host "root@$host" \
|
|
||||||
test --show-trace
|
|
||||||
|
|
||||||
# however you like, verify the system is running as expected
|
|
||||||
# if it is, run the same command with "switch" instead of "test"
|
|
||||||
# otherwise, we will wait until the machine reboots back into the
|
|
||||||
# this is crude, but should be pretty foolproof
|
|
||||||
# the main gotcha is that the system is already unbootable or non-workable, but
|
|
||||||
# if you always use this method, that should be an impossible state to get into
|
|
||||||
|
|
||||||
# if we still have ssh access and the machine fails testing, just rollback
|
|
||||||
# instead of waiting for the reboot
|
|
||||||
ssh "root@$host" nixos-rebuild --rollback switch
|
|
||||||
```
|
|
||||||
|
|
||||||
## Provisioning New NixOS Hosts
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# establish network access
|
|
||||||
# plug in ethernet or do the wpa_cli song and dance for wifi
|
|
||||||
wpa_cli scan
|
|
||||||
wpa_cli scan_results
|
|
||||||
wpa_cli add_network 0
|
|
||||||
wpa_cli set_network 0 ssid "MY_SSID"
|
|
||||||
wpa_cli set_network 0 psk "MY_WIFI_PASSWORD"
|
|
||||||
wpa_cli enable_network 0
|
|
||||||
wpa_cli save_config
|
|
||||||
|
|
||||||
# disk encryption key (if needed)
|
|
||||||
echo -n "password" > /tmp/secret.key
|
|
||||||
|
|
||||||
# partition disks
|
|
||||||
nix-shell --packages git --run "sudo nix run \
|
|
||||||
--extra-experimental-features nix-command \
|
|
||||||
--extra-experimental-features flakes \
|
|
||||||
github:nix-community/disko -- \
|
|
||||||
--flake 'git+https://git.lyte.dev/lytedev/nix#${PARTITION_SCHEME}' \
|
|
||||||
--mode disko \
|
|
||||||
--arg disks '[ \"/dev/${DISK}\" ]'"
|
|
||||||
|
|
||||||
# install
|
|
||||||
nix-shell --packages git \
|
|
||||||
--run "sudo nixos-install \
|
|
||||||
--flake 'git+https://git.lyte.dev/lytedev/nix#${FLAKE_ATTR}' \
|
|
||||||
--option trusted-substituters 'https://cache.nixos.org https://nix.h.lyte.dev' \
|
|
||||||
--option trusted-public-keys 'cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0='"
|
|
||||||
```
|
|
||||||
|
|
||||||
# Internal Usage
|
|
||||||
|
|
||||||
Just for me, see [[lib/internal.md]]
|
|
||||||
|
|
||||||
# To Do
|
# To Do
|
||||||
|
|
||||||
|
@ -135,7 +67,6 @@ Just for me, see [[lib/internal.md]]
|
||||||
- grafana and stuff for monitoring
|
- grafana and stuff for monitoring
|
||||||
- alerts?
|
- alerts?
|
||||||
- Fonts installed by home manager instead of nixos module
|
- Fonts installed by home manager instead of nixos module
|
||||||
- Zellij config?
|
|
||||||
- Broot config?
|
- Broot config?
|
||||||
|
|
||||||
## Long Term
|
## Long Term
|
||||||
|
|
Loading…
Reference in a new issue