Skip to content
Snippets Groups Projects
Verified Commit 4c3649e7 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: add standard devenv.nix #5

parent d17cc2a6
No related branches found
No related tags found
No related merge requests found
Showing
with 105 additions and 0 deletions
{
inputs = {
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devenv.url = "github:cachix/devenv?dir=src/modules";
} // (if builtins.pathExists ./.devenv/flake.json
then builtins.fromJSON (builtins.readFile ./.devenv/flake.json)
else {});
outputs = { nixpkgs, ... }@inputs:
let
devenv = if builtins.pathExists ./.devenv/devenv.json
then builtins.fromJSON (builtins.readFile ./.devenv/devenv.json)
else {};
getOverlays = inputName: inputAttrs:
map (overlay: let
input = inputs.${inputName} or (throw "No such input `${inputName}` while trying to configure overlays.");
in input.overlays.${overlay} or (throw "Input `${inputName}` has no overlay called `${overlay}`. Supported overlays: ${nixpkgs.lib.concatStringsSep ", " (builtins.attrNames input.overlays)}"))
inputAttrs.overlays or [];
overlays = nixpkgs.lib.flatten (nixpkgs.lib.mapAttrsToList getOverlays (devenv.inputs or {}));
pkgs = import nixpkgs {
system = "x86_64-linux";
config = {
allowUnfree = devenv.allowUnfree or false;
permittedInsecurePackages = devenv.permittedInsecurePackages or [];
};
inherit overlays;
};
lib = pkgs.lib;
importModule = path:
if lib.hasPrefix "./" path
then ./. + (builtins.substring 1 255 path) + "/devenv.nix"
else if lib.hasPrefix "../" path
then throw "devenv: ../ is not supported for imports"
else let
paths = lib.splitString "/" path;
name = builtins.head paths;
input = inputs.${name} or (throw "Unknown input ${name}");
subpath = "/${lib.concatStringsSep "/" (builtins.tail paths)}";
devenvpath = "${input}" + subpath + "/devenv.nix";
in if builtins.pathExists devenvpath
then devenvpath
else throw (devenvpath + " file does not exist for input ${name}.");
project = pkgs.lib.evalModules {
specialArgs = inputs // { inherit inputs pkgs; };
modules = [
(inputs.devenv.modules + /top-level.nix)
{ devenv.cliVersion = "0.6.3"; }
] ++ (map importModule (devenv.imports or [])) ++ [
./devenv.nix
(devenv.devenv or {})
(if builtins.pathExists ./devenv.local.nix then ./devenv.local.nix else {})
];
};
config = project.config;
options = pkgs.nixosOptionsDoc {
options = builtins.removeAttrs project.options [ "_module" ];
# Unpack Nix types, e.g. literalExpression, mDoc.
transformOptions =
let isDocType = v: builtins.elem v [ "literalDocBook" "literalExpression" "literalMD" "mdDoc" ];
in lib.attrsets.mapAttrs (_: v:
if v ? _type && isDocType v._type then
v.text
else if v ? _type && v._type == "derivation" then
v.name
else
v
);
};
in {
packages."x86_64-linux" = {
optionsJSON = options.optionsJSON;
inherit (config) info procfileScript procfileEnv procfile;
ci = config.ciDerivation;
};
devenv.containers = config.containers;
devShell."x86_64-linux" = config.shell;
};
}
{"inputs": {"nixpkgs": {"url": "github:nixos/nixpkgs/nixos-23.05"}, "version": {"url": "git+https://gitlab.schukai.com/oss/utilities/version.git", "flake": true}}, "allowUnfree": false}
\ No newline at end of file
{"nixpkgs": {"url": "github:nixos/nixpkgs/nixos-23.05"}, "version": {"url": "git+https://gitlab.schukai.com/oss/utilities/version.git", "flake": true}}
\ No newline at end of file
shell-2-link
\ No newline at end of file
/nix/store/1ppns0fipd84msivyw8ypd4804zn8jli-devenv-shell-env
\ No newline at end of file
/nix/store/ishxkjwm6m1nq2dzailw41xw5rczf6hi-devenv-profile
\ No newline at end of file
v1.1.1
module github.com/agnivade/levenshtein
go 1.13
require (
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48
)
v0.0.0-20160628152529-48b4e1c0c4d0
module github.com/arbovm/levenshtein
v1.1.0
v1.1.1
module github.com/davecgh/go-spew
{"Version":"v1.1.1","Time":"2018-02-21T23:26:28Z"}
\ No newline at end of file
module github.com/davecgh/go-spew
File added
h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
\ No newline at end of file
v0.0.0-20200323201526-dd97f9abfb48
module github.com/dgryski/trifles
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment