custom package function

This commit is contained in:
Daylin Morgan 2024-07-25 09:57:26 -05:00
parent 3a14d3bb7e
commit 4da9ef467c
Signed by: daylin
GPG key ID: 950D13E9719334AD
11 changed files with 79 additions and 59 deletions

View file

@ -1,5 +1,11 @@
{ inputs, system }: {
inputs,
system,
lib,
}:
let let
inherit (builtins) map;
inherit (lib) pkgFromSystem pkgsFromSystem;
pkgs = import inputs.nixpkgs { pkgs = import inputs.nixpkgs {
inherit system; inherit system;
overlays = [ overlays = [
@ -8,28 +14,33 @@ let
inputs.nixpkgs-wayland.overlay inputs.nixpkgs-wayland.overlay
]; ];
}; };
pkgsFrom = pkgsFromSystem system;
pkgFrom = pkgFromSystem system;
in in
{ {
makePackages = makePackages =
pkgs.runCommandLocal "build-third-party" pkgs.runCommandLocal "build-third-party"
{ {
src = ./.; src = ./.;
nativeBuildInputs = [ nativeBuildInputs =
pkgs.pixi [
pkgs.swww pkgs.pixi
pkgs.nixVersions.stable pkgs.swww
pkgs.nixVersions.stable
inputs.hyprland.packages.${pkgs.system}.default ]
inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland ++ (map [
"tsm"
inputs.tsm.packages.${pkgs.system}.default "hyprman"
inputs.hyprman.packages.${pkgs.system}.default "zls"
] pkgFrom)
inputs.roc.packages.${pkgs.system}.full # cli + lang_server ++ (with pkgsFrom "hyprland"; [
default
inputs.zls.outputs.packages.${pkgs.system}.default xdg-desktop-portal-hyprland
inputs.zig2nix.outputs.packages.${pkgs.system}.zig.master.bin ])
]; ++ [
(pkgsFrom "roc").full
(pkgsFrom "zig2nix").zig.master.bin
];
} }
'' ''
mkdir "$out" mkdir "$out"

View file

@ -1,6 +1,6 @@
inputs@{ nixpkgs, self, ... }: inputs@{ nixpkgs, self, ... }:
let let
lib = nixpkgs.lib.extend (import ./extended.nix); lib = nixpkgs.lib.extend (import ./extended.nix inputs);
inherit (builtins) mapAttrs readDir listToAttrs; inherit (builtins) mapAttrs readDir listToAttrs;
inherit (lib) genAttrs; inherit (lib) genAttrs;
@ -30,7 +30,7 @@ let
checks = forAllSystems ( checks = forAllSystems (
pkgs: pkgs:
import ./checks.nix { import ./checks.nix {
inherit inputs; inherit inputs lib;
system = pkgs.system; system = pkgs.system;
} }
); );

View file

@ -1,4 +1,4 @@
final: prev: inputs: final: prev:
let let
inherit (builtins) listToAttrs substring filter; inherit (builtins) listToAttrs substring filter;
inherit (final) inherit (final)
@ -71,6 +71,10 @@ let
filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths; filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths;
listNixFilesRecursive = dir: filterNotDefaultNixFile (listFilesRecursive dir); listNixFilesRecursive = dir: filterNotDefaultNixFile (listFilesRecursive dir);
# defaultLinuxPackage = flake: flake.packages.x86_64-linux.default;
# defaultPackageGeneric = system: flake: "${flake}.packages.${system}.default";
pkgsFromSystem = system: flake: inputs."${flake}".packages."${system}";
pkgFromSystem = system: flake: (pkgsFromSystem system flake).default;
in in
{ {
inherit inherit
@ -85,5 +89,7 @@ in
isNixFile isNixFile
listNixFilesRecursive listNixFilesRecursive
flakeVer flakeVer
pkgsFromSystem
pkgFromSystem
; ;
} }

View file

@ -13,24 +13,24 @@ let
mkOizysModule mkOizysModule
enabled enabled
enableAttrs enableAttrs
pkgsFromSystem
pkgFromSystem
; ;
inherit (lib.filesystem) listFilesRecursive; inherit (lib.filesystem) listFilesRecursive;
pkgFrom = pkgFromSystem "x86_64-linux";
pkgsFrom = pkgsFromSystem "x86_64-linux";
mkIso = nixosSystem { mkIso = nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
self.nixosModules.nix self.nixosModules.nix
self.nixosModules.essentials self.nixosModules.essentials
( (
{ { pkgs, modulesPath, ... }:
self,
pkgs,
modulesPath,
...
}:
{ {
imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ];
environment.systemPackages = (with pkgs; [ neovim ]) ++ [ self.packages.${pkgs.system}.default ]; environment.systemPackages = (with pkgs; [ neovim ]) ++ [ (pkgFrom "self") ];
} }
) )
]; ];
@ -64,6 +64,8 @@ let
enabled enabled
enableAttrs enableAttrs
hostName hostName
pkgFrom
pkgsFrom
; ;
}; };
}; };

View file

