chore: use projects.toml in docs and examples

This commit is contained in:
DavHau 2022-12-07 17:44:49 +07:00
parent da780c7cdd
commit 01b5d43524
39 changed files with 282 additions and 79 deletions

View File

@ -72,6 +72,7 @@ Minimal Example `flake.nix`:
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
projects = ./projects.toml;
};
}
```
@ -86,6 +87,7 @@ Extensive Example `flake.nix`:
config.projectRoot = ./.;
source = ./.;
projects = ./projects.toml;
# Configure the behavior of dream2nix when translating projects.
# A setting applies to all discovered projects if `filter` is unset,

View File

@ -32,6 +32,7 @@ Alternatively, we can define the targets in the `flake.nix` like so:
systems = ["x86_64-linux"]; # <- This line.
config.projectRoot = ./.;
source = ./.;
projects = ./projects.toml;
};
}
```

View File

@ -24,6 +24,7 @@
inherit systems;
config.projectRoot = ./.;
source = src;
projects = ./projects.toml;
};
in
dream2nix.lib.dlib.mergeFlakes [

View File

@ -0,0 +1,9 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[prettier]
name = "prettier"
relPath = ""
subsystem = "nodejs"
translator = "yarn-lock"

View File

@ -16,12 +16,8 @@
./builders.nix
];
source = ./.;
settings = [
{
builder = "dummy";
translator = "dummy";
}
];
# The dummy discoverer will discover a project `hello` automatically.
autoProjects = true;
})
// {
checks.x86_64-linux.hello = self.packages.x86_64-linux.hello;

View File

@ -50,12 +50,12 @@
'')
];
source = src;
settings = [
{
builder = "brp-new";
translator = "cargo-toml-new";
}
];
projects.linemd = {
name = "linemd";
subsystem = "rust";
translator = "cargo-toml-new";
builder = "brp-new";
};
})
// {
# checks.x86_64-linux.linemd = self.packages.x86_64-linux.linemd;

View File

@ -0,0 +1,16 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[linemd]
name = "linemd"
relPath = ""
subsystem = "rust"
translator = "cargo-lock"
translators = [ "cargo-lock", "cargo-toml",]
[[linemd.subsystemInfo.crates]]
name = "linemd"
relPath = ""
version = "0.4.0"

View File

@ -18,11 +18,6 @@
pkgs = allPkgs;
config.projectRoot = ./.;
source = inp.src;
settings = [
{
builder = "build-rust-package";
translator = "cargo-lock";
}
];
projects = ./projects.toml;
};
}

View File

@ -0,0 +1,16 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[linemd]
name = "linemd"
relPath = ""
subsystem = "rust"
translator = "cargo-lock"
builder = "build-rust-package"
[[linemd.subsystemInfo.crates]]
name = "linemd"
relPath = ""
version = "0.4.0"

View File

@ -13,10 +13,6 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [
{
translator = "cabal-freeze";
}
];
projects = ./projects.toml;
});
}

View File

@ -0,0 +1,9 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[main]
name = "main"
relPath = ""
subsystem = "haskell"
translator = "cabal-freeze"

View File

@ -14,11 +14,7 @@
pkgs = dream2nix.inputs.nixpkgs.legacyPackages.x86_64-linux;
source = src;
config.projectRoot = ./.;
settings = [
{
translator = "cabal-plan";
}
];
projects = ./projects.toml;
})
// {
# checks.x86_64-linux.cabal2json = self.packages.x86_64-linux.cabal2json.overrideAttrs (old: {

View File

@ -0,0 +1,9 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[main]
name = "main"
relPath = ""
subsystem = "haskell"
translator = "cabal-plan"

View File

@ -14,15 +14,7 @@
pkgs = dream2nix.inputs.nixpkgs.legacyPackages.x86_64-linux;
source = src;
config.projectRoot = ./.;
settings = [
{
# Optionally, override the compiler version
subsystemInfo.compiler = {
name = "ghc";
version = "8.10.7";
};
}
];
projects = ./projects.toml;
})
// {
# checks = self.packages;

View File

@ -0,0 +1,14 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[main]
name = "main"
relPath = ""
subsystem = "haskell"
translator = "stack-lock"
translators = [ "stack-lock",]
[[main.subsystemInfo.compiler]]
name = "ghc"
version = "8.10.7"

View File

@ -14,12 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [
{
subsystemInfo.noDev = true;
aggregate = true;
}
];
projects = ./projects.toml;
})
// {
checks = self.packages;

View File

@ -0,0 +1,15 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[eslint]
name = "eslint"
relPath = ""
subsystem = "nodejs"
translator = "package-json"
translators = [ "package-json",]
[eslint.subsystemInfo]
noDev = true
noedjs = 18
aggregated = true

View File

@ -14,12 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [
{
subsystemInfo.noDev = true;
subsystemInfo.nodejs = 18;
}
];
projects = ./projects.toml;
})
// {
# checks = self.packages;

View File

@ -0,0 +1,14 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[eslint]
name = "eslint"
relPath = ""
subsystem = "nodejs"
translator = "package-json"
translators = [ "package-json",]
[eslint.subsystemInfo]
noDev = true
noedjs = 18

View File

@ -14,6 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
projects = ./projects.toml;
})
// {
checks.x86_64-linux.prettier = self.packages.x86_64-linux.prettier;

View File

@ -0,0 +1,9 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[prettier]
name = "prettier"
relPath = ""
subsystem = "nodejs"
translator = "yarn-lock"

