mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-01-22 07:07:32 -06:00
add package helper
This commit is contained in:
parent
e495c7d8bb
commit
a5e0fea1ea
4 changed files with 44 additions and 23 deletions
|
@ -1,22 +0,0 @@
|
|||
{ pkgs, flake, ... }:
|
||||
{
|
||||
environment.systemPackages =
|
||||
[
|
||||
(flake.pkg "utils")
|
||||
(flake.pkg "ghostty")
|
||||
]
|
||||
++ (with pkgs; [
|
||||
sops
|
||||
attic-client
|
||||
|
||||
distrobox
|
||||
# cachix
|
||||
zk
|
||||
|
||||
graphviz
|
||||
charm-freeze
|
||||
|
||||
quarto
|
||||
calibre
|
||||
]);
|
||||
}
|
10
hosts/othalan/settings/pkgs
Normal file
10
hosts/othalan/settings/pkgs
Normal file
|
@ -0,0 +1,10 @@
|
|||
flake:utils
|
||||
flake:ghostty
|
||||
sops
|
||||
attic-client
|
||||
distrobox
|
||||
zk
|
||||
graphviz
|
||||
charm-freeze
|
||||
quarto
|
||||
calibre
|
|
@ -21,6 +21,7 @@ let
|
|||
types
|
||||
hasPrefix
|
||||
splitString
|
||||
removePrefix
|
||||
trim
|
||||
;
|
||||
inherit (final.filesystem) listFilesRecursive;
|
||||
|
@ -147,6 +148,35 @@ let
|
|||
// (tryreadEnabledAttrsOrEmpty "${p}/settings/modules")
|
||||
);
|
||||
|
||||
# convert the following:
|
||||
# ```txt
|
||||
# flake:utils
|
||||
# sops
|
||||
# graphviz
|
||||
# ```
|
||||
# to
|
||||
# ```nix
|
||||
# [
|
||||
# (flake.pkg "utils")
|
||||
# pkgs.sops
|
||||
# pkgs.graphviz
|
||||
# ]
|
||||
# ```
|
||||
tryPkgsFromFile =
|
||||
{
|
||||
hostName,
|
||||
pkgs,
|
||||
flake ? flakeFromSystem "x86_64-linux",
|
||||
}:
|
||||
hostName
|
||||
|> pathFromHostName
|
||||
|> (p: "${p}/settings/pkgs")
|
||||
|> tryReadLinesNoComment
|
||||
|> map (
|
||||
line:
|
||||
if hasPrefix "flake:" line then (line |> removePrefix "flake:" |> flake.pkgs) else pkgs.${line}
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
inherit
|
||||
|
@ -169,5 +199,6 @@ in
|
|||
loadOverlays
|
||||
hostFiles
|
||||
oizysSettings
|
||||
tryPkgsFromFile
|
||||
;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
lib,
|
||||
self,
|
||||
hostName,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption loadOverlays oizysSettings;
|
||||
inherit (lib) mkEnableOption mkOption loadOverlays oizysSettings tryPkgsFromFile;
|
||||
in
|
||||
{
|
||||
imports = with self.nixosModules; [
|
||||
|
@ -61,5 +62,6 @@ in
|
|||
time.timeZone = "US/Central";
|
||||
nixpkgs.overlays = import ../overlays { inherit inputs loadOverlays; };
|
||||
oizys = oizysSettings hostName;
|
||||
environment.systemPackages = tryPkgsFromFile {inherit hostName pkgs;};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue