Update lib directory, organize things

This commit is contained in:
albert 2024-08-13 18:41:19 +09:00
parent 714723c6eb
commit 864cf63397
Signed by: albert
GPG key ID: 3895DD267CA11BA9
3 changed files with 29 additions and 37 deletions

View file

@ -50,7 +50,7 @@
inherit (self) outputs; inherit (self) outputs;
stateVersion = "23.11"; stateVersion = "23.11";
hmStateVersion = "23.11"; hmStateVersion = "23.11";
libx = import ./lib { inherit self inputs outputs stateVersion hmStateVersion; }; libx = import ./lib/default.nix { inherit self inputs outputs stateVersion hmStateVersion; };
in { in {
nixosConfigurations = { nixosConfigurations = {
# Linode VMs # Linode VMs

View file

@ -42,10 +42,8 @@
ip ? null, ip ? null,
ephemeral ? false, ephemeral ? false,
deployment_type ? "containers", deployment_type ? "containers",
pkgs ? import inputs.${repo} pkgs ? let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs,
{ inherit system; config.allowUnfree = unfree; hostPlatform = system; }, pkgs-unstable ? let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs-unstable,
pkgs-unstable ? import inputs.nixpkgs-unstable
{ inherit system; config.allowUnfree = unfree; hostPlatform = system; }
}: { }: {
bindMounts = lib.mkMerge [ bindMounts = lib.mkMerge [
( import ../nixos/containers/mounts.nix ) ( import ../nixos/containers/mounts.nix )
@ -87,16 +85,12 @@
theme ? "default", theme ? "default",
type ? "default", type ? "default",
repo ? "nixpkgs-unstable", repo ? "nixpkgs-unstable",
unfree ? true,
deployment_type ? "hosts", deployment_type ? "hosts",
}: inputs.${repo}.lib.nixosSystem { }: inputs.${repo}.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self deployment_type; inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self deployment_type;
# Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use pkgs-unstable = let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs-unstable;
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
hostPlatform = system;
};
}; };
modules = [ modules = [
@ -124,17 +118,8 @@
specialArgs = { specialArgs = {
inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self deployment_type; inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self deployment_type;
# Choose whether to pull from stable or unstable # Choose whether to pull from stable or unstable
pkgs = import inputs.${repo} { pkgs = let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs;
inherit system; pkgs-unstable = let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs-unstable;
config.allowUnfree = unfree;
hostPlatform = system;
};
# Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit system;
config.allowUnfree = unfree;
hostPlatform = system;
};
}; };
modules = [ modules = [
@ -160,21 +145,8 @@
specialArgs = { specialArgs = {
inherit inputs outputs desktop hostname username stateVersion hmStateVersion gpu system theme format; inherit inputs outputs desktop hostname username stateVersion hmStateVersion gpu system theme format;
# Choose whether to pull from stable or unstable # Choose whether to pull from stable or unstable
pkgs = import inputs.${repo} { pkgs = let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs;
inherit system; pkgs-unstable = let packages = (import ./packages.nix { inherit inputs repo system unfree; }); in packages.pkgs-unstable;
config.allowUnfree = unfree;
# For Logseq / Obsidian
config.permittedInsecurePackages = [ "electron-27.3.11" ];
hostPlatform = system;
};
# Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit system;
config.allowUnfree = unfree;
# For Logseq / Obsidian
config.permittedInsecurePackages = [ "electron-27.3.11" ];
hostPlatform = system;
};
}; };
system = system; system = system;
format = format; format = format;

20
lib/packages.nix Normal file
View file

@ -0,0 +1,20 @@
{ inputs, system, unfree, repo, ... }: {
# Choose whether to pull from stable or unstable
pkgs = (import inputs.${repo} {
inherit system;
config = {
allowUnfree = unfree;
permittedInsecurePackages = [ "electron-27.3.11" ];
};
hostPlatform = system;
});
# Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use
pkgs-unstable = (import inputs.nixpkgs-unstable {
inherit system;
config = {
allowUnfree = unfree;
permittedInsecurePackages = [ "electron-27.3.11" ];
};
hostPlatform = system;
});
}