tlp: fix CPU scaling
[julm/julm-nix.git] / flake.nix
index d8fc84d088b162944d8a5f2f044e0a4384d69b46..695f03494398f0bd83680262d7e903edc5b2793b 100644 (file)
--- a/flake.nix
+++ b/flake.nix
@@ -6,7 +6,7 @@
     home-manager.url = "github:nix-community/home-manager";
     nix-formatter-pack.inputs.nixpkgs.follows = "nixpkgs";
     nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack";
-    nixpkgs.url = "github:NixOS/nixpkgs/fdebb81f45a1ba2c4afca5fd9f526e1653ad0949";
+    nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
     pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
     pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
   };
@@ -15,6 +15,7 @@
     let
       remoteNixpkgsPatches = import nixpkgs/patches.nix;
       localNixpkgsPatches = [
+        nixpkgs/patches/mmsd.diff
       ];
       originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
       nixpkgsPath = originPkgs.applyPatches {
 
                 nix copy --to ssh://${target}${lib.optionalString config.install.substituteOnDestination " --substitute-on-destination"} ${build.toplevel}
 
-                ssh ${target} set -x ';' \
+                if ssh ${target} set -x ';' \
                   systemctl reset-failed nixos-fallback '2>/dev/null' ';' \
+                  test "''${NO_NIXOS_FALLBACK:+set}" '||' \
                   systemd-run -u nixos-fallback --description=nixos-fallback /bin/sh -xc '''\'''
                     PATH=${with pkgs; lib.makeBinPath [ coreutils nix systemd ]}
                     sleep $((10 * 60))
                     systemctl reboot
                   '\'''' '&&' \
                   ${build.toplevel}/bin/switch-to-configuration test
-
-                ssh ${target} -o ControlPath=none set -x ';' \
-                  systemctl stop nixos-fallback.service ';' \
-                  nix-env --profile ${profile} --set '${build.toplevel}' ';' \
-                  ${build.toplevel}/bin/switch-to-configuration boot '&&' \
-                  nix-env --delete-generations 7d --profile ${profile}
+                then
+                  ssh ${target} -o ControlPath=none set -x ';' \
+                    systemctl stop nixos-fallback.service ';' \
+                    nix-env --profile ${profile} --set '${build.toplevel}' ';' \
+                    ${build.toplevel}/bin/switch-to-configuration boot '&&' \
+                    nix-env --delete-generations 7d --profile ${profile}
+                else
+                  tput rev
+                  echo WARNING: switch-to-configuration was not registered at boot
+                  tput sgr0
+                  ssh ${target} -o ControlPath=none set -x ';' \
+                    systemctl stop nixos-fallback.service
+                  false
+                fi
               '';
             })
           inputs.self.nixosConfigurations);