!xmLtiCaAJxfhURjrXl:matrix.org

NixOS RISC-V

233 Members
NixOS on RISC-V https://wiki.nixos.org/wiki/RISC-V https://pad.lassul.us/NixOS-riscv64-linux https://github.com/orgs/NixOS/teams/risc-v69 Servers

Load older messages


SenderMessageTime
30 Mar 2024
@hive:the-apothecary.clubDagn Hivewe do have the server set to powersave mode, so it's probably something similar, but i don't think we could afford to run it without it00:15:53
@hive:the-apothecary.clubDagn Hiveoh well00:16:01
@alex:tunstall.xyzAlexIIRC powersave means it will always use the min frequency00:16:35
@hive:the-apothecary.clubDagn Hiveye00:16:39
@hive:the-apothecary.clubDagn Hivetbh after thinking it over, it's probably costing more to have the server running this long, so i will probably turn power saver off after this00:17:47
@alex:tunstall.xyzAlex

On the other hand lower cpufreq should be more power efficient (due to lower core temperatures).

I guess if you wanted to maximise power efficiency the only way of finding the sweet spot is a lot of benchmarking.

00:20:04
@hive:the-apothecary.clubDagn Hiveyeah00:26:32
@shalokshalom:kde.org@shalokshalom:kde.org left the room.00:27:37
@hive:the-apothecary.clubDagn Hive
In reply to @skeuchel:matrix.org

tau: Here is a minimal flake that at least evaluates

{
  inputs = {
    nixpkgs.url = "github:AlexandreTunstall/nixpkgs/ghc-cross";
  };

  outputs = { nixpkgs, ... }:
    {
      nixosConfigurations.riscv64 = nixpkgs.lib.nixosSystem {
        modules = [({lib, pkgs, ...}: {
          nixpkgs.crossSystem.system = "riscv64-linux";
          nixpkgs.localSystem.system = "x86_64-linux";
          environment.systemPackages = [
             pkgs.haskell.compiler.native-bignum.ghc948
          ];
          # Dummy values
          fileSystems."/".device  = lib.mkDefault "/dev/sda1";
          boot.loader.grub.device = lib.mkDefault "/dev/sda";
        })];
      };
    };
}

Maybe you can use that to figure out what is going wrong.

i really don't understand why it's not building, i added the crossSystem and localSystem options,

┏━ 1 Errors: 
 ⋮ 
┃           182|       buildCommand = ''
┃              |       ^
┃           183|         mkdir -p $out/nix-support $out/sd-image
┃ 
┃        (stack trace truncated; use '--show-trace' to show the full trace)
┃ 
┃        error: Package ‘ghc-9.6.4’ in /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/pkgs/development/compilers/ghc/common-hadrian.nix:525 is not available o…
┃          hostPlatform.config = "riscv64-unknown-linux-gnu"
┃          package.meta.platforms = [
┃            "aarch64-darwin"
┃            "aarch64-linux"
┃            "i686-linux"
┃            "x86_64-darwin"
┃            "x86_64-linux"
┃          ]
┃          package.meta.badPlatforms = [ ]
┃        , refusing to evaluate.
┃ 
┃        a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
┃           for a single invocation of the nix tools.
┃ 
┃             $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
┃ 
┃           Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
┃                 then pass `--impure` in order to allow use of environment variables.
┃ 
┃        b) For `nixos-rebuild` you can set
┃          { nixpkgs.config.allowUnsupportedSystem = true; }
┃        in configuration.nix to override this.
┃ 
┃        c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
┃          { allowUnsupportedSystem = true; }
┃        to ~/.config/nixpkgs/config.nix.
┣━━━                                                            
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 00:52:48 after 7s
00:54:58
@hive:the-apothecary.clubDagn Hive
┏━ 1 Errors: 
┃ error:
┃        … while calling the 'derivationStrict' builtin
┃ 
┃          at /derivation-internal.nix:9:12:
┃ 
┃             8|
┃             9|   strict = derivationStrict drvAttrs;
┃              |            ^
┃            10|
┃ 
┃        … while evaluating derivation 'nixos-sd-image-24.05.20240327.2726f12-riscv64-linux-starfive-visionfive2.img'
┃          whose name attribute is located at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/pkgs/stdenv/generic/make-derivation.nix:331:7
┃ 
┃        … while evaluating attribute 'buildCommand' of derivation 'nixos-sd-image-24.05.20240327.2726f12-riscv64-linux-starfive-visionfive2.img'
┃ 
┃          at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/nixos/modules/installer/sd-card/sd-image.nix:182:7:
┃ 
┃           181|
┃           182|       buildCommand = ''
┃              |       ^
┃           183|         mkdir -p $out/nix-support $out/sd-image
┃ 
┃        (stack trace truncated; use '--show-trace' to show the full trace)
┃ 
┃        error: cannot bootstrap GHC on this platform ('riscv64-linux' with libc 'defaultLibc')
┣━━━                                                            
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 00:53:28 after 6s

( when adding the --impure flag )

