Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

yolo some nixos updates

+86 -5
+5 -2
flake.nix
··· 86 86 legacyPackages = { 87 87 inherit beamPackages; 88 88 }; 89 - packages = { 89 + packages = rec { 90 90 91 91 seed-ci = pkgs.callPackage ./nix/seed-ci.nix { inherit (inputs'.attic.packages) attic; }; 92 92 sower-tree = pkgs.callPackage ./nix/sower-tree.nix { }; 93 93 94 - cli = craneLib.buildPackage ( 94 + # legacy alias 95 + cli = client; 96 + 97 + client = craneLib.buildPackage ( 95 98 craneLib.crateNameFromCargoToml { cargoToml = ./cli/Cargo.toml; } 96 99 // { 97 100 src =
+2 -1
nix/home-module.nix
··· 12 12 { 13 13 options = { 14 14 services.sower = { 15 - enable = lib.mkEnableOption "Sower agent"; 15 + enable = lib.mkEnableOption "Sower client"; 16 16 17 17 package = lib.mkOption { type = lib.types.package; }; 18 18 ··· 62 62 Service = { 63 63 Environment = [ "PATH=${lib.makeBinPath [ pkgs.nix ]}" ]; 64 64 ExecStart = "${lib.getExe cfg.package} tree upgrade"; 65 + Type = "oneshot"; 65 66 }; 66 67 }; 67 68
+4 -2
nix/module.nix
··· 8 8 cfg = config.services.sower; 9 9 in 10 10 { 11 + imports = [ ./nixos-client.nix ]; 12 + 11 13 options = { 12 14 services.sower = { 13 - enable = lib.mkEnableOption "Enable Sower service"; 15 + enable = lib.mkEnableOption "Sower server"; 14 16 15 17 package = lib.mkOption { 16 18 type = lib.types.package; ··· 34 36 35 37 config = lib.mkIf cfg.enable { 36 38 systemd.services.sower = { 37 - description = "Sower NixOS management platform"; 39 + description = "Sower management platform"; 38 40 39 41 wantedBy = [ "multi-user.target" ]; 40 42 after = [ "network-online.target" ];
+75
nix/nixos-client.nix
··· 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 7 + let 8 + cfg = config.services.sower.client; 9 + toml = pkgs.formats.toml { }; 10 + tomlType = toml.type; 11 + in 12 + { 13 + options = { 14 + services.sower.client = { 15 + enable = lib.mkEnableOption "Sower client"; 16 + 17 + package = lib.mkOption { type = lib.types.package; }; 18 + 19 + config = lib.mkOption { 20 + type = lib.types.submodule { 21 + freeformType = tomlType; 22 + 23 + options = { 24 + url = lib.mkOption { 25 + type = lib.types.str; 26 + description = "URL to Sower, e.g. https://mysower.org/"; 27 + }; 28 + 29 + type = lib.mkOption { 30 + type = lib.types.enum [ 31 + "home-manager" 32 + "nix-darwin" 33 + "nixos" 34 + ]; 35 + default = "nixos"; 36 + }; 37 + }; 38 + }; 39 + description = "Sower configuration file"; 40 + default = null; 41 + }; 42 + }; 43 + }; 44 + 45 + config = lib.mkIf cfg.enable { 46 + assertions = [ 47 + { 48 + assertion = cfg.config.url != null; 49 + message = "Sower URL is required"; 50 + } 51 + ]; 52 + 53 + environment.etc."sower/config.toml".source = lib.mkIf (cfg.config != null) ( 54 + toml.generate "sower-config.toml" cfg.config 55 + ); 56 + 57 + systemd.services.sower-client = { 58 + path = [ pkgs.nix ]; 59 + 60 + serviceConfig = { 61 + ExecStart = "${lib.getExe cfg.package} tree upgrade --reboot --yes"; 62 + Type = "oneshot"; 63 + }; 64 + }; 65 + 66 + systemd.timers.sower-client = { 67 + wantedBy = [ "timers.target" ]; 68 + 69 + timerConfig = { 70 + OnCalendar = "daily"; 71 + Persistent = true; 72 + }; 73 + }; 74 + }; 75 + }