cleanup + docs
This commit is contained in:
parent
50a9bd8c9c
commit
988ab7b6aa
517
README.md
517
README.md
|
@ -6,28 +6,45 @@ include_toc: true
|
|||
# dragnpkgs
|
||||
|
||||
this is my personal nixos modules and packages repository. while it was designed for my own use,
|
||||
it's also intended to be flexible and reusable enough for general purpose usage. i might consider
|
||||
upstreaming into nixpkgs if there is sufficient interest
|
||||
it's also intended to be flexible and reusable enough for general purpose usage
|
||||
|
||||
dragnpkgs provides the following
|
||||
- a set of package definitions, in `pkgs/`, which provide packages not in `nixpkgs`, some of my own
|
||||
libraries and utilities, and rewrites/patches of upstream packages to suit my needs
|
||||
- the top level overlay is located in `overlay.nix`, in a similar style as nixpkgs
|
||||
`all-packages.nix`
|
||||
- a set of nixos modules, in `modules/`
|
||||
- a module including all of the other modules is located at `module.nix`
|
||||
- utilities, in `lib/` and contained within `flake.nix`
|
||||
- flake templates, in `templates/`
|
||||
- a full wrapper around `nixpkgs` which includes the package set and nixos modules by default, and
|
||||
changes the default nix implementation to `lix`, so this repo can be used in place of the
|
||||
`nixpkgs` flake
|
||||
|
||||
## licensing
|
||||
|
||||
this repository is NOT licensed under a "standard" FOSS license. instead, it uses [CC-BY-NC-SA
|
||||
4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en). this means, in particular that
|
||||
commercial use is forbidden. if you are, for whatever reason, interested in using this code
|
||||
commercially, please contact me
|
||||
|
||||
additionally, several package definitions included in this repo point to packages which have their
|
||||
own noteworthy licensing (including, for example, unfree and non-redistributable game server
|
||||
software). make sure you are following the license requirements, which can be found in
|
||||
`meta.license` for each package
|
||||
|
||||
## usage
|
||||
|
||||
dragnpkgs provides a set of nixos modules and a nixpkgs overlay containing custom packages. the
|
||||
modules require the overlay
|
||||
|
||||
### non-flake
|
||||
|
||||
since i use flakes now (sigh!!!) i'm not supporting non-flake usage anymore. if you read the files
|
||||
in the repo there's a way to do it probably
|
||||
|
||||
### flake
|
||||
|
||||
for flake usage, add this repo as an input and don't input nixpkgs at all, since we fully wrap it
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
# for nixos-24.11
|
||||
dragnpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=nixos-24.11";
|
||||
# for nixos-25.05
|
||||
dragnpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=nixos-25.05";
|
||||
|
||||
# for nixos-unstable
|
||||
dragnpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=main";
|
||||
|
@ -47,26 +64,205 @@ flake.nix for details
|
|||
dragnpkgs-specific registration mechanism for these that is enabled by default, see
|
||||
`options.dragnpkgs`
|
||||
- in flake.nix but not in module.nix: disable channels
|
||||
- add lix cache and its keys to substitutors
|
||||
- enable experimental features `nix-command flakes repl-flake`
|
||||
- disable the default flake registry. i think it's cringe
|
||||
- add a repl overlay that adds some useful utilities to `nix repl` -- see repl-overlay.nix for
|
||||
details
|
||||
- provides a flake pure eval mode bypass via a lix plugin for allowlisting certain unfree licenses
|
||||
that can be enabled when the user has permission to use packages with those licenses. this allows
|
||||
usage of those packages without needing to set `NIXPKGS_ALLOW_UNFREE=1` and passing `--impure`,
|
||||
which i find very clunky
|
||||
|
||||
also note that overriding inputs to the flake won't necessarily work because of the way nixpkgs
|
||||
registers itself with the system. this requires really annoying hacks to get working at all. if you
|
||||
want to depend on `dragnpkgs` with a different version of `nixpkgs` (ie not 24.11 or unstable),
|
||||
clone the repo and recreate `flake.lock`. aren't flakes so cool and fun!!!!
|
||||
|
||||
## options documentation
|
||||
## flake lib documentation
|
||||
|
||||
documentation for options provided by dragnpkgs
|
||||
These utilities are provided by the dragnpkgs flake.
|
||||
|
||||
### `dragnpkgs.lib.mkFlake attrs`
|
||||
|
||||
This provides a small utility for defining flakes in a way that avoids some of the pain related to
|
||||
flake attributes being keyed by `system`. `attrs` is an attribute set similar to what would normally
|
||||
be returned for `outputs`, but the keys `packages`, `legacyPackages`, `devShells`, and `apps` are
|
||||
written in `callPackage` style
|
||||
|
||||
For example:
|
||||
|
||||
```nix
|
||||
outputs = { self, dragnpkgs }: dragnpkgs.lib.mkFlake {
|
||||
devShells.default = {
|
||||
mkShell,
|
||||
hello,
|
||||
}: mkShell {
|
||||
packages = [
|
||||
hello
|
||||
];
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Currently there is no mechanism to access `system`-keyed attributes from another `system`-keyed
|
||||
attribute, so it must be done manually using `system` in the arguments to the `callPackage`-style
|
||||
function. For example:
|
||||
|
||||
```nix
|
||||
outputs = { self, dragnpkgs }: dragnpkgs.lib.mkFlake {
|
||||
packages.default = {
|
||||
stdenv,
|
||||
mydependency,
|
||||
}: stdenv.mkDerivation {
|
||||
pname = "mypackage";
|
||||
version = "DEV";
|
||||
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ mydependency ];
|
||||
};
|
||||
|
||||
devShells.default = {
|
||||
mkShell,
|
||||
system,
|
||||
}: mkShell {
|
||||
packages = [
|
||||
self.packages.${system}.default
|
||||
];
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Future work is planned to make this easier.
|
||||
|
||||
## lib documentation
|
||||
|
||||
These utilities are provided by the dragnpkgs overlay
|
||||
|
||||
### [`fetchFromSteam`](./lib/fetchsteam)
|
||||
|
||||
a fetcher that downloads binaries from [Steam](https://store.steampowered.com/) using
|
||||
[DepotDownloader](https://github.com/SteamRE/DepotDownloader). this is intended for game servers
|
||||
that are distributed via Steam. use [SteamDB](https://steamdb.info) to get the needed IDs.
|
||||
|
||||
Usage:
|
||||
|
||||
```nix
|
||||
pkgs.fetchFromSteam {
|
||||
name = "..."; # optional
|
||||
appId = "...";
|
||||
depot = {
|
||||
depotId = "...";
|
||||
manifestId = "...";
|
||||
beta = "..."; # optional
|
||||
};
|
||||
|
||||
additionalDepots = [
|
||||
# same format as the main `depot`
|
||||
# use this to include eg the steamworks redistributable depot
|
||||
];
|
||||
|
||||
hash = pkgs.lib.fakeHash;
|
||||
}
|
||||
```
|
||||
|
||||
### [`fetchb4`](./lib/fetchb4)
|
||||
|
||||
A fetcher that uses `b4` to download patchsets from <https://lore.kernel.org> so that they can be
|
||||
applied in `boot.kernelPatches`
|
||||
|
||||
Usage:
|
||||
|
||||
```nix
|
||||
pkgs.fetchb4 {
|
||||
msgid = "2024042069.1337-example@example";
|
||||
hash = pkgs.lib.fakeHash;
|
||||
|
||||
# optional args
|
||||
version = "3"; # default: latest
|
||||
single_message = true; # default: false
|
||||
}
|
||||
```
|
||||
|
||||
note that not specifying a version may make cause future invocations to return different output if a
|
||||
newer version is sent to the thread
|
||||
|
||||
### [`mkNginxServer`](./lib/dev-nginx)
|
||||
|
||||
creates a shell script that launches nginx in the foreground as the current user. the nginx is
|
||||
configured to run an http server on `localhost:8080` with the given `siteConfig`
|
||||
|
||||
example:
|
||||
```nix
|
||||
pkgs.mkNginxServer {
|
||||
siteConfig = ''
|
||||
location / {
|
||||
root path/to/development_site_root;
|
||||
error_page 404 /404.html;
|
||||
}
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
### [`makeSquashFs`](./lib/make-squashfs)
|
||||
|
||||
builds a squashfs image from the given derivations
|
||||
|
||||
example
|
||||
```nix
|
||||
makeSquashFs {
|
||||
filename = "my-image"; # optional
|
||||
storeContents = [ foo bar ];
|
||||
}
|
||||
```
|
||||
|
||||
### [`makeHpcDist`](./lib/make-hpc-dist)
|
||||
|
||||
create a packaged nix distribution with the given packages in it for weird HPC systems. go read the
|
||||
source to find out what it does; i don't recommend using this if you're not me
|
||||
|
||||
### [`lib.licenses.fyptl`](./lib/licenses/fyptl.nix)
|
||||
|
||||
The "Fuck You, Pirate This License" (FYPTL) is the author's version of a software non-license, which
|
||||
explicitly does not grant any rights to use, modify, or redistribute a given piece of software, but
|
||||
does disclaim warranty.
|
||||
|
||||
## nixos options documentation
|
||||
|
||||
documentation for nixos options provided by dragnpkgs
|
||||
|
||||
### [`dragnpkgs`](./flake.nix)
|
||||
|
||||
options for configuring dragnpkgs
|
||||
|
||||
### [`dragnpkgs.setFlakeRegistry`](./flake.nix) (`true`)
|
||||
|
||||
Set flake registry option pointing to self
|
||||
|
||||
### [`dragnpkgs.setNixPath`](./flake.nix) (`true`)
|
||||
|
||||
Set nix path entry pointing to self
|
||||
|
||||
### [`dragnpkgs.setNixpkgsFlakeAlias`](./flake.nix) (`true`)
|
||||
|
||||
Set flake registry entry for `nixpkgs` to self
|
||||
|
||||
### [`dragnpkgs.setTemplatesFlakeAlias`](./flake.nix) (`true`)
|
||||
|
||||
Set flake registry entry for `templates` to self
|
||||
|
||||
### [`dragnpkgs.possiblyCommitCrimes`](./flake.nix) (`false`)
|
||||
|
||||
Globally enable usage of packages marked as FYPTL. This installs a nix plugin, which is widely
|
||||
considered to be a nix crime, and it also might be an actual crime to use these packages depending
|
||||
on you jurisdiction. Use at your own risk
|
||||
|
||||
### [`services.ghidra-server`](./modules/ghidra-server)
|
||||
the shared project server for [ghidra](https://ghidra-sre.org)
|
||||
|
||||
the shared project server for [ghidra](https://github.com/NationalSecurityAgency/ghidra)
|
||||
|
||||
example usage:
|
||||
|
||||
```nix
|
||||
services.ghidra-server = {
|
||||
enable = true;
|
||||
|
@ -74,59 +270,175 @@ services.ghidra-server = {
|
|||
};
|
||||
```
|
||||
|
||||
#### services.ghidra-server.enable
|
||||
##### development notes
|
||||
|
||||
the module does the following:
|
||||
|
||||
- sets up unix permissions on the ghidra repositories location that allows anyone in the `ghidra`
|
||||
group to run `ghidra-svrAdmin` to perform admin tasks
|
||||
- only supports basic username/password authentication for the time being
|
||||
- parses the classpath file for the ghidra server which is normally read by the launcher, and uses
|
||||
it to launch the server directly, without using the launcher. this was done because the launcher
|
||||
was doing several things that were unwanted / could be better handled by systemd and journald, and
|
||||
it was complicated to turn them off. this also allows us to customize the jvm args more easily
|
||||
- provides a log4j configuration that causes all logs to be sent to the system journal. this
|
||||
effectively disables any ghidra-server-specific logfile management
|
||||
- sets the most basic isolation parameters (`PrivateTmp=true` and `NoNewPrivileges=true`), but more
|
||||
work could be done to secure the ghidra server service
|
||||
|
||||
#### `services.ghidra-server.enable`
|
||||
|
||||
enables the ghidra server service
|
||||
|
||||
#### services.ghidra-server.enableAdminCli (`true`)
|
||||
#### `services.ghidra-server.enableAdminCli` (`true`)
|
||||
|
||||
adds a system package for the CLI tool `ghidra-svrAdmin`, which allows anyone in the `ghidra` group
|
||||
to administer the server (this corresponds to the `server/svrAdmin` tool in the stock ghidra
|
||||
distribution)
|
||||
|
||||
#### services.ghidra-server.{package, jdkPackage} (`ghidra_headless`, `openjdk21_headless`)
|
||||
#### `services.ghidra-server.{package, jdkPackage}` (`ghidra_headless`, `openjdk21_headless`)
|
||||
|
||||
allows overriding the ghidra package and jdk package used for the server
|
||||
|
||||
#### services.ghidra-server.host
|
||||
#### `services.ghidra-server.host`
|
||||
|
||||
the server hostname or IP; this is typically required (by java RMI) for correct operation
|
||||
|
||||
#### services.ghidra-server.basePort (`13100`)
|
||||
#### `services.ghidra-server.basePort` (`13100`)
|
||||
|
||||
the server will use 3 consecutive TCP ports starting from this port
|
||||
|
||||
#### services.ghidra-server.directory (`ghidra-server`)
|
||||
#### `services.ghidra-server.directory` (`ghidra-server`)
|
||||
|
||||
the root directory for server files, as a subdirectory of `/var/lib`. this is needed because this
|
||||
option is passed to systemd `StateDirectory=`
|
||||
|
||||
#### services.ghidra-server.{user,group} (`ghidra`)
|
||||
#### `services.ghidra-server.{user,group}` (`ghidra`)
|
||||
|
||||
the service user and group
|
||||
|
||||
### [`environment.machineInfo`](./modules/machine-info/default.nix)
|
||||
|
||||
### more coming soon(tm)
|
||||
provides options to customize the `/etc/machine-info` file on a NixOS system. See the module itself
|
||||
and <https://www.freedesktop.org/software/systemd/man/latest/machine-info.html> for more info
|
||||
|
||||
### [`services.satisfactory`](./modules/satisfactory-dedicated-server/default.nix)
|
||||
|
||||
The dedicated server for the game [satisfactory](https://satisfactorygame.com)
|
||||
|
||||
This module provides the needed runtime environment for the dedicated server to run on NixOS, as
|
||||
well as settings which can be automatically applied to provision the server on the first start (eg
|
||||
server name, admin password). This provisioning needs to be done at runtime, due to the way the
|
||||
server works, but it will be performed securely, before the server is exposed to the network for the
|
||||
first time. This means you can safely deploy the server to the public internet without worrying
|
||||
about exposing the "unclaimed" initial server mode, where any user could gain full privileges.
|
||||
|
||||
### `services.satisfactory.enable`
|
||||
|
||||
enables the satisfactory dedicated server service
|
||||
|
||||
### `services.satisfactory.package` (`pkgs.satisfactory-dedicated-server`)
|
||||
|
||||
the package to use for the service
|
||||
|
||||
### `services.satisfactory.directory` (`"/var/lib/satisfactory"`)
|
||||
|
||||
Directory where Satisfactory Dedicated Server data will be stored
|
||||
|
||||
### `services.satisfactory.{user,group}` (`"satisfactory"`)
|
||||
|
||||
User account and group under which Satisfactory Dedicated Server runs
|
||||
|
||||
### `services.satisfactory.useACMEHost` (`null`)
|
||||
|
||||
If set, the server will use the ACME-provided TLS certificate for the given host.
|
||||
|
||||
Note that this module does not actually provision the specified certificate; you must use additional
|
||||
config (e.g., `services.nginx.virtualHosts.<name>.enableACME = true`) to provision the certificate
|
||||
using a supported ACME method.
|
||||
|
||||
### `services.satisfactory.port` (`7777`)
|
||||
|
||||
Server port number (TCP/UDP)
|
||||
|
||||
This corresponds to the `-Port` command line option.
|
||||
|
||||
### `services.satisfactory.reliablePort` (`8888`)
|
||||
|
||||
Server reliable port number
|
||||
|
||||
This corresponds to the `-ReliablePort` command line option.
|
||||
|
||||
### `services.satisfactory.externalReliablePort` (`null`)
|
||||
|
||||
Server reliable port number as seen outside NAT.
|
||||
|
||||
This corresponds to the `-ExternalReliablePort` command line option.
|
||||
|
||||
### `services.satisfactory.disableSeasonalEvents` (`false`)
|
||||
|
||||
Whether to run the server with seasonal events disabled.
|
||||
|
||||
This corresponds to the `-DisableSeasonalEvents` command line option.
|
||||
|
||||
### `services.satisfactory.extraIniOptions` (`{}`)
|
||||
|
||||
Run the server with additional ini configuration values.
|
||||
|
||||
This is a nested attribute set of values.
|
||||
|
||||
- The top level attribute specifies the ini file containing the value to set (i.e., the
|
||||
first component of the `-ini` command line option), for example `Game` or `Engine`.
|
||||
- The secondary level attribute specifies the ini file category, without brackets,
|
||||
for example `/Script/Engine.GameSession`.
|
||||
- The final level attribute specifies the option name to set, for example
|
||||
`MaxPlayers`. The value of the attribute is the value to set on the command line.
|
||||
|
||||
This corresponds to the `-ini` command line option.
|
||||
|
||||
### `services.satisfactory.initialSettings`
|
||||
|
||||
Settings to apply to the server via the server API on the first run.
|
||||
|
||||
### `services.satisfactory.initialSettings.serverName` (`null`)
|
||||
|
||||
The name of the server.
|
||||
|
||||
If this is provided, `adminPasswordFile` must also be set.
|
||||
|
||||
### `services.satisfactory.initialSettings.adminPasswordFile` (`null`)
|
||||
|
||||
Path to a file containing the initial admin password.
|
||||
|
||||
If this is provided, `serverName` must also be set.
|
||||
|
||||
### `services.satisfactory.initialSettings.clientPasswordFile` (`null`)
|
||||
|
||||
Path to a file containing the initial client password. If not set, the server will
|
||||
not be configured with a client password and will be accessible to any client.
|
||||
|
||||
### [`hardware.wirelessRegulatoryDomain`](./modules/regdom/default.nix)
|
||||
|
||||
The wireless regulatory domain to set in the kernel `cfg80211` module. This defaults to `"00"`
|
||||
(international), but more bands (such as 6GHz, on supported hardware) can be enabled by setting this
|
||||
to the jurisdiction in which the machine is located, for example `"US"`.
|
||||
|
||||
## packages documentation
|
||||
|
||||
### [`ghidra_headless`](./default.nix)
|
||||
|
||||
a variant of ghidra which does not have a dependency on any jdk, intended to
|
||||
reduce closure size for server operation with a headless jdk (in particular,
|
||||
the ghidra-server nixos module uses `ghidra_headless` with `openjdk21_headless`
|
||||
by default
|
||||
|
||||
### [`ghidra`](./pkgs/ghidra-xenia/build.nix)
|
||||
|
||||
a version of ghidra that uses a split derivation, `lib` contains the core
|
||||
ghidra distribution, `doc` contains all the documentation elements, and `out`
|
||||
contains the bin folder, icons, and desktop file. only `out` has a dependency
|
||||
on the build jdk, so `lib` and `doc` can be used with reduced closure size
|
||||
a version of ghidra that uses a split derivation, `lib` contains the core ghidra distribution, `doc`
|
||||
contains all the documentation elements, and `out` contains the bin folder, icons, and desktop file.
|
||||
only `out` has a dependency on the build jdk, so `lib` and `doc` can be used with reduced closure
|
||||
size
|
||||
|
||||
### [`kicad`](./pkgs/kicad-xenia/default.nix)
|
||||
### [`ghidra_headless`](./pkgs/ghidra-xenia/build.nix)
|
||||
|
||||
preview version of kicad with my patches
|
||||
a variant of ghidra which does not have a dependency on any jdk, intended to reduce closure size for
|
||||
server operation with a headless jdk (in particular, the ghidra-server nixos module uses
|
||||
`ghidra_headless` with `openjdk21_headless` by default
|
||||
|
||||
this is equivalent to the `lib` output of the split `ghidra` package
|
||||
|
||||
### [`ocamlPackages.ppx_unicode`](./pkgs/ocaml/ppx_unicode)
|
||||
|
||||
|
@ -170,6 +482,10 @@ example
|
|||
feedvalidator --base "https://my-base-url/atom.xml" path/to/atom.xml
|
||||
```
|
||||
|
||||
### [`python312Packages.megacom` or `megacom`](./pkgs/python/megacom)
|
||||
|
||||
a python utility to access serial ports from the command line
|
||||
|
||||
### [`outer-wilds-text-adventure`](./pkgs/games/outer-wilds-text-adventure)
|
||||
|
||||
nix packaging for the Outer Wilds text adventure game. it should work by default on NixOS. if using
|
||||
|
@ -180,6 +496,12 @@ another ALSA plugin that lives in a separate package
|
|||
export ALSA_PLUGIN_DIR=$(nix eval -f '<nixpkgs>' --raw pipewire)/lib/alsa-lib
|
||||
```
|
||||
|
||||
### [`satisfactory-dedicated-server`](./pkgs/games/satisfactory-dedicated-server)
|
||||
|
||||
The dedicated server for [satisfactory](https://satisfactorygame.com), with packaging steps to make
|
||||
it run correctly on NixOS. This must be used together with the NixOS module
|
||||
(`services.satisfactory`), which sets up the environment needed for the server to execute.
|
||||
|
||||
### [`eta`](./pkgs/cmdline/eta)
|
||||
|
||||
Generic tool for monitoring ETA and progress of an arbitrary process.
|
||||
|
@ -198,120 +520,23 @@ Cado-NFS, An Implementation of the Number Field Sieve Algorithm
|
|||
|
||||
<https://gitlab.inria.fr/cado-nfs/cado-nfs>
|
||||
|
||||
## lib documentation
|
||||
### [`lix-plugins`](./pkgs/lix/lix-plugins)
|
||||
|
||||
### [`fetchFromSteam`](./lib/fetchsteam)
|
||||
A plugin module for lix which provides the flake pure eval bypass which can be enabled using the
|
||||
dragnpkgs flake.
|
||||
|
||||
a fetcher that downloads binaries from [Steam](https://store.steampowered.com/) using
|
||||
[DepotDownloader](https://github.com/SteamRE/DepotDownloader). this is intended for game servers
|
||||
that are distributed via Steam. use [SteamDB](https://steamdb.info) to get the needed IDs.
|
||||
### [`zfs_2_3`](./pkgs/zfs/)
|
||||
|
||||
Usage:
|
||||
A version of ZFS with a patch for the `zed` userspace daemon to enable desktop notifications on ZFS
|
||||
errors. This makes ZFS a bit more reasonable to run on GUI systems
|
||||
|
||||
```nix
|
||||
pkgs.fetchFromSteam {
|
||||
name = "..."; # optional
|
||||
appId = "...";
|
||||
depot = {
|
||||
depotId = "...";
|
||||
manifestId = "...";
|
||||
beta = "..."; # optional
|
||||
};
|
||||
### [`pympress`](./pkgs/python/pympress)
|
||||
|
||||
additionalDepots = [
|
||||
# same format as the main `depot`
|
||||
# use this to include eg the steamworks redistributable depot
|
||||
];
|
||||
A version of [pympress](https://cimbali.github.io/pympress/) with a patch to fix the window icon on
|
||||
KDE
|
||||
|
||||
hash = pkgs.lib.fakeHash;
|
||||
}
|
||||
```
|
||||
### [`texliveDragonPackages.moloch`](./pkgs/tex/moloch)
|
||||
|
||||
### [`fetchb4`](./lib/fetchb4)
|
||||
|
||||
A fetcher that uses `b4` to download patchsets from <https://lore.kernel.org> so that they can be applied in `boot.kernelPatches`
|
||||
|
||||
Usage:
|
||||
|
||||
```nix
|
||||
pkgs.fetchb4 {
|
||||
msgid = "2024042069.1337-example@example";
|
||||
hash = pkgs.lib.fakeHash;
|
||||
|
||||
# optional args
|
||||
version = "3"; # default: latest
|
||||
single_message = true; # default: false
|
||||
}
|
||||
```
|
||||
|
||||
note that not specifying a version may make cause future invocations to return different output if a newer version is sent to the thread
|
||||
|
||||
### [`mkNginxServer`](./lib/dev-nginx)
|
||||
|
||||
creates a shell script that launches nginx in the foreground as the current user. the nginx is
|
||||
configured to run an http server on `localhost:8080` with the given `siteConfig`
|
||||
|
||||
example:
|
||||
```nix
|
||||
pkgs.mkNginxServer {
|
||||
siteConfig = ''
|
||||
location / {
|
||||
root path/to/development_site_root;
|
||||
error_page 404 /404.html;
|
||||
}
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
### [`gitSource`](./lib/git-source)
|
||||
|
||||
for development package nix files, computes the source set of files tracked by git at the given root
|
||||
path
|
||||
|
||||
arguments:
|
||||
- `root`: the root of the git repo, where `.git` is located
|
||||
- `subdir`, optional: a subdirectory within the git repo. if provided, only files in this
|
||||
subdirectory will go into the final source set
|
||||
|
||||
example:
|
||||
```nix
|
||||
stdenv.mkDerivation {
|
||||
# ...
|
||||
src = gitSource { root = ./.; };
|
||||
}
|
||||
```
|
||||
|
||||
### [`makeSquashFs`](./lib/make-squashfs)
|
||||
|
||||
builds a squashfs image from the given derivations
|
||||
|
||||
example
|
||||
```nix
|
||||
makeSquashFs {
|
||||
filename = "my-image"; # optional
|
||||
storeContents = [ foo bar ];
|
||||
}
|
||||
```
|
||||
|
||||
### [`makeHpcDist`](./lib/make-hpc-dist)
|
||||
|
||||
create a packaged nix distribution with the given packages in it for weird HPC systems. go read the
|
||||
source to find out what it does; i don't recommend using this if you're not me
|
||||
|
||||
## development
|
||||
|
||||
structure of this repo
|
||||
- `default.nix`: the top level NixOS module, which can also be interpreted as a plain nix file
|
||||
outside of NixOS for access to just the nixpkgs overlay. this contains all definitions for
|
||||
packages, library functions, and NixOS modules
|
||||
- `lib/`: library functions (ie functions that get added to the overlay) go here
|
||||
- `modules/`: NixOS modules go here
|
||||
- `pkgs/`: packages that get added to the overlay go here
|
||||
- `support/`: WIP support tools (eg generating documentation)
|
||||
|
||||
## licensing
|
||||
|
||||
this repository is NOT licensed under a "standard" FOSS license. instead, it uses
|
||||
[CC-BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en). this means, in
|
||||
particular that commercial use is forbidden. if you are, for whatever reason, interested in using
|
||||
this code commercially, please contact me
|
||||
A version of the [moloch](https://jolars.co/blog/2024-05-30-moloch/) beamer theme with [some
|
||||
patches](https://git.lain.faith/haskal/moloch-dragon/) to make it easier to use with pympress and
|
||||
fix an issue with appendix slide numbering
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{ lib }: { root, subdir ? null }:
|
||||
let
|
||||
fs = lib.fileset;
|
||||
sourceFiles = fs.difference
|
||||
(fs.gitTracked root)
|
||||
(fs.fileFilter (file: file.hasExt "nix") root);
|
||||
finalSourceFiles =
|
||||
if subdir == null then
|
||||
sourceFiles
|
||||
else
|
||||
fs.intersection sourceFiles subdir;
|
||||
finalRoot = if subdir == null then root else subdir;
|
||||
in
|
||||
fs.toSource { root = finalRoot; fileset = finalSourceFiles; }
|
|
@ -1,119 +1,119 @@
|
|||
{ config, pkgs, lib, ... }: with lib; {
|
||||
options.environment.machineInfo = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Machine metadata, including stylized hostname, computer icon, etc.
|
||||
options.environment.machineInfo = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Machine metadata, including stylized hostname, computer icon, etc.
|
||||
|
||||
This module controls the options written to `/etc/machine-info`. For more
|
||||
information, see [the freedesktop documentation][1].
|
||||
This module controls the options written to `/etc/machine-info`. For more
|
||||
information, see [the freedesktop documentation][1].
|
||||
|
||||
[1]: https://www.freedesktop.org/software/systemd/man/machine-info.html
|
||||
'';
|
||||
default = {};
|
||||
type = types.submodule { options = {
|
||||
[1]: https://www.freedesktop.org/software/systemd/man/machine-info.html
|
||||
'';
|
||||
default = {};
|
||||
type = types.submodule { options = {
|
||||
|
||||
prettyHostname = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
A pretty, human-readable hostname for this machine, potentially including
|
||||
spaces, unicode, and emoji. If unset, this falls back to the network hostname
|
||||
set in `networking.hostName`.
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"Jade's Laptop 💎\"";
|
||||
};
|
||||
prettyHostname = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
A pretty, human-readable hostname for this machine, potentially including
|
||||
spaces, unicode, and emoji. If unset, this falls back to the network hostname
|
||||
set in `networking.hostName`.
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"Jade's Laptop 💎\"";
|
||||
};
|
||||
|
||||
iconName = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
An XDG icon which should be associated with this machine. Some common choices
|
||||
include: `"computer"`, `"phone"`, but a complete list of icons can be found in
|
||||
the [XDG Icon Naming Spec][1].
|
||||
iconName = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
An XDG icon which should be associated with this machine. Some common choices
|
||||
include: `"computer"`, `"phone"`, but a complete list of icons can be found in
|
||||
the [XDG Icon Naming Spec][1].
|
||||
|
||||
If left unset, applications will typically default to `"computer"`.
|
||||
If left unset, applications will typically default to `"computer"`.
|
||||
|
||||
[1]: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"computer\"";
|
||||
};
|
||||
[1]: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"computer\"";
|
||||
};
|
||||
|
||||
chassis = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
The type of chassis this machine resides within. This is typically detected
|
||||
automatically, but can be manually overridden here.
|
||||
'';
|
||||
type = with types; nullOr (enum [
|
||||
"desktop"
|
||||
"laptop"
|
||||
"convertible"
|
||||
"server"
|
||||
"tablet"
|
||||
"handset"
|
||||
"watch"
|
||||
"embedded"
|
||||
"vm"
|
||||
"container"
|
||||
]);
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"server\"";
|
||||
};
|
||||
chassis = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
The type of chassis this machine resides within. This is typically detected
|
||||
automatically, but can be manually overridden here.
|
||||
'';
|
||||
type = with types; nullOr (enum [
|
||||
"desktop"
|
||||
"laptop"
|
||||
"convertible"
|
||||
"server"
|
||||
"tablet"
|
||||
"handset"
|
||||
"watch"
|
||||
"embedded"
|
||||
"vm"
|
||||
"container"
|
||||
]);
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"server\"";
|
||||
};
|
||||
|
||||
deployment = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
If this machine is part of a deployment environment / pipeline, this option can
|
||||
be used to specify what environment/pipeline stage it manages.
|
||||
deployment = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
If this machine is part of a deployment environment / pipeline, this option can
|
||||
be used to specify what environment/pipeline stage it manages.
|
||||
|
||||
Typically, but not necessarily, set to something like `"development"`,
|
||||
`"integration"`, `"staging"`, or `"production"`.
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"production\"";
|
||||
};
|
||||
Typically, but not necessarily, set to something like `"development"`,
|
||||
`"integration"`, `"staging"`, or `"production"`.
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"production\"";
|
||||
};
|
||||
|
||||
location = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
A human-readable short description of the location of this machine.
|
||||
location = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
A human-readable short description of the location of this machine.
|
||||
|
||||
This can be set to whatever has the most meaning for you, for example "Living
|
||||
Room", "Left Rack, 2nd Shelf", or "Parishville, NY".
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"Bedroom\"";
|
||||
};
|
||||
This can be set to whatever has the most meaning for you, for example "Living
|
||||
Room", "Left Rack, 2nd Shelf", or "Parishville, NY".
|
||||
'';
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
example = literalExpression "\"Bedroom\"";
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Extra variables to put in `/etc/machine-info`
|
||||
'';
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
defaultText = literalExpression "{ }";
|
||||
example = literalExpression "{ HARDWARE_VENDOR = \"Intel Corp.\" }";
|
||||
};
|
||||
extraOptions = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
Extra variables to put in `/etc/machine-info`
|
||||
'';
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
defaultText = literalExpression "{ }";
|
||||
example = literalExpression "{ HARDWARE_VENDOR = \"Intel Corp.\" }";
|
||||
};
|
||||
|
||||
};};
|
||||
};
|
||||
};};
|
||||
};
|
||||
|
||||
config.environment.etc.machine-info =
|
||||
with config.environment.machineInfo;
|
||||
let
|
||||
rawShellVars = {
|
||||
PRETTY_HOSTNAME = prettyHostname;
|
||||
ICON_NAME = iconName;
|
||||
CHASSIS = chassis;
|
||||
DEPLOYMENT = deployment;
|
||||
LOCATION = location;
|
||||
} // extraOptions;
|
||||
nonNullShellVars = attrsets.filterAttrs (k: v: v != null) rawShellVars;
|
||||
in rec {
|
||||
text = strings.toShellVars nonNullShellVars;
|
||||
enable = builtins.stringLength text > 0;
|
||||
};
|
||||
}
|
||||
config.environment.etc.machine-info =
|
||||
with config.environment.machineInfo;
|
||||
let
|
||||
rawShellVars = {
|
||||
PRETTY_HOSTNAME = prettyHostname;
|
||||
ICON_NAME = iconName;
|
||||
CHASSIS = chassis;
|
||||
DEPLOYMENT = deployment;
|
||||
LOCATION = location;
|
||||
} // extraOptions;
|
||||
nonNullShellVars = attrsets.filterAttrs (k: v: v != null) rawShellVars;
|
||||
in rec {
|
||||
text = strings.toShellVars nonNullShellVars;
|
||||
enable = builtins.stringLength text > 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@ final: prev: {
|
|||
fetchFromSteam = prev.callPackage ./lib/fetchsteam {};
|
||||
fetchb4 = prev.callPackage ./lib/fetchb4 {};
|
||||
|
||||
gitSource = prev.callPackage ./lib/git-source {};
|
||||
|
||||
makeSquashFs = prev.callPackage ./lib/make-squashfs {};
|
||||
makeHpcDist = final.callPackage ./lib/make-hpc-dist {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue