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": { "locked": {
"lastModified": 1667907331, "lastModified": 1683543852,
"narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=", "narHash": "sha256-aS9qNcg9GwSYFLCWa3Lw+2nVPG11mmQ3B7Oka1hh04M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6639e3a837fc5deb6f99554072789724997bc8e5", "rev": "3f3fa731ad0f99741d4dc98e8e1287b45e30b452",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-22.05", "ref": "master",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
+22 -1
View File
@@ -10,7 +10,7 @@
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-22.05"; url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "stable"; inputs.nixpkgs.follows = "stable";
}; };
darwin = { 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 { in {
nixosConfigurations = { nixosConfigurations = {
"2maccabees" = unstable { system = "aarch64-linux"; name = "2maccabees"; }; "2maccabees" = unstable { system = "aarch64-linux"; name = "2maccabees"; };
@@ -107,6 +127,7 @@
./hosts/work ./hosts/work
]; ];
}; };
la23002 = mac { name = "ivr"; };
}; };
defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage);
+10 -6
View File
@@ -21,7 +21,9 @@ let
username username
}: }:
let let
stateVersion = "22.05";
homeDirectory = home system username; homeDirectory = home system username;
cfg = { home = { inherit username homeDirectory stateVersion; }; };
configDir = "${homeDirectory}/.config"; configDir = "${homeDirectory}/.config";
@@ -32,12 +34,14 @@ let
}; };
in home-manager.lib.homeManagerConfiguration rec { in home-manager.lib.homeManagerConfiguration rec {
inherit pkgs system username homeDirectory; inherit pkgs;
stateVersion = "22.05"; modules = [
configuration = import ./home.nix { (import ./home.nix {
inherit pkgs gui gnome; inherit pkgs gui gnome;
inherit (pkgs) config lib stdenv; inherit (pkgs) config lib stdenv;
}; })
cfg
];
}; };
in flake-utils.lib.eachDefaultSystem (system: { in flake-utils.lib.eachDefaultSystem (system: {
+22 -20
View File
@@ -15,27 +15,29 @@ in with lib;
programs.firefox = { programs.firefox = {
enable = (! pkgs.stdenv.hostPlatform.isDarwin); enable = (! pkgs.stdenv.hostPlatform.isDarwin);
package = ffPkgs; 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 = { profiles = {
default.settings = { default = {
"app.update.auto" = false; settings = {
"browser.ctrlTab.sortByRecentlyUsed" = true; "app.update.auto" = false;
"browser.startup.page" = 3; "browser.ctrlTab.sortByRecentlyUsed" = true;
"browser.startup.homepage" = "https://thehellings.com"; "browser.startup.page" = 3;
"doh-rollout.doorhanger-decision" = "UIDisabled"; "browser.startup.homepage" = "https://thehellings.com";
"doh-rollout.doneFirstRun" = true; "doh-rollout.doorhanger-decision" = "UIDisabled";
"signon.rememberSignons" = false; "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 import os
system = os.uname() system = os.uname()
if system.sysname == 'Darwin': if system.sysname == 'Darwin':
darwin-rebuild --flake ~/.config/nix switch darwin-rebuild --flake ~/.config/darwin switch
else: else:
sudo nixos-rebuild switch 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 {}; 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 {}; enwiki-dump = super.callPackage ./enwiki-dump.nix {};
hms = super.callPackage ./hms.nix { hms = super.callPackage ./hms.nix {
+4 -15
View File
@@ -5,8 +5,11 @@ set -eo pipefail
arch="$(uname -m)" arch="$(uname -m)"
if [ "$(uname -s)" == "Darwin" ]; then if [ "$(uname -s)" == "Darwin" ]; then
# On macOS # On macOS
src="${HOME}/.config/nix/" src="${HOME}/.config/darwin/"
flavor="gui" flavor="gui"
if [ "${arch}" == "arm64" ]; then
arch=aarch64
fi
arch="${arch}-darwin" arch="${arch}-darwin"
elif [ x"${WSL_DISTRO_NAME}" != "x" ]; then elif [ x"${WSL_DISTRO_NAME}" != "x" ]; then
src=/etc/nixos src=/etc/nixos
@@ -31,17 +34,3 @@ nix build "${src}#homeConfigurations.${flavor}.${arch}.activationPackage"
./result/activate ./result/activate
popd > /dev/null popd > /dev/null
rm -r "${dest}" 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