diff --git a/flake.nix b/flake.nix index f3fb0ce..9e5715a 100644 --- a/flake.nix +++ b/flake.nix @@ -111,7 +111,18 @@ allowUnfree = true; }; }; + + # Systems that can run tests: + supportedSystems = ["aarch64-linux" "i686-linux" "x86_64-linux"]; + + # Function to generate a set based on supported systems: + forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems; + + # Attribute set of nixpkgs for each system: + nixpkgsFor = + forAllSystems (system: import inputs.nixpkgs {inherit system;}); in { + # NixOS Configurations nixosConfigurations = { kogami = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -141,6 +152,7 @@ ]; }; }; + # Phone Configurations nixOnDroidConfigurations = { tsunemori = inputs.nix-on-droid.lib.nixOnDroidConfiguration { pkgs = import inputs.nixpkgs-droid {system = "aarch64-linux";}; @@ -153,5 +165,27 @@ }; }; }; + + # Install script + packages = forAllSystems (system: let + pkgs = nixpkgsFor.${system}; + in { + default = self.packages.${system}.install; + + install = pkgs.writeShellApplication { + name = "install"; + runtimeInputs = with pkgs; [git busybox gum ]; + text = ''${./install.sh} "$@"''; + }; + }); + + apps = forAllSystems (system: { + default = self.apps.${system}.install; + + install = { + type = "app"; + program = "${self.packages.${system}.install}/bin/install"; + }; + }); }; } diff --git a/ginoza/configuration.nix b/ginoza/configuration.nix index 465deeb..c357ecf 100644 --- a/ginoza/configuration.nix +++ b/ginoza/configuration.nix @@ -26,7 +26,7 @@ boot.loader.systemd-boot.enable = true; sys = { audio.enable = true; - bootloader.systemd-boot.enable = true; + #bootloader.systemd-boot.enable = true; desktop = { plasma.enable = false; gnome.enable = true; diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..8093d28 --- /dev/null +++ b/install.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +if [ $# -gt 0 ]; then + SCRIPT_DIR=$1 +else + SCRIPT_DIR=~/.dotfiles +fi + +nix-shell -p git --command "git clone https://git.foglar.tech/foglar/dotfiles.git $SCRIPT_DIR" +sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/kogami/hardware-configuration.nix +sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/ginoza/hardware-configuration.nix + +sed -i "0,/shinya/s//$(whoami)/" $SCRIPT_DIR/flake.nix + +if [ -z $EDITOR ]; then + EDITOR=nano +fi +$EDITOR $SCRIPT_DIR/flake.nix + +profile=$(gum choose kogami ginoza) +sudo nixos-rebuild build --flake $SCRIPT_DIR#"${profile}" --update + +gum confirm "Do you want to switch to the new configuration?" && sudo nixos-rebuild switch --flake $SCRIPT_DIR#"${profile}" +gum confirm "Do you want to reboot now?" && sudo reboot