View File

@ -11,8 +11,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
settings = [
];
autoProjects = true;
})
// {
checks = self.packages;

View File

@ -14,7 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [];
projects = ./projects.toml;
})
// {
# checks = self.packages;

View File

@ -0,0 +1,12 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
["gipetto/cowsay"]
name = "gipetto/cowsay"
relPath = ""
subsystem = "php"
translator = "composer-lock"
translators = [ "composer-lock", "composer-json",]
["gipetto/cowsay".subsystemInfo]

View File

@ -14,14 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [
{
# optionally define python version
subsystemInfo.pythonVersion = "3.8";
# optionally define extra setup requirements;
subsystemInfo.extraSetupDeps = ["cython > 0.29"];
}
];
projects = ./projects.toml;
})
// {
checks.x86_64-linux.aiohttp = self.packages.x86_64-linux.main;

View File

@ -0,0 +1,21 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[llhttp]
name = "llhttp"
relPath = "vendor/llhttp"
subsystem = "nodejs"
translator = "package-lock"
[main]
name = "main"
relPath = ""
subsystem = "python"
translator = "pip"
[llhttp.subsystemInfo]
[main.subsystemInfo]
pythonAttr = "python3"
pythonVersion = "3.8"

View File

@ -14,5 +14,6 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = goblins;
projects = ./projects.toml;
});
}

View File

@ -0,0 +1,11 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[goblins]
name = "goblins"
relPath = "goblins"
subsystem = "racket"
translator = "racket-impure"
[goblins.subsystemInfo]

View File

@ -14,12 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [
{
builder = "crane";
translator = "cargo-toml";
}
];
projects = ./projects.toml;
})
// {
# checks.x86_64-linux.linemd = self.packages.x86_64-linux.linemd;

View File

@ -0,0 +1,17 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[linemd]
name = "linemd"
relPath = ""
subsystem = "rust"
translator = "cargo-toml"
builder = "crane"
[[linemd.subsystemInfo.crates]]
name = "linemd"
relPath = ""
version = "0.4.0"

View File

@ -14,12 +14,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = src;
settings = [
{
builder = "crane";
translator = "cargo-lock";
}
];
projects = ./projects.toml;
})
// {
# checks.x86_64-linux.ripgrep = self.packages.x86_64-linux.ripgrep;

View File

@ -0,0 +1,64 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[ripgrep]
name = "ripgrep"
relPath = ""
subsystem = "rust"
translator = "cargo-lock"
translators = [ "cargo-lock", "cargo-toml",]
builder = "crane"
[ripgrep.subsystemInfo]
workspaceMembers = [ "crates/globset", "crates/grep", "crates/cli", "crates/matcher", "crates/pcre2", "crates/printer", "crates/regex", "crates/searcher", "crates/ignore",]
[[ripgrep.subsystemInfo.crates]]
name = "ripgrep"
relPath = ""
version = "13.0.0"
[[ripgrep.subsystemInfo.crates]]
name = "grep-cli"
relPath = "crates/cli"
version = "0.1.6"
[[ripgrep.subsystemInfo.crates]]
name = "globset"
relPath = "crates/globset"
version = "0.4.7"
[[ripgrep.subsystemInfo.crates]]
name = "grep"
relPath = "crates/grep"
version = "0.2.8"
[[ripgrep.subsystemInfo.crates]]
name = "ignore"
relPath = "crates/ignore"
version = "0.4.18"
[[ripgrep.subsystemInfo.crates]]
name = "grep-matcher"
relPath = "crates/matcher"
version = "0.1.5"
[[ripgrep.subsystemInfo.crates]]
name = "grep-pcre2"
relPath = "crates/pcre2"
version = "0.1.5"
[[ripgrep.subsystemInfo.crates]]
name = "grep-printer"
relPath = "crates/printer"
version = "0.1.6"
[[ripgrep.subsystemInfo.crates]]
name = "grep-regex"
relPath = "crates/regex"
version = "0.1.9"
[[ripgrep.subsystemInfo.crates]]
name = "grep-searcher"
relPath = "crates/searcher"
version = "0.1.8"

View File

@ -23,12 +23,7 @@
systems = [system];
config.projectRoot = ./.;
source = src;
settings = [
{
builder = "crane";
translator = "cargo-lock";
}
];
projects = ./projects.toml;
packageOverrides = {
# override all packages and set a toolchain
"^.*" = {

View File

@ -0,0 +1,15 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project.
[linemd]
name = "linemd"
relPath = ""
subsystem = "rust"
translator = "cargo-lock"
[[linemd.subsystemInfo.crates]]
name = "linemd"
relPath = ""
version = "0.4.0"

View File

@ -1,3 +1,3 @@
# To re-generate this file, run:
# nix run github:nix-community/dream2nix#detect-projects $source
# ... where `$source` points to the source of your project
# ... where `$source` points to the source of your project.

View File

@ -5,5 +5,6 @@
systemsFromFile = ./nix_systems;
config.projectRoot = ./.;
source = ./.;
projects = ./projects.toml;
};
}

View File

@ -23,5 +23,6 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
autoProjects = true;
});
}

View File

@ -24,5 +24,6 @@
config.projectRoot = ./.;
packageOverrides = {};
source = ./.;
autoProjects = true;
};
}

View File

@ -24,6 +24,7 @@
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
autoProjects = true;
packageOverrides = {
test = {
"check-linked-bin-version" = {