Be more specific on Darwin
This commit is contained in:
+25
-17
@@ -1,25 +1,32 @@
|
|||||||
{ nixpkgs, nurpkgs, home-manager, username ? builtins.getEnv "USER", ... }:
|
{ nixpkgs, nurpkgs, home-manager, username ? builtins.getEnv "USER", ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
homeDirectory = if username == "root" then "/root" else "/home/${username}";
|
home = system:
|
||||||
configDir = "${homeDirectory}/.config";
|
if username == "root" then "/root" else
|
||||||
|
( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" );
|
||||||
pkgs = import nixpkgs {
|
|
||||||
config.allowUnfree = true;
|
|
||||||
config.xdg.configHome = configDir;
|
|
||||||
overlays = [
|
|
||||||
nurpkgs.overlay
|
|
||||||
(import ../overlays)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nur = import nurpkgs {
|
|
||||||
inherit pkgs;
|
|
||||||
nur = pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
mkhome = system: gui:
|
mkhome = system: gui:
|
||||||
home-manager.lib.homeManagerConfiguration rec {
|
let
|
||||||
|
homeDirectory = home system;
|
||||||
|
|
||||||
|
configDir = "${homeDirectory}/.config";
|
||||||
|
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
config.allowUnfree = true;
|
||||||
|
config.xdg.configHome = configDir;
|
||||||
|
overlays = [
|
||||||
|
nurpkgs.overlay
|
||||||
|
(import ../overlays)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nur = import nurpkgs {
|
||||||
|
inherit pkgs;
|
||||||
|
nur = pkgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
in home-manager.lib.homeManagerConfiguration rec {
|
||||||
inherit pkgs system username homeDirectory;
|
inherit pkgs system username homeDirectory;
|
||||||
stateVersion = "22.05";
|
stateVersion = "22.05";
|
||||||
configuration = import ./home.nix username {
|
configuration = import ./home.nix username {
|
||||||
@@ -32,4 +39,5 @@ in {
|
|||||||
"aarch64-nogui" = mkhome "aarch64-linux" false;
|
"aarch64-nogui" = mkhome "aarch64-linux" false;
|
||||||
"x86_64-gui" = mkhome "x86_64-linux" true;
|
"x86_64-gui" = mkhome "x86_64-linux" true;
|
||||||
"x86_64-nogui" = mkhome "x86_64-linux" false;
|
"x86_64-nogui" = mkhome "x86_64-linux" false;
|
||||||
|
"x86_64-darwin" = mkhome "x86_64-darwin" true;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-7
@@ -3,16 +3,19 @@
|
|||||||
pkgs.writeShellScriptBin "hms" ''
|
pkgs.writeShellScriptBin "hms" ''
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
# Build different targets with GUI or not
|
# Build different targets with GUI or not
|
||||||
if [ -z "$DISPLAY" ]; then
|
|
||||||
target="nogui"
|
|
||||||
else
|
|
||||||
target="gui"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
arch="$(uname -m)"
|
||||||
if [ "$(uname -s)" == "Darwin" ]; then
|
if [ "$(uname -s)" == "Darwin" ]; then
|
||||||
|
# On macOS
|
||||||
src="$HOME/.config/nix/"
|
src="$HOME/.config/nix/"
|
||||||
target=gui
|
target="''${arch}-darwin"
|
||||||
else
|
else
|
||||||
|
# On Linux/WSL2 systems
|
||||||
|
if [ -z "$DISPLAY" ]; then
|
||||||
|
target="''${arch}-nogui"
|
||||||
|
else
|
||||||
|
target="''${arch}-gui"
|
||||||
|
fi
|
||||||
src=/etc/nixos
|
src=/etc/nixos
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -20,7 +23,7 @@ fi
|
|||||||
echo "Building $(uname -m)-$target"
|
echo "Building $(uname -m)-$target"
|
||||||
dest=$(mktemp -d)
|
dest=$(mktemp -d)
|
||||||
pushd "$dest" > /dev/null
|
pushd "$dest" > /dev/null
|
||||||
nix build --impure "$src#homeConfigurations.$(uname -m)-$target.activationPackage"
|
nix build --impure "$src#homeConfigurations.$target.activationPackage"
|
||||||
./result/activate
|
./result/activate
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
rm -r "$dest"
|
rm -r "$dest"
|
||||||
|
|||||||
Reference in New Issue
Block a user