sane-scripts: sane-private-*: port to nix-shell

This commit is contained in:
Colin 2023-06-07 06:53:45 +00:00
parent 46edc56a32
commit 14ae501433
7 changed files with 37 additions and 6 deletions

View File

@ -195,6 +195,30 @@ let
src = ./src;
pkgs = [ "coreutils-full" ];
};
private-change-passwd = static-nix-shell.mkBash {
pname = "sane-private-change-passwd";
src = ./src;
pkgs = [ "gocryptfs" "rsync" "sane-scripts.private-unlock" ];
};
private-do = static-nix-shell.mkBash {
pname = "sane-private-do";
src = ./src;
pkgs = [ "sane-scripts.private-unlock" ];
};
private-unlock = static-nix-shell.mkBash {
pname = "sane-private-unlock";
src = ./src;
pkgs = [ "gocryptfs" ];
};
private-lock = static-nix-shell.mkBash {
pname = "sane-private-lock";
src = ./src;
};
private-init = static-nix-shell.mkBash {
pname = "sane-private-init";
src = ./src;
pkgs = [ "gocryptfs" ];
};
reclaim-boot-space = static-nix-shell.mkPython3Bin {
pname = "sane-reclaim-boot-space";
src = ./src;
@ -204,6 +228,7 @@ in
symlinkJoin {
name = "sane-scripts";
paths = [ shell-scripts ] ++ lib.attrValues nix-shell-scripts;
passthru = nix-shell-scripts;
meta = {
description = "collection of scripts associated with uninsane systems";
homepage = "https://git.uninsane.org";

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p gocryptfs -p rsync -p sane-scripts.private-unlock
set -ex

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p sane-scripts.private-unlock
# unlock the ~/private store, run some command, and then re-lock the store

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p gocryptfs
set -ex

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell -i bash
sudo umount /home/colin/private

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p gocryptfs
set -ex

View File

@ -13,9 +13,10 @@ let
# <name> = expected string in the nix-shell invocation
# <value> = package to provide
pkgsToAttrs = prefix: pkgSet: expr: ({
# branch based on the type of `expr`
"lambda" = expr: pkgsToAttrs prefix pkgSet (expr pkgSet);
"list" = expr: foldl' (acc: pname: acc // {
"${prefix + pname}" = pkgSet."${pname}";
"${prefix + pname}" = lib.getAttrFromPath (lib.splitString "." pname) pkgSet;
}) {} expr;
"set" = expr: expr;
})."${typeOf expr}" expr;