ydeployer via direnv

master
Yorick van Pelt 2023-04-03 15:51:22 +02:00
parent 44f4bbb79f
commit 42cb5ccb2d
Signed by: yorick
GPG Key ID: A36E70F9DC014A15
14 changed files with 1089 additions and 1659 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ result
*~
/mutt/.mutt/hcache-lock
/emacs/emacs.el
.direnv

1
deployer/.envrc Normal file
View File

@ -0,0 +1 @@
use flake ..#deployer

2
deployer/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
dist/

5
deployer/.yarnignore Normal file
View File

@ -0,0 +1,5 @@
yarn-cache
index.ts
nix.ts
ssh.ts

2
deployer/bin/ydeployer.js Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
import "../dist/index.js"

View File

@ -1,4 +1,3 @@
#!/usr/bin/env -S tsx
import { ssh, SSH } from './ssh.js'
import { Expression, BuiltOutput } from './nix.js'
@ -18,6 +17,12 @@ class Cmd {
}
async run() {
const opt = argv._[0]
if (opt == "__autocompletes") {
for (const k of Object.keys(this.registry)) {
console.log(k)
}
return
}
if (opt && this.registry[opt]) await this.registry[opt]()
else {
console.log("Possible options: \n")
@ -98,6 +103,8 @@ class MachineInterface {
_commands?: string[]
constructor(machine: Machine) {
this.machine = machine
// hack:
delete this._commands
}
@cmd
async ssh() {

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,14 @@
"test": "test"
},
"type": "module",
"bin": {
"ydeployer": "./bin/ydeployer.js"
},
"scripts": {
"watch": "exec tsc --noEmit -w",
"start": "exec tsx ./index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "exec tsup ./*.ts --dts --format esm"
},
"repository": {
"type": "git",
@ -20,6 +24,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"tsup": "^6.7.0",
"tsx": "^3.12.2",
"typescript": "^4.9.4",
"zx": "^7.1.1"

13
deployer/package.nix Normal file
View File

@ -0,0 +1,13 @@
{ buildYarnPackage }:
buildYarnPackage {
src = ./.;
postBuild = ''
yarn install --production --ignore-scripts --prefer-offline
'';
postInstall = ''
rm $out/bin/yarn
sed -i '/^cd /d' $out/bin/ydeployer
'';
meta.mainProgram = "ydeployer";
passthru.exePath = "/bin/ydeployer";
}

1006
deployer/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -235,6 +235,26 @@
"type": "github"
}
},
"nix-npm-buildpackage": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1677562139,
"narHash": "sha256-J39FdMjECbWGSXVHmEdyGBD2aRYGhg9bWEPf1/ZR47k=",
"owner": "serokell",
"repo": "nix-npm-buildpackage",
"rev": "d45296118cae672982f192451dd3e19fa6c2d068",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "nix-npm-buildpackage",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1673803274,
@ -380,6 +400,7 @@
"flake-utils": "flake-utils_2",
"home-manager": "home-manager",
"nix-index-database": "nix-index-database",
"nix-npm-buildpackage": "nix-npm-buildpackage",
"nixos-hardware": "nixos-hardware",
"nixos-mailserver": "nixos-mailserver",
"nixpkgs": "nixpkgs",

View File

@ -14,10 +14,12 @@
agenix.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-npm-buildpackage.url = "github:serokell/nix-npm-buildpackage";
nix-npm-buildpackage.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ nixpkgs, home-manager, nixpkgs-mozilla, emacs-overlay
, nixpkgs-wayland, nixpkgs-stable, nixos-hardware, agenix, flake-utils
, nix-index-database
, nix-index-database, nix-npm-buildpackage
, self
, ... }:
(flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
@ -59,6 +61,21 @@
];
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
y-deployer
];
};
devShells.deployer = pkgs.mkShell {
buildInputs = with pkgs; [
yarn
nodePackages.typescript-language-server
];
};
apps.default = flake-utils.lib.mkApp {
drv = pkgs.y-deployer;
};
# updater script for home profile
# works around https://github.com/nix-community/home-manager/issues/2848
apps.update-home = flake-utils.lib.mkApp {
@ -78,6 +95,7 @@
nixpkgs-mozilla.overlay
emacs-overlay.overlay
agenix.overlay
nix-npm-buildpackage.overlays.default
(import ./fixups.nix)
(import ./pkgs)
(import ./pkgs/mdr.nix)

View File

@ -251,6 +251,7 @@ in {
unzip
vim
xdg-utils
countfftabs
#wlrctl
## coins
@ -270,9 +271,10 @@ in {
neomutt
spotify
tdesktop
signal-desktop
virt-manager
wireshark
yubioath-flutter
#yubioath-flutter
## games
prismlauncher

View File

@ -34,5 +34,6 @@
'';
});
wayland-push-to-talk-fix = self.callPackage ./wayland-push-to-talk-fix.nix {};
y-deployer = self.callPackage ../deployer/package.nix {};
})