From 3e5352ac5323f5dcd00ad1c66ce82a7a232763f1 Mon Sep 17 00:00:00 2001 From: Chris Dombroski Date: Sat, 13 Apr 2024 16:30:55 -0400 Subject: [PATCH] auto upgrade --- flake.nix | 9 ++++++++- systems/smolboi/home.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 48af71c..bc0700c 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,14 @@ nixosConfigurations = { smolboi = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - modules = [ ./systems/smolboi/configuration.nix ]; + modules = [ + ./systems/smolboi/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.users.cdombroski = import ./systems/smolboi/home.nix; + } + ]; }; orangepihole = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; diff --git a/systems/smolboi/home.nix b/systems/smolboi/home.nix index a48e9de..b1eb0ff 100644 --- a/systems/smolboi/home.nix +++ b/systems/smolboi/home.nix @@ -56,6 +56,7 @@ ]; }) + # # Adds the 'hello' command to your environment. It prints a friendly # # "Hello, world!" when run. # pkgs.hello @@ -74,6 +75,32 @@ # '') ]; + systemd.user = { + services = { + autoupgrade = { + Service = { + WorkingDirectory = "/home/cdombroski/work/nix-configs"; + Type = "oneshot"; + ExecStart = "${pkgs.writeShellScript "upgrade-system" '' + ${pkgs.nix}/bin/nix flake update + ${pkgs.git}/bin/git add . + ${pkgs.git}/bin/git commit -m "update flake" + ${pkgs.git}/bin/git push + ${pkgs.deploy-rs}/bin/deploy + ''}"; + }; + }; + }; + timers = { + autoupgrade = { + Timer = { + OnCalendar = "daily"; + }; + Install.WantedBy = [ "timers.target" ]; + }; + }; + }; + nixpkgs.config = { allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "discord"