Add flake

This commit is contained in:
Erwin Boskma 2022-12-11 23:02:15 +01:00
parent 01eb7fd609
commit 4379396e1d
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
6 changed files with 217 additions and 0 deletions

8
.envrc Normal file
View file

@ -0,0 +1,8 @@
use flake
HEX_HOME="${PWD}/.nix/hex"
MIX_HOME="${PWD}/.nix/mix"
export HEX_HOME MIX_HOME
PATH_add "${MIX_HOME}/escripts"

13
default.nix Normal file
View file

@ -0,0 +1,13 @@
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).defaultNix

57
devshell.toml Normal file
View file

@ -0,0 +1,57 @@
[devshell]
packages = [
"erlang",
"libnotify",
"inotify-tools",
"gnumake",
"taplo",
]
[[env]]
name = "HEX_HOME"
eval = "${PWD}/.nix/hex"
[[env]]
name = "MIX_HOME"
eval = "${PWD}/.nix/mix"
[[env]]
name = "PATH"
prefix = "${MIX_HOME}/escripts"
[[env]]
name = "ERL_AFLAGS"
value = "-kernel shell_history enabled"
[[env]]
name = "XLA_TARGET"
value = "cpu"
# [[env]]
# name = "XLA_BUILD"
# value = "true"
[[env]]
name = "LIVEBOOK_HOME"
eval = "${PWD}"
[[env]]
name = "LIVEBOOK_TOKEN_ENABLED"
value = "false"
[[env]]
name = "LIVEBOOK_SHUTDOWN_ENABLED"
value = "true"
[[env]]
name = "LIVEBOOK_PORT"
value = "9090"
[[env]]
name = "LIVEBOOK_IFRAME_PORT"
value = "9091"
[[commands]]
name = "mix"
package = "elixir_1_14"
help = "mix"

84
flake.lock Normal file
View file

@ -0,0 +1,84 @@
{
"nodes": {
"devshell": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1667210711,
"narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=",
"owner": "numtide",
"repo": "devshell",
"rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1670597555,
"narHash": "sha256-/k939P2S2246G6K5fyvC0U2IWvULhb4ZJg9K7ZxsX+k=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2dea0f4c2d6e4603f54b2c56c22367e77869490c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

42
flake.nix Normal file
View file

@ -0,0 +1,42 @@
{
description = "A basic flake for elixir development";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, devshell, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlay ];
};
in
{
formatter = pkgs.nixpkgs-fmt;
packages = { };
devShells.default =
let
elixir_ls = pkgs.elixir_ls.override { elixir = pkgs.elixir_1_14; };
in pkgs.devshell.mkShell {
imports = [
(pkgs.devshell.importTOML ./devshell.toml)
];
devshell.packages = [ elixir_ls ];
};
});
}

13
shell.nix Normal file
View file

@ -0,0 +1,13 @@
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).shellNix