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

View file

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

View file

@ -1,4 +1,4 @@
final: prev:
inputs: final: prev:
let
inherit (builtins) listToAttrs substring filter;
inherit (final)
@ -71,6 +71,10 @@ let
filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths;
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
{
inherit
@ -85,5 +89,7 @@ in
isNixFile
listNixFilesRecursive
flakeVer
pkgsFromSystem
pkgFromSystem
;
}

View file

@ -13,24 +13,24 @@ let
mkOizysModule
enabled
enableAttrs
pkgsFromSystem
pkgFromSystem
;
inherit (lib.filesystem) listFilesRecursive;
pkgFrom = pkgFromSystem "x86_64-linux";
pkgsFrom = pkgsFromSystem "x86_64-linux";
mkIso = nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.nix
self.nixosModules.essentials
(
{
self,
pkgs,
modulesPath,
...
}:
{ pkgs, modulesPath, ... }:
{
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
enableAttrs
hostName
pkgFrom
pkgsFrom
;
};
};

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +1,8 @@
{
config,
lib,
pkgs,
inputs,
pkgsFrom,
...
}:
let
@ -10,14 +10,13 @@ let
version = flakeVer inputs.roc;
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
roc = rocPkgs.cli.overrideAttrs {
inherit version;
};
lang-server = rocPkgs.lang-server.overrideAttrs { inherit version; };
in
{
config = mkIfIn "roc" cfg {

View file

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

View file

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