From d020ef218993286f605d651152bf0bbc93ca1d15 Mon Sep 17 00:00:00 2001 From: Dennis <52411861+DerDennisOP@users.noreply.github.com> Date: Tue, 6 Feb 2024 20:35:02 +0100 Subject: [PATCH] Created fabius user (raspberry pi 5). Changed flake.nix. (#76) * Created fabius user (raspberry pi 5). Changed flake.nix. * add custom iso type * change to crossPkgs * add crossCompile aarch64 --- flake.nix | 68 ++++++++++++++++--------- modules/boot.nix | 2 +- systems/palatine-hill/configuration.nix | 4 +- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/flake.nix b/flake.nix index cd7a05a..b5dcda2 100644 --- a/flake.nix +++ b/flake.nix @@ -91,13 +91,22 @@ outputs = { self, nixpkgs-fmt, nix, home-manager, mailserver, nix-pre-commit, nixos-modules, nixpkgs, sops-nix, ... }@inputs: let inherit (nixpkgs) lib; - systems = [ "x86_64-linux" "aarch64-linux" ]; + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = lib.genAttrs systems; overlayList = [ self.overlays.default nix.overlays.default ]; pkgsBySystem = forEachSystem (system: import nixpkgs { inherit system; overlays = overlayList; - config.allowUnfree = true; + config = { + allowUnfree = true; + isHydra = true; + }; }); src = builtins.filterSource (path: type: type == "directory" || lib.hasSuffix ".nix" (baseNameOf path)) ./.; @@ -140,13 +149,13 @@ # language = "system"; # files = "\\.nix"; # } - { - id = "nix-flake-check"; - entry = "nix flake check"; - language = "system"; - files = "\\.nix"; - pass_filenames = false; - } + # { + # id = "nix-flake-check"; + # entry = "nix flake check"; + # language = "system"; + # files = "\\.nix"; + # pass_filenames = false; + # } ]; } ]; @@ -160,11 +169,14 @@ nixosConfigurations = let - constructSystem = { hostname, users, home ? true, modules ? [ ], server ? true, sops ? true, system ? "x86_64-linux" }: + constructSystem = { hostname, users, home ? true, iso ? [ ], modules ? [ ], server ? true, sops ? true, system ? "x86_64-linux" }: lib.nixosSystem { inherit system; - - modules = [ nixos-modules.nixosModule sops-nix.nixosModules.sops { config.networking.hostName = "${hostname}"; } ] ++ (if server then [ + modules = [ + nixos-modules.nixosModule + sops-nix.nixosModules.sops + { config.networking.hostName = "${hostname}"; } + ] ++ (if server then [ mailserver.nixosModules.mailserver ./systems/programs.nix ./systems/configuration.nix @@ -173,21 +185,27 @@ ] else [ ./users/${builtins.head users}/systems/${hostname}/configuration.nix ./users/${builtins.head users}/systems/${hostname}/hardware.nix - ]) ++ modules - ++ fileList "modules" + ]) ++ fileList "modules" + ++ modules ++ lib.optional home home-manager.nixosModules.home-manager + ++ lib.optional (builtins.elem "minimal" iso) "${toString nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" + ++ lib.optional (builtins.elem "sd" iso) "${toString nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" ++ (if home then (map (user: { home-manager.users.${user} = import ./users/${user}/home.nix; }) users) else [ ]) - ++ map (user: { config, lib, pkgs, ... }@args: { - users.users.${user} = import ./users/${user} (args // { name = "${user}"; }); - boot.initrd.network.ssh.authorizedKeys = lib.mkIf server config.users.users.${user}.openssh.authorizedKeys.keys; - sops = lib.mkIf sops { - secrets."${user}/user-password" = { - sopsFile = ./users/${user}/secrets.yaml; - neededForUsers = true; - }; + ++ lib.optional (system != "x86_64-linux") { + config.nixpkgs = { + config.allowUnsupportedSystem = true; + crossSystem = lib.systems.examples.aarch64-multiplatform; + }; + } ++ map (user: { config, lib, pkgs, ... }@args: { + users.users.${user} = import ./users/${user} (args // { name = "${user}"; }); + boot.initrd.network.ssh.authorizedKeys = lib.mkIf server config.users.users.${user}.openssh.authorizedKeys.keys; + sops = lib.mkIf sops { + secrets."${user}/user-password" = { + sopsFile = ./users/${user}/secrets.yaml; + neededForUsers = true; }; - }) - users; + }; + }) users; }; in (builtins.listToAttrs (map @@ -259,7 +277,7 @@ (type: { name = type; value = mkBuild type; - }) [ "toplevel" "isoImage" ]) + }) [ "toplevel" "isoImage" "sdImage" ]) ); }; } diff --git a/modules/boot.nix b/modules/boot.nix index cf0089d..cf1b715 100644 --- a/modules/boot.nix +++ b/modules/boot.nix @@ -51,7 +51,7 @@ in { generationsDir.copyKernels = true; systemd-boot.enable = lib.mkIf cfg.useSystemdBoot true; grub = lib.mkIf (!cfg.useSystemdBoot) { - enable = true; + enable = lib.mkForce true; copyKernels = true; zfsSupport = lib.mkIf (cfg.filesystem == "zfs") true; efiSupport = true; diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index 6d41db3..445ece7 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -24,6 +24,7 @@ nix = { extraOptions = '' allowed-uris = github: gitlab: git+https:// git+ssh:// https:// + builders-use-substitutes = true ''; buildMachines = [{ @@ -32,7 +33,7 @@ protocol = "ssh-ng"; speedFactor = 2; supportedFeatures = [ "kvm" "nixos-test" "big-parallel" "benchmark" ]; - system = "x86_64-linux"; + systems = [ "x86_64-linux" "x86_64-linux" ]; }]; }; @@ -109,7 +110,6 @@ smtpHost = "alicehuston.xyz"; notificationSender = "hydra@alicehuston.xyz"; gcRootsDir = "/ZFS/ZFS-Primary/hydra"; - buildMachinesFiles = [ ]; useSubstitutes = true; minimumDiskFree = 50; minimumDiskFreeEvaluator = 100;