added script to install nixos with one command
This commit is contained in:
parent
9e4b796451
commit
8b28196951
34
flake.nix
34
flake.nix
@ -111,7 +111,18 @@
|
|||||||
allowUnfree = true;
|
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 {
|
in {
|
||||||
|
# NixOS Configurations
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
kogami = nixpkgs.lib.nixosSystem {
|
kogami = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
@ -141,6 +152,7 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# Phone Configurations
|
||||||
nixOnDroidConfigurations = {
|
nixOnDroidConfigurations = {
|
||||||
tsunemori = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
tsunemori = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
pkgs = import inputs.nixpkgs-droid {system = "aarch64-linux";};
|
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";
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
sys = {
|
sys = {
|
||||||
audio.enable = true;
|
audio.enable = true;
|
||||||
bootloader.systemd-boot.enable = true;
|
#bootloader.systemd-boot.enable = true;
|
||||||
desktop = {
|
desktop = {
|
||||||
plasma.enable = false;
|
plasma.enable = false;
|
||||||
gnome.enable = true;
|
gnome.enable = true;
|
||||||
|
|||||||
24
install.sh
Normal file
24
install.sh
Normal file
@ -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
|
||||||
Loading…
Reference in New Issue
Block a user