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,10 @@
{ package, runCommandLocal, name }:
runCommandLocal "${name}-symlink" {}
''
dest="/usr/local/opt/${name}"
mkdir -p $dest
ln -sf "${package.out}/lib/" "$dest" && mkdir -p "$out" && touch "$out/${name}-done"
''

22
nix/lib/darwin/mkApp.nix Normal file
View file

@ -0,0 +1,22 @@
# REF: https://github.com/bandithedoge/nixpkgs-firefox-darwin/blob/ceaca2359e5371ccef3f92a36baf7c438b354afb/overlay.nix
{ stdenv, undmg, _7zz, pname, version, sourceRoot ? ".", appFileName, src, meta
, nativeBuildInputs ? [ undmg _7zz ]
, unpackPhase ? "undmg $src || 7zz x -snld $src"
, installPhase ? ''
mkdir -p $out/Applications
cp -R ${appFileName} "$out/Applications/"
''
}:
stdenv.mkDerivation rec {
inherit pname version;
inherit src nativeBuildInputs;
inherit sourceRoot;
phases = [ "unpackPhase" "installPhase" ];
inherit unpackPhase installPhase;
inherit meta;
}

21
nix/lib/mkCommon.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs, pkgs-unstable, ... }:
let
custom = {
python = (pkgs.python312Full.withPackages (py: [
py.pip
py.tkinter
py.dnspython
]));
};
custom.inkscape = if pkgs.stdenv.isDarwin then pkgs.casks.inkscape else (pkgs.inkscape.override { python3 = custom.python; });
in {
inherit custom;
packages = [
pkgs.zsh
pkgs.home-manager
pkgs.zoxide
pkgs.ruby
pkgs._7zz
];
}

29
nix/lib/mkSystem.nix Normal file
View file

@ -0,0 +1,29 @@
{ arch, stable, unstable, nur, extraOverlays ? [] }:
let
overlays = [
(import ../overlays/python.nix)
] ++ extraOverlays;
# Placed here so that we don't need to specify hash for fetchTarball
packageOverrides = pkgs: {
nur = import nur {
nurpkgs = pkgs;
inherit pkgs;
};
};
in {
system = arch;
pkgs = import stable {
system = arch;
inherit overlays;
config.allowUnfree = true;
config.packageOverrides = packageOverrides;
};
pkgs-unstable = import unstable {
system = arch;
inherit overlays;
config.allowUnfree = true;
# config.packageOverrides = packageOverrides;
};
}