diff --git a/README.md b/README.md index 265fd41..3b0a798 100644 --- a/README.md +++ b/README.md @@ -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) -``` \ No newline at end of file +``` + +--- + +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) +``` diff --git a/common/module.nix b/common/module.nix index 7da9b3d..513a39e 100644 --- a/common/module.nix +++ b/common/module.nix @@ -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; diff --git a/common/nix.nix b/common/nix.nix index 1b588b2..dd5d510 100644 --- a/common/nix.nix +++ b/common/nix.nix @@ -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; } diff --git a/common/shell/not-aliases.nix b/common/shell/not-aliases.nix index 2243a3c..1543e77 100644 --- a/common/shell/not-aliases.nix +++ b/common/shell/not-aliases.nix @@ -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 "$@"'') ]; } diff --git a/fw/default.nix b/fw/default.nix index 346083e..c065e51 100644 --- a/fw/default.nix +++ b/fw/default.nix @@ -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; diff --git a/nixvim.nix b/nixvim.nix deleted file mode 100644 index 6960da8..0000000 --- a/nixvim.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: -{ - a = 1; -} diff --git a/nixvim/default.nix b/nixvim/default.nix new file mode 100644 index 0000000..3cc4c96 --- /dev/null +++ b/nixvim/default.nix @@ -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; + }; + }; +} diff --git a/nixvim/nixd-init.lua b/nixvim/nixd-init.lua new file mode 100644 index 0000000..91d0072 --- /dev/null +++ b/nixvim/nixd-init.lua @@ -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) diff --git a/triple-dezert/default.nix b/triple-dezert/default.nix index d261b71..5611069 100644 --- a/triple-dezert/default.nix +++ b/triple-dezert/default.nix @@ -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. 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 = "22.05"; # Did you read the comment? boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;