move ci to flake
This commit is contained in:
parent
c9cb2ab0de
commit
1a2bc3021c
23 changed files with 99 additions and 37 deletions
2
.github/workflows/pr.yml
vendored
2
.github/workflows/pr.yml
vendored
|
|
@ -9,4 +9,6 @@ jobs:
|
|||
- uses: cachix/install-nix-action@v14
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- run: ./ci/test.sh
|
||||
|
|
|
|||
4
.github/workflows/update.yml
vendored
4
.github/workflows/update.yml
vendored
|
|
@ -17,6 +17,8 @@ jobs:
|
|||
- uses: cachix/install-nix-action@v14
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- name: update nur / nur-combined
|
||||
run: ./ci/update-nur.sh
|
||||
env:
|
||||
|
|
@ -29,6 +31,8 @@ jobs:
|
|||
- uses: cachix/install-nix-action@v14
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- name: update nur-search/data/packages.json
|
||||
run: ./ci/update-nur-search.sh
|
||||
env:
|
||||
|
|
|
|||
2
bin/nur
2
bin/nur
|
|
@ -4,7 +4,7 @@ import sys
|
|||
import os
|
||||
|
||||
sys.path.insert(0, os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
|
||||
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "ci"))
|
||||
|
||||
from nur import main
|
||||
|
||||
|
|
|
|||
43
ci/flake.lock
generated
Normal file
43
ci/flake.lock
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1631561581,
|
||||
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1633329294,
|
||||
"narHash": "sha256-0LpQLS4KMgxslMgmDHmxG/5twFlXDBW9z4Or1iOrCvU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ee084c02040e864eeeb4cf4f8538d92f7c675671",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
12
ci/flake.nix
Normal file
12
ci/flake.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
description = "Internal flake for ci tasks of NUR";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system: {
|
||||
packages.nur = nixpkgs.legacyPackages.${system}.python3.pkgs.callPackage ./nur.nix {};
|
||||
defaultPackage = self.packages.${system}.nur;
|
||||
});
|
||||
}
|
||||
13
ci/nur.nix
Normal file
13
ci/nur.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ buildPythonApplication, lib, nix-prefetch-git, git, nixUnstable, glibcLocales }:
|
||||
|
||||
buildPythonApplication {
|
||||
name = "nur";
|
||||
src = ./.;
|
||||
|
||||
doCheck = false;
|
||||
|
||||
makeWrapperArgs = [
|
||||
"--prefix" "PATH" ":" "${lib.makeBinPath [ nix-prefetch-git git nixUnstable ]}"
|
||||
"--set" "LOCALE_ARCHIVE" "${glibcLocales}/lib/locale/locale-archive"
|
||||
];
|
||||
}
|
||||
22
ci/test.sh
22
ci/test.sh
|
|
@ -1,16 +1,11 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -p bash -i bash -p python3Packages.mypy -p python3Packages.black -p python3Packages.flake8 -p nix
|
||||
#!nix-shell -p bash -i bash -p python3Packages.mypy -p python3Packages.black -p python3Packages.flake8 -p nixUnstable
|
||||
|
||||
set -eux -o pipefail # Exit with nonzero exit code if anything fails
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur format-manifest
|
||||
if [ -n "$(git diff --exit-code repos.json)" ]; then
|
||||
echo "repos.json was not formatted before committing repos.json:" >&2
|
||||
git diff --exit-code repos.json
|
||||
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
|
||||
exit 1
|
||||
fi
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
cd "${DIR}"
|
||||
# Type checker
|
||||
mypy nur
|
||||
# Format checker
|
||||
|
|
@ -18,5 +13,14 @@ black --check .
|
|||
# Linter
|
||||
flake8 .
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur update
|
||||
cd "${DIR}/.."
|
||||
nix run "${DIR}#" -- format-manifest
|
||||
if [ -n "$(git diff --exit-code repos.json)" ]; then
|
||||
echo "repos.json was not formatted before committing repos.json:" >&2
|
||||
git diff --exit-code repos.json
|
||||
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
nix run "${DIR}#" -- update
|
||||
nix-build
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -p git -p nix -p bash -i bash
|
||||
#!nix-shell -p git -p nixUnstable -p bash -i bash
|
||||
|
||||
set -eu -o pipefail # Exit with nonzero exit code if anything fails
|
||||
|
||||
|
|
@ -12,13 +12,15 @@ set -x
|
|||
# build package.json for nur-search
|
||||
# ---------------------------------
|
||||
|
||||
nix-build --quiet release.nix
|
||||
nix build "${DIR}#"
|
||||
|
||||
git clone --single-branch "https://$API_TOKEN_GITHUB@github.com/nix-community/nur-combined.git"
|
||||
cd "${DIR}/.."
|
||||
|
||||
git clone --recurse-submodules "https://$API_TOKEN_GITHUB@github.com/nix-community/nur-search.git"
|
||||
git clone --single-branch "https://${API_TOKEN_GITHUB:-git}@github.com/nix-community/nur-combined.git" || git -C nur-combined pull
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur index nur-combined > nur-search/data/packages.json
|
||||
git clone --recurse-submodules "https://${API_TOKEN_GITHUB:-git}@github.com/nix-community/nur-search.git" || git -C nur-search pull
|
||||
|
||||
nix run "${DIR}#" -- index nur-combined > nur-search/data/packages.json
|
||||
|
||||
# rebuild and publish nur-search repository
|
||||
# -----------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -p git -p nix -p bash -i bash
|
||||
#!nix-shell -p git -p nixUnstable -p bash -i bash
|
||||
|
||||
set -eu -o pipefail # Exit with nonzero exit code if anything fails
|
||||
|
||||
|
|
@ -9,17 +9,14 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|||
source ${DIR}/lib/setup-git.sh
|
||||
set -x
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur update
|
||||
nix-build
|
||||
nix run ${DIR}# -- update
|
||||
|
||||
cd ${DIR}/..
|
||||
|
||||
git clone \
|
||||
--single-branch \
|
||||
"https://$API_TOKEN_GITHUB@github.com/nix-community/nur-combined.git"
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur combine \
|
||||
--irc-notify nur-bot@chat.freenode.net:6697/nixos-nur \
|
||||
nur-combined
|
||||
|
||||
if [[ -z "$(git diff --exit-code)" ]]; then
|
||||
echo "No changes to the output on this push; exiting."
|
||||
else
|
||||
|
|
|
|||
15
release.nix
15
release.nix
|
|
@ -1,15 +0,0 @@
|
|||
{ nixpkgs ? import <nixpkgs> }:
|
||||
|
||||
with import <nixpkgs> {};
|
||||
|
||||
python3Packages.buildPythonApplication {
|
||||
name = "nur";
|
||||
src = ./.;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
makeWrapperArgs = [
|
||||
"--prefix" "PATH" ":" "${pkgs.lib.makeBinPath [ nix-prefetch-git git nix ]}"
|
||||
"--set" "LOCALE_ARCHIVE" "${glibcLocales}/lib/locale/locale-archive"
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue