mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-12 11:17:17 +00:00
make apps also output as programs
This commit is contained in:
parent
f130fd10df
commit
64b1f20745
3 changed files with 20 additions and 10 deletions
|
@ -2,14 +2,15 @@
|
|||
flake =
|
||||
let
|
||||
buildProgram = system: definition: (withSystem system ({ pkgs, self', ... }: definition self.lib pkgs));
|
||||
createApp = { definition, system }: { type = "app"; program = lib.getExe (buildProgram system definition); };
|
||||
defineApp = system: name: definition: { ${system}.${name} = createApp { definition = definition; system = system; }; };
|
||||
defineProgram = system: name: definition: { ${system}.${name} = buildProgram system definition; };
|
||||
appsDir = self.lib.importDirToAttrs ../apps;
|
||||
builtApps = lib.mapAttrsToList (name: value: (lib.forEach value.systems (system: defineApp system name value.definition))) appsDir;
|
||||
flattened = lib.flatten builtApps;
|
||||
assembled = builtins.foldl' (a: b: lib.recursiveUpdate a b) { } flattened;
|
||||
builtPrograms = lib.mapAttrsToList (name: value: (lib.forEach value.systems (system: defineProgram system name value.definition))) appsDir;
|
||||
flattenedPrograms = lib.flatten builtPrograms;
|
||||
assembledPrograms = builtins.foldl' (a: b: lib.recursiveUpdate a b) { } flattenedPrograms;
|
||||
assembledApps = lib.mapAttrsRecursiveCond (as: !(as ? "type" && as.type == "derivation")) (path: value: { type = "app"; program = lib.getExe value; }) assembledPrograms;
|
||||
in
|
||||
{
|
||||
apps = assembled;
|
||||
apps = assembledApps;
|
||||
programs = assembledPrograms;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
packages = lib.pipe activationPackages [
|
||||
(lib.filterAttrs (_: drv: pkgs.system == drv.system))
|
||||
(lib.mapAttrs' (username: lib.nameValuePair "home-${username}"))
|
||||
];
|
||||
# packages = lib.pipe activationPackages [
|
||||
# (lib.filterAttrs (_: drv: pkgs.system == drv.system))
|
||||
# (lib.mapAttrs' (username: lib.nameValuePair "home-${username}"))
|
||||
# ];
|
||||
};
|
||||
}
|
||||
|
|
9
testing.nix
Normal file
9
testing.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ withSystem, ... }:
|
||||
{
|
||||
flake = {
|
||||
packages.aarch64-darwin.test = (withSystem "aarch64-darwin" ({ pkgs, ... }: pkgs.writeScriptBin "runme" ''
|
||||
echo "I am currently being run!"
|
||||
''));
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue