Skip to content

Commit

Permalink
Merge 8227133 into a78f504
Browse files Browse the repository at this point in the history
  • Loading branch information
exarkun committed Jun 18, 2022
2 parents a78f504 + 8227133 commit ce26cfc
Show file tree
Hide file tree
Showing 12 changed files with 1,445 additions and 386 deletions.
36 changes: 20 additions & 16 deletions .circleci/config.yml
Expand Up @@ -31,12 +31,12 @@ workflows:
{}

- "nixos":
name: "NixOS 21.05"
nixpkgs: "21.05"

- "nixos":
name: "NixOS 21.11"
nixpkgs: "21.11"
matrix:
parameters:
python:
- "python37"
- "python38"
- "python39"

# Eventually, test against PyPy 3.8
#- "pypy27-buster":
Expand Down Expand Up @@ -373,16 +373,15 @@ jobs:

nixos:
parameters:
nixpkgs:
python:
description: >-
Reference the name of a niv-managed nixpkgs source (see `niv show`
and nix/sources.json)
Reference the name of the Python package to build and test against.
type: "string"

docker:
# Run in a highly Nix-capable environment.
- <<: *DOCKERHUB_AUTH
image: "nixos/nix:2.3.16"
image: "nixos/nix:2.9.1"

environment:
# CACHIX_AUTH_TOKEN is manually set in the CircleCI web UI and
Expand All @@ -392,16 +391,21 @@ jobs:

steps:
- "run":
# The nixos/nix image does not include ssh. Install it so the
# `checkout` step will succeed. We also want cachix for
# Nix-friendly caching.
name: "Install Basic Dependencies"
command: |
# The nixos/nix image does not include ssh. Install it so the
# `checkout` step will succeed. We also want cachix for
# Nix-friendly caching.
nix-env \
--file https://github.com/nixos/nixpkgs/archive/nixos-<<parameters.nixpkgs>>.tar.gz \
--file https://github.com/nixos/nixpkgs/archive/nixos-21.11.tar.gz \
--install \
-A openssh cachix bash
# We also want to use flakes but they're still experimental so
# turn them on.
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf
- "checkout"

- run:
Expand Down Expand Up @@ -434,13 +438,13 @@ jobs:
# build a couple simple little dependencies that don't take
# advantage of multiple cores and we get a little speedup by doing
# them in parallel.
nix-build --cores 3 --max-jobs 2 --argstr pkgsVersion "nixpkgs-<<parameters.nixpkgs>>"
nix build --cores 3 --max-jobs 2 .#tahoe-lafs-<<parameters.python>>
- "run":
name: "Test"
command: |
# Let it go somewhat wild for the test suite itself
nix-build --cores 8 --argstr pkgsVersion "nixpkgs-<<parameters.nixpkgs>>" tests.nix
nix build --cores 8 .#tahoe-lafs-<<parameters.python>>-tests
- run:
# Send any new store objects to cachix.
Expand Down
102 changes: 0 additions & 102 deletions default.nix

This file was deleted.

86 changes: 86 additions & 0 deletions flake.lock

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

60 changes: 60 additions & 0 deletions flake.nix
@@ -0,0 +1,60 @@
{
description = "Tahoe-LAFS, free and open decentralized data store";
inputs.nixpkgs = {
url = "github:NixOS/nixpkgs?rev=838eefb4f93f2306d4614aafb9b2375f315d917f";
};
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.mach-nix = {
flake = true;
url = "github:DavHau/mach-nix?rev=bdc97ba6b2ecd045a467b008cff4ae337b6a7a6b";
inputs = {
pypi-deps-db = {
flake = false;
url = "github:DavHau/pypi-deps-db?rev=76b8f1e44a8ec051b853494bcf3cc8453a294a6a";
};
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};

outputs = { self, nixpkgs, flake-utils, mach-nix }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let

lib = import ./nix/lib.nix {
inherit system pkgs mach-nix;
};
inherit (lib) checksForVersions packageForVersions devShellForVersions withDefault;

pkgs = nixpkgs.legacyPackages.${system};

# the Python version used by the default package
defaultPythonVersion = "python37";

# the Python versions for which packages are available
supportedPythonVersions = ["python37" "python38" "python39" ];

# the extras we will include in all packages
extras = [ "tor" "i2p" ];

in rec {
packages =
let
packages = packageForVersions extras supportedPythonVersions;
tests = checksForVersions extras supportedPythonVersions;
in
# Define tests alongside the packages because it's easier to pick
# and choose which to run this way (as compared to making them all
# "checks").
withDefault (packages // tests) defaultPythonVersion;

apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/tahoe";
};

devShells =
withDefault
(devShellForVersions extras supportedPythonVersions)
defaultPythonVersion;
});
}
1 change: 1 addition & 0 deletions newsfragments/3903.installation
@@ -0,0 +1 @@
The Nix packaging is now "flakes"-based.

0 comments on commit ce26cfc

Please sign in to comment.