mirror of
https://github.com/nix-community/emacs-overlay.git
synced 2025-12-06 02:40:25 -08:00
Migrate repo to new nix-community layout
This commit is contained in:
parent
aa1d14d8c2
commit
65699a664a
21 changed files with 118 additions and 158 deletions
15
.ci/cron
Executable file
15
.ci/cron
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# Note: This script is executed from git root
|
||||
set -exuo pipefail
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
function finish {
|
||||
rm -rf $HOME
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
nix-shell -p git --run 'git config --global user.name "emacs-overlay"'
|
||||
nix-shell -p git --run 'git config --global user.email "emacs-overlay@nix-community"'
|
||||
|
||||
./update
|
||||
./.ci/push
|
||||
BIN
.ci/exwm-overlay-key.enc
Normal file
BIN
.ci/exwm-overlay-key.enc
Normal file
Binary file not shown.
1
.ci/exwm-overlay-key.pub
Normal file
1
.ci/exwm-overlay-key.pub
Normal file
|
|
@ -0,0 +1 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIJIKt9dZ5Z3CcIN0XU61Bmrbm4TXPZ54Gwe3U66rH5m exwm-overlay-key
|
||||
15
.ci/push
Executable file
15
.ci/push
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p openssl git openssh
|
||||
set -euo pipefail
|
||||
|
||||
# Note: This script is executed from git root
|
||||
|
||||
export TMP_PLAIN=$(mktemp)
|
||||
function finish {
|
||||
rm -rf $TMP_PLAIN
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
openssl enc -aes-256-cbc -d -in ./.ci/exwm-overlay-key.enc -out $TMP_PLAIN -k $SSH_KEY_PASSPHRASE
|
||||
|
||||
git push origin master
|
||||
17
.travis.yml
17
.travis.yml
|
|
@ -1,17 +0,0 @@
|
|||
language: nix
|
||||
os: linux
|
||||
env:
|
||||
global:
|
||||
- SSH_KEY="/tmp/deploy_rsa"
|
||||
- TARGET_BRANCH="master"
|
||||
- DEPLOY_BRANCH="master"
|
||||
- GIT_NAME="EXWM-Updater"
|
||||
- GIT_EMAIL="exwm-updater@example.org"
|
||||
- NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_88023bb2dbf0_key -iv $encrypted_88023bb2dbf0_iv -in .travis/deploy_rsa.enc -out $SSH_KEY -d
|
||||
|
||||
script:
|
||||
- "./update"
|
||||
after_success:
|
||||
- "./.travis/deploy.sh"
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
* Set up of ssh key
|
||||
#+begin_src sh
|
||||
# Generate SSH key
|
||||
ssh-keygen -t rsa -b 4096 -C 'build@travis-ci.org' -f ./.travis/deploy_rsa
|
||||
|
||||
# Get the travis util
|
||||
nix-shell --run fish -p travis
|
||||
|
||||
# Generate a github access token to use with travis:
|
||||
# https://github.com/settings/tokens
|
||||
#
|
||||
# I gave it all scopes for user and repo.
|
||||
|
||||
# Log in to travis
|
||||
travis login --user etu --github-token <your-token-here>
|
||||
|
||||
# Encrypt the file using travis
|
||||
travis encrypt-file .travis/deploy_rsa --add
|
||||
|
||||
# Move the encrypted file to the travis directory
|
||||
mv deploy_rsa.enc .travis/
|
||||
|
||||
# Add the public key as a deploy key to the repo with write-access:
|
||||
# https://github.com/adisbladis/exwm-overlay/settings/keys/new
|
||||
cat .travis/deploy_rsa.pub
|
||||
|
||||
# Remove secret private and the public key
|
||||
rm -rf .travis/deploy_rsa .travis/deploy_rsa.pub
|
||||
|
||||
# Then just go ahead and commit .travis/deploy_rsa
|
||||
#+end_src
|
||||
|
||||
* Set up travis build
|
||||
Copy my =.travis.yml= file. Alter the names of the the variables in
|
||||
=before_install= based on the names of the names of the variables here:
|
||||
https://travis-ci.org/etu/exwm-overlay/settings
|
||||
|
||||
You should also make a copy of =.travis/deploy.sh=.
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
REPO=$(git config remote.origin.url)
|
||||
|
||||
if [ -n "$TRAVIS_BUILD_ID" ]; then
|
||||
# When running on Travis we need to use SSH to deploy to GitHub
|
||||
#
|
||||
# The following converts the repo URL to an SSH location,
|
||||
# decrypts the SSH key and sets up the Git config with
|
||||
# the correct user name and email (globally as this is a
|
||||
# temporary travis environment)
|
||||
#
|
||||
# Set the following environment variables in the travis configuration (.travis.yml)
|
||||
#
|
||||
# DEPLOY_BRANCH - The only branch that Travis should deploy from
|
||||
# GIT_NAME - The Git user name
|
||||
# GIT_EMAIL - The Git user email
|
||||
#
|
||||
echo GIT_NAME: $GIT_NAME
|
||||
echo GIT_EMAIL: $GIT_EMAIL
|
||||
|
||||
if [ "$TRAVIS_BRANCH" != "$DEPLOY_BRANCH" ]; then
|
||||
echo "Travis should only deploy from the DEPLOY_BRANCH ($DEPLOY_BRANCH) branch"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
echo "Travis should not deploy from pull requests"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Switch both git and https protocols as we don't know which travis
|
||||
# is using today (it changed in the past!)
|
||||
REPO=${REPO/git:\/\/github.com\//git@github.com:}
|
||||
REPO=${REPO/https:\/\/github.com\//git@github.com:}
|
||||
|
||||
# Add SSH key to SSH agent
|
||||
chmod 600 $SSH_KEY
|
||||
eval `ssh-agent -s`
|
||||
ssh-add $SSH_KEY
|
||||
|
||||
git config --global user.name "$GIT_NAME"
|
||||
git config --global user.email "$GIT_EMAIL"
|
||||
|
||||
# Set a rw remote
|
||||
git remote set-url origin $REPO
|
||||
|
||||
# Checkout master
|
||||
git fetch origin
|
||||
git checkout master
|
||||
|
||||
# Add changes
|
||||
git add repos/
|
||||
|
||||
# Commit changes
|
||||
git commit -m "Built from commit $REV"
|
||||
|
||||
# Push changes
|
||||
git push $REPO $TARGET_BRANCH
|
||||
fi
|
||||
Binary file not shown.
|
|
@ -1,7 +1,9 @@
|
|||
[[https://travis-ci.org/adisbladis/exwm-overlay][https://api.travis-ci.org/adisbladis/exwm-overlay.svg?branch=master]]
|
||||
|
||||
* EXWM-overlay for NixOS
|
||||
** Contents of the overlay
|
||||
|
||||
*** Melpa / Melpa stable
|
||||
Daily generations of Melpa & Melpa stable attribute sets.
|
||||
|
||||
*** EXWM & needed dependencies
|
||||
This overlay provides fresh versions of EXWM and dependencies. This is
|
||||
updated daily.
|
||||
|
|
@ -28,7 +30,7 @@ cause compilation time.
|
|||
#+BEGIN_SRC nix
|
||||
nixpkgs.overlays = [
|
||||
(import (builtins.fetchTarball {
|
||||
url = https://github.com/adisbladis/exwm-overlay/archive/master.tar.gz;
|
||||
url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
|
||||
}))
|
||||
];
|
||||
#+END_SRC
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ self: super:
|
|||
let
|
||||
|
||||
mkExDrv = emacsPackagesNg: name: args: let
|
||||
repoMeta = super.lib.importJSON (./. + "/repos/${name}.json");
|
||||
repoMeta = super.lib.importJSON (./repos/exwm/. + "/${name}.json");
|
||||
in emacsPackagesNg.melpaBuild (args // {
|
||||
pname = name;
|
||||
ename = name;
|
||||
|
|
@ -22,7 +22,7 @@ let
|
|||
in {
|
||||
|
||||
emacsGit = let
|
||||
repoMeta = super.lib.importJSON (./. + "/repos/emacs.json");
|
||||
repoMeta = super.lib.importJSON ./repos/emacs/emacs.json;
|
||||
in (super.emacs.override { srcRepo = true; }).overrideAttrs(old: {
|
||||
name = "emacs-git-${repoMeta.version}";
|
||||
inherit (repoMeta) version;
|
||||
|
|
@ -41,11 +41,11 @@ in {
|
|||
(super.emacsPackagesNgFor emacs).overrideScope'(eself: esuper: let
|
||||
|
||||
melpaStablePackages = esuper.melpaStablePackages.override {
|
||||
archiveJson = ./repos/recipes-archive-melpa.json;
|
||||
archiveJson = ./repos/melpa/recipes-archive-melpa.json;
|
||||
};
|
||||
|
||||
melpaPackages = esuper.melpaPackages.override {
|
||||
archiveJson = ./repos/recipes-archive-melpa.json;
|
||||
archiveJson = ./repos/melpa/recipes-archive-melpa.json;
|
||||
};
|
||||
|
||||
# TODO: Org/elpa packages
|
||||
|
|
|
|||
7
repos/emacs/test.nix
Normal file
7
repos/emacs/test.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ pkgs ? import <nixpkgs> { overlays = [ (import ../../default.nix) ]; } }:
|
||||
|
||||
let
|
||||
package = pkgs.emacsGit;
|
||||
emacsPackages = pkgs.emacsPackagesNgGen package;
|
||||
emacsWithPackages = emacsPackages.emacsWithPackages;
|
||||
in emacsWithPackages(epkgs: [ ])
|
||||
23
repos/emacs/update
Executable file
23
repos/emacs/update
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl xmlstarlet nix coreutils
|
||||
set -euxo pipefail
|
||||
|
||||
function update_repo() {
|
||||
owner=$1
|
||||
repo=$2
|
||||
echo $repo
|
||||
|
||||
# Get relevant data (commit id and timestamp) for the latest commit
|
||||
commit_data=$(curl "https://github.com/$owner/$repo/commits/master.atom" | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v "concat(atom:id,'/',atom:updated)" -n | head -n 1)
|
||||
|
||||
# Extract commit sha and build a version number based on date: YYYYMMDD.0
|
||||
commit_sha=$(echo $commit_data | cut -d '/' -f 2)
|
||||
version_number=$(echo $commit_data | cut -d '/' -f 3 | cut -d 'T' -f 1 | sed 's/-//g').0
|
||||
|
||||
digest=$(nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/${commit_sha}.tar.gz")
|
||||
echo "{\"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > repos/$repo.json
|
||||
}
|
||||
|
||||
update_repo emacs-mirror emacs
|
||||
|
||||
nix-build --no-out-link --show-trace ./test.nix
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs ? import <nixpkgs> { overlays = [ (import ./default.nix) ]; } }:
|
||||
{ pkgs ? import <nixpkgs> { overlays = [ (import ../../default.nix) ]; } }:
|
||||
|
||||
let
|
||||
package = pkgs.emacsGit;
|
||||
package = pkgs.emacs;
|
||||
emacsPackages = pkgs.emacsPackagesNgGen package;
|
||||
emacsWithPackages = emacsPackages.emacsWithPackages;
|
||||
in emacsWithPackages(epkgs: [
|
||||
24
repos/exwm/update
Executable file
24
repos/exwm/update
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl xmlstarlet nix coreutils
|
||||
set -euxo pipefail
|
||||
|
||||
function update_repo() {
|
||||
owner=$1
|
||||
repo=$2
|
||||
echo $repo
|
||||
|
||||
# Get relevant data (commit id and timestamp) for the latest commit
|
||||
commit_data=$(curl "https://github.com/$owner/$repo/commits/master.atom" | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v "concat(atom:id,'/',atom:updated)" -n | head -n 1)
|
||||
|
||||
# Extract commit sha and build a version number based on date: YYYYMMDD.0
|
||||
commit_sha=$(echo $commit_data | cut -d '/' -f 2)
|
||||
version_number=$(echo $commit_data | cut -d '/' -f 3 | cut -d 'T' -f 1 | sed 's/-//g').0
|
||||
|
||||
digest=$(nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/${commit_sha}.tar.gz")
|
||||
echo "{\"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > $repo.json
|
||||
}
|
||||
|
||||
update_repo ch11ng exwm
|
||||
update_repo ch11ng xelb
|
||||
|
||||
nix-build --no-out-link --show-trace ./test.nix
|
||||
11
repos/melpa/test.nix
Normal file
11
repos/melpa/test.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
let
|
||||
|
||||
pkgs = import <nixpkgs> {
|
||||
overlays = [
|
||||
(import ../../default.nix)
|
||||
];
|
||||
};
|
||||
|
||||
in {
|
||||
inherit (pkgs.emacsPackagesNg) melpaStablePackages melpaPackages;
|
||||
}
|
||||
6
repos/melpa/update
Executable file
6
repos/melpa/update
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p bash
|
||||
set -euxo pipefail
|
||||
# eval $(nix-instantiate --eval --expr 'let nixpath = builtins.toString (import <nixpkgs> {}).path; in "${nixpath}/pkgs/applications/editors/emacs-modes/update-melpa"')
|
||||
env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ./test.nix -A melpaStablePackages
|
||||
env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ./test.nix -A melpaPackages
|
||||
37
update
37
update
|
|
@ -1,33 +1,6 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl xmlstarlet nix coreutils
|
||||
set -euxo pipefail
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
function update_repo() {
|
||||
owner=$1
|
||||
repo=$2
|
||||
echo $repo
|
||||
|
||||
# Get relevant data (commit id and timestamp) for the latest commit
|
||||
commit_data=$(curl "https://github.com/$owner/$repo/commits/master.atom" | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v "concat(atom:id,'/',atom:updated)" -n | head -n 1)
|
||||
|
||||
# Extract commit sha and build a version number based on date: YYYYMMDD.0
|
||||
commit_sha=$(echo $commit_data | cut -d '/' -f 2)
|
||||
version_number=$(echo $commit_data | cut -d '/' -f 3 | cut -d 'T' -f 1 | sed 's/-//g').0
|
||||
|
||||
digest=$(nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/${commit_sha}.tar.gz")
|
||||
echo "{\"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > repos/$repo.json
|
||||
}
|
||||
|
||||
function update_melpa() {
|
||||
cd repos
|
||||
eval $(nix-instantiate --eval --expr 'let nixpath = builtins.toString (import <nixpkgs> {}).path; in "${nixpath}/pkgs/applications/editors/emacs-modes/update-melpa"')
|
||||
cd -
|
||||
}
|
||||
|
||||
update_repo ch11ng exwm
|
||||
update_repo ch11ng xelb
|
||||
update_repo emacs-mirror emacs
|
||||
|
||||
update_melpa
|
||||
|
||||
nix-build --no-out-link --show-trace ./test.nix
|
||||
for repo in repos/*; do
|
||||
$repo/update && (git diff --exit-code $repo > /dev/null || git commit -m "Updated $repo" -- $repo)
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue