Skip to content

Instantly share code, notes, and snippets.

@layus
Created November 10, 2021 15:14
Show Gist options
  • Select an option

  • Save layus/74a4c2e3be911fccc6333347361b6e31 to your computer and use it in GitHub Desktop.

Select an option

Save layus/74a4c2e3be911fccc6333347361b6e31 to your computer and use it in GitHub Desktop.
Barf on ignored config text
diff --git a/nixos/machines/uberwald/configuration.nix b/nixos/machines/uberwald/configuration.nix
index d276df1..f59e631 100644
--- a/nixos/machines/uberwald/configuration.nix
+++ b/nixos/machines/uberwald/configuration.nix
@@ -1,30 +1,55 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
+with lib;
let
cfg = config.custom;
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../../common/fonts.nix
../../common/screencast.nix
../../common/sound.nix
../../common/bluetooth.nix
../../common/ssh.nix
../../common/epson.nix
+ (
+ # define a new module
+ {config, lib, ...}:
+ {
+ # that defines extra features for the existing config `environment.etc`
+ options.environment.etc = mkOption {
+ type = types.attrsOf (
+ # by the means of an extra submodule type
+ types.submodule (
+ { name, config, ... }:
+ {
+ # where `source` is assigned with normal priority
+ config.source = mkIf (config.text != null) (
+ let name' = "etc-" + baseNameOf name;
+ in pkgs.writeText name' config.text
+ );
+ }
+ )
+ );
+ };
+ }
+ )
];
+ environment.etc.bashrc.source = pkgs.writeText "hacky-bashrc" "Silently override careful bash config";
+
security.pam.loginLimits = [
{
domain = "*";
item = "nofile";
type = "soft";
value = "unlimited";
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment