diff --git a/flake.nix b/flake.nix index 592d559..13fe091 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,10 @@ nixos-nspawn.url = "github:tfc/nspawn-nixos"; nixos-nspawn.flake = false; # we don't use it /shrug + # https://github.com/nix-community/nix-unit + /* nix-unit.url = "github:nix-community/nix-unit"; */ + /* nix-unit.inputs.nixpkgs.follows = "nixpkgs-edge"; */ + # https://github.com/wamserma/flake-programs-sqlite #flake-programs-sqlite-2311.url = "github:wamserma/flake-programs-sqlite"; #flake-programs-sqlite-2311.inputs.nixpkgs.follows = "nixpkgs-2311"; @@ -441,5 +445,30 @@ remoteenv-fhs = mkShell { inheritFrom = [ remoteenv ]; } [ system-manager ]; }); + /* + checks = forAllSystems ({ pkgs, inputs, system }: { + unitTests = pkgs.runCommand "tests" { + nativeBuildInputs = [ inputs.nix-unit.packages.${system}.default ]; + } '' + export HOME="$(realpath .)" + # The nix derivation must be able to find all used inputs in the nix-store because it cannot download it during buildTime. + nix-unit --eval-store "$HOME" \ + --extra-experimental-features flakes \ + --override-input nixpkgs ${inputs.nixpkgs} \ + --flake ${self}#unitTests + touch $out + ''; + }); + + unitTests = let + doesEval = x: { + expr = (builtins.tryEval x).success; + expected = true; + }; + in { + # https://nix-community.github.io/nix-unit/ + }; + */ + }; } diff --git a/justfile b/justfile index fbebd2b..86636e3 100644 --- a/justfile +++ b/justfile @@ -10,10 +10,19 @@ export FZF_DEFAULT_OPTS := "--height 15 --cycle --bind 'ctrl-a:toggle-all' " + e @_default: just "$(gum filter --placeholder "Pick a recipie..." $(just --summary --unsorted))" -eval hostname=`just _a_host`: - nix eval ".#nixosConfigurations.\"{{hostname}}\".config.system.build.toplevel.outPath" --show-trace -eval-vm hostname=`just _a_host`: - nix eval ".#nixosConfigurations.\"{{hostname}}\".config.system.build.vm.outPath" --show-trace +# @eval $hostname=`just _a_host` $attrpath="" *_="_sentinel_": +@eval $hostname=`just _a_host` $attrpath="" *_: + attrpath="${attrpath:-system.build.toplevel.outPath}"; \ + args=("${@:3}"); \ + # [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}"); \ + set -x; nix eval ".#nixosConfigurations.\"$hostname\".config.$attrpath" --show-trace "${args[@]}" +# @eval-vm $hostname=`just _a_host` $attrpath="" *_="_sentinel_": +@eval-vm $hostname=`just _a_host` $attrpath="" *_: + # nix eval ".#nixosConfigurations.\"$hostname\".config.system.build.vm.outPath" --show-trace "${@:2}" + attrpath="${attrpath:-system.build.toplevel.outPath}"; \ + args=("${@:3}"); \ + # [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}"); \ + set -x; nix eval ".#nixosConfigurations.\"$hostname\".config.virtualisation.vmVariant.$attrpath" --show-trace "${args[@]}" repl $hostname=`just _a_host`: NIX_NO_NOM=1 nixos-rebuild --flake .#"$hostname" repl diff --git a/todos.md b/todos.md index 2df2f07..46a4380 100644 --- a/todos.md +++ b/todos.md @@ -5,6 +5,15 @@ * [ ] nixos mobile * [ ] home-manager on fhs distro * [ ] system-manager with nix-system-graphics and systemd stuff +# non-nix +* [ ] a better joinLines micro plugin +* [ ] a joinLines zed plugin +* [ ] a copy-as-rich-text for micro using pandoc +* [ ] a copy-as-rich-text for zed using pandoc? +* [ ] a align-lines plugin for micro +* [ ] a align-lines plugin for zed +* [ ] toggle-markdown-checkbox plugin for micro +* [ ] toggle-markdown-checkbox plugin for zed # nice to have * [ ] move mkNixos mkHome mkSystem mkBsd etc out of flake.nix * [ ] make `just build` detect which of nixos-rebuild/home-manage/system-manager to use diff --git a/users/pbsds/home/profiles/bashrc.d/nix-fd.sh b/users/pbsds/home/profiles/bashrc.d/nix-fd.sh index c4c3d1a..f842751 100644 --- a/users/pbsds/home/profiles/bashrc.d/nix-fd.sh +++ b/users/pbsds/home/profiles/bashrc.d/nix-fd.sh @@ -55,7 +55,9 @@ _nix_fd() ( readarray -d $'\n' -t storepaths < <( "$nix" build "${nix_args[@]}" "${nix_flags[@]}" --print-out-paths --no-link ) - fd "${fd_pattern[@]}" "${storepaths[@]}" "${fd_flags[@]}" + if [[ "${#storepaths[@]}" -gt 0 ]]; then + fd "${fd_pattern[@]}" "${storepaths[@]}" "${fd_flags[@]}" + fi ) nix-fd() { _nix_fd "nix" "$@"; } diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix index 29a5146..b3461be 100644 --- a/users/pbsds/home/profiles/shell.nix +++ b/users/pbsds/home/profiles/shell.nix @@ -72,9 +72,19 @@ in changeDirWidgetOptions = [ "--preview 'tree -C {} | head -200'" ]; # ctrl-t - fileWidgetCommand = "fd --type f"; # respects .gitignore + # fileWidgetCommand = "fd . --type file"; # respects .gitignore + fileWidgetCommand = "fd . | sort --ignore-case --general-numeric-sort"; # respects .gitignore fileWidgetOptions = [ + "--bind 'home:first'" + "--bind 'end:last'" + "--cycle" + #"--preview 'head {}'" + # "--preview 'bat {}'" + # "--preview 'tail -n$LINES {} | bat --file-name {} --paging never --style plain'" + # "--preview 'bat {} --paging never --style plain' --preview-window follow" + "--preview 'if [[ -f {} ]]; then tail -n$LINES {} | bat --paging=never --style=plain --color=always --file-name {} ; else file {} ; fi' --preview-window follow" + # https://github.com/junegunn/fzf/discussions/3363#discussioncomment-6419463 "--bind 'ctrl-a:reload:eval $FZF_DEFAULT_COMMAND --no-ignore'" ]; @@ -95,9 +105,9 @@ in #programs.zoxide.enable = true; #programs.zoxide.options = [ "--cmd cd --cmd dc" ]; - # https://carapace-sh.github.io/carapace-bin/completers.html - programs.carapace.enable = true; # completions - programs.bash.sessionVariables.CARAPACE_EXCLUDES = "just"; # comma-separated + # # https://carapace-sh.github.io/carapace-bin/completers.html + # programs.carapace.enable = true; # completions + # programs.bash.sessionVariables.CARAPACE_EXCLUDES = "just"; # comma-separated # i can't type home.shellAliases.sl = "ls";