From 80fc93efe5af234cb341205ce1a910e31c9caab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Fri, 22 Nov 2024 18:57:25 +0100 Subject: [PATCH] expose nix overlays --- config/overlays/default.nix | 33 +++++++++++++++++-- config/overlays/riscv-cross-packages.nix | 40 ++++++++++++++++++++++++ config/overlays/riscv.nix | 7 +++++ machine/not522/cross-packages.nix | 25 --------------- machine/not522/default.nix | 1 - modules/default.nix | 12 ------- 6 files changed, 77 insertions(+), 41 deletions(-) create mode 100644 config/overlays/riscv-cross-packages.nix create mode 100644 config/overlays/riscv.nix delete mode 100644 machine/not522/cross-packages.nix diff --git a/config/overlays/default.nix b/config/overlays/default.nix index 04386f99..ba27b85b 100644 --- a/config/overlays/default.nix +++ b/config/overlays/default.nix @@ -1,13 +1,40 @@ { inTester, + system, + self, + rust-overlay, + nix-vscode-extensions, ... }: { imports = if !inTester then - [ - ./inputs-overlay.nix - ] + ( + [ + ./inputs-overlay.nix + ] + ++ ( + if system == "riscv64-linux" then + [ + ./riscv.nix + ./riscv-cross-packages.nix + ] + else + [ ] + ) + ) else [ ]; } +// ( + if !inTester then + { + nixpkgs.overlays = [ + self.overlays.default + (import rust-overlay) + nix-vscode-extensions.overlays.default + ]; + } + else + { } +) diff --git a/config/overlays/riscv-cross-packages.nix b/config/overlays/riscv-cross-packages.nix new file mode 100644 index 00000000..d1b6bcdd --- /dev/null +++ b/config/overlays/riscv-cross-packages.nix @@ -0,0 +1,40 @@ +# Cross compiled packages for when shit breaks +{ + nixpkgs, + lix, + ... +}: +let + pkgs_x86_64 = import nixpkgs { + system = "x86_64-linux"; + crossSystem.system = "riscv64-linux"; + overlays = [ lix.overlays.default ]; + }; + pkgs_x86_64_2 = import nixpkgs { + system = "x86_64-linux"; + crossSystem.system = "riscv64-linux"; + }; +in +{ + nixpkgs.overlays = [ + (self: super: { + inherit (pkgs_x86_64) lix; + inherit (pkgs_x86_64_2) nixos-option; + }) + ]; + environment.etc."nix/inputs/nixpkgs-overlays/riscv-cross-packages.nix".text = '' + self: _: let pkgs_x86_64 = import { + system = "x86_64-linux"; + crossSystem.system = "riscv64-linux"; + overlays = [self.inputs.lix.overlays.default]; + } + pkgs_x86_64_2 = import { + system = "x86_64-linux"; + crossSystem.system = "riscv64-linux"; + overlays = []; + }; in { + inherit (pkgs_x86_64) lix; + inherit (pkgs_x86_64_2) nixos-option; + } + ''; +} diff --git a/config/overlays/riscv.nix b/config/overlays/riscv.nix new file mode 100644 index 00000000..64748669 --- /dev/null +++ b/config/overlays/riscv.nix @@ -0,0 +1,7 @@ +{ riscv-overlay }: +{ + nixpkgs.overlays = [ + riscv-overlay.overlays.default + ]; + environment.etc."nix/inputs/nixpkgs-overlays/riscv-overlay.nix".text = "import ${riscv-overlay}/overlay.nix"; +} diff --git a/machine/not522/cross-packages.nix b/machine/not522/cross-packages.nix deleted file mode 100644 index 13d95f87..00000000 --- a/machine/not522/cross-packages.nix +++ /dev/null @@ -1,25 +0,0 @@ -# Cross compiled packages for when shit breaks -{ - nixpkgs, - lix, - ... -}: -let - pkgs_x86_64 = import nixpkgs { - system = "x86_64-linux"; - crossSystem.system = "riscv64-linux"; - overlays = [ lix.overlays.default ]; - }; - pkgs_x86_64_2 = import nixpkgs { - system = "x86_64-linux"; - crossSystem.system = "riscv64-linux"; - }; -in -{ - nixpkgs.overlays = [ - (self: super: { - inherit (pkgs_x86_64) lix; - inherit (pkgs_x86_64_2) nixos-option; - }) - ]; -} diff --git a/machine/not522/default.nix b/machine/not522/default.nix index ea3af0f9..62f27f32 100644 --- a/machine/not522/default.nix +++ b/machine/not522/default.nix @@ -9,7 +9,6 @@ "${nixos-config}/config" ./disko.nix ./hardware.nix - ./cross-packages.nix "${nixpkgs}/nixos/modules/profiles/minimal.nix" ]; system.stateVersion = "24.11"; diff --git a/modules/default.nix b/modules/default.nix index 47c81ac7..d0e64f04 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -23,16 +23,4 @@ with lib; options.isInstaller = mkEnableOption "Whether or not this configuration is an installer and has no access to secrets"; options.isNSFW = mkEnableOption "Whether or not this configuration is NSFW"; options.isIntelGPU = mkEnableOption "Whether or not this configuration uses an Intel GPU"; - - config = - if !inTester then - { - nixpkgs.overlays = [ - self.overlays.default - (import rust-overlay) - nix-vscode-extensions.overlays.default - ]; - } - else - { }; }