Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted improvements #5

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ci/scripts/build-all-dev-envs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PROJECT_FLAKES_DIR="project-flakes"
set -ex

# Loop through each sub-directory in 'project-flakes'
for project in "$PROJECT_FLAKES_DIR"/*/ ; do
for project in "$PROJECT_FLAKES_DIR"/*/ ; do
# Remove the trailing '/'
project=${project%*/}
# Extract the project name
Expand All @@ -24,12 +24,12 @@ for project in "$PROJECT_FLAKES_DIR"/*/ ; do
# Enter the project directory.
cd "$project"
# Show the generated outputs of the flake.
nix flake show ..
nix flake show --impure ..
# Attempt to build and enter the development environment,
# then run the specified test command.
nix develop --impure ..#"$project" -c bash -c "$cmd"
# Leave the project directory.
cd ..
# Delete the project directory.
rm -rf "$project"
done
done
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ installer](https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-fil
Then at the root of your local Synapse checkout, run the following command:

```shell
nix develop impure github:element-hq/nix-flakes#synapse
nix develop --impure github:element-hq/nix-flakes#synapse
```

Dependencies will be downloaded and installed for you, and you'll be dropped
Expand All @@ -59,7 +59,7 @@ If typing `nix develop --impure ...` gets tiring, you can automatically enter
the desired project development environment by installing `direnv` and creating
a `.envrc` file with the following contents:

```
```shell
use flake --impure github:element-hq/nix-flakes#synapse
```

Expand Down Expand Up @@ -145,15 +145,15 @@ language that returns a devenv module. A basic example of a `module.nix`:
To test a development environment locally without pushing it to git, you can
use the following to reference a development environment in a local directory:

```
```shell
nix develop path:///home/work/code/nix-flakes#synapse --impure
```

...which would drop you into a new `synapse` development environment shell.
... which would drop you into a new `synapse` development environment shell.

The same can be done when using `direnv`. Just set your `.envrc` file to:

```
```shell
use flake path:///home/work/code/nix-flakes#synapse --impure
```

Expand All @@ -168,4 +168,4 @@ is where all that happens.
available options you can specify.

The [Nix Language basics](https://zero-to-nix.com/concepts/nix-language) is a
recommended read.
recommended read.
16 changes: 10 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
inputs = {
# Aim for the latest versions of packages by default.
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# A development environment manager built on Nix. See https://devenv.sh.
devenv.url = "github:cachix/devenv/v1.0.7";
# Output a development shell for x86_64/aarch64 Linux/Darwin (MacOS).
Expand Down Expand Up @@ -111,4 +113,4 @@
}
);
};
}
}
6 changes: 3 additions & 3 deletions project-flakes/matrix-hyper-federation-client/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# Search for package names at https://search.nixos.org/packages?channel=unstable
packages = with pkgs; [
# The rust toolchain and related tools.
(rust-bin.stable."1.66.0".default.override {
(rust-bin.stable."1.70.0".default.override {
extensions = [ "rust-src" ];
})

# For enabling faster Rust compile times. See the `env` option below.
clang
mold
Expand All @@ -27,4 +27,4 @@
# TODO: The lld flags may be Linux-only?
"RUSTFLAGS" = "-Clinker=clang -Clink-arg=-fuse-ld=${pkgs.mold}/bin/mold";
};
}
}
8 changes: 4 additions & 4 deletions project-flakes/synapse/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# Automatically activate the poetry virtualenv upon entering the shell.
languages.python.poetry.activate.enable = true;
# Install all extra Python dependencies; this is needed to run the unit
# tests and utilitise all Synapse features.
# tests and utilise all Synapse features.
languages.python.poetry.install.arguments = ["--extras all"];
# Install the 'matrix-synapse' package from the local checkout.
languages.python.poetry.install.installRootPackage = true;
Expand All @@ -81,8 +81,8 @@
# Create a postgres user called 'synapse_user' which has ownership
# over the 'synapse' database.
services.postgres.initialScript = ''
CREATE USER synapse_user;
ALTER DATABASE synapse OWNER TO synapse_user;
CREATE USER synapse_user;
ALTER DATABASE synapse OWNER TO synapse_user;
'';

# Redis is needed in order to run Synapse in worker mode.
Expand Down Expand Up @@ -130,4 +130,4 @@
enterShell = ''
unset LD_LIBRARY_PATH
'';
}
}
4 changes: 2 additions & 2 deletions project-flakes/sytest/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# corresponding Nix packages on https://search.nixos.org/packages.
#
# This was done until `./install-deps.pl --dryrun` produced no output.
env.PERL5LIB = "${with pkgs.perl536Packages; makePerlPath [
env.PERL5LIB = "${with pkgs.perl538Packages; makePerlPath [
DBI
ClassMethodModifiers
CryptEd25519
Expand Down Expand Up @@ -79,4 +79,4 @@
URI
YAMLLibYAML
]}";
}
}