diff --git a/configs/main.nix b/configs/main.nix deleted file mode 100644 index 32a6a71..0000000 --- a/configs/main.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./emacs.nix - ./git.nix - ./gpg.nix - ./zsh.nix - ]; -} diff --git a/darwin-configuration.nix b/darwin-configuration.nix new file mode 100644 index 0000000..4bb1788 --- /dev/null +++ b/darwin-configuration.nix @@ -0,0 +1,48 @@ +{ config, pkgs, lib, currentSystem, ... }: + +let + user = builtins.getEnv "USER"; + unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz; +in +{ + imports = [ ]; + + # List of packages to be installed in the system profile. + environment.systemPackages = []; + + # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix + environment.darwinConfig = "$HOME/.config/nixpkgs/darwin-configuration.nix"; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + nixpkgs.config.packageOverrides = pkgs: { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + users.users.${user} = { + home = "/Users/${user}"; + name = "${user}"; + }; + + services.emacs.enable = true; + + home-manager.useGlobalPkgs = true; + home-manager.users.${user} = import ./home.nix { inherit lib config pkgs currentSystem; }; +} diff --git a/configs/emacs.nix b/emacs.nix similarity index 100% rename from configs/emacs.nix rename to emacs.nix diff --git a/configs/git.nix b/git.nix similarity index 90% rename from configs/git.nix rename to git.nix index 992fb0e..21dd353 100644 --- a/configs/git.nix +++ b/git.nix @@ -7,7 +7,7 @@ enable = true; }; signing = { - gpgPath = "/opt/homebrew/bin/gpg"; +# gpgPath = "${pkgs.gpg.outPath}"; key = "C3DE5DF6198DACBD"; signByDefault = true; }; diff --git a/configs/gpg.nix b/gpg.nix similarity index 100% rename from configs/gpg.nix rename to gpg.nix diff --git a/home.nix b/home.nix index 5b90850..3d2554a 100644 --- a/home.nix +++ b/home.nix @@ -1,34 +1,15 @@ -{ config, pkgs, ... }: +{ pkgs, config, lib, currentSystem, ... }: +let + inherit (lib.systems.elaborate { system = builtins.currentSystem; }) isLinux isDarwin; +in { - imports = [ - ./configs/main.nix - ]; - - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. home.stateVersion = "22.05"; - - home.username = "willem"; - home.homeDirectory = "/Users/willem"; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - nix = { - package = pkgs.nix; - settings.experimental-features = [ "nix-command" ]; - }; - - home.packages = with pkgs; [ - htop - wget - texlive.combined.scheme-full + home.packages = import ./packages.nix { inherit lib config pkgs isDarwin; }; + imports = [ + ./emacs.nix + ./git.nix + ./gpg.nix + ./zsh.nix ]; -} +} diff --git a/configs/p10k-config/p10k.zsh b/p10k-config/p10k.zsh similarity index 100% rename from configs/p10k-config/p10k.zsh rename to p10k-config/p10k.zsh diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..0d919fa --- /dev/null +++ b/packages.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, isDarwin, ... }: + +let + darwinPackages = with pkgs; [ + coreutils + gnused + spoof-mac + colima + pinentry_mac + ]; + dockerPackages = with pkgs; [ + unstable.docker + docker-compose + ]; + editingPackages = with pkgs; [ + black + shellcheck + plantuml + texlive.combined.scheme-full + ]; + nodePackages = with pkgs.nodePackages; [ + bash-language-server + ]; + sharedPackages = with pkgs; [ + zsh-powerlevel10k + automake + autoconf + cmake + bash + rustup + curl + pv + wget + htop + tree + bat + fd + ripgrep + jq + nmap + unzip + yt-dlp + rsync + openssh + tldr + #(import ./python-packages.nix { inherit pkgs; }) + ]; +in +sharedPackages +++ (lib.optionals isDarwin darwinPackages) +++ editingPackages +++ nodePackages +++ dockerPackages diff --git a/python-packages.nix b/python-packages.nix new file mode 100644 index 0000000..c78374f --- /dev/null +++ b/python-packages.nix @@ -0,0 +1,6 @@ +{ pkgs }: + +pkgs.python310.withPackages(p: with p; [ + matplotlib + latexify-py +]) diff --git a/configs/zsh.nix b/zsh.nix similarity index 97% rename from configs/zsh.nix rename to zsh.nix index ec94b6a..4aedaaf 100644 --- a/configs/zsh.nix +++ b/zsh.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { programs.zoxide = {