diff --git a/flake.nix b/flake.nix index 1b27f69..d321648 100644 --- a/flake.nix +++ b/flake.nix @@ -4,44 +4,44 @@ # nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; #nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - }; - outputs = { nixpkgs, ... }: let + outputs = {nixpkgs, ...}: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; lib = nixpkgs.lib; - - - in rec { devShell.${system} = pkgs.mkShell { buildInputs = with pkgs; [ rsync zstd + git ]; }; + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; nixosConfigurations.m1 = lib.nixosSystem { system = "aarch64-linux"; modules = [ - ({ pkgs, config, ... }: { - + ({ + pkgs, + config, + ... + }: { imports = [ ./kboot-conf # "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix" "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" - ]; sdImage = { #compressImage = false; populateFirmwareCommands = let configTxt = pkgs.writeText "README" '' - Nothing to see here. This empty partition is here because I don't know how to turn its creation off. + Nothing to see here. This empty partition is here because I don't know how to turn its creation off. ''; in '' cp ${configTxt} firmware/README @@ -49,14 +49,14 @@ populateRootCommands = '' ${config.boot.loader.kboot-conf.populateCmd} -c ${config.system.build.toplevel} -d ./files/kboot.conf ''; - }; + }; #boot.loader.grub.enable = false; boot.loader.kboot-conf.enable = true; - # Use kernel >6.6 + # Use kernel >6.6 boot.kernelPackages = pkgs.linuxPackages_latest; # Stop ZFS breasking the build - boot.supportedFilesystems = lib.mkForce [ "btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs" ]; + boot.supportedFilesystems = lib.mkForce ["btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs"]; # I'm not completely sure if some of these could be omitted, # but want to make sure disk access works @@ -69,28 +69,28 @@ # Petitboot uses this port and baud rate on the boards serial port, # it's probably good to keep the options same for the running # kernel for serial console access to work well - boot.kernelParams = [ "console=ttyS2,1500000" ]; + boot.kernelParams = ["console=ttyS2,1500000"]; hardware.deviceTree.name = "rockchip/rk3568-odroid-m1.dtb"; - - # Turn on flakes. - ##nix.package = pkgs.nixVersions.stable; + + # Enable nix flakes + nix.package = pkgs.nixFlakes; nix.extraOptions = '' experimental-features = nix-command flakes ''; + nix.nixPath = ["nixpkgs=${nixpkgs}"]; # includes this flake in the live iso : "/etc/nixcfg" environment.etc.nixcfg.source = builtins.filterSource - (path: type: - baseNameOf path - != ".git" - && type != "symlink" - && !(pkgs.lib.hasSuffix ".qcow2" path) - && baseNameOf path != "secrets") - ../.; + (path: type: + baseNameOf path + != ".git" + && type != "symlink" + && !(pkgs.lib.hasSuffix ".qcow2" path) + && baseNameOf path != "secrets") + ../.; - - services.openssh = { + services.openssh = { enable = true; settings.PermitRootLogin = "yes"; }; diff --git a/kboot-conf/default.nix b/kboot-conf/default.nix index 87315e4..52f2fcb 100644 --- a/kboot-conf/default.nix +++ b/kboot-conf/default.nix @@ -1,8 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let +{ + config, + lib, + pkgs, + ... +}: +with lib; let cfg = config.boot.loader.kboot-conf; # The builder used to write during system activation @@ -19,8 +21,7 @@ let path = with pkgs.buildPackages; [coreutils gnused gnugrep]; inherit (pkgs.buildPackages) bash; }; -in -{ +in { options = { boot.loader.kboot-conf = { enable = mkOption { @@ -52,9 +53,10 @@ in }; config = let args = "-g ${toString cfg.configurationLimit} -n ${config.hardware.deviceTree.name}"; - in mkIf cfg.enable { - system.build.installBootLoader = lib.mkForce "${builder} ${args} -c"; - system.boot.loader.id = "kboot-conf"; - boot.loader.kboot-conf.populateCmd = "${populateBuilder} ${args}"; - }; + in + mkIf cfg.enable { + system.build.installBootLoader = lib.mkForce "${builder} ${args} -c"; + system.boot.loader.id = "kboot-conf"; + boot.loader.kboot-conf.populateCmd = "${populateBuilder} ${args}"; + }; }