Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
lccambiaghi committed Jan 14, 2024
1 parent 3c576d1 commit 69a98b3
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 442 deletions.
16 changes: 1 addition & 15 deletions darwin/bootstrap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,13 @@
# Add shells installed by nix to /etc/shells file
environment.shells = with pkgs; [
bashInteractive
fish
zsh
];

# Make Fish the default shell
programs.fish.enable = true;
programs.fish.useBabelfish = true;
programs.fish.babelfishPackage = pkgs.babelfish;
# Needed to address bug where $PATH is not properly set for fish:
# https://github.com/LnL7/nix-darwin/issues/122
programs.fish.shellInit = ''
for p in (string split : ${config.environment.systemPath})
if not contains $p $fish_user_paths
set -g fish_user_paths $fish_user_paths $p
end
end
'';
environment.variables.SHELL = "${pkgs.fish}/bin/fish";

# Install and setup ZSH to work with nix(-darwin) as well
programs.zsh.enable = true;
environment.variables.SHELL = "${pkgs.zsh}/bin/zsh";

# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
Expand Down
6 changes: 3 additions & 3 deletions darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@
'';
# loginShell = pkgs.fish;
pathsToLink = [ "/Applications" ];
shells = [ pkgs.fish pkgs.zsh ];
shells = [ pkgs.zsh ];
# systemPackages = [ ];
systemPath = [
# "/run/current-system/sw/bin/" # TODO how to avoid hardcoding?
"$HOME/.npm-packages/bin"
"$HOME/.poetry/bin"
"$HOME/.modular/pkg/packages.modular.com_mojo/bin"
"/Users/cambiaghiluca/.modular/pkg/packages.modular.com_mojo/bin"
# "$HOME/.emacs.d/bin"
# "$HOME/git/doom-emacs/bin"
# "/opt/homebrew/bin"
Expand All @@ -125,7 +125,7 @@

};

programs.fish.enable = true;
programs.fish.enable = false;
programs.zsh.enable = true;
programs.bash.enable = true;

Expand Down
141 changes: 10 additions & 131 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 3 additions & 84 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,11 @@
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = github:nix-community/home-manager;
home-manager.inputs.nixpkgs.follows = "nixpkgs-unstable";

# Other sources
emacs.url = "github:nix-community/emacs-overlay";
fish-done = { url = "github:franciscolourenco/done"; flake = false; };
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
flake-utils.url = "github:numtide/flake-utils";
};

# outputs = { self, darwin, home-manager, flake-utils, ... }@inputs:
outputs = inputs@{ self, nixpkgs, darwin, home-manager, flake-utils, ... }:
let
inherit (darwin.lib) darwinSystem;
inherit (inputs.nixpkgs-unstable.lib) attrValues makeOverridable optionalAttrs singleton;
nixpkgsConfig = {
config = { allowUnfree = true; allowUnsupportedSystem = true;};
overlays = attrValues self.overlays ++ singleton (
# Sub in x86 version of packages that don't build on Apple Silicon yet
final: prev: (optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
inherit (final.pkgs-x86)
idris2
nix-index
niv;
})
);
};
homeManagerCommonConfig = {
imports = with self.homeManagerModules; [
Expand All @@ -60,8 +41,6 @@
in
{
nixpkgs = nixpkgsConfig;
# Hack to support legacy worklows that use `<nixpkgs>` etc.
# nix.nixPath = { nixpkgs = "$HOME/.config/nixpkgs/nixpkgs.nix"; };
# `home-manager` config
users.users.${primaryUser}.home = "/Users/${primaryUser}";
home-manager.useGlobalPkgs = true;
Expand All @@ -71,15 +50,8 @@
];
in {
darwinConfigurations = rec {
# Mininal configurations to bootstrap systems
bootstrap-x86 = makeOverridable darwinSystem {
system = "x86_64-darwin";
modules = [ ./darwin/bootstrap { nixpkgs = nixpkgsConfig; } ];
};
bootstrap-arm = bootstrap-x86.override { system = "aarch64-darwin"; };
# main macbook configuration
macbookpro = makeOverridable darwinSystem {
system = "x86_64-darwin";
macbookpro-m1 = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = nixDarwinCommonModules ++ [
{
# users.primaryUser = "cambiaghiluca";
Expand All @@ -93,13 +65,6 @@
];
specialArgs = { inherit inputs nixpkgs; };
};
# My new Apple Silicon macOS laptop config
macbookpro-m1 = macbookpro.override { system = "aarch64-darwin"; };
githubCI = darwin.lib.darwinSystem {
modules = nixDarwinCommonModules { user = "runner"; } ++ [
({ lib, ... }: { homebrew.enable = lib.mkForce false; })
];
};
};
cloudVM = home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";
Expand All @@ -110,51 +75,5 @@
nixpkgs = nixpkgsConfig;
};
};
# homeManagerModules = {
# configs.git.aliases = import ./home/configs/git-aliases.nix;
# configs.gh.aliases = import ./home/configs/gh-aliases.nix;
# configs.starship.symbols = import ./home/configs/starship-symbols.nix;
# programs.neovim.extras = import ./home/modules/programs/neovim/extras.nix;
# programs.kitty.extras = import ./home/modules/programs/kitty/extras.nix;
# };
overlays = {
# Overlays to add different versions `nixpkgs` into package set
pkgs-master = final: prev: {
pkgs-master = import inputs.nixpkgs-master {
inherit (prev.stdenv) system;
inherit (nixpkgsConfig) config;
};
};
pkgs-stable = final: prev: {
pkgs-stable = import inputs.nixpkgs-stable {
inherit (prev.stdenv) system;
inherit (nixpkgsConfig) config;
};
};
pkgs-unstable = final: prev: {
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit (prev.stdenv) system;
inherit (nixpkgsConfig) config;
};
};
apple-silicon = final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
# Add access to x86 packages system is running Apple Silicon
pkgs-x86 = import inputs.nixpkgs-unstable {
system = "x86_64-darwin";
inherit (nixpkgsConfig) config;
};
};
};
} //
flake-utils.lib.eachDefaultSystem (system: {
legacyPackages = import inputs.nixpkgs-unstable {
inherit system;
inherit (nixpkgsConfig) config;
overlays = with self.overlays; [
pkgs-master
pkgs-stable
apple-silicon
];
};
});
};
}
2 changes: 1 addition & 1 deletion home/programs/shells/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in
# echo "$HOME/.nix-profile/bin/fish" | sudo tee -a /etc/shells
# sudo chsh -s "/run/current-system/sw/bin/fish" "$USER"
programs.fish = {
enable = true;
enable = false;
inherit shellAliases;
shellInit = ''
direnv hook fish | source
Expand Down
5 changes: 0 additions & 5 deletions overlays/default.nix

This file was deleted.

Loading

0 comments on commit 69a98b3

Please sign in to comment.