From 75a4e0a52a0d657c0935d28b05c6a3e942f218d5 Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Sun, 8 Oct 2023 21:04:23 -0400 Subject: [PATCH] bunch of small changes --- flake.lock | 14 ++++----- flake.nix | 2 +- hosts/gerg-desktop/services/ddns.nix | 7 +++++ lib/default.nix | 32 +++++++++++---------- modules/nix.nix | 43 ++++++++++++++++------------ 5 files changed, 57 insertions(+), 41 deletions(-) diff --git a/flake.lock b/flake.lock index 6fdbd71..95ff1c4 100644 --- a/flake.lock +++ b/flake.lock @@ -207,16 +207,16 @@ "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1695384831, - "narHash": "sha256-Ah4JBpKBFgOjXjhQBjaf7Zk9WYVk2ykcXPMeHpuoEyc=", + "lastModified": 1696671022, + "narHash": "sha256-Qs9hVi4sKOsvV3YjKJK16hF/XF4PZ8l7XzAipjyWMPU=", "owner": "NixOS", "repo": "nix", - "rev": "f89b84919c1a5c796512c50311821e7779b3678b", + "rev": "c29b8ba142a0650d1182ca838ddc1b2d273dcd2a", "type": "github" }, "original": { "owner": "NixOS", - "ref": "f89b84919c1a5c796512c50311821e7779b3678b", + "ref": "c29b8ba142a0650d1182ca838ddc1b2d273dcd2a", "repo": "nix", "type": "github" } @@ -380,11 +380,11 @@ ] }, "locked": { - "lastModified": 1696738534, - "narHash": "sha256-s+78173jpqZF4gUhjFAAEJbmv0acmUuungSHmT1eUn4=", + "lastModified": 1696788953, + "narHash": "sha256-Ya/R6KBM2BLXRU4lG4knszteAq09FXBsAHq5rW6RmOE=", "owner": "Gerg-L", "repo": "nvim-flake", - "rev": "91d65b5a185288994148425778a69f733f8569cd", + "rev": "4a502f7fd265b43e8de91c8968529d270f809c66", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 51ba609..8764729 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ stable.url = "github:NixOS/nixpkgs?ref=nixos-23.05"; nix = { - url = "github:NixOS/nix?ref=f89b84919c1a5c796512c50311821e7779b3678b"; + url = "github:NixOS/nix?ref=c29b8ba142a0650d1182ca838ddc1b2d273dcd2a"; inputs.nixpkgs.follows = "stable"; }; diff --git a/hosts/gerg-desktop/services/ddns.nix b/hosts/gerg-desktop/services/ddns.nix index 83b61d8..2c7efb4 100644 --- a/hosts/gerg-desktop/services/ddns.nix +++ b/hosts/gerg-desktop/services/ddns.nix @@ -4,6 +4,13 @@ _: sops.secrets.cloudflare = { }; systemd.services.ddns = { + reloadIfChanged = false; + restartIfChanged = false; + stopIfChanged = false; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; wantedBy = [ "multi-user.target" ]; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; diff --git a/lib/default.nix b/lib/default.nix index 1026527..aca9d31 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -55,15 +55,15 @@ in lib.evalModules { specialArgs.modulesPath = "${unstable}/nixos/modules"; - modules = - builtins.attrValues self.nixosModules - ++ importAll "${self}/hosts/${name}" - ++ [ { + modules = builtins.concatLists [ + (builtins.attrValues self.nixosModules) + (importAll "${self}/hosts/${name}") + (import "${unstable}/nixos/modules/module-list.nix") + (lib.singleton { networking.hostName = name; nixpkgs.hostPlatform = system; - } ] - ++ (import "${unstable}/nixos/modules/module-list.nix") - ; + }) + ]; } ); mkDisko = @@ -72,13 +72,15 @@ in mkPackages = path: pkgs: - builtins.listToAttrs ( - map - (module: { - name = lib.removeSuffix ".nix" (builtins.baseNameOf module); - value = pkgs.callPackage module { }; - }) - (listNixFilesRecursive path) - ); + lib.pipe path [ + listNixFilesRecursive + (map ( + x: { + name = lib.removeSuffix ".nix" (builtins.baseNameOf x); + value = pkgs.callPackage x { }; + } + )) + builtins.listToAttrs + ]; _file = ./default.nix; } diff --git a/modules/nix.nix b/modules/nix.nix index 66d57a8..7010c0e 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -1,17 +1,28 @@ inputs: -{ pkgs, lib, ... }: -# -# Flake registry and $NIX_PATH pinning -# -let - alias = inputs // { - nixpkgs = inputs.unstable; - }; - flakes = lib.filterAttrs (_: lib.isType "flake") alias; -in { - nix.nixPath = lib.mapAttrsToList (x: _: "${x}=flake:${x}") flakes; - nix.registry = lib.mapAttrs (_: flake: { inherit flake; }) flakes; + pkgs, + lib, + config, + ... +}: +{ + # + # Flake registry and $NIX_PATH pinning + # + nix.registry = lib.pipe inputs [ + (lib.filterAttrs (_: lib.isType "flake")) + (lib.mapAttrs (_: flake: { inherit flake; })) + (x: x // { nixpkgs.flake = inputs.unstable; }) + ]; + + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + nix.nixPath = [ "/etc/nix/path" ]; # # Ignore global registry # @@ -32,7 +43,6 @@ in "dynamic-derivations" "fetch-closure" "flakes" - "impure-derivations" "nix-command" "no-url-literals" "parse-toml-timestamps" @@ -46,11 +56,8 @@ in # Use for testing # #allow-import-from-derivation = false; - trusted-users = [ - "root" - "@wheel" - ]; - allowed-users = [ ]; + trusted-users = [ "root" ]; + allowed-users = [ "@wheel" ]; use-xdg-base-directories = true; auto-allocate-uids = true; };