{"pageProps":{"metadata":{"date":"\"2020-09-19 08:31:48 +08:00\"","date_modified":"\"2021-09-08 02:42:50 +08:00\"","language":"en","source":""},"title":"Functional package management","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Functional package management (FPM) is the next step forward "},{"type":"element","tagName":"a","properties":{"href":"https://edolstra.github.io/pubs/nixos-icfp2008-final.pdf"},"children":[{"type":"text","value":"pioneered by Eelco Dolstra"}]},{"type":"text","value":" with "},{"type":"element","tagName":"a","properties":{"href":"/tools.nix"},"children":[{"type":"text","value":"Nix package manager"}]},{"type":"text","value":" as the living implementation. "},{"type":"text","value":"[GNU Guix]] and "},{"type":"element","tagName":"a","properties":{"href":"https://silverblue.fedoraproject.org/"},"children":[{"type":"text","value":"Fedora Silverblue"}]},{"type":"text","value":".]\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It was first realized from the thesis \""},{"type":"element","tagName":"a","properties":{"href":"id:f2e1e2f3-cc34-4c76-91d4-2706ce7756d2"},"children":[{"type":"text","value":"The Purely Functional Software Deployment Model"}]},{"type":"text","value":"\".\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The conceptual overview of it is similar to "},{"type":"element","tagName":"a","properties":{"href":"/2020-09-04-19-57-06"},"children":[{"type":"text","value":"Functional programming"}]},{"type":"text","value":" with how it views with data and functions (in this case, packages and build processes).\nIt views that packages are a unique result from combining different things: dependencies, build processes, versions, and more.\nIf a dependency has updated its patch version or a build instruction has revised with one line of change, it will result in a \"new\" package as the output even if the package isn't any different.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Coming from a functional approach, it also features statelessness and immutability, making it a reliable toolkit for "},{"type":"element","tagName":"a","properties":{"href":"https://reproducible-builds.org/"},"children":[{"type":"text","value":"reproducible builds"}]},{"type":"text","value":" (thus gaining a reach for "},{"type":"element","tagName":"a","properties":{"href":"/2020-04-12-11-20-53"},"children":[{"type":"text","value":"Reproducible research"}]},{"type":"text","value":").\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The problems that FPM attempts to solve come from the critique of the traditional package management which is still dominant as of today (2020-08-31).\nHere are some of the problems on a traditional Linux-based system:\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The statefulness of the entire system leads to similar situations on Windows' dependency hell problem.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"As a consequence of the statefulness, traceability is almost non-existent.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Multiple versions of packages are hard to place side-by-side which is used by developers targetting stable versions while experimenting with the latest versions.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Destructive ongoing updates which consists of replacing the current version with the updated version while the update is going.\n"}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The functional approach with the unique output and immutable variables addresses the listed problems in some way.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"A package is built from an input resulting in a package on a unique immutable location, eliminating the statefulness in the process.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Since each revision results in a new location, the same package with different versions can be easily placed side-by-side.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"With the way how packages built, the old system can be kept giving the possibility for the user to rollback to those previous versions.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The functional approach creates a guaranteed output, making it predictable (and traceable).\n"}]}]}]}]},"backlinks":[{"path":"/2020-08-19-08-21-44","title":"Guix package manager"},{"path":"/tools.nix","title":"Nix package manager"}]},"__N_SSG":true}