refactor: Move nix outside of .config dir

Technically not a config but a compose file, so I think it's better to
have outside of `.config` dir
This commit is contained in:
Ahmad Ansori Palembani 2024-11-05 13:53:13 +07:00
parent 3484b4154a
commit 93a26accd1
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
22 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,105 @@
{ pkgs, pkgs-unstable, config, vars, common, inputs, ... }:
let
libFixup = import ../../lib/darwin/libFixup.nix;
in {
# I don't want to risk breaking my hackintosh setup in case Apple decided to
# turn on auto install by default.
system.defaults.SoftwareUpdate.AutomaticallyInstallMacOSUpdates = false;
# NOTE: List packages installed in system profile. To search by name, run:
# `nix-env -qaP | grep wget`
environment.systemPackages =
common.packages ++ [
pkgs.git
pkgs.vim
pkgs.neovim
pkgs.htop-vim
pkgs.wget
pkgs.eza
pkgs.coreutils-full
pkgs.rclone
pkgs.fastfetch
pkgs.casks.iterm2
pkgs.nmap
pkgs.cargo
pkgs.android-tools
pkgs.duti
pkgs.undmg
pkgs.mkalias
pkgs.jq
# lan-mouse deps
(libFixup { package = pkgs.libadwaita; inherit (pkgs) runCommandLocal; name = "libadwaita"; })
(libFixup { package = pkgs.gtk4; inherit (pkgs) runCommandLocal; name = "gtk4"; })
(libFixup { package = pkgs.pango; inherit (pkgs) runCommandLocal; name = "pango"; })
(libFixup { package = pkgs.harfbuzz; inherit (pkgs) runCommandLocal; name = "harfbuzz"; })
(libFixup { package = pkgs.gdk-pixbuf; inherit (pkgs) runCommandLocal; name = "gdk-pixbuf"; })
(libFixup { package = pkgs.cairo; inherit (pkgs) runCommandLocal; name = "cairo"; })
(libFixup { package = pkgs.graphene; inherit (pkgs) runCommandLocal; name = "graphene"; })
(libFixup { package = pkgs.glib; inherit (pkgs) runCommandLocal; name = "glib"; })
(libFixup { package = pkgs.gettext; inherit (pkgs) runCommandLocal; name = "gettext"; })
pkgs.pass
pkgs.passExtensions.pass-otp
pkgs.gnupg
pkgs.pinentry_mac
common.custom.python
#(pkgs.poetry.override { python3 = common.custom.python; })
pkgs.wimlib
pkgs.google-cloud-sdk
(pkgs.yt-dlp.override { withAlias = true; })
pkgs.iina
pkgs.floorp-bin
common.custom.inkscape
pkgs.casks.zotero
# pkgs.casks.lulu # Doesn't work, it needs to be installed on /Applications/
# pkgs.heliport # FIXME: https://github.com/matthewbauer/undmg/issues/2
pkgs.vesktop
pkgs.lf
pkgs.yazi # lf replacement, need further testing
];
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix = {
package = pkgs.nix;
settings.experimental-features = "nix-command flakes"; # stopping nix from crying about using experimental features flakes and nix-command
};
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enableCompletion = false; # causing "insecure directories and files" error if user doesn't have configured zsh
# Set Git commit hash for darwin-version.
system.configurationRevision = vars.rev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system = {
stateVersion = 4;
# Nix-darwin does not link installed applications to the user environment. This means apps will not show up
# in spotlight, and when launched through the dock they come with a terminal window. This is a workaround.
# Upstream issue: https://github.com/LnL7/nix-darwin/issues/214
# Original code: https://github.com/IvarWithoutBones/dotfiles/commit/0b3faad8bd1d0e1af6103caf59b206666ab742f4
activationScripts.applications.text = let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
in pkgs.lib.mkForce ''
echo "setting up /Applications..." >&2
rm -rf "/Applications/Nix Apps"
mkdir -p "/Applications/Nix Apps"
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
};
}

View file

@ -0,0 +1,68 @@
{ inputs, nixpkgs-stable, nixpkgs-unstable, nix-darwin, brew-api, nur, vars, ... }:
let
mkCommon = import ../../lib/mkCommon.nix;
mkSystem = import ../../lib/mkSystem.nix;
mkBrew = import ../../overlays/darwin/brew.nix;
in
{
# Host list
# Build with darwin flake: `darwin-rebuild build --flake .#<host>`
# e.g. `darwin-rebuild build --flake .#"ThiccBook-Pro"`
# Switch to current build: `darwin-rebuild switch --flake .#<host>`
# Lenovo ThinkPad L460; Intel Core i5-6300U
"ThiccBook-Pro" =
let
system = "x86_64-darwin";
inherit (
mkSystem {
arch = system;
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
extraOverlays = [
inputs.firefox-darwin.overlay
(mkBrew { inherit system brew-api; nixpkgs = nixpkgs-stable; })
(import ../../overlays/darwin/heliport.nix)
(import ../../overlays/darwin/vesktop.nix)
];
nur = nur;
}
) pkgs pkgs-unstable;
common = (mkCommon { inherit pkgs pkgs-unstable; });
in
nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit inputs pkgs pkgs-unstable vars common; };
modules = [
./configuration.nix
];
};
# Imaginary M1, just for reference
MacBookProM1 =
let
system = "aarch64-darwin";
inherit (
mkSystem {
arch = system;
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
extraOverlays = [
inputs.firefox-darwin.overlay
(mkBrew { inherit system brew-api; nixpkgs = nixpkgs-stable; })
(import ../../overlays/darwin/vesktop.nix)
];
nur = nur;
}
) pkgs pkgs-unstable;
common = (mkCommon { inherit pkgs pkgs-unstable; });
in
nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit inputs pkgs pkgs-unstable vars common; };
modules = [
./configuration.nix
];
};
}

View file

@ -0,0 +1,26 @@
{ inputs, nixpkgs-stable, nixpkgs-unstable, system-manager, nur, vars, ... }:
let
mkCommon = import ../../lib/mkCommon.nix;
mkSystem = import ../../lib/mkSystem.nix;
in
{
"potato" =
let
inherit (
mkSystem {
arch = "x86_64-linux";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
nur = nur;
}
) system pkgs pkgs-unstable;
common = (mkCommon { inherit pkgs pkgs-unstable; });
in
system-manager.lib.makeSystemConfig {
extraSpecialArgs = { inherit inputs pkgs pkgs-unstable vars common; };
modules = [
./potato
];
};
}

View file

@ -0,0 +1,25 @@
{ pkgs, pkgs-unstable, config, vars, common, ... }:
{
config = {
system-manager.allowAnyDistro = true;
# NOTE: List packages installed in system profile. To search by name, run:
# `nix-env -qaP | grep wget`
environment = {
etc = {
"nix/nix.conf".text =
''
trusted-users = [ root @wheel ]
experimental-features = nix-command flakes
build-users-group = nixbld
'';
};
systemPackages =
common.packages ++ [
];
};
nixpkgs.hostPlatform = pkgs.system;
};
}