move flake-parts into pkgs or toplevel
This commit is contained in:
19
pkgs/installer/flake-module.nix
Normal file
19
pkgs/installer/flake-module.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ self, lib, ... }:
|
||||
let
|
||||
installer = lib.nixosSystem {
|
||||
pkgs = self.inputs.nixpkgs.legacyPackages.x86_64-linux;
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
self.nixosModules.installer
|
||||
self.nixosModules.hidden-ssh-announce
|
||||
self.inputs.nixos-generators.nixosModules.all-formats
|
||||
self.inputs.disko.nixosModules.disko
|
||||
({ config, ... }: { system.stateVersion = config.system.nixos.version; })
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
flake.packages.x86_64-linux.install-iso = self.inputs.disko.lib.lib.makeDiskImage { nixosConfig = installer; };
|
||||
flake.apps.x86_64-linux.install-vm.program = installer.config.formats.vm.outPath;
|
||||
flake.apps.x86_64-linux.install-vm-nogui.program = installer.config.formats.vm-nogui.outPath;
|
||||
}
|
||||
27
pkgs/merge-after-ci/default.nix
Normal file
27
pkgs/merge-after-ci/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
perSystem =
|
||||
{ pkgs
|
||||
, self'
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
name = builtins.baseNameOf ./.;
|
||||
script = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
runtimeInputs = [
|
||||
pkgs.bash
|
||||
pkgs.coreutils
|
||||
pkgs.git
|
||||
pkgs.tea
|
||||
pkgs.openssh
|
||||
self'.packages.tea-create-pr
|
||||
];
|
||||
text = ''
|
||||
bash ${./script.sh} "$@"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.${name} = script;
|
||||
};
|
||||
}
|
||||
7
pkgs/merge-after-ci/script.sh
Normal file
7
pkgs/merge-after-ci/script.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
remoteName="${1:-origin}"
|
||||
targetBranch="${2:-main}"
|
||||
shift && shift
|
||||
tea-create-pr "$remoteName" "$targetBranch" --assignees clan-bot "$@"
|
||||
26
pkgs/tea-create-pr/default.nix
Normal file
26
pkgs/tea-create-pr/default.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
perSystem =
|
||||
{ pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
name = builtins.baseNameOf ./.;
|
||||
script = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
runtimeInputs = [
|
||||
pkgs.bash
|
||||
pkgs.coreutils
|
||||
pkgs.git
|
||||
pkgs.tea
|
||||
pkgs.openssh
|
||||
];
|
||||
text = ''
|
||||
export EDITOR=${pkgs.vim}/bin/vim
|
||||
bash ${./script.sh} "$@"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.${name} = script;
|
||||
};
|
||||
}
|
||||
31
pkgs/tea-create-pr/script.sh
Normal file
31
pkgs/tea-create-pr/script.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
remoteName="${1:-origin}"
|
||||
targetBranch="${2:-main}"
|
||||
shift && shift
|
||||
TMPDIR="$(mktemp -d)"
|
||||
currentBranch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
user="$(tea login list -o simple | cut -d" " -f4)"
|
||||
tempRemoteBranch="$user-$currentBranch"
|
||||
|
||||
git log --reverse --pretty="format:%s%n%n%b%n%n" "$remoteName/$targetBranch..HEAD" > "$TMPDIR"/commit-msg
|
||||
|
||||
$EDITOR "$TMPDIR"/commit-msg
|
||||
|
||||
COMMIT_MSG=$(cat "$TMPDIR"/commit-msg)
|
||||
|
||||
firstLine=$(echo "$COMMIT_MSG" | head -n1)
|
||||
rest=$(echo "$COMMIT_MSG" | tail -n+2)
|
||||
|
||||
if [[ "$firstLine" == "$rest" ]]; then
|
||||
rest=""
|
||||
fi
|
||||
git push --force -u "$remoteName" HEAD:refs/heads/"$tempRemoteBranch"
|
||||
|
||||
tea pr create \
|
||||
--title "$firstLine" \
|
||||
--description "$rest" \
|
||||
--head "$tempRemoteBranch" \
|
||||
--base "$targetBranch" \
|
||||
"$@"
|
||||
Reference in New Issue
Block a user