chia: force downgrade
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2023-06-05 22:35:44 +01:00
parent 5e2f073fd0
commit 553e09ee3f
3 changed files with 26 additions and 7 deletions

View File

@ -124,6 +124,22 @@
"type": "github" "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": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1685655444, "lastModified": 1685655444,
@ -146,6 +162,7 @@
"darwin": "darwin_2", "darwin": "darwin_2",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-chia": "nixpkgs-chia",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
} }
}, },

View File

@ -2,6 +2,7 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-chia.url = "github:nixos/nixpkgs?rev=0305391fb65b5bdaa8af3c48275ec0df1cdcc34e";
darwin.url = "github:lnl7/nix-darwin/master"; darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs"; darwin.inputs.nixpkgs.follows = "nixpkgs";
@ -15,7 +16,7 @@
description = "Hillion Nix flake"; 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 = nixosConfigurations =
let let
fqdns = builtins.attrNames (builtins.readDir ./hosts); fqdns = builtins.attrNames (builtins.readDir ./hosts);

View File

@ -1,7 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, nixpkgs-chia, ... }:
let let
cfg = config.custom.chia; cfg = config.custom.chia;
chia = nixpkgs-chia.legacyPackages.x86_64-linux.chia;
in in
{ {
options.custom.chia = { options.custom.chia = {
@ -30,7 +31,7 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ chia ]; environment.systemPackages = [ chia ];
users.groups.chia = { }; users.groups.chia = { };
users.users.chia = { users.users.chia = {
@ -44,8 +45,8 @@ in
description = "Chia daemon."; description = "Chia daemon.";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
preStart = with pkgs; lib.strings.concatStringsSep "\n" ([ "${pkgs.chia}/bin/chia init" ] preStart = lib.strings.concatStringsSep "\n" ([ "${chia}/bin/chia init" ]
++ (if cfg.keyFile == null then [ ] else [ "${pkgs.chia}/bin/chia keys add -f ${cfg.keyFile}" ]) ++ (if cfg.keyFile == null then [ ] else [ "${chia}/bin/chia keys add -f ${cfg.keyFile}" ])
++ (if cfg.targetAddress == null then [ ] else [ ++ (if cfg.targetAddress == null then [ ] else [
'' ''
${pkgs.yq-go}/bin/yq e \ ${pkgs.yq-go}/bin/yq e \
@ -59,8 +60,8 @@ in
-i ${cfg.path}/.chia/mainnet/config/config.yaml -i ${cfg.path}/.chia/mainnet/config/config.yaml
'' ''
])); ]));
script = with pkgs; "${pkgs.chia}/bin/chia start farmer"; script = "${chia}/bin/chia start farmer";
preStop = with pkgs; "${pkgs.chia}/bin/chia stop -d farmer"; preStop = "${chia}/bin/chia stop -d farmer";
serviceConfig = { serviceConfig = {
Type = "forking"; Type = "forking";