initial commit
This commit is contained in:
commit
b7ea790891
1 changed files with 941 additions and 0 deletions
62
flake.nix
Normal file
62
flake.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, ... }:
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
in
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
quadshell = final.callPackage ./package.nix { };
|
||||
};
|
||||
|
||||
packages = forAllSystems (system: {
|
||||
default = (nixpkgs.legacyPackages.${system}.extend self.overlays.default).quadshell;
|
||||
});
|
||||
|
||||
apps = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
# Just the path, the phone should already have it, so this machine doesn't need it
|
||||
quickshell = builtins.unsafeDiscardStringContext (
|
||||
nixpkgs.lib.getExe nixpkgs.legacyPackages.aarch64-linux.quickshell
|
||||
);
|
||||
in
|
||||
{
|
||||
# nix run .#phone [host]: runs the shell on the phone until Ctrl+C.
|
||||
phone = {
|
||||
type = "app";
|
||||
program = nixpkgs.lib.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "quadshell-phone";
|
||||
runtimeInputs = [
|
||||
pkgs.openssh
|
||||
pkgs.gnutar
|
||||
];
|
||||
text = ''
|
||||
host=''${1:-phone}
|
||||
dest=.cache/quadshell-dev
|
||||
|
||||
# The store's files are read-only, which would stop the next run replacing them
|
||||
# shellcheck disable=SC2029
|
||||
tar -C ${self}/src --mode=u+w -c . | ssh "$host" "rm -rf $dest; mkdir -p $dest; tar -C $dest -x"
|
||||
|
||||
# shellcheck disable=SC2029
|
||||
exec ssh -t "$host" "
|
||||
nix-store --realise ${builtins.dirOf (builtins.dirOf quickshell)} >/dev/null;
|
||||
pkill -f '^/nix/store/[^ ]*/bin/quickshell ';
|
||||
exec systemd-run --user --pty --quiet --collect ${quickshell} --path ~/$dest
|
||||
"
|
||||
'';
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue