From 8ee6267080f543e9d9e6c90dfa513cee44096e84 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sat, 26 Sep 2020 11:41:35 +0200 Subject: Add system config --- platforms/common-packages.nix | 11 +++++++++++ platforms/darwin/aliases.nix | 3 +++ platforms/darwin/configuration.nix | 27 +++++++++++++++++++++++++++ platforms/linux/aliases.nix | 3 +++ programs/zsh/default.nix | 29 +++++++---------------------- 5 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 platforms/common-packages.nix create mode 100644 platforms/darwin/aliases.nix create mode 100644 platforms/darwin/configuration.nix create mode 100644 platforms/linux/aliases.nix diff --git a/platforms/common-packages.nix b/platforms/common-packages.nix new file mode 100644 index 0000000..9bfac5e --- /dev/null +++ b/platforms/common-packages.nix @@ -0,0 +1,11 @@ +[ + curl + wget + vim + htop + zip + unzip + ripgrep + jq + file +]; diff --git a/platforms/darwin/aliases.nix b/platforms/darwin/aliases.nix new file mode 100644 index 0000000..f7ef00a --- /dev/null +++ b/platforms/darwin/aliases.nix @@ -0,0 +1,3 @@ +{ + darwin-rebuild = "darwin-rebuild -I darwin-config=$HOME/.config/nixpkgs/platforms/darwin/configuration.nix"; +} diff --git a/platforms/darwin/configuration.nix b/platforms/darwin/configuration.nix new file mode 100644 index 0000000..da6e0aa --- /dev/null +++ b/platforms/darwin/configuration.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +let + common-packages = import ../common-packages.nix; +{ + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ + # Packages + ] ++ common-packages; + + # Use a custom configuration.nix location. + # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix + environment.darwinConfig = "$HOME/.config/nixpkgs/platforms/darwin/configuration.nix"; + + # Auto upgrade nix package and the daemon service. + # services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + # Create /etc/bashrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + # programs.fish.enable = true; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; +} diff --git a/platforms/linux/aliases.nix b/platforms/linux/aliases.nix new file mode 100644 index 0000000..e9b5878 --- /dev/null +++ b/platforms/linux/aliases.nix @@ -0,0 +1,3 @@ +{ + nixos-rebuild = "nixos-rebuild -I nixos-config=$HOME/.config/nixpkgs/platforms/linux/configuration.nix"; +} diff --git a/programs/zsh/default.nix b/programs/zsh/default.nix index 942af70..0e19da1 100644 --- a/programs/zsh/default.nix +++ b/programs/zsh/default.nix @@ -1,4 +1,10 @@ pkgs: + +let + isDarwin = builtins.currentSystem == "x86_64-darwin"; + platformAliases = + if isDarwin then ../../platforms/darwin/aliases.nix + else ../../platforms/linux/aliases.nix { programs.zsh = { enable = true; @@ -11,34 +17,13 @@ pkgs: size = 10000; save = 10000; }; - shellAliases = import ../aliases.nix; + shellAliases = import ../aliases.nix // import platformAliases; defaultKeymap = "viins"; initExtraBeforeCompInit = builtins.readFile ./precomp.zshrc; initExtra = '' _comp_options+=(globdots) ''; - # plugins = [ - # { - # name = "zsh-autosuggestions"; - # src = pkgs.fetchFromGitHub { - # owner = "zsh-users"; - # repo = "zsh-autosuggestions"; - # rev = "v0.6.3"; - # sha256 = "1h8h2mz9wpjpymgl2p7pc146c1jgb3dggpvzwm9ln3in336wl95c"; - # }; - # } - # { - # name = "zsh-syntax-highlighting"; - # src = pkgs.fetchFromGitHub { - # owner = "zsh-users"; - # repo = "zsh-syntax-highlighting"; - # rev = "be3882aeb054d01f6667facc31522e82f00b5e94"; - # sha256 = "0w8x5ilpwx90s2s2y56vbzq92ircmrf0l5x8hz4g1nx3qzawv6af"; - # }; - # } - # ]; - sessionVariables = rec { PROMPT="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "; NVIM_TUI_ENABLE_TRUE_COLOR = "1"; -- cgit 1.4.1