From 553e09ee3fcabafa0d3256f160904496dc4bd833 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Mon, 5 Jun 2023 22:35:44 +0100 Subject: [PATCH] chia: force downgrade --- flake.lock | 17 +++++++++++++++++ flake.nix | 3 ++- modules/chia.nix | 13 +++++++------ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 4d82d9c..68c783a 100644 --- a/flake.lock +++ b/flake.lock @@ -124,6 +124,22 @@ "type": "github" } }, + "nixpkgs-chia": { + "locked": { + "lastModified": 1661317206, + "narHash": "sha256-AlIqr/oyha8JnmVYmeDIb2ENR9wq0aZwI0XYVoshU0Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0305391fb65b5bdaa8af3c48275ec0df1cdcc34e", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0305391fb65b5bdaa8af3c48275ec0df1cdcc34e", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1685655444, @@ -146,6 +162,7 @@ "darwin": "darwin_2", "home-manager": "home-manager_2", "nixpkgs": "nixpkgs", + "nixpkgs-chia": "nixpkgs-chia", "nixpkgs-unstable": "nixpkgs-unstable" } }, diff --git a/flake.nix b/flake.nix index a4166af..b6eac4a 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-chia.url = "github:nixos/nixpkgs?rev=0305391fb65b5bdaa8af3c48275ec0df1cdcc34e"; darwin.url = "github:lnl7/nix-darwin/master"; darwin.inputs.nixpkgs.follows = "nixpkgs"; @@ -15,7 +16,7 @@ description = "Hillion Nix flake"; - outputs = { self, nixpkgs, nixpkgs-unstable, agenix, home-manager, darwin, ... }@inputs: { + outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-chia, agenix, home-manager, darwin, ... }@inputs: { nixosConfigurations = let fqdns = builtins.attrNames (builtins.readDir ./hosts); diff --git a/modules/chia.nix b/modules/chia.nix index 620d4cf..238a9e0 100644 --- a/modules/chia.nix +++ b/modules/chia.nix @@ -1,7 +1,8 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, nixpkgs-chia, ... }: let cfg = config.custom.chia; + chia = nixpkgs-chia.legacyPackages.x86_64-linux.chia; in { options.custom.chia = { @@ -30,7 +31,7 @@ in }; config = lib.mkIf cfg.enable { - environment.systemPackages = with pkgs; [ chia ]; + environment.systemPackages = [ chia ]; users.groups.chia = { }; users.users.chia = { @@ -44,8 +45,8 @@ in description = "Chia daemon."; wantedBy = [ "multi-user.target" ]; - preStart = with pkgs; lib.strings.concatStringsSep "\n" ([ "${pkgs.chia}/bin/chia init" ] - ++ (if cfg.keyFile == null then [ ] else [ "${pkgs.chia}/bin/chia keys add -f ${cfg.keyFile}" ]) + preStart = lib.strings.concatStringsSep "\n" ([ "${chia}/bin/chia init" ] + ++ (if cfg.keyFile == null then [ ] else [ "${chia}/bin/chia keys add -f ${cfg.keyFile}" ]) ++ (if cfg.targetAddress == null then [ ] else [ '' ${pkgs.yq-go}/bin/yq e \ @@ -59,8 +60,8 @@ in -i ${cfg.path}/.chia/mainnet/config/config.yaml '' ])); - script = with pkgs; "${pkgs.chia}/bin/chia start farmer"; - preStop = with pkgs; "${pkgs.chia}/bin/chia stop -d farmer"; + script = "${chia}/bin/chia start farmer"; + preStop = "${chia}/bin/chia stop -d farmer"; serviceConfig = { Type = "forking";