work towards os agnostic config

This commit is contained in:
willemml 2023-01-28 11:35:56 -08:00
parent bc6254b8c3
commit a35b13e5d8
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
10 changed files with 108 additions and 42 deletions

View file

@ -1 +0,0 @@
willem@zeus.44981

17
flake.lock generated
View file

@ -53,22 +53,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-willem": {
"locked": {
"lastModified": 1672945252,
"narHash": "sha256-vkZYxDq8Bdt5JhZCcV4nniqaIsiYW3DAiuNXClFWcGA=",
"owner": "willemml",
"repo": "nixpkgs",
"rev": "4d11054d40eeeb77400d8cd71966d1bf3098d449",
"type": "github"
},
"original": {
"owner": "willemml",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1672872270, "lastModified": 1672872270,
@ -89,7 +73,6 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs-22_11": "nixpkgs-22_11", "nixpkgs-22_11": "nixpkgs-22_11",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nixpkgs-willem": "nixpkgs-willem",
"nur": "nur" "nur": "nur"
} }
}, },

View file

@ -2,7 +2,6 @@
description = "Willem's Home Manager configuration"; description = "Willem's Home Manager configuration";
inputs = { inputs = {
nixpkgs-willem.url = "github:willemml/nixpkgs/master";
nixpkgs-22_11.url = "github:NixOS/nixpkgs/nixos-22.11"; nixpkgs-22_11.url = "github:NixOS/nixpkgs/nixos-22.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = { home-manager = {
@ -13,7 +12,7 @@
}; };
outputs = outputs =
{ self, nixpkgs-willem, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: { self, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs:
let let
system = "aarch64-darwin"; system = "aarch64-darwin";
@ -29,10 +28,6 @@
]; ];
}; };
pkgsCustom = import nixpkgs-willem {
inherit system;
};
nurNoPkgs = import nur { nurNoPkgs = import nur {
nurpkgs = pkgs; nurpkgs = pkgs;
pkgs = throw "nixpkgs eval"; pkgs = throw "nixpkgs eval";
@ -47,7 +42,7 @@
# Optionally use extraSpecialArgs # Optionally use extraSpecialArgs
# to pass through arguments to home.nix # to pass through arguments to home.nix
extraSpecialArgs = { inherit nurNoPkgs pkgsCustom; }; extraSpecialArgs = { inherit nurNoPkgs; };
}; };
}; };
} }

View file

@ -1,6 +1,8 @@
{ config, pkgs, lib, inputs, ... }: { config, pkgs, lib, inputs, ... }:
let let
inherit (pkgs) stdenv;
inherit (lib) mkIf;
emacsCommand = "emacsclient -c -nw"; emacsCommand = "emacsclient -c -nw";
homeDirectory = config.home.homeDirectory; homeDirectory = config.home.homeDirectory;
in { in {
@ -16,7 +18,7 @@ in {
builders-use-substitutes = true builders-use-substitutes = true
''; '';
home.file.".gnupg/gpg-agent.conf".text = '' home.file.".gnupg/gpg-agent.conf".text = mkIf stdenv.isDarwin ''
pinentry-program "${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac" pinentry-program "${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac"
''; '';

View file

@ -1,7 +1,7 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
{ {
launchd = { launchd = lib.mkIf pkgs.stdenv.isDarwin {
enable = true; enable = true;
agents.emacs = { agents.emacs = {

View file

@ -1,19 +1,22 @@
{ config, lib, pkgs, pkgsCustom, ... }: { pkgs, lib, ... }:
{ let
darwin = with pkgs; [
colima
coreutils
gnused
iterm2
karabiner-elements
pinentry_mac
spoof-mac
(pkgs.callPackage ./packages/qbittorrent-mac.nix { inherit pkgs; })
(pkgs.callPackage ./packages/spotify-mac.nix { inherit pkgs; })
(pkgs.callPackage ./packages/vlc-mac.nix { inherit pkgs; })
];
linux = with pkgs; [ vlc qbittorrent ];
in {
home.packages = with pkgs; home.packages = with pkgs;
[ [
colima
coreutils
gnused
iterm2
karabiner-elements
pinentry_mac
spoof-mac
zoom-us
(pkgs.callPackage ./spotify-mac.nix { inherit config lib pkgs; })
] ++ [ discord pkgsCustom.vlc pkgsCustom.qbittorrent ]
++ [ docker docker-compose ] ++ [
autoconf autoconf
automake automake
bash bash
@ -21,6 +24,9 @@
cmake cmake
comma comma
curl curl
discord
docker
docker-compose
fd fd
gawk gawk
htop htop
@ -28,15 +34,19 @@
nix-review nix-review
nmap nmap
openssh openssh
pass
pv pv
ripgrep ripgrep
rsync rsync
rustup rustup
tldr tldr
units
unp unp
unrar unrar
unzip unzip
wget wget
yq yq
]; zoom-us
] ++ lib.optionals stdenv.isLinux linux
++ lib.optionals stdenv.isDarwin darwin;
} }

View file

@ -0,0 +1,33 @@
{ stdenv, pkgs, fetchurl, ... }:
let
version = "4.4.5";
appName = "qBittorrent";
pname = "qbittorrent";
in stdenv.mkDerivation {
inherit pname;
name = pname;
src = fetchurl {
url =
"https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM=";
};
nativeBuildInputs = [ pkgs.undmg pkgs.makeWrapper ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r "${appName}.app" $out/Applications
# wrap executable to $out/bin
mkdir -p $out/bin
makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${pname}" "$out/bin/${pname}"
runHook postInstall
'';
}

View file

@ -1,4 +1,4 @@
{ stdenv, lib, config, pkgs, ... }: { stdenv, pkgs, ... }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "spotify-mac-app"; name = "spotify-mac-app";

39
packages/vlc-mac.nix Normal file
View file

@ -0,0 +1,39 @@
{ stdenv, pkgs, fetchurl, ... }:
let
version = "3.0.18";
srcs = {
aarch64-darwin = fetchurl {
url =
"http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg";
sha256 = "sha256-mcJZvbxSIf1QgX9Ri3Dpv57hdeiQdDkDyYB7x3hmj0c=";
};
x86_64-darwin = fetchurl {
url =
"http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg";
sha256 = "sha256-iO3N/Os70vaANn2QCdOKDBR/p1jy3TleQ0EsHgjOHMs=";
};
};
pname = "vlc";
in stdenv.mkDerivation {
name = pname;
src = srcs.${stdenv.hostPlatform.system};
nativeBuildInputs = [ pkgs.undmg pkgs.makeWrapper ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r "VLC.app" $out/Applications
# wrap executable to $out/bin
mkdir -p $out/bin
makeWrapper "$out/Applications/VLC.app/Contents/MacOS/VLC" "$out/bin/vlc"
runHook postInstall
'';
}

View file

@ -112,6 +112,10 @@
export PATH=${pkgs.pinentry_mac.out}/Applications/pinentry-mac.app/Contents/MacOS:$PATH export PATH=${pkgs.pinentry_mac.out}/Applications/pinentry-mac.app/Contents/MacOS:$PATH
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
eval $(gpg-agent --daemon -q 2>/dev/null) eval $(gpg-agent --daemon -q 2>/dev/null)
function gsearch() {
open -a Safari "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')"
}
''; '';
dotDir = ".config/zsh"; dotDir = ".config/zsh";
history = { history = {
@ -128,6 +132,7 @@
hms = "home-manager switch"; hms = "home-manager switch";
cd = "z"; cd = "z";
l = "ls -1"; l = "ls -1";
web = "open -a Safari";
}; };
}; };