Skip to content

Commit 33ea788

Browse files
authored
[plugins] flakes should be in own dir (#1626)
## Summary **What this fixes:** When plugins create flake in a directory shared with other files, `nix search` can break. (We use `nix search` to determine output path). For example in the mysql plugin the flake would live side-by-side with the `run` directory which has a sock file. `nix search` would recurse in that directory and try to search for nix expressions and break because the file had an unexpected format. **How it was surfaced:** This issue was previously hidden because we don't call `nix search` if a package has already been installed. The bug fixed in #1625 was causing us to needlessly call `nix search` on stuff that was already **Solution:** The partial solution in this PR is to always create the flake in its own dir. This is a bit fragile, e.g. someone can forget if writing their own plugin. Longer term, we need a better way to extract the output path from a custom flake. (I think `nix flake show` could do it without causing the issues surfaced by search) ## How was it tested? CICD tests all plugins with exampels.
1 parent cca5828 commit 33ea788

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

plugins/haskell.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "haskell",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"readme": "Haskell plugin",
55
"__packages": [
6-
"path:{{ .Virtenv }}"
6+
"path:{{ .Virtenv }}/flake"
77
],
88
"__remove_trigger_package": true,
99
"create_files": {
10-
"{{ .Virtenv }}/flake.nix": "haskell/flake.nix"
10+
"{{ .Virtenv }}/flake/flake.nix": "haskell/flake.nix"
1111
}
1212
}

plugins/mariadb.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mariadb",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"readme": "* This plugin wraps mysqld and mysql_install_db to work in your local project\n* This plugin will create a new database for your project in MYSQL_DATADIR if one doesn't exist on shell init\n* Use mysqld to manually start the server, and `mysqladmin -u root shutdown` to manually stop it",
55
"env": {
66
"MYSQL_BASEDIR": "{{ .DevboxProfileDefault }}",
@@ -11,12 +11,12 @@
1111
},
1212
"create_files": {
1313
"{{ .Virtenv }}/run": "",
14-
"{{ .Virtenv }}/flake.nix": "mariadb/flake.nix",
14+
"{{ .Virtenv }}/flake/flake.nix": "mariadb/flake.nix",
1515
"{{ .Virtenv }}/setup_db.sh": "mariadb/setup_db.sh",
1616
"{{ .Virtenv }}/process-compose.yaml": "mariadb/process-compose.yaml"
1717
},
1818
"__packages": [
19-
"path:{{ .Virtenv }}"
19+
"path:{{ .Virtenv }}/flake"
2020
],
2121
"__remove_trigger_package": true,
2222
"shell": {

plugins/mysql.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mysql",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"readme": "* This plugin wraps mysqld and mysql_install_db to work in your local project\n* This plugin will create a new database for your project in MYSQL_DATADIR if one doesn't exist on shell init. This DB will be started in `insecure` mode, so be sure to add a root password after creation if needed.\n* Use mysqld to manually start the server, and `mysqladmin -u root shutdown` to manually stop it",
55
"env": {
66
"MYSQL_BASEDIR": "{{ .DevboxProfileDefault }}",
@@ -11,12 +11,12 @@
1111
},
1212
"create_files": {
1313
"{{ .Virtenv }}/run": "",
14-
"{{ .Virtenv }}/flake.nix": "mysql/flake.nix",
14+
"{{ .Virtenv }}/flake/flake.nix": "mysql/flake.nix",
1515
"{{ .Virtenv }}/setup_db.sh": "mysql/setup_db.sh",
1616
"{{ .Virtenv }}/process-compose.yaml": "mysql/process-compose.yaml"
1717
},
1818
"__packages": [
19-
"path:{{ .Virtenv }}"
19+
"path:{{ .Virtenv }}/flake"
2020
],
2121
"__remove_trigger_package": true,
2222
"shell": {

plugins/php.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "php",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"readme": "PHP is compiled with default extensions. If you would like to use non-default extensions you can add them with devbox add php81Extensions.{extension} . For example, for the memcache extension you can do `devbox add php81Extensions.memcached`.",
55
"__packages": [
6-
"path:{{ .Virtenv }}",
7-
"path:{{ .Virtenv }}#composer"
6+
"path:{{ .Virtenv }}/flake",
7+
"path:{{ .Virtenv }}/flake#composer"
88
],
99
"__remove_trigger_package": true,
1010
"env": {
@@ -17,6 +17,6 @@
1717
"{{ .DevboxDir }}/php-fpm.conf": "php/php-fpm.conf",
1818
"{{ .DevboxDir }}/php.ini": "php/php.ini",
1919
"{{ .Virtenv }}/process-compose.yaml": "php/process-compose.yaml",
20-
"{{ .Virtenv }}/flake.nix": "php/flake.nix"
20+
"{{ .Virtenv }}/flake/flake.nix": "php/flake.nix"
2121
}
2222
}

0 commit comments

Comments
 (0)