diff --git a/flake.lock b/flake.lock index 06990cf..d486cf0 100644 --- a/flake.lock +++ b/flake.lock @@ -605,6 +605,21 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1700392353, + "narHash": "sha256-KARn8aVJu5fdW0jdJYoOQ1SPqWlNdz4l7r90NbArWSY=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "2b00bc76dc893cd996a3d76a2f059d657a5ef37a", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1698611440, @@ -888,9 +903,11 @@ "nix-on-droid": "nix-on-droid", "nix-wsl": "nix-wsl", "nixos-generators": "nixos-generators", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_4", "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap", - "robotnix": "robotnix" + "robotnix": "robotnix", + "rpi-nixpkgs": "rpi-nixpkgs" } }, "rotate-text": { @@ -909,6 +926,22 @@ "type": "github" } }, + "rpi-nixpkgs": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, "sln-mode": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index acc68d1..b7984a8 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,8 @@ #nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/release-23.05"; + rpi-nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + firefox.url = "github:nix-community/flake-firefox-nightly"; @@ -28,6 +30,9 @@ }; + nixos-hardware.url = "github:nixos/nixos-hardware"; + + robotnix = { url = "github:nix-community/robotnix"; #inputs.nixpkgs.follows = "nixpkgs"; @@ -95,7 +100,46 @@ # my raspberry to try out stuff with "luna" = nixpkgs.lib.nixosSystem { inherit specialArgs; - system = "x86_64-linux"; + system = "aarch64-linux"; + #system = "armv7l-linux"; + modules = [ + "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + #"${inputs.rpi-nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi4.nix" + inputs.nixos-hardware.nixosModules.raspberry-pi-4 + ./hosts/luna.nix + { + system.stateVersion = "23.05"; # Did you read the comment? + + nixpkgs.overlays = [ + { + ubootRaspberryPi4_64bit = nixpkgs.legacyPackages.x86_64.pkgsCross.aarch64-multiplatform.ubootRaspberryPi4_64bit; + ubootRaspberryPi3_64bit = nixpkgs.legacyPackages.x86_64.pkgsCross.aarch64-multiplatform.ubootRaspberryPi3_64bit; + + ubootRaspberryPi4_32bit = nixpkgs.legacyPackages.x86_64.pkgsCross.aarch64-multiplatform.ubootRaspberryPi4_32bit; + ubootRaspberryPi3_3264bit = nixpkgs.legacyPackages.x86_64.pkgsCross.aarch64-multiplatform.ubootRaspberryPi3_32bit; + raspberrypi-armstubs = nixpkgs.legacyPackages.x86_64.pkgsCross.raspberryPi.raspberrypi-armstubs; + } + ]; + + + #nixpkgs.crossSystem.system = "armv7l-linux"; + #nixpkgs.config.allowUnsupportedSystem = true; + #nixpkgs.hostPlatform.system = "armv7l-linux"; + #nixpkgs.buildPlatform.system = "x86_64-linux"; #If you build on x86 other wise changes this. + + # ... extra configs as above + + #nixpkgs.config.allowUnsupportedSystem = true; + #nixpkgs.hostPlatform.system = "armv7l-linux"; + nixpkgs.hostPlatform.system = "aarch64-linux"; + nixpkgs.buildPlatform.system = "x86_64-linux"; #If you build on x86 other wise changes this. + + #nixpkgs.crossSystem.system = "armv7l-linux"; + # ... extra configs as above + + hardware.enableRedistributableFirmware = true; + } + ]; }; # my headless nixos vm @@ -150,6 +194,17 @@ ./hosts/the-most-default.nix ]; }; + "test" = nixpkgs.lib.nixosSystem { + #specialArgs = { inherit inputs confDir workDir secretsDir persistentDir self; }; + system = "aarch64-linux"; + modules = [ + "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + { + nixpkgs.hostPlatform.system = "aarch64-linux"; + nixpkgs.buildPlatform.system = "x86_64-linux"; + } + ]; + }; }; robotnixConfigurations = rec { @@ -183,7 +238,6 @@ home-manager-path = inputs.home-manager.outPath; }; - packages.x86_64-linux = { cbm = nixpkgs.legacyPackages.x86_64-linux.callPackage ./mods/cbm.nix { }; supabase = nixpkgs.legacyPackages.x86_64-linux.callPackage ./mods/supabase.nix { }; @@ -192,7 +246,11 @@ ${self.nixosConfigurations.hpm.config.system.build.vm}/bin/run-hpm-vm -m 4G -cpu host -smp 4 ''; #wsl = inputs.nix-wsl.nixosConfigurations.modern.config.system.build.tarballBuilder; - + #luna = (self.nixosConfigurations.luna.extendModules { + #modules = [ "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64-new-kernel-no-zfs-installer.nix" ]; + #}).config.system.build.sdImage; + luna = self.nixosConfigurations.luna.config.system.build.sdImage; + test = nixpkgs.legacyPackages.x86_64-linux.pkgsCross.raspberryPi.raspberrypi-armstubs; }; apps.x86_64-linux = { diff --git a/hosts/luna.nix b/hosts/luna.nix index 2742e14..287471f 100644 --- a/hosts/luna.nix +++ b/hosts/luna.nix @@ -1,5 +1,6 @@ { lib, pkgs, ... }: { + # This causes an overlay which causes a lot of rebuilding environment.noXlibs = lib.mkForce false; # "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" creates a @@ -9,6 +10,8 @@ { device = "/dev/disk/by-label/NIXOS_SD"; fsType = "ext4"; }; + + /* boot = { kernelPackages = lib.mkForce pkgs.linuxPackages_latest; loader = { @@ -16,6 +19,8 @@ grub.enable = lib.mkDefault false; }; }; + */ + nix.settings = { experimental-features = lib.mkDefault "nix-command flakes"; trusted-users = [ "root" "@wheel" ]; @@ -43,4 +48,76 @@ }; }; }; + + + /* + boot = { + + kernelPackages = pkgs.linuxKernel.packages.linux_rpi4; + initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ]; + loader = { + grub.enable = false; + generic-extlinux-compatible.enable = true; + }; + }; + + + fileSystems = { + + "/" = { + + device = "/dev/disk/by-label/NIXOS_SD"; + + fsType = "ext4"; + + options = [ "noatime" ]; + + }; + + }; + + + networking = { + + hostName = hostname; + + wireless = { + + enable = true; + + networks."${SSID}".psk = SSIDpassword; + + interfaces = [ interface ]; + + }; + + }; + + + environment.systemPackages = with pkgs; [ vim ]; + + + services.openssh.enable = true; + + + users = { + + mutableUsers = false; + + users."${user}" = { + + isNormalUser = true; + + password = password; + + extraGroups = [ "wheel" ]; + + }; + + }; + + + + system.stateVersion = "23.11"; + */ } diff --git a/hosts/main.nix b/hosts/main.nix index 1155b7f..7e25606 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -50,7 +50,12 @@ # to build rpi images - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + boot.binfmt.emulatedSystems = [ + "aarch64-linux" + #"x86_64-unknown-linux-gnu" + #"armv6l-unknown-linux-gnueabihf" + #"armv7l-hf-multiplatform" + ]; # some bind mounts diff --git a/mybin/mvn b/mybin/mvn index fa3c871..f360301 100755 --- a/mybin/mvn +++ b/mybin/mvn @@ -27,8 +27,6 @@ fi if [ "$1" == "ignore" ] -echo hello -exit then if [ -t 0 ] then diff --git a/mybin/nixre b/mybin/nixre index a7ea83a..18ebf5d 100755 --- a/mybin/nixre +++ b/mybin/nixre @@ -6,20 +6,32 @@ build_from_github(){ export out_path=$(nix build --refresh "github:c2vi/nixos#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths $args_to_pass) - build_exit_code=$? + + if [[ "$out_path" == "" ]] + then + build_exit_code=1 + else + build_exit_code=0 + fi echo out_path: $out_path - echo build_exit_code: $build_exit_code + echo build_exit_code: $build_exit_code return $build_exit_code } build_from_local(){ export out_path=$(sudo nix build "$HOME/work/config#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths $args_to_pass) - build_exit_code=$? + if [[ "$out_path" == "" ]] + then + build_exit_code=1 + else + build_exit_code=0 + fi + echo out_path: $out_path - echo build_exit_code: $build_exit_code + echo build_exit_code: $build_exit_code return $build_exit_code } diff --git a/programs/bash.nix b/programs/bash.nix index 0ebddc7..7ccb79a 100644 --- a/programs/bash.nix +++ b/programs/bash.nix @@ -12,6 +12,8 @@ "ls" "cd" "exit" + "sd vim /etc/hosts" + "sd vim /etc/host-youtube-block" ]; shellOptions = [ diff --git a/programs/ssh.nix b/programs/ssh.nix index abbe722..84db89e 100644 --- a/programs/ssh.nix +++ b/programs/ssh.nix @@ -18,6 +18,11 @@ user = "sebastian"; identityFile = "${secretsDir}/private-key-main"; hostname = "192.168.122.56"; + }; + acern = { + user = "me"; + identityFile = "${secretsDir}/private-key-main"; + hostname = "192.168.1.5"; }; hpm = { #hostname = "192.168.1.6";