use nix-darwin and add more packages

This commit is contained in:
willemml 2022-12-04 21:09:19 -08:00
parent 0452ac1eb2
commit bd35608bba
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
10 changed files with 120 additions and 40 deletions

View file

@ -1,8 +0,0 @@
{
imports = [
./emacs.nix
./git.nix
./gpg.nix
./zsh.nix
];
}

48
darwin-configuration.nix Normal file
View file

@ -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 = [ <home-manager/nix-darwin> ];
# 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; };
}

View file

@ -7,7 +7,7 @@
enable = true;
};
signing = {
gpgPath = "/opt/homebrew/bin/gpg";
# gpgPath = "${pkgs.gpg.outPath}";
key = "C3DE5DF6198DACBD";
signByDefault = true;
};

View file

@ -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
];
}
}

53
packages.nix Normal file
View file

@ -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

6
python-packages.nix Normal file
View file

@ -0,0 +1,6 @@
{ pkgs }:
pkgs.python310.withPackages(p: with p; [
matplotlib
latexify-py
])

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, lib, ... }:
{
programs.zoxide = {