Deployment and lifecycle management for Nix
0
fork

Configure Feed

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

nixos: read sower meta from the nixos config

+45 -17
-1
apps/nix/lib/nix/eval.ex
··· 249 249 |> Enum.reverse() 250 250 |> Enum.map(&String.split(&1, "\n")) 251 251 |> List.flatten() 252 - |> Enum.map(&String.trim/1) 253 252 |> Enum.reject(fn l -> 254 253 Regex.match?(~r{(fetching git input|error \(ignored\): error: SQLite database|^$)}, l) 255 254 end)
-5
flake.nix
··· 194 194 services.tempo.tempo1.enable = true; 195 195 }; 196 196 }; 197 - 198 - flake = { 199 - nixosModules.sower = ./nix/nixos/module.nix; 200 - homeModules.sower = ./nix/home/module.nix; 201 - }; 202 197 } 203 198 ); 204 199 }
+15 -3
nix/flake/part.nix
··· 1 - { inputs, lib, ... }: 1 + { 2 + inputs, 3 + lib, 4 + self, 5 + ... 6 + }: 2 7 { 3 8 imports = [ 4 9 ./sower.nix 5 10 ]; 6 11 7 - flake.flakeModules.sower = ./sower.nix; 8 - flake.lib = import ../sowerlib.nix { inherit inputs lib; }; 12 + flake = { 13 + lib = import ../sowerlib.nix { inherit inputs lib; }; 14 + 15 + flakeModules.sower = ./sower.nix; 16 + homeModules.sower = ../home/module.nix; 17 + nixosModules.sower = ../nixos/module.nix; 18 + }; 9 19 10 20 flake.nixosConfigurations = { 11 21 example = inputs.nixpkgs.lib.nixosSystem { ··· 13 23 modules = [ 14 24 "${inputs.nixpkgs}/nixos/maintainers/scripts/incus/incus-container-image.nix" 15 25 { system.stateVersion = "25.11"; } 26 + { sower.seed.meta.broken = true; } 27 + self.nixosModules.sower 16 28 ]; 17 29 }; 18 30
+1
nix/nixos/module.nix
··· 1 1 { 2 2 imports = [ 3 3 ./agent.nix 4 + ./seed.nix 4 5 ./server.nix 5 6 ]; 6 7 }
+14
nix/nixos/seed.nix
··· 1 + { lib, pkgs, ... }: 2 + let 3 + json = pkgs.formats.json { }; 4 + jsonType = json.type; 5 + in 6 + { 7 + options = { 8 + sower.seed.meta = lib.mkOption { 9 + type = lib.types.submodule { freeformType = jsonType; }; 10 + description = "meta to add to package meta"; 11 + default = { }; 12 + }; 13 + }; 14 + }
+15 -8
nix/sowerlib.nix
··· 8 8 }: 9 9 rec { 10 10 addSowerMeta = 11 - { name, package }: 12 - lib.addMetaAttrs { 13 - # TODO add a nixos module that can be included in the nixosConfig for setting values, e.g. seed.tags 14 - sower.seed = { 15 - inherit name; 16 - seed_type = "nixos"; 17 - }; 18 - } package; 11 + { 12 + name, 13 + package, 14 + meta ? { }, 15 + }: 16 + lib.addMetaAttrs ( 17 + { 18 + sower.seed = { 19 + inherit name; 20 + seed_type = "nixos"; 21 + }; 22 + } 23 + // meta 24 + ) package; 19 25 20 26 genNixosPackages = 21 27 nixosConfigurations: ··· 29 35 lib.nameValuePair "nixos/${name}" (addSowerMeta { 30 36 inherit name; 31 37 package = nixosConfigurations.${name}.config.system.build.toplevel; 38 + meta = nixosConfigurations.${name}.config.sower.seed.meta or { }; 32 39 }) 33 40 )) 34 41 ];