@ -3,6 +3,7 @@
pkgs, pkgs,
config, config,
lib, lib,
pkgFrom,
... ...
}: }:
let let
@ -10,26 +11,26 @@ let
in in
{ {
config = mkIf config.oizys.desktop.enable { config = mkIf config.oizys.desktop.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages =
wezterm [ (pkgFrom "f1multiviewer") ]
alacritty ++ (with pkgs; [
wezterm
alacritty
xfce.thunar xfce.thunar
inkscape inkscape
gimp gimp
zotero zotero
libreoffice-qt libreoffice-qt
hunspell # spell check for libreoffice hunspell # spell check for libreoffice
(catppuccin-gtk.override { (catppuccin-gtk.override {
accents = [ "rosewater" ]; accents = [ "rosewater" ];
variant = "mocha"; variant = "mocha";
}) })
]);
inputs.f1multiviewer.outputs.packages.${pkgs.system}.default
];
}; };
} }

View file

@ -4,6 +4,8 @@
config, config,
mkOizysModule, mkOizysModule,
enabled, enabled,
pkgFrom,
pkgsFrom,
... ...
}: }:
@ -41,12 +43,10 @@ mkOizysModule config "hyprland" {
catppuccin-cursors.mochaDark catppuccin-cursors.mochaDark
]) ])
++ [ ++ [ (pkgFrom "hyprman") ]
inputs.hyprman.packages.${pkgs.system}.default
]
# swww-git is broken # swww-git is broken
++ (with inputs.nixpkgs-wayland.packages.${pkgs.system}; [ ++ (with (pkgsFrom "nixpkgs-wayland"); [
mako mako
eww eww
wlr-randr wlr-randr

View file

@ -4,6 +4,7 @@
config, config,
enabled, enabled,
mkDefaultOizysModule, mkDefaultOizysModule,
pkgFrom,
... ...
}: }:
mkDefaultOizysModule config "cli" { mkDefaultOizysModule config "cli" {
@ -35,5 +36,5 @@ mkDefaultOizysModule config "cli" {
btop btop
gdu gdu
]) ])
++ [ inputs.tsm.packages.${pkgs.system}.tsm ]; ++ [ (pkgFrom "tsm") ];
} }

View file

@ -3,6 +3,7 @@
config, config,
lib, lib,
pkgs, pkgs,
pkgFrom,
... ...
}: }:
let let
@ -10,7 +11,7 @@ let
cfg = config.oizys.languages; cfg = config.oizys.languages;
python = pkgs.python3.withPackages (ps: with ps; [ pip ]); python = pkgs.python3.withPackages (ps: with ps; [ pip ]);
pixi = inputs.pixi.packages.${pkgs.system}.default; pixi = pkgFrom "pixi";
in in
{ {
config = mkIfIn "python" cfg { config = mkIfIn "python" cfg {

View file

@ -1,8 +1,8 @@
{ {
config, config,
lib, lib,
pkgs,
inputs, inputs,
pkgsFrom,
... ...
}: }:
let let
@ -10,14 +10,13 @@ let
version = flakeVer inputs.roc; version = flakeVer inputs.roc;
cfg = config.oizys.languages; cfg = config.oizys.languages;
rocPkgs = inputs.roc.packages.${pkgs.system}; rocPkgs = pkgsFrom "roc";
# I'm setting the versions so the changes are more apparent as flake is updated # I'm setting the versions so the changes are more apparent as flake is updated
roc = rocPkgs.cli.overrideAttrs { roc = rocPkgs.cli.overrideAttrs {
inherit version; inherit version;
}; };
lang-server = rocPkgs.lang-server.overrideAttrs { inherit version; }; lang-server = rocPkgs.lang-server.overrideAttrs { inherit version; };
in in
{ {
config = mkIfIn "roc" cfg { config = mkIfIn "roc" cfg {

View file

@ -1,17 +1,15 @@
{ {
inputs,
config, config,
lib, lib,
pkgs, pkgsFrom,
pkgFrom,
... ...
}: }:
let let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
zig = inputs.zig2nix.outputs.packages.${pkgs.system}.zig.master.bin; zig = (pkgsFrom "zig2nix").zig.master.bin;
zls = inputs.zls.outputs.packages.${pkgs.system}.default.overrideAttrs { zls = (pkgFrom "zls").overrideAttrs { nativeBuildInputs = [ zig ]; };
nativeBuildInputs = [ zig ];
};
in in
{ {
config = mkIfIn "zig" cfg { config = mkIfIn "zig" cfg {

View file

@ -4,6 +4,7 @@
pkgs, pkgs,
lib, lib,
enabled, enabled,
pkgFrom,
... ...
}: }:
let let
@ -31,7 +32,7 @@ in
pkgs.nixfmt-rfc-style pkgs.nixfmt-rfc-style
pkgs.nix-output-monitor pkgs.nix-output-monitor
self.packages.${pkgs.system}.default (pkgFrom "self")
]; ];
programs.nix-index-database.comma = enabled; programs.nix-index-database.comma = enabled;