diff --git a/flake.nix b/flake.nix index fdf02de..127a3e0 100644 --- a/flake.nix +++ b/flake.nix @@ -17,38 +17,32 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - -# plasma-manager = { -# url = "github:pjones/plasma-manager"; # Add "inputs.plasma-manager.homeManagerModules.plasma-manager" to the home-manager.users.${user}.imports -# inputs.nixpkgs.follows = "nixpkgs"; -# inputs.home-manager.follows = "home-manager"; -# }; }; outputs = { nixpkgs, home-manager, -# plasma-manager, ... }: let lib = nixpkgs.lib; importConfiguration = directory: { - nixosConfigurations.${builtins.baseNameOf directory} = lib.nixosSystem { + nixosConfigurations.${builtins.baseNameOf directory} = + let + hostPlatform = import (directory + "/platform.nix"); + in + lib.nixosSystem { specialArgs = { - inherit lib; # plasma-manager; + inherit lib; pkgs = import nixpkgs { + system = hostPlatform; config.allowUnfree = true; }; - homeManagerConfiguration = attrs: - let - userName = import (directory + "username.nix"); - in - { - home-manager.users.${userName} = attrs; + homeManagerConfiguration = attrs: { + home-manager.users.${import (directory + "/username.nix")} = attrs; }; }; @@ -56,6 +50,7 @@ directory { networking.hostName = builtins.baseNameOf directory; + nixpkgs.hostPlatform = hostPlatform; } home-manager.nixosModules.home-manager diff --git a/link.sh b/link.sh deleted file mode 100755 index 94ef948..0000000 --- a/link.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -sudo true - -echo "* Cleaning /etc/nixos" -sudo rm -rf /etc/nixos -sudo mkdir /etc/nixos - -echo "* Linking files" -sudo ln ./flake.nix /etc/nixos/flake.nix -sudo ln ./flake.lock /etc/nixos/flake.lock - -sudo ln -s ./system-configuration /etc/nixos/ -sudo ln -s ./home-configuration /etc/nixos/ diff --git a/machines/asus/plasma/default.nix b/machines/asus/plasma/default.nix deleted file mode 100644 index d8147ea..0000000 --- a/machines/asus/plasma/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - -} diff --git a/machines/asus/platform.nix b/machines/asus/platform.nix new file mode 100644 index 0000000..132026a --- /dev/null +++ b/machines/asus/platform.nix @@ -0,0 +1 @@ +"x86_64-linux" diff --git a/rebuild.sh b/rebuild.sh index 9dd1111..4cacb5c 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -1,17 +1,20 @@ #!/bin/sh if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then - echo "Usage: rebuild.sh [-h | --help] [-c | --clean-garbage]" + echo "Usage: rebuild.sh [-h | --help] [-c | --clean-garbage] [machine]" exit fi sudo true -echo -e "\n*** LINKING *** \n" -./link.sh +if [ -n "$1" ]; then + machine = $1 +else + read -p "What machine would you want to build? [$(ls --format=commas machines)]: " machine +fi echo -e "\n*** REBUILDING SYSTEM ***\n" -sudo nixos-rebuild switch +sudo nixos-rebuild switch --flake .#$machine if [[ $? != 0 ]]; then exit 1