00:55:41
@hive:the-apothecary.clubDagn Hiveif cross compilation is supported, why do i keep getting this error ? it's really frustrating00:56:48
@hive:the-apothecary.clubDagn Hiveok even after i've built ghc locally02:01:47
@hive:the-apothecary.clubDagn Hiveand i've set the nixpkgs to alexandretunstall/nixpkgs/ghc-cross-usable02:01:54
@hive:the-apothecary.clubDagn Hiveit still saying cannot bootstrap ghc on this platform02:02:08
@hive:the-apothecary.clubDagn Hivei do not understand what is going on02:02:13
@alex:tunstall.xyzAlex

It looks like you're missing the overlay that replaces the Nixpkgs GHCs with those based off of the cross-compiled GHC.

Do you have a link to a reproducer I can look at?

07:46:13
@hive:the-apothecary.clubDagn Hivegit.solarpunk.moe/geekygays/nixconf17:12:33
@hive:the-apothecary.clubDagn Hive* https://git.solarpunk.moe/geekygays/nixconf17:12:41
@alex:tunstall.xyzAlex nixosConfigurations.cmb2.config.system.build.toplevel on branch magrathea?
Let me take a look...
17:20:12
@hive:the-apothecary.clubDagn Hiveyeah the magrathrea branch17:22:01
@hive:the-apothecary.clubDagn Hiveits under systems/riscv64-linux/cmb217:22:36
@alex:tunstall.xyzAlexI can't say I fully understand which of the modules is included in the configuration, but I'll start from there.17:23:22
@alex:tunstall.xyzAlex

Well, I've gotten it to evaluate.

diff --git a/flake.nix b/flake.nix
index a3995c4..837952e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,7 +7,7 @@
   };
 
   inputs = {
-    nixpkgs.url = "github:geekygays/nixpkgs";
+    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
     nixos-hardware.url = "github:nixos/nixos-hardware";
     systems.url = "github:geekygays/systems";
 
diff --git a/modules/nixos/core/default.nix b/modules/nixos/core/default.nix
index 75ef1c9..45fbf7e 100644
--- a/modules/nixos/core/default.nix
+++ b/modules/nixos/core/default.nix
@@ -65,7 +65,7 @@
     '';
   };
   environment.systemPackages = with pkgs; [
-    nvd nixpkgs-fmt nix-output-monitor
+    nvd nixpkgs-fmt
     coreutils mime-types file
     usbutils pciutils gitFull git-crypt
   ];

This works for two reasons:

  1. Compiling nix-output-monitor requires GHC.
  2. Your custom Nixpkgs incorporates my ghc-cross branch, which prevents the ShellCheck fix from working.

To compile ShellCheck and nix-output-monitor, you must overlay the default GHC builds to replace them with a usable GHC.

Note that my ghc-cross branch doesn't do all of that; it only makes it possible to build a cross-compiler. Something similar to the example module I wrote into the notes is needed to do that.

(If you don't want to make your flake impure, you can use packages.x86_64-linux instead of builtins.storePath and it won't complain about being unable to build x86_64-linux as long as the output is already in the cache.)

17:51:15
@alex:tunstall.xyzAlex *

Well, I've gotten it to evaluate.

diff --git a/flake.nix b/flake.nix
index a3995c4..837952e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,7 +7,7 @@
   };
 
   inputs = {
-    nixpkgs.url = "github:geekygays/nixpkgs";
+    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
     nixos-hardware.url = "github:nixos/nixos-hardware";
     systems.url = "github:geekygays/systems";
 
diff --git a/modules/nixos/core/default.nix b/modules/nixos/core/default.nix
index 75ef1c9..45fbf7e 100644
--- a/modules/nixos/core/default.nix
+++ b/modules/nixos/core/default.nix
@@ -65,7 +65,7 @@
     '';
   };
   environment.systemPackages = with pkgs; [
-    nvd nixpkgs-fmt nix-output-monitor
+    nvd nixpkgs-fmt
     coreutils mime-types file
     usbutils pciutils gitFull git-crypt
   ];

This works for two reasons:

  1. Compiling nix-output-monitor requires GHC.
  2. Your custom Nixpkgs incorporates my ghc-cross branch, which prevents the ShellCheck fix from working.

To compile ShellCheck and nix-output-monitor, you must overlay the default GHC builds to replace them with a usable GHC.

Note that my ghc-cross branch doesn't do all of that; it only makes it possible to build a cross-compiler. Something similar to the example module I wrote into the notes is needed to do that.

(If you don't want to make your flake impure, you can use packages.x86_64-linux instead of builtins.storePath and it won't complain about being unable to build x86_64-linux as long as the output is already in the cache.)

17:52:26
@hive:the-apothecary.clubDagn Hivethank u <333317:58:22
@hive:the-apothecary.clubDagn Hiveur incredible17:58:32
@alex:tunstall.xyzAlex

tau I've been modernising my RISC-V configuration, so I just so happen to have a pure flake that can evaluate GHC. It's not yet done building so I'm not entirely sure it'll work flawlessly on my VF2, but feel free to use it as a reference for how to overlay GHC.

https://github.com/AlexandreTunstall/nixos-riscv

18:06:38
31 Mar 2024
@hive:the-apothecary.clubDagn Hiveright now it's doing an emulated build, and i'm guessing there's no way to get it to do a cross build ?05:45:32
@hive:the-apothecary.clubDagn Hivei don't think nix build has an option for that05:46:16
@hive:the-apothecary.clubDagn Hivei know nix-build does, but i have been able to find a flag for nix build anywhere05:46:37

Show newer messages


Back to Room ListRoom Version: 10