diff --git a/darwin.sh b/darwin.sh new file mode 100644 index 0000000..0bd50b0 --- /dev/null +++ b/darwin.sh @@ -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 diff --git a/flake.lock b/flake.lock index 0daae6c..adf2236 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } diff --git a/flake.nix b/flake.nix index 32928a2..2839629 100644 --- a/flake.nix +++ b/flake.nix @@ -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); diff --git a/home/default.nix b/home/default.nix index 06417d3..31b6222 100644 --- a/home/default.nix +++ b/home/default.nix @@ -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: { diff --git a/home/gui/firefox.nix b/home/gui/firefox.nix index 85e3abf..a1ccc64 100644 --- a/home/gui/firefox.nix +++ b/home/gui/firefox.nix @@ -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 + ]; }; }; }; diff --git a/home/xonsh_footer.xsh b/home/xonsh_footer.xsh index e91d2ba..daed89b 100644 --- a/home/xonsh_footer.xsh +++ b/home/xonsh_footer.xsh @@ -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 diff --git a/hosts/ivr/default.nix b/hosts/ivr/default.nix new file mode 100644 index 0000000..0ec2a68 --- /dev/null +++ b/hosts/ivr/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + ]; +} diff --git a/overlays/default.nix b/overlays/default.nix index 85bf0f7..ce5becf 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -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 { diff --git a/overlays/hms.sh b/overlays/hms.sh index 1c08bcd..ac7c6f2 100644 --- a/overlays/hms.sh +++ b/overlays/hms.sh @@ -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