Compare commits
1 Commits
main
..
6da4c90853
| Author | SHA1 | Date | |
|---|---|---|---|
|
6da4c90853
|
@@ -96,8 +96,7 @@
|
|||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system: let
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pkgs = import nixpkgs {inherit system;};
|
|
||||||
in {
|
in {
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
@@ -112,7 +111,7 @@
|
|||||||
packages = {
|
packages = {
|
||||||
homeConfigurations = let
|
homeConfigurations = let
|
||||||
extraSpecialArgs = {inherit inputs outputs system;};
|
extraSpecialArgs = {inherit inputs outputs system;};
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
defaultUserModules = [
|
defaultUserModules = [
|
||||||
inputs.sops-nix.homeManagerModules.sops
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
inputs.spicetify.homeManagerModules.default
|
inputs.spicetify.homeManagerModules.default
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [./helpers.nix];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
flake = {
|
||||||
|
nixosConfigurations = lib.mkMerge [
|
||||||
|
(config.flake.lib.mkNixos "x86_64-linux" "alys")
|
||||||
|
(config.flake.lib.mkNixos "x86_64-linux" "elcafe")
|
||||||
|
(config.flake.lib.mkNixos "x86_64-linux" "gampo")
|
||||||
|
(config.flake.lib.mkNixos "x86_64-linux" "marpa")
|
||||||
|
(config.flake.lib.mkNixos "x86_64-linux" "NaroMk3")
|
||||||
|
(config.flake.lib.mkNixos "x86_64-linux" "tilo")
|
||||||
|
(config.flake.lib.mkPinetab "x86_64-linux" [
|
||||||
|
inputs.self.modules.nixos.pinetab2-gnome
|
||||||
|
])
|
||||||
|
];
|
||||||
|
|
||||||
|
homeConfigurations = lib.mkMerge [
|
||||||
|
(config.flake.lib.mkHome "aarch64-linux" "phundrak" "pinetab2")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "creug" "elcafe")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "phundrak" "NaroMk3")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "phundrak" "alys")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "phundrak" "elcafe")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "phundrak" "gampo")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "phundrak" "marpa")
|
||||||
|
(config.flake.lib.mkHome "x86_64-linux" "phundrak" "tilo")
|
||||||
|
];
|
||||||
|
};
|
||||||
|
perSystem = {
|
||||||
|
config',
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
nh
|
||||||
|
jujutsu
|
||||||
|
git
|
||||||
|
inputs.jj-cz.packages.${config'.system}.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
imports = [./home-manager.nix];
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
settingsToLines = with lib;
|
||||||
|
settings:
|
||||||
|
concatStringsSep "\n" (
|
||||||
|
mapAttrsToList (name: value: "set ${name} ${toString value}") settings
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
flake-file.inputs.zen-browser = {
|
||||||
|
url = "github:youwen5/zen-browser-flake";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.modules.homeManager.firefox = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.flake.options.firefox;
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
|
zen = inputs.zen-browser.packages.${system}.default;
|
||||||
|
in {
|
||||||
|
options.flake.options.firefox = {
|
||||||
|
enable = mkEnableOption "enable Firefox";
|
||||||
|
useZen = mkEnableOption "use Zen instead of Firefox";
|
||||||
|
tridactyl = {
|
||||||
|
enable = mkEnableOption "enable Tridactyl";
|
||||||
|
preConfig = mkOption {
|
||||||
|
description = "Lines to add to the beginning of tridactylrc";
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
config = mkOption {
|
||||||
|
type = with types;
|
||||||
|
attrsOf (oneOf [int str bool]);
|
||||||
|
description = "Tridactyl settings (converted to 'set key value' lines)";
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
smoothscroll = true;
|
||||||
|
history = 1000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraConfig = mkOption {
|
||||||
|
description = "Extra lines to add to tridactylrc (for bindings, autocmds, etc)";
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.sessionVariables.MOZ_ENABLE_WAYLAND = "1";
|
||||||
|
programs.firefox = {
|
||||||
|
inherit (cfg) enable;
|
||||||
|
package =
|
||||||
|
if cfg.useZen
|
||||||
|
then zen
|
||||||
|
else pkgs.firefox;
|
||||||
|
nativeMessagingHosts = lists.optional cfg.tridactyl.enable pkgs.tridactyl-native;
|
||||||
|
configPath = ".mozilla/firefox";
|
||||||
|
};
|
||||||
|
xdg.configFile."tridactyl/tridactylrc" = mkIf cfg.tridactyl.enable {
|
||||||
|
text = concatStringsSep "\n" (filter (s: s != "") [
|
||||||
|
cfg.tridactyl.preConfig
|
||||||
|
(settingsToLines (cfg.tridactyl.config
|
||||||
|
// {
|
||||||
|
browser =
|
||||||
|
if cfg.useZen
|
||||||
|
then "zen"
|
||||||
|
else "firefox";
|
||||||
|
}))
|
||||||
|
cfg.tridactyl.extraConfig
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
config.flake.lib = {
|
||||||
|
mkNixos = system: name: {
|
||||||
|
${name} = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
inputs.self.modules.nixos.${name}
|
||||||
|
{nixpkgs.hostPlatform = lib.mkDefault system;}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mkHome = system: username: hostname: {
|
||||||
|
"${username}@${hostname}" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
|
extraSpecialArgs = {inherit inputs;};
|
||||||
|
modules = [inputs.self.modules.homeManager.${username}.${hostname}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mkPinetab = buildPlatform: variantModules: {
|
||||||
|
pinetab2 = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
system = "aarch64-linux";
|
||||||
|
modules =
|
||||||
|
[
|
||||||
|
inputs.rockchip.nixosModules.sdImageRockchip
|
||||||
|
inputs.rockchip.nixosModules.dtOverlayPCIeFix
|
||||||
|
inputs.rockchip.nixosModules.noZFS
|
||||||
|
inputs.self.modules.nixos.pinetab2-base
|
||||||
|
]
|
||||||
|
++ variantModules
|
||||||
|
++ [
|
||||||
|
{
|
||||||
|
rockchip.uBoot = inputs.rockchip.packages.${buildPlatform}.uBootPineTab2;
|
||||||
|
boot.kernelPackages =
|
||||||
|
inputs.rockchip.legacyPackages.${buildPlatform}.kernel_linux_7_0_pinetab_unstable;
|
||||||
|
hardware.firmware = [inputs.rockchip.packages.aarch64-linux.bes2600];
|
||||||
|
nixpkgs.config.allowUnfreePredicate = pkg:
|
||||||
|
builtins.elem (inputs.nixpkgs.lib.getName pkg) ["bes2600-firmware"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
flake-file = {
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
nixpkgsStable.url = "nixpkgs/nixos-25.11";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
flake-file.url = "github:vic/flake-file";
|
||||||
|
import-tree.url = "github:vic/import-tree";
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
jj-cz = {
|
||||||
|
url = "git+https://labs.phundrak.com/phundrak/jj-cz?ref=main";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
outputs = "flake-parts";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{inputs, ...}: {
|
||||||
|
flake.modules = {
|
||||||
|
nixos.phundrak = {
|
||||||
|
imports = [./nixos.nix];
|
||||||
|
home-manager.users.phundrak = {
|
||||||
|
imports = [inputs.self.modules.homeManager.phundrak];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
homeManager.phundrak = {
|
||||||
|
imports = [./homeManager.nix];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.flake.options.phundrak;
|
||||||
|
in {
|
||||||
|
options.flake.options.phundrak = {
|
||||||
|
sudo = mkEnableOption "Make phundrak a superuser";
|
||||||
|
trusted = mkOption {
|
||||||
|
description = "Mark phundrak as trusted by Nix";
|
||||||
|
type = types.bool;
|
||||||
|
default = cfg.sudo;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
users.users.phundrak = {
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "Greg";
|
||||||
|
extraGroups =
|
||||||
|
["networkmanager" "dialout" "games" "audio" "input"]
|
||||||
|
++ optional cfg.sudo "wheel";
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
openssh.authorizedKeys.keyFiles = filesystem.listFilesRecursive ./keys;
|
||||||
|
};
|
||||||
|
nix.settings = mkIf cfg.trusted {
|
||||||
|
trusted-users = ["phundrak"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
# Baseline variant of Bun for x86_64-linux CPUs without AVX2 support.
|
|
||||||
# The regular `bun` from nixpkgs requires AVX2 and crashes with SIGILL on older hardware.
|
|
||||||
#
|
|
||||||
# Version is typically kept in sync with nixpkgs's `bun` (passed via `callPackage`).
|
|
||||||
{
|
|
||||||
lib,
|
|
||||||
stdenvNoCC,
|
|
||||||
fetchurl,
|
|
||||||
autoPatchelfHook,
|
|
||||||
unzip,
|
|
||||||
makeBinaryWrapper,
|
|
||||||
glibc,
|
|
||||||
stdenv,
|
|
||||||
version ? "1.3.13",
|
|
||||||
}: let
|
|
||||||
# When updating `version`, compute the new hash with:
|
|
||||||
# nix store prefetch-file "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-x64-baseline.zip"
|
|
||||||
hash = {
|
|
||||||
"1.3.13" = "sha256-nYokKSpwaAkCBdqsCloiP19pc29Sh+N7+I07QDHtx1A=";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
stdenvNoCC.mkDerivation {
|
|
||||||
pname = "bun-baseline";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-x64-baseline.zip";
|
|
||||||
hash = hash.${version};
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs =
|
|
||||||
[unzip]
|
|
||||||
++ lib.optionals stdenvNoCC.hostPlatform.isLinux [
|
|
||||||
autoPatchelfHook
|
|
||||||
makeBinaryWrapper
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [
|
|
||||||
glibc
|
|
||||||
(lib.getLib stdenv.cc.cc)
|
|
||||||
];
|
|
||||||
|
|
||||||
dontConfigure = true;
|
|
||||||
dontBuild = true;
|
|
||||||
|
|
||||||
unpackPhase = ''
|
|
||||||
runHook preUnpack
|
|
||||||
mkdir -p source
|
|
||||||
cd source
|
|
||||||
${lib.getExe unzip} -q $src
|
|
||||||
runHook postUnpack
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
mkdir -p $out/bin
|
|
||||||
find . -type f -name "bun" -not -path "./__MACOSX/*" -exec cp {} $out/bin/bun \;
|
|
||||||
chmod +x $out/bin/bun
|
|
||||||
ln -s $out/bin/bun $out/bin/bunx
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Bun JavaScript runtime (baseline variant, works without AVX2)";
|
|
||||||
homepage = "https://bun.sh";
|
|
||||||
license = lib.licenses.mit;
|
|
||||||
platforms = ["x86_64-linux"];
|
|
||||||
mainProgram = "bun";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,30 +1,15 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
cfg = config.home.dev.ai.opencode;
|
cfg = config.home.dev.ai.opencode;
|
||||||
|
defaultPackageCli = inputs.opencode.packages.${system}.opencode;
|
||||||
# On x86_64-linux CPUs without AVX2, use the baseline bun variant
|
defaultPackageDesktop = inputs.opencode.packages.${system}.desktop;
|
||||||
# when building opencode - the regular `bun` from nixpkgs requires
|
|
||||||
# AVX2 and crashes on older hardware, such as my Thinkpad x220’s
|
|
||||||
# Intel Core i5 2640M.
|
|
||||||
needsBaselineBun =
|
|
||||||
pkgs.stdenv.hostPlatform.isx86_64 && !pkgs.stdenv.hostPlatform.avx2Support;
|
|
||||||
bunBaseline = pkgs.callPackage ../../../../packages/bun-baseline.nix {};
|
|
||||||
|
|
||||||
defaultPackageCli =
|
|
||||||
if needsBaselineBun
|
|
||||||
then pkgs.opencode.override {bun = bunBaseline;}
|
|
||||||
else pkgs.opencode;
|
|
||||||
|
|
||||||
defaultPackageDesktop =
|
|
||||||
if needsBaselineBun
|
|
||||||
then pkgs.opencode-desktop.override {bun = bunBaseline;}
|
|
||||||
else pkgs.opencode-desktop;
|
|
||||||
|
|
||||||
corsList = domains: lists.remove "" (lists.forEach (strings.splitString "," domains) trim);
|
corsList = domains: lists.remove "" (lists.forEach (strings.splitString "," domains) trim);
|
||||||
in {
|
in {
|
||||||
options.home.dev.ai.opencode = {
|
options.home.dev.ai.opencode = {
|
||||||
@@ -81,9 +66,9 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
config.programs.opencode = mkIf cfg.enable {
|
config.programs.opencode = mkIf cfg.enable {
|
||||||
inherit (cfg) enable tui package;
|
inherit (cfg) enable tui;
|
||||||
enableMcpIntegration = true;
|
enableMcpIntegration = true;
|
||||||
extraPackages = with pkgs; [uv] ++ lists.optional cfg.desktop.enable cfg.desktop.package;
|
extraPackages = with pkgs; [uv];
|
||||||
settings =
|
settings =
|
||||||
{
|
{
|
||||||
server = mkIf cfg.web.mdns.enable {
|
server = mkIf cfg.web.mdns.enable {
|
||||||
|
|||||||
@@ -106,7 +106,6 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
media.mopidy.enable = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
manual = {
|
manual = {
|
||||||
|
|||||||
Reference in New Issue
Block a user