This commit is contained in:
Shelvacu
2024-09-04 23:37:53 -07:00
parent 0c546acefd
commit 420a2d8d02
9 changed files with 113 additions and 54 deletions

View File

@@ -1,13 +1,31 @@
more just notes for now
---
deploy:
```sh
nixos-rebuild switch --flake .#triple-dezert --target-host trip.shelvacu.com --use-remote-sudo
```
---
build flake on remote machine, including eval:
```sh
git add . && ssh trip nix flake check $(nix flake archive --to ssh://trip --json | jq .path -r)
```
```
---
search for string in closure
```sh
rg search_str $(nix path-info --recursive ./result)
```
or
```sh
rg search_str $(nix path-info --recursive .#qb.trip)
```

View File

@@ -24,19 +24,16 @@ in
};
vacu.versionInfo = mkOption { readOnly = true; };
vacu.hostName = mkOption {
type = types.str; # default = "BADDEFAULTHOSTNAME";
type = types.str;
};
vacu.shortHostName = mkOption {
type = types.str;
default = config.vacu.hostName;
};
vacu.nixvimPkg = mkOption { readOnly = true; };
};
config = {
# assertions = [{
# assertion = config.vacu.hostName != "BADDEFAULTHOSTNAME";
# message = "must set vacu.hostName";
# }];
vacu.packages = with pkgs; [
vacu.packages = (with pkgs; [
home-manager
nixos-rebuild
which
@@ -71,7 +68,7 @@ in
ssh-to-age
sops
inetutils
#neovim
neovim
diffutils
findutils
utillinux
@@ -96,15 +93,16 @@ in
killall
git
curl
]) ++ [
inputs.nix-search-cli.packages.${pkgs.system}.default
inputs.nix-inspect.packages.${pkgs.system}.default
(inputs.nixvim.legacyPackages.${pkgs.system}.makeNixvimWithModule {
extraSpecialArgs = { inherit inputs; };
module = {
imports = [ ./nixvim.nix ];
};
})
];
vacu.nixvimPkg = inputs.nixvim.legacyPackages.${pkgs.system}.makeNixvimWithModule {
extraSpecialArgs = { inherit inputs; };
module = {
imports = [ ../nixvim ];
};
};
vacu.versionId = toString (self.shortRev or self.dirtyShortRev);
vacu.versionInfo = {
id = self.rev or self.dirtyRev;

View File

@@ -28,7 +28,9 @@ in
};
vacu.nix.substituterUrls = mkOption { readOnly = true; };
vacu.nix.trustedKeys = mkOption { readOnly = true; };
vacu.nix.plainOptions = mkOption {};
};
config.vacu.nix.substituterUrls = map (c: c.url) enabledCaches;
config.vacu.nix.trustedKeys = builtins.concatMap (c: c.keys) enabledCaches;
config.vacu.nix.plainOptions.allowUnfree = true;
}

View File

@@ -1,5 +1,5 @@
# These are the things that might in a simpler time go in ~/.bashrc as aliases. But they're not aliases, cuz aliases are bad
{ pkgs, vaculib, ... }:
{ pkgs, vaculib, config, ... }:
let
inherit (pkgs) writeScriptBin;
inherit (vaculib) writeShellFunction;
@@ -7,39 +7,41 @@ in
{
vacu.packages = [
(writeScriptBin "ms" ''
set -e
if [[ $# != 1 ]]; then
echo "wrong number of args" 1>&2
exit 1
fi
set -x
mosh -- $1 screen -Rd
set -e
if [[ $# != 1 ]]; then
echo "wrong number of args" 1>&2
exit 1
fi
set -x
mosh -- $1 screen -Rd
'')
(writeScriptBin "mss" ''
set -e
if [[ $# != 1 ]]; then
echo "wrong number of args" 1>&2
exit 1
fi
set -x
mosh -- $1 sudo screen -Rd
set -e
if [[ $# != 1 ]]; then
echo "wrong number of args" 1>&2
exit 1
fi
set -x
mosh -- $1 sudo screen -Rd
'')
(writeScriptBin "rmln" ''
set -eo pipefail
for arg in "$@"; do
if [[ "$arg" != "-*" ]] && [[ ! -L "$arg" ]]; then
echo "$0: $arg is not a symlink" 1>&2
exit 1
fi
done
rm "$@"
set -eo pipefail
for arg in "$@"; do
if [[ "$arg" != "-*" ]] && [[ ! -L "$arg" ]]; then
echo "$0: $arg is not a symlink" 1>&2
exit 1
fi
done
rm "$@"
'')
(writeShellFunction "nd" ''
declare -a args
args=("$@")
mkdir "''${args[@]}" && cd "''${args[-1]}"
'')
(writeShellFunction "td" ''pushd $(mktemp "$@")'')
(writeShellFunction "nvim-plain" ''${pkgs.neovim}/bin/nvim "$@"'')
(writeShellFunction "nvim-nixvim" ''${config.vacu.nixvimPkg}/bin/nvim "$@"'')
(writeShellFunction "nvim" ''nvim-plain "$@"'')
];
}

View File

@@ -54,6 +54,8 @@
#update: it didn't work, I dunno why. Leaving this here anyways
services.fwupd.daemonSettings.EspLocation = lib.mkForce "/boot0";
networking.firewall.enable = false;
services.xserver.enable = true;
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;

View File

@@ -1,4 +0,0 @@
{ ... }:
{
a = 1;
}

28
nixvim/default.nix Normal file
View File

@@ -0,0 +1,28 @@
{ ... }: let
in
{
plugins.comment.enable = true;
plugins.surround.enable = true;
plugins.lsp = {
enable = true;
onAttach = builtins.readFile ./nixd-init.lua;
servers = {
bashls.enable = true;
jsonls.enable = true;
# nil-ls.enable = true;
nixd = {
enable = true;
};
pyright.enable = true;
tsserver.enable = true;
lua-ls.enable = true;
rust-analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
html.enable = true;
yamlls.enable = true;
};
};
}

22
nixvim/nixd-init.lua Normal file
View File

@@ -0,0 +1,22 @@
--@param client vim.lsp.Client
local function init_per_dir_nixd(client)
if client.workspace_folders == nil then
return
end
local path = client.workspace_folders[1].name
local command = client.config.cmd[1]
local name = string.gsub(command, "(.*/)(.*)", "%2")
local is_nixd = name == "nixd"
local is_nix_stuff = (path == '/home/shelvacu/dev/nix-stuff' or path == '/home/shelvacu/nix-stuff' or path == '/data/data/com.termux.nix/files/home/nix-stuff')
if is_nixd and is_nix_stuff then
local get_flake = "(builtins.getFlake \"" .. path .. "\")"
client.config.settings["nixd"].options = {
nixos = { expr = get_flake .. ".nixosConfigurations.fw.options", },
["home-manager"] = { expr = get_flake .. ".homeConfigurations.\"nix-on-droid\".options", },
["nix-on-droid"] = { expr = get_flake .. ".nixOnDroidConfigurations.default.options", },
}
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings, })
end
end
init_per_dir_nixd(client)

View File

@@ -1,8 +1,6 @@
{
config,
pkgs,
inputs,
lib,
...
}:
{
@@ -20,7 +18,7 @@
./static-stuff.nix
#./vms.nix
./networking.nix
./devver-host.nix
#./devver-host.nix
./emily.nix
./jellyfin.nix
];
@@ -44,12 +42,13 @@
services.xserver.enable = false;
vacu.packages = with pkgs; [
vacu.packages = (with pkgs; [
zfs
smartmontools
openvpn
nvme-cli
tshark
]) ++ [
config.services.postgresql.package
(pkgs.writeScriptBin "into-nix-cache" ''
if [[ $UID -ne 0 ]]; then exec sudo $0 "$@";fi
@@ -71,14 +70,6 @@
ports = [ 6922 ];
};
system.copySystemConfiguration = 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. Its 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 = "22.05"; # Did you read the comment?
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;