Skip to content

Commit

Permalink
Add nix flake (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
interdependence authored Dec 22, 2024
1 parent 02ba545 commit 4458bc6
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,34 @@ The `zwift.sh` script will update zwift by checking for new image versions on ev

There is a github action in place that will update zwift on a scheduled basis and publish new versions to docker hub.

## How can I install this on NixOS?

To use the NixOS module, configure your flake.nix:

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
zwift.url = "github:netbrain/zwift";
};
outputs = { nixpkgs, zwift, ... }: {
nixosConfigurations."«hostname»" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ zwift.nixosModules.zwift ./configuration.nix ];
};
};
}
```

Then enable the module in your NixOS configuration:

```nix
{
programs.zwift.enable = true;
}
```

## Sponsors 💖

These are our really cool sponsors!
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

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

48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
description = "Easily zwift on linux";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs =
{ nixpkgs, self }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
nixosModules = {
zwift =
{ config, lib, ... }:
{
options.programs.zwift.enable = lib.mkEnableOption "zwift on linux";

config = lib.mkIf config.programs.zwift.enable {
virtualisation.podman.enable = true;
environment.systemPackages = [ self.packages.x86_64-linux.zwift ];
};
};
default = self.nixosModules.zwift;
};

packages.x86_64-linux = {
zwift = pkgs.stdenv.mkDerivation rec {
pname = "zwift";
version = "0-unstable";

src = ./.;

nativeBuildInputs = [ pkgs.copyDesktopItems ];

installPhase = ''
runHook preInstall
install -Dm755 zwift.sh -T $out/bin/${pname}
install -Dm644 $src/assets/hicolor/scalable/apps/Zwift\ Logogram.svg \
-T $out/share/icons/hicolor/scalable/apps/zwift.svg
runHook postInstall
'';

desktopItems = [ "assets/Zwift.desktop" ];
};
default = self.packages.x86_64-linux.zwift;
};
};
}

0 comments on commit 4458bc6

Please sign in to comment.