Update for Darwin aarch64 config

This commit is contained in:
Greg Hellings
2023-05-09 12:01:29 -05:00
parent 65259176f4
commit efa9f107ad
9 changed files with 91 additions and 48 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -ex
set -o pipefail
dir="$(mktemp -d)"
cd "${dir}"
# Install nix-darwin
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
# Get my configuration
mkdir -p ~/.config/darwin
cd ~/.config/darwin
curl -O -L https://github.com/greg-hellings/nixos-config/archive/refs/heads/main.tar.gz
tar xvzf main.tar.gz --strip-components 1
# Build NixOS for this system
cd "${dir}"
nix build "~/.config/darwin#darwinConfigurations.$(hostname -s).system"
./result/sw/bin/darwin-rebuild switch --flake ~/.config/darwin
Generated
+4 -4
View File
@@ -110,16 +110,16 @@
]
},
"locked": {
"lastModified": 1667907331,
"narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=",
"lastModified": 1683543852,
"narHash": "sha256-aS9qNcg9GwSYFLCWa3Lw+2nVPG11mmQ3B7Oka1hh04M=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6639e3a837fc5deb6f99554072789724997bc8e5",
"rev": "3f3fa731ad0f99741d4dc98e8e1287b45e30b452",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-22.05",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
+22 -1
View File
@@ -10,7 +10,7 @@
agenix.url = "github:ryantm/agenix";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "stable";
};
darwin = {
@@ -72,6 +72,26 @@
};
};
mac = {
system ? "aarch64-darwin",
name,
channel ? unstable,
extraMods ? []
}:
let
nixpkgs = channel;
in inputs.darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit nixpkgs; };
modules = [
{ nixpkgs.overlays = overlays; }
inputs.agenix.nixosModule
./modules-all
./modules-darwin
./hosts/${name}
] ++ extraMods;
};
in {
nixosConfigurations = {
"2maccabees" = unstable { system = "aarch64-linux"; name = "2maccabees"; };
@@ -107,6 +127,7 @@
./hosts/work
];
};
la23002 = mac { name = "ivr"; };
};
defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage);
+10 -6
View File
@@ -21,7 +21,9 @@ let
username
}:
let
stateVersion = "22.05";
homeDirectory = home system username;
cfg = { home = { inherit username homeDirectory stateVersion; }; };
configDir = "${homeDirectory}/.config";
@@ -32,12 +34,14 @@ let
};
in home-manager.lib.homeManagerConfiguration rec {
inherit pkgs system username homeDirectory;
stateVersion = "22.05";
configuration = import ./home.nix {
inherit pkgs gui gnome;
inherit (pkgs) config lib stdenv;
};
inherit pkgs;
modules = [
(import ./home.nix {
inherit pkgs gui gnome;
inherit (pkgs) config lib stdenv;
})
cfg
];
};
in flake-utils.lib.eachDefaultSystem (system: {
+22 -20
View File
@@ -15,27 +15,29 @@ in with lib;
programs.firefox = {
enable = (! pkgs.stdenv.hostPlatform.isDarwin);
package = ffPkgs;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
bypass-paywalls-clean
foxyproxy-standard
multi-account-containers
plasma-integration
octotree
refined-github
tree-style-tab
ublock-origin
unpaywall
];
profiles = {
default.settings = {
"app.update.auto" = false;
"browser.ctrlTab.sortByRecentlyUsed" = true;
"browser.startup.page" = 3;
"browser.startup.homepage" = "https://thehellings.com";
"doh-rollout.doorhanger-decision" = "UIDisabled";
"doh-rollout.doneFirstRun" = true;
"signon.rememberSignons" = false;
default = {
settings = {
"app.update.auto" = false;
"browser.ctrlTab.sortByRecentlyUsed" = true;
"browser.startup.page" = 3;
"browser.startup.homepage" = "https://thehellings.com";
"doh-rollout.doorhanger-decision" = "UIDisabled";
"doh-rollout.doneFirstRun" = true;
"signon.rememberSignons" = false;
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
bypass-paywalls-clean
foxyproxy-standard
multi-account-containers
plasma-integration
octotree
refined-github
tree-style-tab
ublock-origin
unpaywall
];
};
};
};
+1 -1
View File
@@ -6,7 +6,7 @@ def _rebuild(args):
import os
system = os.uname()
if system.sysname == 'Darwin':
darwin-rebuild --flake ~/.config/nix switch
darwin-rebuild --flake ~/.config/darwin switch
else:
sudo nixos-rebuild switch
+5
View File
@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
];
}
+1 -1
View File
@@ -80,7 +80,7 @@ in rec {
xonsh-direnv = cp ./xonsh-direnv.nix {};
};
fcitx-engines = self.fcitx5;
#fcitx-engines = if ! super.stdenv.isDarwin then super.fcitx5 else super.fcitx-engines;
enwiki-dump = super.callPackage ./enwiki-dump.nix {};
hms = super.callPackage ./hms.nix {
+4 -15
View File
@@ -5,8 +5,11 @@ set -eo pipefail
arch="$(uname -m)"
if [ "$(uname -s)" == "Darwin" ]; then
# On macOS
src="${HOME}/.config/nix/"
src="${HOME}/.config/darwin/"
flavor="gui"
if [ "${arch}" == "arm64" ]; then
arch=aarch64
fi
arch="${arch}-darwin"
elif [ x"${WSL_DISTRO_NAME}" != "x" ]; then
src=/etc/nixos
@@ -31,17 +34,3 @@ nix build "${src}#homeConfigurations.${flavor}.${arch}.activationPackage"
./result/activate
popd > /dev/null
rm -r "${dest}"
if [ "$(uname -s)" == "Darwin" ]; then
cd ~/.nix-profile/Applications
for app in *.app; do
echo "Updating permissions on '${app}'"
mkdir -p "${HOME}/Applications/${app}"
chmod -R u+w "${HOME}/Applications/${app}" || true
echo "Copying new version to Applications"
rsync -rptgoDv "${app}/" "${HOME}/Applications/${app}/" 2>&1 > /dev/null || true
if [ "$?" != "0" ]; then
echo "An error occurred, proceeding anyway"
fi
done
fi