Skip to content

Commit 7487346

Browse files
committed
Add flake
1 parent d13d70b commit 7487346

File tree

5 files changed

+86
-19
lines changed

5 files changed

+86
-19
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Test"
2+
on:
3+
pull_request:
4+
push:
5+
jobs:
6+
tests:
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, macos-latest]
10+
runs-on: ${{ matrix.os }}
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- uses: cachix/install-nix-action@v10
16+
- run: nix build
17+
- run: nix-build -E '(import ./. {}).defaultPackage.${builtins.currentSystem}'
18+
#- run: nix flake check
19+
# - run: nix-build -E '(import ./. {}).checks.${builtins.currentSystem}'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![MELPA Stable](https://stable.melpa.org/packages/nix-mode-badge.svg)](https://stable.melpa.org/#/nix-mode)
55
[![Build Status](https://travis-ci.com/NixOS/nix-mode.svg?branch=master)](https://travis-ci.com/NixOS/nix-mode)
66

7-
An emacs major mode for editing nix expressions. There is also a
7+
An Emacs major mode for editing Nix expressions. There is also a
88
manual available at nix-mode.org.
99

1010
## Submodes

default.nix

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
{ pkgs ? import <nixpkgs> {}}:
2-
let
3-
inherit (pkgs) emacsWithPackages stdenvNoCC texinfo git;
4-
emacs = emacsWithPackages (epkgs: with epkgs; [
5-
org-plus-contrib
6-
company
7-
json-mode
8-
mmm-mode
9-
]);
10-
in stdenvNoCC.mkDerivation {
11-
name = "nix-mode";
1+
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
122
src = ./.;
13-
nativeBuildInputs = [ emacs texinfo git ];
14-
makeFlags = [ "PREFIX=$(out)" ];
15-
shellHook = ''
16-
echo Run make run to get vanilla emacs with nix-mode loaded.
17-
'';
18-
doCheck = true;
19-
}
3+
}).defaultNix

flake.lock

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
description = "An emacs major mode for editing Nix expressions";
3+
4+
inputs.nixpkgs.url = "nixpkgs/nixos-20.03-small";
5+
6+
outputs = { self, nixpkgs }: let
7+
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
8+
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
9+
in {
10+
packages = forAllSystems (system: with (import nixpkgs { inherit system; }); {
11+
nix-mode = let
12+
emacs = emacsWithPackages (epkgs: with epkgs; [
13+
org-plus-contrib
14+
company
15+
json-mode
16+
mmm-mode
17+
]);
18+
in stdenvNoCC.mkDerivation {
19+
name = "nix-mode";
20+
src = self;
21+
nativeBuildInputs = [ emacs texinfo git ];
22+
makeFlags = [ "PREFIX=$(out)" ];
23+
shellHook = ''
24+
echo Run make run to get vanilla emacs with nix-mode loaded.
25+
'';
26+
doCheck = true;
27+
};
28+
});
29+
30+
defaultPackage = forAllSystems (system: self.packages.${system}.nix-mode);
31+
32+
# checks are run in ‘make check’ right now we should probably move
33+
# these to its own derivation
34+
checks = forAllSystems (system: {
35+
inherit (self.packages.${system}) nix-mode;
36+
});
37+
};
38+
}

0 commit comments

Comments
 (0)