From 3aef3e349fcae5fe3bed2787e4914fef7a3459fb Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Wed, 29 Jan 2025 19:37:48 -0500 Subject: [PATCH] extract unfree option to it's own module --- nixosModules/misc.nix | 135 ++++++++++++++++++---------------------- nixosModules/unfree.nix | 12 ++++ 2 files changed, 74 insertions(+), 73 deletions(-) create mode 100644 nixosModules/unfree.nix diff --git a/nixosModules/misc.nix b/nixosModules/misc.nix index f114143..0f6a9ef 100644 --- a/nixosModules/misc.nix +++ b/nixosModules/misc.nix @@ -5,82 +5,71 @@ nix-janitor, }: { - options.local.allowedUnfree = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ ]; - }; - config = { - - nixpkgs.config = { - allowAliases = false; - allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.local.allowedUnfree; - }; - - local.packages = { - inherit (pkgs) - bottom # view tasks - efibootmgr # efi editor - nix-output-monitor # nom nom nom nom; - nix-tree # view packages - pciutils # lspci - ; - nix-janitor = pkgs.symlinkJoin { - name = "nix-janitor"; - paths = [ nix-janitor.packages.default ]; - nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; - postBuild = '' - wrapProgram "$out/bin/janitor" \ - --suffix PATH : ${lib.makeBinPath [ config.nix.package ]} - ''; - }; - - }; - - programs.git.enable = true; - # Mr sandro why - services.libinput.enable = true; - programs.nano.enable = false; - - environment.defaultPackages = lib.mkForce [ ]; - - #enable ssh - programs.mtr.enable = true; # ping and traceroute - services.openssh = { - enable = true; - hostKeys = lib.mkForce [ - { - path = "/etc/ssh/ssh_host_ed25519_key"; - type = "ed25519"; - } - ]; - settings = { - PermitRootLogin = lib.mkDefault "no"; - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - }; - }; - - programs.ssh = { - startAgent = true; - agentTimeout = "1m"; - extraConfig = '' - AddKeysToAgent yes + nixpkgs.config.allowAliases = false; + local.packages = { + inherit (pkgs) + bottom # view tasks + efibootmgr # efi editor + nix-output-monitor # nom nom nom nom; + nix-tree # view packages + pciutils # lspci + ; + nix-janitor = pkgs.symlinkJoin { + name = "nix-janitor"; + paths = [ nix-janitor.packages.default ]; + nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; + postBuild = '' + wrapProgram "$out/bin/janitor" \ + --suffix PATH : ${lib.makeBinPath [ config.nix.package ]} ''; }; - i18n.defaultLocale = "en_US.UTF-8"; - #time settings - - time.timeZone = "America/New_York"; - - # For `info` command. - documentation.info.enable = false; - # NixOS manual and such. - documentation.nixos.enable = false; - # Useless with flakes (without configuring) - programs.command-not-found.enable = false; - - system.rebuild.enableNg = true; }; + + programs.git.enable = true; + # Mr sandro why + services.libinput.enable = true; + programs.nano.enable = false; + + environment.defaultPackages = lib.mkForce [ ]; + + #enable ssh + programs.mtr.enable = true; # ping and traceroute + services.openssh = { + enable = true; + hostKeys = lib.mkForce [ + { + path = "/etc/ssh/ssh_host_ed25519_key"; + type = "ed25519"; + } + ]; + settings = { + PermitRootLogin = lib.mkDefault "no"; + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; + + programs.ssh = { + startAgent = true; + agentTimeout = "1m"; + extraConfig = '' + AddKeysToAgent yes + ''; + }; + + i18n.defaultLocale = "en_US.UTF-8"; + #time settings + + time.timeZone = "America/New_York"; + + # For `info` command. + documentation.info.enable = false; + # NixOS manual and such. + documentation.nixos.enable = false; + # Useless with flakes (without configuring) + programs.command-not-found.enable = false; + + system.rebuild.enableNg = true; } diff --git a/nixosModules/unfree.nix b/nixosModules/unfree.nix new file mode 100644 index 0000000..b16744d --- /dev/null +++ b/nixosModules/unfree.nix @@ -0,0 +1,12 @@ +{ lib, config }: +{ + options.local.allowedUnfree = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + }; + + config = { + nixpkgs.config.allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) config.local.allowedUnfree; + }; +}