tooling: linux fixes, add nix flake and workflow
This commit is contained in:
parent
0890b09fc2
commit
a830d5ddb5
28
.github/workflows/sync.yml
vendored
Normal file
28
.github/workflows/sync.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: "sync from forge.joshwel.co"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v27
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: get the forge's repo
|
||||
run: |
|
||||
mkdir -p ${{ runner.temp }}/sota
|
||||
git clone https://forge.joshwel.co/mark/sota ${{ runner.temp }}/sota
|
||||
|
||||
- name: restep
|
||||
run: |
|
||||
cd ${{ runner.temp }}/sota
|
||||
nix develop --command python sync.py
|
61
flake.lock
Normal file
61
flake.lock
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1722062969,
|
||||
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
28
flake.nix
Normal file
28
flake.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
description = "flake for running the sota staircase ReStepper";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
with pkgs; {
|
||||
devShells.default = mkShellNoCC {
|
||||
buildInputs = [
|
||||
git
|
||||
git-lfs
|
||||
git-filter-repo
|
||||
(python312.withPackages (python-pkgs: [
|
||||
python-pkgs.tqdm
|
||||
python-pkgs.gitignore-parser
|
||||
]))
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -92,7 +92,7 @@ def run(
|
|||
try:
|
||||
cp = _run(
|
||||
command,
|
||||
shell=True if isinstance(command, list) else False,
|
||||
shell=False if isinstance(command, list) else True,
|
||||
cwd=cwd,
|
||||
capture_output=capture_output,
|
||||
input=give_input.encode() if give_input else None,
|
||||
|
|
4
sync.py
4
sync.py
|
@ -215,7 +215,7 @@ def post_filter_repo_check(cp: CompletedProcess) -> CompletedProcess:
|
|||
# install git-filter-repo
|
||||
pip_invocation: list[str] = ["pipx"] if use_pipx else [executable, "-m", "pip"]
|
||||
print(
|
||||
f"running '{' '.join([*pip_invocation, "install", "git-filter-repo"])}'... ",
|
||||
f"running '{' '.join([*pip_invocation, 'install', 'git-filter-repo'])}'... ",
|
||||
end="",
|
||||
flush=True,
|
||||
)
|
||||
|
@ -571,7 +571,7 @@ def main() -> None:
|
|||
)
|
||||
|
||||
def add_and_commit() -> CompletedProcess:
|
||||
cp = cmd("git add *")()
|
||||
cp = cmd("git add -A")()
|
||||
if cp.returncode != 0:
|
||||
return cp
|
||||
return cmd(
|
||||
|
|
Reference in a new issue