updates for 24.11 and other things
This commit is contained in:
parent
945e1f9915
commit
c8a4d759b8
34
README.md
34
README.md
|
@ -16,42 +16,34 @@ modules require the overlay
|
||||||
|
|
||||||
### non-flake
|
### non-flake
|
||||||
|
|
||||||
```nix
|
since i use flakes now (sigh!!!) i'm not supporting non-flake usage anymore. if you read the files
|
||||||
{config, lib, pkgs, ...}:
|
in the repo there's a way to do it probably
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
/path/to/dragnpkgs/module.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.overlays = [ (import /path/to/dragnpkgs/overlay.nix) ];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
for standalone nix on other distros, use `~/.config/nixpkgs/overlays.nix` to enable the dragnpkgs
|
|
||||||
overlay
|
|
||||||
```nix
|
|
||||||
[ (import <dragnpkgs/overlay.nix>) ]
|
|
||||||
```
|
|
||||||
|
|
||||||
### flake
|
### flake
|
||||||
|
|
||||||
for flake usage, point your `nixpkgs` to this repo
|
for flake usage, add this repo as an input and don't input nixpkgs at all, since we fully wrap it
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
# for nixos-24.05
|
# for nixos-24.11
|
||||||
nixpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=nixos-24.05";
|
dragnpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=nixos-24.11";
|
||||||
|
|
||||||
# for nixos-unstable
|
# for nixos-unstable
|
||||||
nixpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=main";
|
dragnpkgs.url = "git+https://git.lain.faith/haskal/dragnpkgs.git?ref=main";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, dragnpkgs, ... }: {
|
||||||
|
nixosConfigurations.mycomputer = dragnpkgs.lib.nixosSystem {
|
||||||
|
...
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
note that overriding inputs to the flake won't necessarily work because of the way nixpkgs registers
|
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
|
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.05 or unstable), clone the
|
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!!!!
|
repo and recreate `flake.lock`. aren't flakes so cool and fun!!!!
|
||||||
|
|
||||||
## options documentation
|
## options documentation
|
||||||
|
|
70
flake.nix
70
flake.nix
|
@ -8,6 +8,7 @@
|
||||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-2.tar.gz";
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-2.tar.gz";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
lix = {
|
lix = {
|
||||||
url = "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz";
|
url = "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
@ -22,6 +23,25 @@
|
||||||
];
|
];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||||
in {
|
in {
|
||||||
|
# we don't just use nix.registry.whatever.flake = self
|
||||||
|
# the reason for this is to be able to handle a flake.lock containing an entry for this
|
||||||
|
# flake -- setting .flake makes it a path entry in the registry, whereas we want our
|
||||||
|
# self reference in the registry to be downloadable by URL in case it makes it into a
|
||||||
|
# flake.lock
|
||||||
|
meta.registry-entry = {
|
||||||
|
from = { id = "dragnpkgs-unstable"; type = "indirect"; };
|
||||||
|
to = {
|
||||||
|
type = "git";
|
||||||
|
url = "https://git.lain.faith/haskal/dragnpkgs.git";
|
||||||
|
ref = "main";
|
||||||
|
} // self.lib.filterAttrs
|
||||||
|
(n: _: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash")
|
||||||
|
self;
|
||||||
|
};
|
||||||
|
|
||||||
|
# the nix path entry for self
|
||||||
|
meta.path-entry = "dragnpkgs-unstable=flake:dragnpkgs-unstable";
|
||||||
|
|
||||||
lib = nixpkgs.lib.extend (final: prev: {
|
lib = nixpkgs.lib.extend (final: prev: {
|
||||||
nixosSystem = args:
|
nixosSystem = args:
|
||||||
import "${nixpkgs}/nixos/lib/eval-config.nix" (
|
import "${nixpkgs}/nixos/lib/eval-config.nix" (
|
||||||
|
@ -32,13 +52,59 @@
|
||||||
|
|
||||||
modules = args.modules ++ [
|
modules = args.modules ++ [
|
||||||
({ config, pkgs, lib, ... }: {
|
({ config, pkgs, lib, ... }: {
|
||||||
config.nixpkgs.flake.source = self.outPath;
|
config.nixpkgs = {
|
||||||
config.nixpkgs.overlays = overlays;
|
# we remove nixpkgs' machinery for setting self flake references and
|
||||||
|
# replace it with our own (in the next inline module)
|
||||||
|
flake = {
|
||||||
|
source = self.outPath;
|
||||||
|
setNixPath = false;
|
||||||
|
setFlakeRegistry = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
overlays = overlays;
|
||||||
|
};
|
||||||
|
|
||||||
|
# this is in the flake rather than in module.nix so there's still control over
|
||||||
|
# channels if you're not using a flake based config. but for flake based
|
||||||
|
# configs, we're not doing channels anymore
|
||||||
|
config.nix = {
|
||||||
|
channel.enable = false;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
({ options, config, pkgs, lib, ...}: {
|
||||||
|
options.dragnpkgs = {
|
||||||
|
setFlakeRegistry = lib.mkOption {
|
||||||
|
description = "Set flake registry option pointing to self";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
defaultText = lib.literalExpression "true";
|
||||||
|
example = lib.literalExpression "false";
|
||||||
|
};
|
||||||
|
|
||||||
|
setNixPath = lib.mkOption {
|
||||||
|
description = "Set nix path entry pointing to self";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
defaultText = lib.literalExpression "true";
|
||||||
|
example = lib.literalExpression "false";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.nix.registry = lib.mkIf config.dragnpkgs.setFlakeRegistry {
|
||||||
|
nixpkgs-unstable = self.meta.registry-entry;
|
||||||
|
};
|
||||||
|
|
||||||
|
config.nix.nixPath = lib.mkIf config.dragnpkgs.setNixPath [
|
||||||
|
self.meta.path-entry
|
||||||
|
];
|
||||||
|
})
|
||||||
|
|
||||||
(import ./module.nix)
|
(import ./module.nix)
|
||||||
];
|
];
|
||||||
} // builtins.removeAttrs args [ "modules" ]
|
} // builtins.removeAttrs args [ "modules" ]
|
||||||
);
|
);
|
||||||
|
|
||||||
mkFlake = flakeDef:
|
mkFlake = flakeDef:
|
||||||
let
|
let
|
||||||
rewritePerSystem = sectionDef: (forAllSystems (system:
|
rewritePerSystem = sectionDef: (forAllSystems (system:
|
||||||
|
|
13
module.nix
13
module.nix
|
@ -1,5 +1,18 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./modules/ghidra-server
|
./modules/ghidra-server
|
||||||
|
./modules/regdom
|
||||||
|
./modules/machine-info
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# set some nix settings defaults
|
||||||
|
config.nix.settings = {
|
||||||
|
repl-overlays = [ ./repl-overlay.nix ];
|
||||||
|
experimental-features = "nix-command flakes repl-flake";
|
||||||
|
substituters = [ "https://cache.lix.systems" ];
|
||||||
|
trusted-public-keys = [ "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=" ];
|
||||||
|
|
||||||
|
# we're disabling the default flake registry because i don't like it
|
||||||
|
flake-registry = "";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
{ config, pkgs, lib, ... }: with lib; {
|
||||||
|
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].
|
||||||
|
|
||||||
|
[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 💎\"";
|
||||||
|
};
|
||||||
|
|
||||||
|
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"`.
|
||||||
|
|
||||||
|
[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\"";
|
||||||
|
};
|
||||||
|
|
||||||
|
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\"";
|
||||||
|
};
|
||||||
|
|
||||||
|
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\"";
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.hardware.wirelessRegulatoryDomain;
|
||||||
|
in {
|
||||||
|
options.hardware.wirelessRegulatoryDomain = mkOption {
|
||||||
|
description = "The wireless regulatory domain to set in the kernel cfg80211 module";
|
||||||
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
|
defaultText = literalExpression "null";
|
||||||
|
example = literalExpression "\"US\"";
|
||||||
|
};
|
||||||
|
|
||||||
|
config.boot.extraModprobeConfig = mkIf (cfg != null) ''
|
||||||
|
options cfg80211 ieee80211_regdom=${cfg}
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
info: final: prev:
|
||||||
|
rec {
|
||||||
|
inherit (builtins) attrValues attrNames getFlake typeOf;
|
||||||
|
currentSystem = info.currentSystem;
|
||||||
|
|
||||||
|
dragnpkgs = getFlake "dragnpkgs";
|
||||||
|
dragnpkgs-unstable = getFlake "dragnpkgs-unstable";
|
||||||
|
pkgs = dragnpkgs.legacyPackages.${currentSystem};
|
||||||
|
pkgs-unstable = dragnpkgs-unstable.legacyPackages.${currentSystem};
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
|
f = getFlake "git+file:${builtins.getEnv "PWD"}";
|
||||||
|
fp =
|
||||||
|
if (builtins.hasAttr "legacyPackages" f) then
|
||||||
|
f.legacyPackages.${currentSystem}
|
||||||
|
else
|
||||||
|
f.packages.${currentSystem};
|
||||||
|
fs = f.devShells.${currentSystem};
|
||||||
|
}
|
Loading…
Reference in New Issue